Archive for the 'Digital Fabrication' Category

I recently decided to update the Polar Coaster project. The primary reason was to update the controller to use Grbl_ESP32 firmware. I also thought I could make it smaller, lighter and remove a little cost.

Controller

The old controller was not custom made and just sort of tacked onto the back. This increased the size and didn’t look very good. It had a Bluetooth module, but you still had to stream the gcode. You could use an Android app, but that was still a little awkward.

Firmware

The controller runs Grbl_ESP32. This was recently updated to include pen machine features. This allows precise control and calibration of the pen servo. You can control the speed, timing and endpoints of the servo travel.

WebUI

The controller has a web server that serves a web app. This allows complete control of the machine. Web browser based control is ideal, because it is compatible with anything that can use a browser. We hope to add additional web apps for generating gcode from images and SVGs.

SD Card

This is a great feature. If you have files on the SD card, they can easily be plotted. The WebUI lets you upload files and then click play.

Stepper motors

Both versions use NEMA 14 motors. The original version used 34mm deep motors. I used these because I had some. They are overkill, because there is very little load on the motors. I bought some 20mm deep motors for the new version. These are even a little overkill. I am only running about 0.3A of current into each one. There are not too many options for standard stepper motors that are smaller and lower cost than these.

Gear Driven Rotational Axis

I decided to change from a belt driven rational axis to a gear driven one. Loop belts are a pain, because you have to order them from expensive places like SDP-SI and if you want to tweak anything, you might need to order a different size. I decided to use helix gears this time. These are 15° gears with a modulus of 1. They print and work great with my printer, even on a coarse layer height. The motor is mounted on slots and it is easy to get virtually no backlash. The helix keeps them quiet.

Rotational Platter

The platter rotates around a central bearing. This pulls (3) smaller bearings, that act like wheels, into contact with the PCB. This causes the platter to stay very flat, without wobble. I created a copper ring, plated with solder on the PCB to make it extra smooth and wear resistant. It also looks really cool and shiny on the PCB!

Buttons

Since there was a little room left on he board, I added three buttons. I have not added anything to the firmware yet. I think one will definitely be a homing button. I am not sure what to use the others for. I thought it might be handy to have a repeat button to repeat the last plot without having to fire up the phone app.

Battery Power

I made a battery case in the base of the machine to hold an RC style LiPo battery. I am using a 3 cell (11.1V) 2200 mah battery. The idle current on the machine with the WiFi running is about 80ma. When plotting it peaks at about 800ma. I think I should get about 2 hours of continuous plotting.

Future

Put kinematics into the firmware. currently files need to be pre-processed with the python script.

Woot!

I and Jason Huggins (@hugs), of Tapster Robotics, will be giving a conference at the 2018 Hackaday SuperConference. The conference will be “Getting Started in Small Scale CNC and Robotics (Build a CNC Badge)”. By the end of the workshop you will have built, programmed and learned to use the DrawBot Badge.

The badge is way more than that though. The badge PCB is a very capable general purpose CNC/Robotics controller. We considered every small scale CNC machine we could think of and made sure this badge could control it. Here is what it can control.

(3) Stepper Motors

(3) Hobby Servos

(3) Homing/Limit switches

(1) Variable Speed Spindle PWM signal

(1) Laser Module (Power control and Safety interlock)

(4) Control switch inputs

(1) Probe switch control

(1) Coolant Control

(1) High current (3 Amp) output for relays or solenoids (includes flyback diode)

(1) i2C interface (for displays or Sh**ty Add-Ons)

(1) SD Card socket to store and run files

You can’t use every feature at once, like the Laser PWM and Spindle PWM are the same signal, but they are broken out logically to multiple, machine specific, connectors.

It is all powered by an ESP32 running Grbl_ESP32, which provides serial, Bluetooth and WebUI interfaces.

The first half of the conference will cover tips and tricks for getting started with making and controlling small machines. We will also learn and use some basic gcode to control some motors and other items. It is a just a basic intro to get you started and discover some resources. During the second half we will build the DrawBot badge.

