Archive for the 'CAM' Category

#Inktober 2019 Project – Post 2

Reverse Engineering the Atari 1020

The field service manual is quite helpful, but the pin numbers of the connectors are not labeled and there are no part number.

Between the manual and some measurements with my meter, I think I have it figured out.

Power Supply.

I do not have the original external (wall wart) power supply. You can tell it is AC from the schematic. I did some research and found out it is 9VAC. That goes through (2) 5V volt linear regulators (with a huge heatsink). One powers the stepper motors and all the logic. The other powers the pen up/down solenoid.

Basically, I should be able to power everything with a robust 5VDC power supply. I’ll probably use this style.

Switch Panel

This connects via a 6 pin molex SPOX 10013066 connector. The PCB side is Molex p/n 10321061. The power switch is a latching switch that connects the incoming 9VAC voltage.

The function switches are normally open, momentary switches that close to ground.

Here is the pinout of that cable.

Pin #DescriptionWire color
1GrnBlack
2Pen Change SwBlue
3Paper Feed SwPink
4pen Change SwYellow
5Power (in)Red
6Power (out)Red

Pen Solenoid

Then pen moves to and away from the paper using a solenoid. The schematic is amazingly complex here, but basically the voltage flows one way through it for pen up and the for pen down. It is a 5V coil with a resistance of 5.2 Ohm.

Stepper motors

There are (2) stepper motors. One is for the paper feed and the other moves the pen carriage. These motors are 5 wire unipolar motors. These are typically used by connecting the common to voltage+ and the other wires to transistors. If sequenced on one at a time, you get 4 independent coils.


The coil resistance of the paper feed stepper coils is 50 Ohm and the carriage is 60 Ohm.

Pen Change, Homing switch

There is a reed switch activated by a magnet in the pen carriage.

Printer Mechanism Cable

There is a 13 pin cable that connects everything in the plotter mechanism to the controller PCB. This uses a Molex connector p/n 511911300. The mate on the PCB is Molex p/n 22041131. The pinout is here.

Pin #DescriptionColor
1Reed SwBlack
2Reed SwOrange
3Carriage Stepper #1White/Red
4Carriage Stepper #2Pink
5Carriage Stepper #3Blue
6Carriage Stepper #4Red
7+5VWhite
8Feed Stepper #1Purple
9Feed Stepper #2White/Blue
10Feed Stepper #3Yellow
11Feed Stepper #4Brown
12Pen SolenoidGray
13Pen SolenoidLight Blue

Polar Coaster Version 2

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.

If you want to be notified of future blog posts, please subscribe.

 

New 2.5D Pen/Laser ESP32 Controller

I have done several pen and laser machines lately, so I decided to create a custom PCB for Grbl_ESP32 for these types of machines. This is a small (70mm x 60mm) PCB with all the features a pen plotter or laser cutter/engraver would need.

These typically use stepper motors for the X and Y axes. On pen plotters, the Z axis is controlled by a servo or solenoid. On lasers you need an accurate PWM for laser power control.

Here are the features of the PCB assembly

  • (2) Stepper Motor Driver Sockets for standard stepper driver modules.
  • (1) Hobby Servo Connector.
  • (1) High Current (10A max) Output Control. This can be used for a solenoid, fans, etc.
  • (2) limit/Home Switch Connectors.
  • Laser Power PWM connector
  • Removable Micro SD card. Upload files via Wifi to reliably run off-line.
  • 5V 3A Step Down Power Supply
  • Standard DC Barrel Connector for power input. (9-28 VDC)
  • Power Output Connection for laser module.

Grbl_ESP32 Advanced Features

  • 32-Bit dual core processor
  • Fast 120kHz step rates
  • WiFi
    • Access point or station modes
    • Complete web user interface
    • Telnet
  • Bluetooth Serial
    • Compatible with phone apps
    • Compatible with most serial port gcode senders
  • 16 bit laser power control.
  • Core XY kinematics supported for T style machines.
  • RTOS (real time operating system) allows the use of custom tasks.
    • Precise servo control accurately mapped to Z motion, plus interactive calibration.
    • Precise control of solenoids via adjustable pull and hold strengths using PWM. This allows a strong pull, yet a cool hold temperature.
  • Instant On/Off – Unlike a Raspberry Pi, there is no long boot time or formal shutdown required. It is typically ready to go in a few seconds.

