Drawbot!

13,945

197

7

This instructable will document the construction of a Raspberry Pi controlled drawing robot that allows you to turn any flat surface into a canvas. Once you've built the drawing robot you'll be able to calibrate and send drawings to it via WiFi.

*This was built in the Black & Veatch MakerSpace from plans created by MakerSpace patron and creative wonder Andy Wise. See the Drawbot project on Github by Andy for more information.

Step 1: What You'll Need

3D-Printable parts:

Polargraph gondola - https://www.thingiverse.com/thing:372244
Servo horn extension - https://www.thingiverse.com/thing:2427037
Drawbot motor mount and spool (x2) - https://www.thingiverse.com/thing:2427037
Drawbot electronics case (optional) - https://www.thingiverse.com/thing:2427037
Drawbot Pi + Stepper mount (optional) - https://www.thingiverse.com/thing:3122682
Suction Cup Dome with hole(alternative) - https://www.thingiverse.com/thing:3132569

Hardware:

NEMA 17 Stepper Motors (x2)
Suction Cups with Quick Release - Harbor Freight item #62715 (x2)
Spiderwire 80-pound fishing line
Micro USB cable 10-ft. (x2)
Micro USB breakout (x2)
USB type A female breakout (x2)
Raspberry Pi Zero W (or another WiFi enabled Pi)
Micro SD card
EasyDriver Stepper Motor Driver V4.5 (x2)
SG92R Micro Servo
6003zz bearings (x2)
3-pin servo extensions (several)
2.1mm x 5.5mm barrel jack
12v 1a power adapter 2.1mm/5.5mm lead
USB Micro Power Adapter for Pi
Pololu Universal Mounting Hub for 5mm shaft, #4-40 holes (x2)
#8-32 x 1-5/8 in. Eye Bolts (x2)
8 screws for spools (#4-40 x ~½")
8 screws for motors (M3-.50 x 6mm metric machine screws)
1-2 small screws for gondola to secure pen/marker
Standard wire or jumper wires
markers
Measuring tape/stick

Tools:

Computer
Soldering Iron
Wire Strippers/Cutters

Optional:

Paper
Mounting Putty
USB Fan
Hot Glue
Paperclip
Header Pins
Breadboard/Perfboard

The drawbot githubwill have some links to specific sellers/items.

Step 2: ​Stepper Motor and Suction Cup Assembly

Parts needed this step:

3D printed:
2 motor mounts
2 spools
2 suction cup domes with 1/8" hole drilled -or- Suction Cup Dome with Hole

Notes: Printed in PLA

Hardware:
2 Stepper Motors
2 Suction Cups
2 Universal mounting hubs
2 Eye Bolts (#8-32 x 1-5/8 in.)
8 Screws for spools (#4-40 x ~½")
8 Screws for motors (M3-.50 x 6mm metric machine screws)
Fishing line

Notes: The suction cups need a long metal post to reach the motor mount.

  1. First, attach the aluminum universal mounting hub to the stepper motor. Use the set screws included with the mounting hub and attach the hub close to the end of the stepper shaft.
  2. Next, attach the 3D printed twist motor mount to the stepper motor using four M3 screws. The twist motor mount will have an indentation to indicate which side to mount the motor.
  3. Now attach the 3D printed spool to the mounting hub with 4-40 screws.
  4. For the suction cup mounts you’ll need to disassemble your Harbor Freight suction cup. Keep the rubber suction cup, spring and metal post. Drill a ⅛” hole in the suction dome and thread in your eye bolts or use the Suction Cup Dome with Hole. Place the 3D printed dome over the rubber suction cup. Attach the motor mount by pushing it down on the suction dome so you can thread the screw through the metal post.
  5. Now do the same for the other motor mount.
  6. Spool fishing line on the spools.


Notes: Harbor Freight suction cups are a must, they have a taller metal post than other suction cups. The item number is 62715.

Step 3: Pen Holder Gondola Assembly:

Parts needed this step:

3D Printed:
Polargraph Gondola
2 Bearing connector arms
2 Bearing connector rings
1 Gondola retainer
1 Servo extension

Hardware:
1 SG92R Servo motor
2 6003zz bearings
1 Twist tie

  1. Glue the 3D printed servo extension arm to one of the servo arms supplied with the servo. -Ours eventually fell off so we used a paperclip that we snipped in half and taped it to the servo arm.
  2. Use the ultra-handy twist tie to secure the servo to the gondola.
  3. Next slot the bearing connector rings to the bearing connector arms. Push the bearing through the bearing connector assembly, our 3D printed parts needed a bit of clean up with a blade to allow the bearing to push down into the bearing connector.
  4. Slide the bearings that now have the bearing conectors and arms on the gondola. The shaft on the 3D printed gondola needed to be sanded a good deal to allow the bearing to slide down.
  5. Last is the gondola retainer that will keep everything together, use screws to secure it to the gondola shaft - these also will secure your pen while drawing.

Step 4: Software

If you've never prepared a Raspberry Pi start by checking out our guide.
For this step I recommend referring to the Drawbot Github .

On the Pi you'll update and upgrade packages and install others:

Updates and upgrades:

sudo apt-get update
sudo apt-get upgrade

Install NPM and Git:

sudo apt-get install npm
sudo apt-get install git

Install Node.js:

sudo npm install -g n
sudo n stable

Upgrade NPM -and remove old apt-get version:

sudo npm install npm@latest -g
sudo apt-get remove npm
sudo reboot

Install pigpio C library:

sudo apt-get install pigpio *if you're using Raspbian Lite*
npm install pigpio

Install the Drawbot software:

git clone https://github.com/andywise/drawbot.git
cd drawbot npm i

To start the Drawbot software:

cd/drawbot
npm start -or- sudo node draw.js

Access the Drawbot control interface

From another computer on the same network:

  • From a Mac: Go to raspberrypi.local/control to access the Drawbot control interface.
  • From a PC: input the ip address (ifconfig is the terminal command) and input your IP address/control ex: 10.167.5.58/control

From the Raspberry Pi:

  • Open a browser. Go to 127.0.0.1/control to access the Drawbot control interface.

Step 5: Connections. Wires. Everywhere.

Parts needed this step:

Hardware:
USB A female breakout - 2
EasyDriver Stepper Motor Drivers - 2
Pi Zero or another WiFi enabled Pi
Stepper Motors - 2
Micro USB breakout - 2
Barrel Jack 2.1mm x 5.5mm

Other parts you might need :
Breadboard for testing connections
Header Pins
3D Printed Stepper + Pi mount
Perf or Proto board

Wiring the EasyDriver motor drivers to the Pi:

Left driver:

  • GND → Pi GPIO 39
  • DIR → Pi GPIO 38 (BCM 20)
  • STE → Pi GPIO 40 (BCM 21)

Right driver:

  • GND → Pi GPIO 34
  • DIR → Pi GPIO 31 (BCM 6)
  • STE → Pi GPIO 33 (BCM 13)

Wiring the Gondola Servo to the Pi:

  • GND → Pi GPIO 14
  • VCC → Pi GPIO 1 (3V3 Power)
  • CNT → Pi GPIO 12 (BCM 18)

Notes: For testing to make sure the connections are correct it's recommended to breadboard first before soldering everything together.

  1. If your Pi and/or EasyDriver doesn't include header pins solder them on now.
  2. Connect the female USB breakouts to each EasyDriver using the motor section on the board. For this step hopefully, you have a datasheet or reference for your Stepper Motros. Make sure to keep the windings/coils together. The stepper here had pairs of Black & Green and Red & Blue. Here we kept "Winding A" to Ground and D+ on the USB breakout and "Winding B" to VCC and D- on the USB breakout.
  3. Use jumper wires to connect the servo motor to the Pi GPIO. -refer to the information above.
  4. Use jumper wires to connect the EasyDriver boards to the Pi GPIO. -refer to the information above
  5. Connect the stepper motor wires to the Micro USB breakout again making sure the pairs are matched correctly.
  6. The EasyDrivers need power. Connect the tip of the barrel jack to the "PWR IN" on the EasyDrivers and the sleeve of the barrel jack to the GND of the "PWR IN" on the EasyDrivers. We used a perfboard to split out our power and ground from the barrel jack to the EasyDrivers.

Step 6: Testing and Drawing!

Once your Pi, EasyDrivers and USB breakouts are connected either via breadboard or if you jumped right in by solder, it's time to test.

Setup and Testing
Start the Drawbot controller software on the Pi. est the easier motor to control, the servo. Click the Pen button in the middle of the controller bulls-eye and hopefully the servo arm will rotate 90°. Use this test to make sure the servo arm is oriented correctly to lift the pen off the surface. This will also let you know if you're connected to the Pi and Drawbot controller software.

Next is the stepper motor. It's easier to start with one at a time. With a stepper motor connected click a coordinate on the Drawbot controller bulls-eye. The stepper should move smoothly. If the stepper stutters make sure the wiring is correct and the pairs are matched. Test the other stepper.

With the steppers disconnected find a nice flat, smooth surface and mount the steppers making sure they are level to each other. Extend some of the fishing line from each spool and connect it to the bearing arms on the gondola. Reconnect the steppers. Use the Drawbot controller to move the gondola. When clicking the upper right on the the bulls-eye the gondola should move to the upper right, if not adjust the config file. If the gondola moves opposite of what it should turn on mirroring in the configuration file on the Pi.

Measuring

Almost there. Next is measuring. We've found a small retractable measuring tape handy, all measurements will be in millimeters.

Click the settings icon in the Drawbot controller and there will be three values that are needed, "D", "X" and "Y". See the image for an illustration of how to measure. The first value, "D" is the distance between the spools. The next values are essentially the home location of the gondola. The "X" value is the measurement from the left spool to the position of the pen in the gondola. The "Y" value is the distance from the spool down to the gondola. Input these into the settings of the Drawbot software. Setting the home in the upper left corner is recommended.

Drawing

Finally drawing!!

Once everything is measured as accurately as possible and the pen in the gondola is lifted off the surface and homed it's time to feed the Drawbot a SVG to draw. Simply drag a single path SVG onto the bulls-eye of the Drawbot software to start a drawing, I've included a calibration drawing for your robot drawing pleasure. Enjoy!

Share

    Recommendations

    • Toys Contest

      Toys Contest
    • First Time Author

      First Time Author
    • Make it Glow Contest 2018

      Make it Glow Contest 2018

    7 Discussions

    0
    None
    AnthongRedbeard

    2 months ago on Step 6

    would you be interested in working on something similar with the following changes?

    1. motors are in the gondola, all you need to do is secure ballchain in corners

    2. battery operated, no wires

    3. it has an on board web server

    I have been working with it for a while. I need to update github with the latest results.

    https://github.com/SuddenDevelopment/WallPlottE

    3 replies
    0
    None
    mermaldadAnthongRedbeard

    Reply 5 days ago

    These changes would make the Drawbot more portable, but would make the gondola heavier and less responsive. So it's kind of a trade-off.

    0
    None
    l8gravely-proAnthongRedbeard

    Reply 5 weeks ago

    Printing out the spools locally has worked out well, now I'm stuck getting nodejs to actually move the darn steppers. They work from python scripts, so I know I've got them hooked up properly.

    Any thoughts on howto debug this better? Do you have any simple nodejs scripts to run steppers?

    0
    None
    jocomakerspaceAnthongRedbeard

    Reply 2 months ago

    Seems like an interesting way to make a polargraph more portable/flexible being battery operated and almost everything included in the gondola without need of external power/connections. I'll be following your progress!

    On the web server part you should check out the drawbot github, it uses a WebSocket.

    0
    None
    l8gravely-pro

    Question 7 weeks ago on Step 6

    Hi,
    I'm finally getting into steppers and such and wondering if you have any pointers for alternatives for the 3d printed parts, since I don't have a 3-d printer at all that I can use. Been looking for 5mm dia shaft pulleys, but most of them have gear teeth, which isn't really ideal.

    Any suggestions of what I could buy pre-made? Or can I order stuff from thingverse? As you can tell, I'm clueless about 3-d printing issues.

    2 answers
    0
    None
    l8gravely-prol8gravely-pro

    Answer 5 weeks ago

    Turns out my local library has a 3-d printer, so I've got one spool and waiting on a second. Now I've got the drawbot software running, but it's not actually talking to the GPIO pins at this time.

    I've got a stepper.py script which I'm using to test, but I'd appreciate any debugging hints. I suspect it's because of my troubles getting the gpio nodejs module installed and working properly, even though I thought it was all set.

    Is there a nodejs script I can run from the CLI to do a quick test to confirm it's all installed properly?

    0
    None
    jocomakerspacel8gravely-pro

    Answer 6 weeks ago

    I imagine you could re-purpose some sewing machine thread spools, or just directly wind the fishing line on the stepper shaft. There are lots of hardware options for mounting steppers out there. Seems most gondolas are 3D printed or made from laser-cut wood or plastic. I've even seen some gondolas made from a Frisbee and PVC.