If you are interested, sign up for the conference and be sure to get into the workshop when that is posted. The workshop will be limited to about 20 people, but I will bring extra badges for sale and will be happy to help build and hack them all weekend. I will also bring extra motors, servos, switches, etc for hacking up simple machines.

Open Source

Within the next couple weeks, all of the documentation will be released. Badge kits will also be for sale on Tindie after the conference.

I showed off an early version of my DrawBot Badge at the Hardware Happy Hour last night. Some tweeted pictures generated a lot of questions, so I thought I would write a quick post about it.

I have been following the #badgelife thing for a few years and felt that the mechanical and CNC world needed to be represented. The goal was to create something small, safe, fun and something anyone could learn to use. A drawing machine seemed the perfect fit.

Drawing Surface

I decided to use 3″ square Post-It notes. The main feature is that they are self stick, so I don’t need any clamps or tape. It is also cool that you can stick them to things when the drawing is done. They are cheap and easy to find. I like the kind that have the majority of the back (full stick) covered in adhesive. This means you can use a small stack of them and peel them off as they are done.

Drawing Mechanism

I tried to make the drawing mechanism as tiny as possible. The size is about 30mm x 70mm. It uses (3) of the smallest readily available class of hobby servos call micro servos. You can buy these from AliExpress for as low $1-$2 in low quantities. The choice of the arm configurations was primarily based on tightly packing the the motors, but I also wanted something new and interesting.

The pen lift is simply a cam on one of the motors. The entire mechanism rotates on two 3mm bearings. In my experience with drawing machines, gravity is the best way to engage the pen to the work. The mechanism needed to work hanging from a lanyard or sitting on a table.

Electronics

There is only one electronic item right now. It is an ESP32 dev module. There are also (3) connectors for the servos and (1) for voltage monitoring. The entire back of the badge is a PCB. I made the board full size to enclose the back and the pen lift cam need to push on something. I have big plans for the rest of the area though. The ESP32 provides the Bluetooth and Wifi needed for the remote control.

Firmware

It is running my ESP32 port of Grbl with a little hacking for the servos. The ESP32 uses an RTOS, so I just created a low priority, repeating task (20Hz). The task checks the position of a virtual CNC machine, does some kinematic math and updates the servos. The software supports streaming drawing data (gcode) via serial port, bluetooth, SD card or wifi. I am using the bluetooth option to send via my phone. I will publish the firmware soon.

Crazy Math (Kinematics)

The math is actually not too hard. You know the desired pen location, the axes of the servos and the lengths of the linkages. There are two ways to do the math. The first way is using the law of cosines and the Pythagorean theorem.

The second method uses intersecting circles. Each linkage can sweep a circle from a axis point and radius. Any two linkage’s circles will intersect at two points. It is easy to pick one of the points as more desirable. While it is less deterministic, due to the two points thing, it appears to run about 40% faster on the ESP32.

The Z is very simple. Any Z value less than 0 is pen down and everything else is pen up.

Drawing Quality

The quality is basically “Adorably Wiggly”. I am using the cheapest analog servos. That means I might get about 200 x 200 resolution at best at the servo hubs. If you mapped that grid to the paper it would be a warped grid with dense and sparse areas of the grid due to the non-linear nature of the mechanism. Digital servos with very low deadbands (~1us) it would probably do a lot better, but I am not sure that is worth it. It would only be a little less wiggly. They cost about 4x what analog servos do (still pretty cheap).

There is a calibration feature. Each servo is a little different and it is difficult to precisely mount the arms at the right angle. The calibration adjusts the zero angle and pwm/degree of rotation.

Next Steps

This project is part of a talk proposal for Hackaday SuperCon 2018. If that gets accepted, the badge will become a full featured CNC controller capable of running a router, laser cutters, high res plotter, etc, as well as the Drawbot badge. Only the DrawBot will be populated. The rest will be modular like this board.

I may also make a simple version that is only the draw bot. The BOM cost is currently about $10-$12 (without 3D printed parts)

Regardless of what happens all source files will be publish sometime in October.

Follow me on Twitter (@buildlog) or subscribe to this blog if you want to follow the project.