How to control it

There are several ways to connect to the controller, but to run jobs, you basically either stream the gcode or run it from a file on the SD card. The SD card is a great feature because it is free from connectivity interruptions and you don’t need to stay connected to your machine while it is running the job. You can quickly upload files via WiFi or remove it and plug it into your computer.

Serial port

This controller is compatible with virtually all of the serial port gcode senders for Grbl. The default baud rate is 115200.

Bluetooth Serial

This is a great way to use your phone to control a machine. When you connect via bluetooth, your phone or computer will create a virtual serial port. This means you can then use existing serial port based gcode senders.

Wifi – WebUI

The controller has a web server. The controller can create its own WiFi access point or connect to an existing WiFi network. You connect to the controller with a web browser and it serves a full featured machine controller to browser.

Controlling the Pen Up/Down Servo

The servo is controlled using a separate RTOS task on the controller. Grbl thinks it is running a normal stepper motor on the Z axis. Each time the servo task runs, it looks at the current position of the Z. It then computes and sets a position for the servo. You map the servo’s range to a Z range.  For example the range could be set for 0-5mm. Any values of Z above or below this range would would be limited by the range, so any Z value above 5mm in this example would not move the servo past where it was at 5mm.

You can calibrate the end points of the servo to fine tune it. We use the Z axis resolution and max travel settings to do this. $102=100 (100%) would be no change to the first end point. %102=90 or $120=110 would be 10% changes in either direction. $132 works the same way for the other end point. Make sure you do not adjust the servo so it hits the physical end point of its travel. You will feel the servo continuously vibrating as it pushes against the end point. This is very hard on a servo and will overheat and damage it.

The servo updates its position 20 times per second. Therefore it will do a good job of respecting the acceleration and speed settings in the gcode.

The feature also uses the $1 (Step idle delay) setting. It the steppers motors disable, so will the servo and can be moved manually.

Additional parts you need

The controller uses plug in modules for the the ESP32 controller and the stepper motor drivers.

ESP32 Controller

The ESP32 controller needs to be a ESP32 Dev Module. It should have 2 rows of 19 pins. The rows should be spaced 0.9 inch (22.86mm) apart. Be careful: Some similar controllers have a wider pitch.

Stepper Motor Drivers

The drivers are the standard StepStick (Pololu) style footprint. The (3) microstepping selection pins (MS1, MS2, MS3) are all connected to logic high. This typically results in the highest resolution (1/16 or 1/32). The Grbl_ESP32 step rates are high enough  to make that not an issue. I typically use TI DRV 8825 or Allego A4988 modules, but others can be used as long as the pins are compatible. The PCB silkscreen has the corner pins labeled. Use them to insure you correctly install your driver modules.

Source Files (coming soon)

A completely assembled PCB is available on Tindie. The profits from Tindie help me to continue to develop the hardware and firmware for projects like this. If you want to roll your own, the source files are linked below.

 

Suggestion / Changes?

If you have any suggestions or need a custom design please contact me.

If you want to be notified of future blog posts, please subscribe.

 

DrawBot Badge – Preview

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.

 


If you want to be notified of future blog posts, please subscribe.

 

 

 

 

 

 

 

NickelBot – Complete

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

I am using LaserGRBL.

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.

Here is an example of the macro to get the nickel.

G90G0X0Y0 ; rapid move to absolute 0,0
M9 ; loosen clamp
G28 ; move under nickels
G4 P0.75 ; wait for nickel to fall and settle
M7 ; close clamp
G4 P0.5; wait a bit
G0X0Y0 ; return to 0,0

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.

If you want to be notified of future blog posts, please subscribe.

Next Project – Wooden Nickel Engraver

I started working on my next backpack scale CNC project. My backpack scale projects are tiny CNC machines that I can easy carry in a backpack to tech meetups and events. This machine is going to be a wooden nickel laser engraver.

