Posts Tagged ‘limit’

Drawbot: Automatic Calibration Update

Friday, May 4th, 2012

I had it stuck in my head that I needed to use digital pins to read the value of the switches. On Thursday I downloaded the Adafruit Motor Shield EAGLE schematic and layout files and started reading, only to discover that the empty holes on one corner of the board are intended for analog sensors.  In about an hour I got the switches and the auto-calibration code written & tested.  Victory!

To add the limit switches to your Drawbot, you will need:

  • some female headers
  • a soldering iron
  • two limit switches
  • 2 two-foot lengths of wire in red
  • 2 two-foot lengths of wire in black
  • 2 two-foot lengths of wire in green
  1. The headers I got came in a 20-pack.  I only needed the sets of three so i cut with some pliers and filed them down.
  2. Unplug your Drawbot completely.  Remove the shield from the Arduino.  You may find it easier to remove the stepper wires, too.
  3. In one corner of the motor shield you will see white letters that say “+5/GND/A0-5″.  You want to solder one set of pins into each of the three holes on the right.  I use a set of helping hands to hold the board sideways, then placed the +5 triplet in first.  After soldering it in place I repeated the process with the GND and then the A3/A4/A5 pins.
  4. I soldered one red, one black, and one green wire to a switch. The green is soldered to the C pin that connects to A5. The red is soldered to NC which is connected to +5V. The black is soldered to NO which is connected to GND.  This is now my right limit switch.
  5. I soldered one red, one black, and one green wire to the other switch. The green is soldered to the C pin that connects to A3. The red is soldered to NC which is connected to +5V. The black is soldered to NO which is connected to GND.  This is now my left limit switch.
  6. Grab a copy of the experimental branch from Github.
  7. Reassemble & connect your Drawbot.
  8. Test your limit switch to make sure you solder it in the correct way using the sketch in the download package @ ./arduino/test_switch/test_switch.ino.  The limit switches are wired as “on” by default – when the switch is hit they turn off and the machine thinks it has made contact.  If you have no switch or a bad connection the machine will think you are touching the switch already. You should only see one message from each switch when they are pressed or released. Any more and the switches are “debouncing” which will require a breadboard and some 10k resistors to fix.
  9. Upload the new Drawbot code (./Arduino/arduino.ino) code to your Drawbot.
  10. Either
    • Type “HOME;” in the serial window or
    • Choose “HOME” in the Java app

    Drawbot motors should begin to move the plotter towards the left motor.  When the left limit switch is touched it will reverse direction and move until it touches the right limit switch.  Now the robot knows exactly how much string has been released and it can move the plotter to the (0,0) position automatically.