The NickelBot is complete and it works great. The goal of the project was to create an easily portable machine that creates low cost items that could be given away at events like Maker Faires. I think it has completely achieved that goal. The nickels are purchased from Amazon and cost about $0.08 each.

Here is a video that explains the machine.

Results

It is quite reliable and the cycle time is is just about right at 1-2 minutes per nickel. I think the engraving quality is quite good. I ran it at the Chicago Northside Maker Faire last weekend. It made about 60 nickels without any problems. Here are some of the nickels it made.

Mechatronics

The NickelBot uses (2) NEMA14 stepper motors in a T-Bot configuration. These drive a single GT2 6mm belt. The linear bearings are (2) 6mm rods per axis with (1) LM6LUU per rod.

To handle the nickel loading and unloading, it uses a single micro hobby servo. This servo connects via a 0.03″ brass wire to a clamp. The firmware has (3) positions hard coded for the servo for fully open, nickel support only and supported plus clamped.

All 3D printed parts are PLA printed on a Lulzbot TAZ6. The colors just represent the color that happened to be in the printer at the time.

The Laser Module

The laser module is a 3.5W peak, 450nm (blue) laser. It comes with a laser power supply that has a 12V power input and TTL laser control input. It also comes with a 12V 5A power supply. I bought it a few months ago from Banggood.com when it was on sale for about $70, but they are typically around $99. I control the engraving power with a 5kHZ PWM from the microcontroller.

Controller

I used a PSoC5 development board as a plug in on a custom PCB. I knew adding an additional, accurate PWM for the servo was going to be vastly easier on the PSoC5 vs. an Arduino.

This dev board has a built in programmer debugger that makes firmware development very easy. It is great to be able to set breakpoints and check values with the debugger. I have have a another blog post with more details on this here.

Firmware

The firmware is a modified version of my PSoC5 Grbl port. The only modification needed was the code to handle the clamp servo. Rather than adding special gcodes for the clamp, I simply re-coded the M7,M8 and M9 coolant commands. I did this because all of the parsing and protocol issues were already done. Each command represents one of the clamp positions.

I may post the source code on Github soon.

Calibration

The machine has (2) home switches (X and Y). A homing sequence needs to be run each time you power up the machine. All other locations are referenced to this location. A one time calibration is done to locate the following locations.

G54: G54 is the the default work offset. I decided to use the center of the nickel as the 0,0. I jogged the machine visually until the nickel looked centered. I then set the G54 location with this gcode line”G20 L10 P0 X0 Y0″. I made a target shaped graphic that I used to test engrave this location(see above). I used a caliper to measure the centering error, jogged that amount and reset the 0,0. I did this about 5 times until I was satisfied with the centering.

G28: I used the G28 location as the location under the nickel hopper. You jog to the location and set it with “G28.1”.

G30: I used the G30 location as the position over the eject chute. This is set with the G30.1 gcode command.

Software

This is a great program for this application. It does everything, starting with a bitmap image, to gcode sending in one application. It also has some macro (multi-line gcode) buttons that are very handy. The only drawback for some is that it is Windows only.

Source Files

Possible Improvements

Interlock switch: Right now there is no interlock switch for the door. If I make a new PCB, I will add a provision for that. I’ll probably just break all power to the laser module.

Nickel Flip: Right now the nickel always comes out of the chute upside down. This is not the best presentation. This was a compromise to make the machine as small as possible. The nickel has to fall between the Y rods. Rather than makethe distance between the rods wider than the nickel, I designed and aligned the clamp/support system so that one side of the nickel falls first and goes between the rods closer to vertical. There is a probably a way to design the chute to catch the nickel before flips over completely or re-flips it back.

Software:

More automation: LaserGRBL has macro buttons for the nickel feed and eject features, but it would be nice if that was automatic. They have added a gcode header and footer feature to the roadmap. Right now you can generate the gcode, save the file and paste the nickel handling code in an editor. That file is then fully automatic.

Customizing: It would have been fun to easily add names, etc to nickels for people.

Memory: The ESP32 has much more RAM and program space to allow more features, levels and audio files.

Physical Size: A Mega is very big. This creates a large enclosure that takes a while to print. The smaller enclosure is also more portable.