Wooden nickels are small wooden discs. You can buy blanks from various places, including Amazon. You can usually get 100 for less than $10. The goal is to create a machine that loads them from a feed tube, engraves them, then ejects them.

Mechatronics

The basic drive will be an H-Bot. It will be similar to the midTbot, but the motors are at the ends of the X axis. It will be fully enclosed, but I not started work on that part yet.

Disc Feed System

I hope to be able to use a single hobby servo to handle the loading and unloading of the blanks. The servo will control a sliding device that has three positions.

  • In the first position it acts like a support shelf for the disc. The bed slides under the feed tube and a disk drops into the pocket.
  • The next position is the clamping position. This holds the disc still while engraving.
  • The final position retracts the shelf so the disc drops through.

Electronics

The goal is to use a low cost controller like an Arduino Nano.

  • (2) Stepper motors for the X,Y motion
  • (1) Hobby servo for the disc feed system (PWM)
  • (1) Laser power control (PWM)
  • (2) homing switches
  • (1) interlock switch loop if there is a door and/or cover

Status

The major new feature of this design is the disc feed system, so I am primarily working on that right now.


If you want to be notified of future blog posts, please subscribe.

Coasty Version 1.2

Here are some updates to Coasty – The Coaster Toaster,  the tiny laser cutter specifically designed to cut drink coasters.

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.

A standard HC-05 or HC-06 module plugs into a right angle connector.

Video

Here is a video of this version.


If you want to be notified of future blog posts, please subscribe.

Using The midTbot Controller

The midTbot Controller is a controller for midTbot pen drawing machines. It is sold on my Tindie store. When fully populated, it has the following features.

  • (2) Stepper Motor Drivers for the X and Y axes with microstepping selector jumpers
  • Servo Connector for Pen Lift
  • Arduino Nano Controller
  • 5V power supply
  • (2) Homing switches
  • Bluetooth connector for HC-05 or HC-06 module.
  • Aux power connector for easy access to 5V and 12V power.

Power Supply

You will need a 12V DC power supply with at least 3A of power. The DC plug should be a coaxial 5.5mm x 2.1mm type with center positive. This type of plug is the most common type and should be pretty easy to find.

Microcontroller.

You should use an Arduino Nano compatible controller. The controller bootloader will need to be changed to the smaller Arduino UNO bootloader in order to fit the firmware. I have instructions on how to do this here. If you would like to buy one already modified, I sell them on my Tindie store. Be sure to install the controller in the correct orientation. The USB connector should face the edge of the controller as noted on the silkscreen of the controller PCB.

Stepper Drivers

You will need 2 stepper driver modules. I recommend ones based on the Allegro A4988 controller or the TI DRV 8825 controller. The drivers often come with heatsinks. The current will typically be set low enough that heatsinks are not needed.

You will need to set the microstepping level. I recommend using 1/8 microstepping. That gives a good balance of accuracy, smoothness and speed. You set this using the jumper blocks. Each stepper driver type has its own configuration. Here are the jumper setting for A4988 and DRV8825

Microstep ResolutionA4988 JumpersDRV 8825 Jumpers
FullNoneNone
1/2MS1MS1
1/4MS2MS2
1/8MS1 + MS2MS1+MS2
1/16MS1+MS2+MS3MS3
1/32Not AvailableMS1+MS2+MS3

Note the MS1, MS2 & MS3 labels next to the jumpers.

The orientation of the drivers is very important. You will break the drivers and likely other parts if you insert them wrong. Most drivers have the pins labeled and the the controller PCB has the corner pins labeled. Be sure the labels match. Here are the correct orientations for the A4988 and DRV8825.

You should set the stepper driver output current to the level required by your stepper motors. The midTbot does not need a lot of power. If you set the power too high, the motor could get hot and damage the 3D printed part it mounts to. You set the current by adjusting a potentiometer and reading a voltage. The drivers need to be powered when you do this. You can install them and power the board to do this. Do not connect the motors when adjusting the potentiometer. Each driver will have a small hole with exposed metal. This is the measurement point. The metal adjustment screw of the potentiometer is also a place you can measure. The reference voltage to current formulea are here.

