Introduction: Tracey - Drawing Machine
This Instructable is a work in progress - we will work hard to make it an easier project but the initial drafts will require maker experience, 3d printing, parts assembly, electronic parts soldering, experience with the Arduino IDE etc
Feedback would be greatly appreciated, help to improve the steps and any issues that can be fixed.
Tracey is a servo based panto-graph drawing machine.
It consists of two main parts:
- Controller board
- Drawing mechanism assembly.
Once calibrated correctly Tracey can produce nice fun drawings, slightly shaky but this is the nature of the parts used.
There are different fun configurations that Tracey can be used in, some are listed below:
- Pen on paper drawings. - we will focus on this mode in this Instructable
- Laser drawing on wood / plastic - using small laser modules
- UV LED drawing on glow in the dark paint.
- Drawing on a Magna Doodle.
- Object scanning with various sensors -infrared heat sensor, light sensors etc
- Moving objects for games - experimental
The Controller Board:
The controller is based on the ESP8266: low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller
The specific type used for this project is the WeMos D1 Mini, this type has a nice small form factor - other types could be used providing they have enough pin outs.
Using the ESP8266 means we can communicate with the machine using both a WiFi (Telnet) and a Serial interface.
Tracey has a Gcode interpreter and a GRBL interface so -at time of writing- the below software works:
LaserGRBL - this is a great piece of open source software, Tracey works with both Telnet and Serial. -Tracey pretends to be a laser engraver.
Easel - web based carving program, very nice. Set to x carve, x controller * -Tracey pretends to be a carver.
Universal Gcode Sender - Open source Java based GCode sender. *
There is also an Android App called Tracey App Beta, it sends drawings over WiFi -more on this later.
*There is also an upcoming Tracey-Link board to send the serial data from Easel and UGS to Tracey via telnet.
If you want to write you own programs to interface to Tracey, this is very easy too, everything about the interface is very open and all details will be explained.
The Drawing mechanism assembly:
The physical drawing machine consists of number of 3D printed parts and three mini servos along with some 3mm bearings and M3 screws.
Two servos are used for drawing and one is used for a lift mechanism.
The drawing servos should be of good quality, the lift servo should not - its resolution and accuracy are not important and it has to do a lot of work.
We have put a lot of work into keeping the 3D printed parts and assembly as simple as possible and they should be easy to print on any standard 3D printer.
Barton Dring - this guy is a bit of a beast when it comes to drawing machines and controllers.
His blog entry on his Line-us clone was where I was introduced to the idea and it was extremely helpful.
And of course, where it all started: the great Line-us
Its a great looking machine, very well designed and there seems to be a great community over there.
Capacitors: 1 X 470uf , 1 X 0.1uf
Resistor: 1X 100 Ohm
1 X LED
3 X 3mm M3 bolts - 8 mm long.
2 X 3mm M3 bolt - 20mm long
Step 1: The Controller Board Circuit
The first step should be building the controller board and verifying that all is working.
For very basic testing, you can just upload the code to a "raw" ESP8266 board.
The Circuit above is Tracey in its simplest configuration.
Note: The 5V screw terminal is if you decide to power the board from an external supply, if you decide to power the board through a USB power bank, the screw terminal can be left out - more about this later.
Step 2: Breadboard Circuit
The Breadboard circuit with servos, the power connector is optional.
An important note on powering Tracey, is that with the servos connected it is possible to power the device with a USB power bank, as they can usually supply about 1 Amp at around 5V.
Trying to power Tracey from a USB 1.0 or USB 2.0 port will not work reliably or not at all and could even cause damage to the USB port -although most ports have over current protection.
Powering from a dedicated USB hub that can supply 1 Amp per port should work OK.
Powering from a USB 3.0 port seems to work OK.
Step 3: Making Your Own Board
A bread board circuit is fine for testing and making sure everything works but you will need something more sturdy for serious use.
Making your own board is straight forward enough if you have some soldering experience, as the circuit is very simple.
Above photos are some old prototype boards I made -untidily- on strip-board, as you can see there is not much to it.
Also shown is a PCB I had manufactured, If there is enough interest I could distribute these.
Step 4: The Controller Board Code
Note: It is assumed that you have the correct USB driver installed on your PC for your ESP8266 board.
If you have experience with the Arduino IDE and have uploaded code to your ESP8266 board before, then all should be fine.
The code comes in the form of a bin file that is uploaded to the board using the esptool - the process that is used to upload compiled binary files from the Arduino IDE.
A Windows only program is included -with source- called TraceyUploader that makes this process very quick and easy.
Why are we not releasing the C source code? Well, we may release it in the future but at the moment it is too big, complex and going through too many changes, the bin file upload is a far simpler process.
Use the links below to download the binary file and the up-loader tool from Github - choose the "Clone or Download" button for both.
Download both and unpack. Place the Tracey.bin file in the TraceyUploader folder.
Plug your ESP8266 into your computer and wait until it connects.
Run the TraceyUploader.exe, the paths to the bin file and esptool should be correct.
Choose the COM port that your ESP8266 is connected to and click the "Build Bin File Command" button, you should get something like:
"C:\temp\Tracey-Uploader---Stand-Alone-master\TraceyUploader/esptool.exe" -vv -cd nodemcu -cb 115200 -cp COM10 -ca 0x00000 -cf "C:\temp\Tracey-Uploader---Stand-Alone-master\TraceyUploader/Tracey.bin"
in the text box.
Click on the "Send to Device" button, a command window should open and you can see the bin file being uploaded to the ESP8266.
Note: when uploading code using an USB 1.0 or USB 2.0 port the servos must be disconnected!
Using a powered USB hub or USB 3.0 seems to work OK.
Step 5: Testing the Controller Board - 1
Now that the Tracey.bin file has been uploaded to your board - the LED should start flashing after about 15-20 seconds, the slow flashing LED means that Tracey is in idle mode and ready for input.
Note: you can skip to the Connecting to WiFi step now if you don't want to connect using the serial port but the serial port is great for providing information and especially useful if you are having any issues.
You can connect up to Tracey right away by using a serial terminal program like Tera Term:
Install and choose Serial and pick your port -you should know this from the last step.
Navigate to serial setup and choose a 115200 baud rate.
You may need to reset your board after the above.
If all has gone well you should see the Screen in the next step:
Step 6: Testing the Controller Board - 2
Above is the serial output from Tracey on a first time run.
You will notice two things; it is warning that no calibration has been preformed and that it has failed to connect to Wifi, we will address both these things in the coming steps.
You can type a '%' to enter the Tracey help and configuration menus if you wish, there is a lot of info in there and all settings are explained.
Its important to note that Tracey runs "blind" or "open-loop" in that it receives no input from the real world about its drawing tasks, its just moves its drawing arms where it is told and it does this buy sending inputs to its three servos.
Because if this, without any drawing assembly connected Tracey can still receive drawings from the various programs listed above - this can be useful for basic testing.
Those with an oscilloscope and the interest could monitor the servo pins while a drawing is being sent to see the changing PWM signals.
Step 7: Testing the Controller Board - Connecting to WiFI
Note: If you don't plan on using WiFi it can be disabled in the help and configuration menu using the terminal program in the previous step. This will decrease boot up times.
Tracey uses WiFiManager, a library that sets the ESP up in station mode and allows WiFi credentials to be entered in a simple web interface.
To get Tracey in this mode you need to press the button (ground D5) for more than two second, the LED should flash twice in quick succession.
You should see an access point called: "Tracey WiFi Config" on the list of WiFi devices.
Connect to the access point and open a browser with URL: 192.168.4.1
Enter your WiFI credentials using the web interface.
Once this is done you should reboot/reset the controller board, you should now see that Tracey has connected to WiFi in the terminal, and the blue light in the ESP8266 should remain on.
Note: A phone or tablet is good for doing this, we have found the Firefox browser to be the most reliable.
Step 8: Testing the Controller Board - Testing WiFi With the App
Now WiFI is configured and Tracey is connected, lets do some testing.
We will start off with the most straight forward and easiest way, using the App..
The App is only for Android devices at the moment -sorry Apple people-, it can be installed here:
As the title says it's in Beta so there is still work to be done, but it works quite well and is very useful.
Start he App and if all is working, it should display Services found:1 on the top left of the screen.
Press the connect button on the bottom right and you should get a menu with your Tracey device and its IP, select it
-the name of your device can be changed in the config menu, useful if you have more that one Tracey device-.
You should now have connection information on the top left.
Hit the Draw button and choose Screen to Tracey, the drawing on the screen will now be sent to your Tracey board, the LED should flash as it receives the different draw codes.
There is much more to say about the App but this is enough for testing purposes.
Step 9: Testing the Controller Board - Testing WiFi With Putty
To test the WiFi connection using a telnet client you can use Putty.
To connect to Putty you will need to know the IP address of your Tracey controller board, below are some ways to find it:
- Use the Tracey App in the previous step.
- Open a command prompt on a Windows PC that is on the same WiFi network as Tracey and type "ping Tracey.local" -Note: if you have changes the name of your Tracey controller board you will have to use that name instead of Tracey.
- View the output of the serial terminal on boot up
- mDNS service discovery - details of this later on.
When you have the IP address choose a telnet connection for the session and enter the IP address.
Click on terminal and set local echo and local line editing to 'Force Off'
Open the connection and you should see the welcome screen.
You can press '%' to enter the help and config menu, here as with with the serial connection; settings can be changed and calibration preformed.
Step 10: LaserGRBL
I can't say enough good things about this program, its open source, has a ton of features and is being actively developed.
It will connect to Tracey using serial or Telnet.
It can convert pictures to Gcode using a variety of techniques, and they can be directly sent to Tracey or saved and sent using the Tracey App.
Its a great way to get started and is highly recommended.
Step 11: Putting Together the Drawing Assembly
Now that the controller is built and tested, lets get on with building the rest!
As stated at the beginning, The drawing assembly is mostly 3D parts along with 3 X 3mm bearings and a few M3 screws.
Print all the parts here:
Note: there are other builds that provide slightly better / cleaner pen down performance, this one was chosen because it is an easy print and build.
The next two steps are the most important of the build.
Step 12: Servo Arms and the Servo Horns
Note: this step will apply to both servo arms.
This is one of the most import steps in the build.
Snip the servo horn as shown in the pictures, make sure it fits in the servo arm, you may need to file the servo horn slightly.
You will super glue this part into the arm shortly.
It's important to make sure the sniped servo arm is straight / level -not necessarily flush- in the arm, if not the arm assembly will not be the same distance from the drawing area for all points and this will cause the pen not to draw in certain areas and is a real headache.
Hopefully I have explained it well enough for you to understand, basically when you insert the servo into the arm it should be level -perpendicular- to the servo in all positions.
Put a small bit of superglue around the hole on the servo arm and insert the servo horn.
A trick to make sure it's level is to quickly insert the servo after gluing and adjust if necessary.
Step 13: Attaching the Servo Arm to the Servo and First Calibration
Note: this step will apply to both servo arms, this step is for the top servo arm. - the long arm
This is another very important step and will involve the first calibration process.
Good calibration is key to good drawings, there are two calibration steps -first calibration and later on, precision calibration.
You can preform this step with a serial port connection (Tera Term) or a telnet connection (Putty).
Open a terminal connection to Tracey.
Press '%' to enter help and config
Press '4' for servos
press '3' for Top servo calibration
'a' and ;'d' are used for moving the servo, use 'a' to get to the lowest number where the servo still moves.
Insert the servo arm and get it it as close to 45 degrees from the body as possible -see the picture above.
The teeth on the servo and the servo horn will mean you might not be able to get it at exactly 45 degrees -use 'a' and 'd' to adjust it until it's exactly at the correct angle - a 45 degree set square will help greatly here.
Note: the servo minimum being at exactly 45 degrees is very import and a bit tricky,keep at it until you are happy that it is the correct angle.
Press 'o' to record the value.
Now press 'd' until the servo hits its maximum and stops moving, ideally this would be 180 degrees from the minimum but don't worry if it's not, press 'o' to record.
You should now see an array of calibration values and a minimum and maximum, press 'y' to save.
The servo is now calibrated with the servo arm, insert the locking screw.
Well done, this is probably to most difficult step. repeat the steps for the bottom -small-servo arm.
Note: there seems to be a bug, where after each calibration step the servos will not move for around 40 seconds when you go to the the next calibration - you may need to reset the controller for each calibration - this bug is on a list and will be addressed soon.
Update: This has been improved in V1.05, I thought it was gone but on one test it reappeared. Feedback from people who experience this bug would be welcome, its a very strange bug.
Step 14: Attaching the Cam to the Lift Servo and Calibration
This time the all parts need to be removed from the servo horn except the cylinder - this will be simplified in the future.
Clip off as much as you can and file the rough bits off, - see picture above.
Glue the cylinder into the cam - this step does not require you to be careful about leveling as in the previous steps.
The calibration in the step is much easier too:
Get to the lift servo calibration on a terminal -you should be able to do this from previous steps.
Press 'a' to get to a low value where the servo still moves.
Attach the servo cam to the servo so the cam nose is pointing straight out from the servo -see photo.
Press 'o' to record position.
Press 'd' until the nose of the cam is 90 degrees or above to the servo body.
Press 'o' and 'y' to save.
That's it for the lift servo, hopefully it went well, this step is very forgiving.
Step 15: Attaching the Servos to the Body + Base
From the picture above it should be clear where the servos are attached.
The wide thread screws that come with the servos should be screwed into the hole before hand to create threads - bit hard sometimes.
Attach the servos to the body.
Attach the base to the body using an M3 bolt equal to, or longer than 20mm
A trick here is to first screw the bolt into the body, then keep screwing until it starts slipping - bit nasty I know - this will make the body move more easily on the bolt.
Once the body and base are connected, keep working them both, the body should easily flop down and be firm in it's seated position.
Note: for this the lift servo cam should be 90 degrees or above from the servo. - the nose should be facing out or above facing out.
Step 16: Precision Calibration
This is the second and final calibration, it is for the top and bottom servos only.
It's very important and will help with the best drawings from your servos.
Use a terminal to enter the help and config menu.
Press '4' to enter the servo menu.
Press '5' to enter precision calibration.
The keys used here are a/d for moving the small arm and j/l for moving the long arm.
Carefully move the small arm until its at exactly 90 degrees left from the body and the long arm is pointing straight up.
Press 'o' to record the value.
Use the same keys but this time the long arm should be 90 degrees right from the body and the short arm should be straight up.
Press 'o' to record value and choose 'y' to save.
Step 17: Pen and Link Arm
Now that all the calibration has been preformed it's time to add the pen and link arms.
A note about the 3mm bearings- you should not go too cheap on these as the really cheap ones will have too much slop / play.
Two of the bearing should be inserted into the link arm by pushing them in, they should fit snugly.
One should be inserted in the long servo arm.
3 X 3mm M3 bolts - 8 mm long.
1 X 3mm M3 bolt - 20mm long - for locking the pen
Assemble as shown in the pictures.
Once fully assembled, send a few drawings without attaching the pen to make sure all is working as it should.
Note: if the bearing are too loose in the arms you could try a small bit of glue to secure them better - dont get glue on the inner workings of the bearings.
Step 18: Setting the Pen Height
Toggling the pen up and down can be done by pressing the button -for less than 2 seconds.
It's important to get the pen at a good height so it does not drag too much and not too high that is will not draw.
The pivoting body build helps here because if the pen is a bit too low the body will pivot and not put too much strain on the arms.
Step 19: Securing Tracey When Drawing
Currently, a good way to secure Tracey when drawing is with two small pieces of blue tack.
In this way, the paper can easily be replaced.
See picture above.
Step 20: Videos
Some videos of Tracey drawing in different modes.
Step 21: Gallery
Some drawings - anything on wood is done by a laser.
Step 22: List of Supported G Codes
G0 X50.5 Y14.7 Z0 - move to position 50.5,14.7 not in a straight line with pen up.
G1 X55.4 Y17.7 Z-0.5 - move to position 55.4,17.7 in a straight line with pen down.
G4 P2000 - Dwell - example waits for 2000 milliseconds
G20 - set units to inches
G21 - set units to millimeters- this is the default
G28 - move to home position (0,0)
M3 - Pen down, when 'laser no lift's is enabled this will set D8 to high
M4 - Pen down, when 'laser no lift's is enabled this will set D8 to high
M5 - Pen Up, when 'laser no lift's is enabled this will set D8 to low
M105 - Report battery voltage
M117 P10 - Set Interpolation points for linear drawing, 0 is Auto, play with this at your peril!
M121 P10 - Set draw speed, 12 is default, 0 is fastest possible, this can be set in the Tracey menu too. -value won't be saved.
M122 P10 - Set Move speed, 7 is default, 0 is fastest possible, this can be set in the Tracey menu too. -value won't be saved.
M142 -toggle laser no lift, when enabled the body will not preform a pen lift but will enable/disable D8 instead.The state will not be saved when rebooted, to save this state set it in the Gcode configuration menu.