DAC Pins: The audio capabilities on the Mega are very crude and basically limited to square wave tones. A DAC can output digital audio. Currently I am just using a similar square wave tone to the Mega, but it works much better for adjusting the volume.

Wireless: The ESP32 has Wifi and Bluetooth. This will allow easier (smartphone) interfacing for options (brightness, volume) and level pack uploads. I also want to consider dual player battle type games with linked controllers.

The Audio

The original TWANG bit banged audio directly from I/O to a speaker. This was super simple, but the volume at max was not loud enough for noisy environments. The ESP32 I/O is a lower voltage (3.3v) and less current, so something needed to be done. I prototyped with a PAM8403 based amplifier (~$4 on Amazon). This worked great, so I added that I.C. to my shield. The volume is controlled by the amplitude of the DAC.

The Shield

I made a shield to simply the wiring and provide a stable way to mount the ESP32. I used a NodeMCU 32S development board for the ESP32. Under the ESP32 is a the audio circuitry. I should have some extra boards to sell on Tindie soon. I will publish the source files soon.

The Firmware

The code is on Github. The port was relatively easy, but I had to rewrite a few libraries. They were designed so the main “setup” and “loop” parts did not change much. Currently the serial port based setup from the Mega version was not ported. This probably won’t be used. A wireless version is in the works.

Enclosure

The new enclosure is smaller. It prints quicker and is easier to fit in my backpack. The size is still big enough to hold comfortably while playing. The files will be uploaded to Thingiverse within the week.

Next Steps

Wireless control: I want a simple way to read the game statistics (average score, levels played, boos kills, etc) and tweak simple settings like audio volume and brightness. I think the easiest way is to make it a wifi access point with a simple web server. This eliminates having to write any client side apps and any smartphone or computer can hope on easily.

Levels: Make some way to edit or upload levels via wifi.

Multiplayer: I should be able to link multiple controllers. If I can think of a good dual player game idea, I might try to add that.

Python: It might be a fun challenge to write the game in Micro Python. This might open up the development to more people.

While the my TWANG clone has been running great, I wanted to clean up the wiring, so I made a shield to plug into the Arduino. I previously used header connectors plugging into the Arduino. The connectors go to three different places and come from all over the Arduino , so there were a lot of connectors including some single pin ones. I was worried they might pop out or fail. I also had to externally power the LED strip and supply power via USB to the Arduino.

The shield takes care of all of this and groups all of the external connections by function on easy to connect and clearly labeled terminal blocks. Here are the features I have…

Single 5V Power Connector: This connector powers the LED strip via a very heavy trace on the PCB. It also powers the Arduino. The Arduino is powered through a Schottke diode. If you plug in the USB, the Arduino switches to be powered by the USB. This allows you to program and hack the firmware while the LED strip is powered.

Terminal Block Connections: The wires are grouped by peripheral (Accel, Speaker, LED Strip) and clearly labeled.

LED Strip Connections: This powers and controls the LED strip. I have tested it with 4 wire (APA102, Dotstar) and 3 wire (Neopixel) strips.

Speaker Connection: There is an integral 100 Ohm resistor that is required when you directly power the a speaker from an Arduino. The terminal block also has 5V and Gnd in case you want to add a simple amplifier. BTW: Driving the speaker directly from the Arduino is plenty loud in my opinion.

Shield Size: The shield will work on both an Arduino Mega sized board or an Arduino UNO sized board. The TWANG firmware requires the extra memory of the Mega, but a tiny, reduced feature, UNO version could probably be made.

Life LEDs: There are provisions for 3 LEDs that are typically used to show remaining lives. I have not been using those. I prefer to use the LED strip to show remaining lives. I like working with the restriction of a 1D LED strip display.

Prototype Assembly Notes: I did not have all of the correct parts for the build. I did not have a 100 Ohm SMD part, so I tacked on a through hole part. I did not have the right terminal blocks, so I cut one and only used 3 positions for the speaker. The correct parts will arrive soon.

Here are some more images.

Future Changes

I will probably get rid of the life LEDs.

I will add a large capacitor for sensitive LEDs, like Neopixels. Right now I just connect the cap to the terminal block.