DRV8825 Current = VREF * 2   (Example 0.4V = 0.8A current)

A4988 is a little more complicated because there are different versions. See this page.

Stepper motors:

The controller is designed for NEMA14 motors. Be sure to get 4 wire motors. Just about any size should work, but I prefer to use smaller ones to keep the size and weight down. You will need to attach connectors to them.  Trim the wires to the correct length so they reach the board connectors when installed. Wires colors should be installed as shown.

The wiring legend on the board that shows where to plug in the motors might not be right. It depends on the way the motor manufacturer wired the coils and which stepper drivers you use. You may need to swap them or rotate the connectors 180° if your axes are moving the wrong way. Here is a photo of how mine are wired. Try this first. Note the wire colors and which motor goes to which connector.

Bluetooth

You can add an HC-05 or HC-06 Bluetooth module. They have different connectors, but just match the pin names on both sides. You will need to setup the module to have a baud rate of 115200, N,8,1. I have detail on how to do that here (HC-05, HC-06).

 

 


If you want to be notified of future blog posts, please subscribe.

The Polar Coaster – A Drink Coaster Drawing Machine

I designed this machine to draw custom, round drink coasters. I already have a laser cutter for square coasters and I wanted to try something unique for round coaster.

The Base

The base of the machine has two stacked 5mm bearings in the center for the bed to rotate on. There are (3) 3mm bearings on the bed perimeter that provide support and keep it level. They have little shafts that snap into the base.

The Bed

The bed is  a 156 tooth GT2 pulley. It has little springy fingers that grip the coaster when it is on the bed. The bed connects to the motor pulley with a closed loop belt.

The Radial Arm.

This is a belt driven, cantilevered arm that uses 6mm shafts and linear bearings. The belt is a cut pieces with the ends clamped at the carriage. It has a slotted mounting hole that lets the arm rotate. The pen must be adjustable to get to the exact center of the coaster or the drawing will be distorted. There is a limit switch on the top.  This is the only axis that needs to be homed. To setup the machine you home it and jog the pen until it is exactly over the center of the bed. You then set the work zero for X (Gcode: “G10 L20 P0 X0”). This only needs to be done once. If you use different types of pens, the center should be rechecked.

The Z Axis

The Z axis uses a micro servo and a cam to control the height of the pen. The firmware is setup to only have (2) Z positions, pen up and pen down. It uses 3mm rods and tiny little 3mm linear bearings.  There is a compression spring on one of the rods that applies a little pressure to the pen, and allows the pen to float a little on uneven coasters.

The Controller

I used my Grbl HAT controller. It is a bit overkill for this project but works perfectly.  It is attached to a Raspberry Pi in this photo, but I have not been using the Pi in this project yet. I just connect directly via USB.

Kinematics and Pre-Processin

See this blog post on how it was done. The pre-processor is written in C#, but it is rather simple and you could probably read the source file and convert if you cannot deal with C# on Windows.

Firmware

I use a modified version of Grbl 1.1f.  Grbl does not support servos, so I needed to hack that in.  I used the PWM that is normally used for the spindle speed to control the servo. I turned off the variable speed spindle option and streamlined the spindle functions to the bare minimum I thought Grbl needed.  I adjusted the PWM parameters for use with a servo and added pen_up() and pen_down() functions. I tried to put as much of the custom code into one file spindle_control.c. I had to add a few lines in stepper.c to look at the current machine Z height and apply the correct pen up/down function.

CAM

You can use anything to generate the gcode that works with Grbl. The pen will go up when the Z is above zero and down when it is below zero. Therefore, you want the Z movement as short as possible to speed up the drawing and not have the pen dwell on the material and bleed.  I make the depth of cut 1mm and the z clearance 3mm.

CAD Files.

The design was done using PTC CREO 3.0.  A STEP version of the design is linked at the end of the post.

Performance

