this project's been cleaned up as 'erik' - see https://github.com/yosemitebandit/erik
interfacing with the eibot board; this stepper and servo controller is sold by EMSL, Sparkfun and others. It is designed by Brian Schmalz of Schmalz Haus.
- what we're up to:
http://tristanperich.com/Art/Machine_Drawings/
- and: http://www.flickr.com/photos/geekphysical/sets/72157625827981787/with/5407732000/
- and: http://www.instructables.com/id/Polargraph-Drawing-Machine/?ALLSTEPS
plug in the eibot board and find the device within /dev. So, in terminal, ls /dev
. Mine was called something
like usbmodemfa141
. Then, where it says /path/to/usb in the examples below, replace that name with the usb name.
bounded-random.py
draws randomly within a bounded box. usage:
python bounded-random.py /path/to/usb
listener.py
responds to up, left, down, right commands
python listener.py /path/to/usb
layers.py
progressively thresholds an image
- documented here: http://evilmadscience.com/productsmenu/partsmenu/187-stepper
- 1.8deg/set (200 steps per rotation)
- connections to the EIBot board:
http://cdn2.evilmadscience.com/im/eggbot/desc/2_800.jpg
(I had brown in place of white)
Fully described here http://www.schmalzhaus.com/EBB/EBBCommands.html
- The most important command seems to be SM; from the docs:
` The "SM" Command (stepper motor move) Format: "SM,,," is a value from 1 to 65,535 and is in milliseconds. It represents the total length of time you want this move to take. and are values from -32,767 to +32,767 and represent the number of steps for each motor to take in milliseconds. If both and are zero, then a delay of ms is executed. is an optional value, and if it is not included in the command, zero steps are assumed for axis 2. Use this command to make the motors draw a straight line at constant velocity. The maximum speed that the EBB can generate is 25,000 steps/s. It is helpful to use this command with zeros for both parameters after moving the pen up or down to give it time to finish moving before starting the next motor move.
Example: "SM,1000,250,-766" Return Packet: "OK" `
- EM is also rather important for setting the step mode:
` The "EM" Command (enable motors) for EBB v1.2 and above
Format: "EM,," To enable a motor driver, set its parameter to 1. To disable a motor driver, set its parameter to 0. For example, "EM,1,0" will enable motor 1 and disable motor 2. To set the microstep mode of BOTH motor drivers (the same signals go to both drivers, so you can't set them separately) use a value of 1,2,3,4 or 5 for . When you use a value of 1,2,3,4 or 5 for , the parameter is not needed. When setting microstep values with : 1 will enable both axis in 1/16th step mode (default on boot) 2 will enable both axis in 1/8th step mode 3 will enable both axis in 1/4 step mode 4 will enable both axis in 1/2 step mode 5 will enable both axis in full step mode Note that any time an SM command is executed, both motors become 'enabled' before the move starts. Thus it is almost never necessary to issue a "EM,1,1" command to enable both motors. Example: "EM,2" - this command will set both motors in 1/8th step mode Example: "EM,0,0" - this command will disable both motors (they will then freewheel) Example: "EM,1,1" - this command will enable both motors and set them to 1/16th microstep mode. Return Packet: "OK" `
I found my device ID by watching what changed in /dev
when I plugged in the board.
import serial
s = serial.Serial('/dev/cu.usbmodemfa141', 9600, timeout=1)
# step-mode is 1/16th by default and the EMSL steppers are 200 steps/rev so this is a full rev in 5000ms
ser.write('SM,5000,3200\r')
# then go to 1 step mode and make a single rev in 2000ms
ser.write('EM,5') # the EM write seems to "eat" the next command.. still puzzling over this
ser.write('SM,2000,200\r')
so keeping in mind that we're making the same thing as this fellow (Tristan Perich):
and see if this makes sense:
* (0,0) * (L,0)
\ /
\ /
\ /
a \ / b
\ /
\ /
o
(x,y)
so
a = √(x² + y²)
b = √(y² + (L-x)²)
also, with regard to the spinning steppers and our 200 steps per revolution, if s
is the number of steps:
Δa = rθ
θ = 2sπ/200
∴
s = 100Δa/(rπ)
- one big plotting class/lib
- letters
- images
- via contours and progressive greyscaling?
- simulator
- python lib generates paths, saves as json and renders locally?