I will probably sell the rest of this batch on my Tindie store in a week or two. I will probably sell assembled boards and full assemblies (less LED strip and Mega)

A lot of people have asked about building their own Coasty Laser Cutter. It takes a lot of work to get the files ready for release. I will release the source files in stages as they are ready so people can get started. Watch this post for updates. Subscribing to this blog or following me on Twitter (@buildlog) is a good way to keep up.

When everything is ready, I’ll probably also post on Thingiverse.

3D Printed Parts

Here are the STL files for the 3D printed parts. The parts are generally pretty easy to print. They require no support and can be printed in low resolution. I print at 0.28mm layer height. You need to watch out for warping on the chassis and front door. If the chassis warps it will stress the PCB and could damage some parts. The door needs to be flat in order to close properly.

I printed my parts in generic PLA. They printed fine, but if you have some crappier PLA or if you don’t have a heated bed, you should probably print with a brim. I would suggest printing the chassis first. If you can print that, the other parts are easier. I have some PETG on order to test. That supposedly warps less that PLA.

The holes used for the 8mm rods are designed to be a press fit. If the rods are hard to install, try cleaning the holes up a little by hand with a 5/16 or 8mm drill. The drive shaft bearing is also a tight fit. Try using a vise or clamp to press it into the chassis.

New Traction Roller

I made the traction roller diameter a lot smaller and moved it behind the beam. A smaller roller has a lot of advantages. It allows the beam to be closer to the contact points of the rubber orings. This improves the usable work area, because you can get closer to the edge of the coaster. With a smaller diameter the coaster travels less per revolution. This increases the torque and resolution.

Smaller Chassis

The chassis is now about 16mm smaller in depth due to the smaller roller and new location. The depth of the machine is quite a bit smaller than the coaster.

Fan Guard and Carbon Filter

I added a fan cover on the back. This acts as a finger guard and also allows a few layers of carbon filter cloth to be used. Bulk carbon filter cloth for use in air purifiers can be purchased on Amazon very cheaply. It removes a good portion of the odor of the smoke.

Carbon Filter Cloth

Door Interlock Switch

There is now a switch that cuts all power to the laser when the door is opened. You can still run the machine to test the motors, homing etc, the the beam cannot turn on with the door open.

IR Coaster Detector

I was not happy with the coaster homing switch used on the first version. While it never failed, it did not appear to be very robust and it caused some drag on the coaster. I changed to a IR LED and photo diode. When the light from the LED hits the photo diode, it conducts to the +5V. When the coaster blocks the light, it is pulled down to ground. I used a pot on the pull down because it did not know what he exact value would be. It turns out the value needs to be about 40k. The only catch was the microcontroller input pin pull up resistor on the Nano could not not used because it is less than the 40k. This required a slight hack to Grbl because Grbl is all or nothing on the pull ups for the limit switches.

I was not sure if ambient light changes might be a problem, like bright sunlight. The photo diode looks down and that appears to be good enough to avoid overhead light. I also have a mounting screw there in case I need to add a little shade/cover.

IR LED / Photo Diode Circuit

Bluetooth

I have been using Bluetooth on some other machines and really like it. Skipping USB cords and using a phone instead of a computer is great. I have found it to be very reliable. The real world bandwidth appears to be a little lower than 115200 USB. It has not been a problem, but I don’t do much gray scale engraving on this machine which needs higher bandwidth. Regardless, USB is still an option.

I wanted to complete a start to finish project with the LX-16A bus servos to do a complete review of their viability for the type of mechatronics projects I do. The low price of the LewanSoul bus servos make them a competitive option over digital servos. I chose to do a remake of the Line-Us clone drawing machine because I would not need to spend too much design time and it would be a good 1:1 comparison with digital servos. Since the bus servos are quite a bit larger, I decided to scale up the machine by 1.5x.

Made My Own Brackets.

I started by buying one servo and it came with brackets. When I went to get more, I noticed the price was lower. I did not realize I was getting these without brackets. These are the brackets you get with the more complete kit.