It does a great job. Here a recent coaster. This was done from a rasterized bitmap image found online (searched: circular Celtic braid).

Here is a Fat Tire beer themed coaster.

Coasters are made to be super absorbent, so larger tipped felt pens tend to bleed a little too much. I like to sketch with Micron pens and the thinner ones really work well on this machine.

Build You Own?

The build is not difficult, but covers a lot of areas. You should know how to work with STEP files and compile firmware.

The design is open source with no commercial restrictions, so feel free to use any part of my work. I found most of the parts on Amazon and eBay. I bought the belt from Stock Drive Products. The polar motor pulley is 36 tooth and the arm pulley is 20 tooth.  Cutting the shafts requires an abrasive cutoff wheel.

Please post any questions in the comments section and I will try to address them.

Links

 

I sell on Tindie

 

 

 

Polar Pen Machine Kinematics

When you have a round work piece like a drink coaster, it makes sense to have a round work area.  A round work area works best with a polar coordinate system. A polar coordinate system uses an angle and a distance from a center point to define a point in 2D.

The problem is that most drawing and CAM programs work in Cartesian (X,Y,Z) coordinate systems. My machine controller firmware, Grbl, also works in normal linear X,Y, and Z. The process of converting one system to another uses Kinematics.

 

The Firmware

The firmware is side is actually quite easy. I defined the X axis as the distance in mm from the center (the radius). The Y axis will control the angle. The Y axis is setup so that millimeters will equal degrees. If I tell the Y to move 360mm, it will actually rotate the work area by 360°.  I could have used radians, but my brain works a lot slower in radians.

The machine will only need to home on the X axis. It needs to know where the exact center of the work area is. The starting angle does not matter because the coaster is a circle.

The conversion from X, Y to polar is probably won’t fit in into the firmware, so the X, Y conversion is done in a preprocessor software program. The X,Y gcode is output from normal CAM programs, then run through a conversion program.

The Conversion Program

The program reads the X,Y gcode, converts any X or Y coordinates into polar coordinates and outputs a new gcode file. The sender simply sends the new files.  The math is actually quite simple.

Typical Gcode sends line data by giving the end points of lines. You simply draw from one point to the next, unfortunately this creates a few problems with a non linear machine.

The basic non-linearity problem

If we were trying to draw the green square centered on the work area, the generated gcode would basically send the corner points. Each corner point has an equal radius to the center. Therefore, the pen will never change radius when going to the next point. This will result in a circle. We want the green square, but we get the red circle.

We need to calculate each point along the way to stay on the desired path. The preprocessor divides the line into tiny segments. Each segment has the same problem, but at a scale you won’t be able to see.

The Spiral Problem

If we are drawing a shape that crosses the 0° angle we don’t want the angle to spin the wrong way. If a point is at 350° and the next point is 10° (crosses over 0) we don’t want it to spin backwards from 350° to 10°. We want it to go to 370°.  It happens anywhere the angle difference between 2 points is greater than 180°. The program will choose the shortest direction even if that means going above 360° or below 0° degrees.

The Feed Rate Problem

Feed rate, in CNC terms, is the speed of the tool across the material. The CAM software is setting the feed rate as if this were a Cartesian machine. On this machine, if you were drawing a circle, you would simply move 360 units in Y. Without compensating feed rate, the pen would move across the work piece faster for larger diameter circles. I want to do some sort of compensation to help with this. The coasters are very absorbent, so the  lines look thicker if the speed is slower. A consistent speed will help the quality of the work.

Since the lines are all very short, the easiest way to compensate for feed rate is to use the current radius. With a simple circle, Grbl thinks the machine moved 360mm. The real distance is easy to to calculate from the perimeter of that circle.

We can compare it to the 360mm (full circle) and apply the ratio to the desired feed rate from the CAM program.

polarFeedrate = cartesianFeedrate * 360 / (2 * pi * radius)

 

Video

Here is a video of it. The machine is rerunning a file to see the repeatability.

Next Steps.

I would like to automate the preprocessor.  I think a Raspberry pi, might be an easy way to do this.  It would sit between the sender and the controller.