I requested some 3D models from LewanSoul. They were only able to provide 2D DXF files, but they were easy to convert in Fusion 360. This allowed me to 3D print some brackets. It actually worked out quite well because I was able to thicken up the brackets and integrate some captive square nuts.

They mounted easily to the servos and were plenty strong for this project.

Servo Arms

I made two arms and one short cam for the Z. They were about 4mm thick and had a little pocket that slid over the standard round actuator. They screwed on with the screws that come with the servos. Before mounting anything I turned on the servos and moved them to the center of the range. This put the arms at a known angle.

Support Bracket and Base

The support bracket holds all three servos and there are 2 pockets on the bottom for some shaft bushings.

The base has two shafts pressed into it.

The shafts slide into the bushings and there is a spring to hold the parts together. The spring prevents the pieces from separating and also provides a little extra pull down force in case the shafts bind a little. The cam provides about 6mm of lift.

Final Assembly

The servos are mounted to the support bracket.

The wires are connected to the servos. They just daisy chain from one servo to the next.

The remaining links are then connected.

Testing

Here is a video of the first run.

Results

I think these are a good alternative to digital servos. They are very strong, easy to mount and accurate. Depending on the design of the controller, using a simple UART might be easier than having multiple PWM signals or extra hardware. The servo’s size might be larger than some machines need but that comes with the higher power.

Source Code

Some people have asked for the source code. Here is what I have. I just tweaked something I had to be good enough for this demo. I can’t offer support for it other than a few quick questions asked on this blog post.

I stumbled upon these LewanSoul LX-16A Servos the other day on Amazon while searching for standard digital servos. These servos are digital serial bus servos. That means they use a serial protocol on a bus rather than a PWM signal. I have used bus servos before, but the $12 price got my attention. That competes well with plain old PWM servos.

Serial bus servos have some real advantages over standard PWM servos.

Wiring: The wiring can be a lot simpler because you can put all your servos on a single 3 wire bus. Each servo has 2 connectors to make daisy chaining easier.

Higher resolution: The resolution is typically higher. It depends on the way they sense position. These use a high accuracy potentiometer and list 0.24° as the resolution.

You can set the speed: You can set a destination and speed for each move.

Set the range: You can limit the range of the servo. This is great if the using the full range would crash a joint on your machine.

Continuous turn mode: There is a speed adjustable continuous rotation mode on these, but absolute distance moves cannot be done.

Motor On/Off: Turn the motor off for manual movement.

Feedback: The communication is bi-directional so you can query a servo for…

Position: If you manually move a servo, you get its position. This is great for recording “poses” or setting range limits.

Temperature: You can read the current temperature of the motors.

Compared to Robotis

I have used the Robotis Dynamixel XL320 servos before but these are a lot stronger and the XL-320 has a weird, plastic rivet, mounting systems that I am not fond of.

Here is a size comparison with a XL-320.

Specs

Spec

LX-16A

XL-320

Max. Torque

17 kg-cm

4 kg-cm

Resolution

0.24°

0.29°

Range

240° and Continuous Rotation

300° and Continuous Rotation

Speed

62 RPM

114 RPM

Weight

52g

16.7g

Usage

To use the servos you need to use one of their controllers. The most basic controller just converts a USB or TTL serial signal to their protocol. The controller is small and low cost ($10). You can send commands via a USB (Com Port) or via the TTL pins.

Setup Program.

They have a setup program. The program is Windows only and I had to run it in Administrator mode to get it to work. This makes setting up the servos easy, but you could write your own program if you don’t want to use theirs.

TTL Control

They also provide some Arduino Sketches. They worked fine and are a good place to grab some code if you are writing your own program. The sketches use the Arduino hardware TX and RX pins. That conflicts with uploading, so you need to disconnect the controller every time you upload. I edited the sketch to use SoftwareSerial on some other pins and that made playing with the code a lot easier.

First Impressions

I found the servos very easy to use and they appear to be strong and responsive. I think they will be a good option for my on my machines.

Next Steps

I want to test these in a real machine. I thought I might try to make a slightly larger version of my Line-Us clone. That would be a good comparison of accuracy. I might try one day build on it tomorrow. I can probably get a machine designed and built in a day, but the controller programming would need more time.