Archive for the 'Uncategorized' Category

Notes On Using The HC-06 Bluetooth Module

A couple weeks ago, on a whim, I added to add a Bluetooth module to my Amazon cart. I think I paid about $7 for it. I chose the HC-06, because it sounded better than the HC-05. I was wrong, but probably made the right choice. More on that later.

The module came with no documentation, but it was easy to find the default values via web searches.

  • Name: HC-06
  • Password: 1234
  • Baud: 9600

I powered up the module. A single red LED started blinking.

I searched for it with my PC. I saw a new device called HC-06. I was able to pair with the default password. The LED did not change. It continued to blink. I checked my settings and saw this.

I was pleasantly surprised because I thought there was going to be some deep Bluetooth programming involved. A virtual COM is perfect.  I tried opening COM12 using a Serial Terminal. It took a couple seconds, but the LED changed to constant red and the Serial Terminal was happily waiting for me to send stuff. Without anything connected to the TX and RX pins, sending stuff was not going to do anything. I was eager to test with Grbl so that meant changing to 115200 baud.

Changing the default values

You change values on the HC-06 using an AT command set. These are sent to the HC-06 on the RX and TX pins at the current baud rate. The HC-06 is in the mode to accept the commands when it is not paired and connected (blinking red LED).  You cannot use the AT commands over Bluetooth.

There are a lot of AT commands, but the ones we will use are here…

  • AT (it will simply respond “OK”. A good test to see if you are in AT command mode)
  • AT+NAMExxx (Example AT+NAMEFRED will set the name to FRED)
  • AT+PINnnnn (nnnn is a 4 digit password. Example AT+PIN1288 will set the password to 1288)
  • AT+BAUDn (where n is code number for the baud as follows. Example AT+BAUD8 will set the baud to 115200)
    • 1 = 1200
    • 2 = 2400
    • 3 = 4800
    • 4 = 9600
    • 5 = 19200
    • 6=38400
    • 7=57600
    • 8=115200
    • 9=230400
    • A=460800
    • B=921600
    • C=1382400

The commands are sent without a carriage return or line feed and must be sent within a second. If you are using a serial terminal, make sure it is not sending each character as you type it or you are probably not going to get the whole command out within the second. Most terminals have a mode to send the a whole line. The Arduino IDE Serial Monitor works this way. Make sure the terminal settings are correct.

Using an Arduino to setup the HC-06

We need some hardware to talk to the HC-06 using 3.3V TTL. An Arduino will easily do that. Here is a diagram and sketch to do this using the Arduino Serial Monitor.

We will be setting up 2 serial links. One link will be from the PC to the Arduino to send the commands from the keyboard over USB. This will use the hardware RX and TX pins. We also need a serial connection from the Arduino the HC-06. We will use a software serial port for this and can use any remaining pins to do this.

This is the hardware diagram. I show an UNO, but virtually any hardware (Nano, Mega, etc) will work. The HC-06 is a 3.3V device so we need to level shift the Arduino 5V Tx signal down to 3.3V.  The diagram uses a resistor divider to do this. The Arduino should have no trouble reading the 3.3V Tx signal from the HC-06, so we don’t need to shift that.

 

BTW: A lot of people don’t bother to shift the 5v down to 3.3V and it seems to not break anything, at least in the short term 🙂

Here is the sketch I use. By default the HC-06 is set to 9600 baud. If you change via the sketch, you will need to edit the line “hcSerial.begin(9600);” to current baud rate. This sketch strips out carriage returns and line feeds, so you can leave those on in the Serial Monitor.

#include <SoftwareSerial.h>
SoftwareSerial hcSerial(11, 12); // RX, TX

String fromPC = "";

void setup() { 
  Serial.begin(9600); // hardware serial for the USB-PC
  hcSerial.begin(9600);  // software serial Arduino to HC-06 (9600 is default)

  // print instructions
  Serial.println("HC-06 AT Command Programming");
  Serial.println(" -- Command Reference ---");
  Serial.println("AT (simply checks connection)");
  Serial.println("AT+VERSION (sends the firmware verison)");
  Serial.println("AT+NAMExxxxx (to change name to xxxxx");
  Serial.println("AT+PINnnnn (to change password to 4 digit nnnn");
  Serial.println("AT+BAUDn (to change to baud rate #1");
  Serial.println("  BAUD1 = 1200");
  Serial.println("  BAUD2 = 2400");
  Serial.println("  BAUD3 = 4800");
  Serial.println("  BAUD4 = 9600");
  Serial.println("  BAUD5 = 19200");
  Serial.println("  BAUD6 = 38400");
  Serial.println("  BAUD7 = 57600");
  Serial.println("  BAUD8 = 115200");
}

void loop() {
  // Read from HC-06
  if (hcSerial.available()) {
    while(hcSerial.available()) { // While there is more to be read, keep reading.
      Serial.print((char)hcSerial.read());
      }   
  }
  
  // Read from PC
  if (Serial.available()){
    delay(10); //     
    fromPC = (char)Serial.read();    
 
    if (fromPC == "r" || fromPC == "n") {  // don't send carriage returns to HC-06          
      Serial.println();  // echo it back to the PC
    }
    else {
      hcSerial.print(fromPC); // show the HC-06 responce
      Serial.print(fromPC); // echo it back to the PC
    }
  }
}

Using the HC-06 as a virtual serial port

If you want to use it for Grbl, you will need to change it to 115200 baud with “AT+BAUD8”. You can now connect it to your controller Tx and Rx pins. Tx on the HC-06 would go to Rx on the controller.

You then need to pair the HC-06 with the PC using the normal Bluetooth features. It will create 2 virtual COM ports. You need to select the “outgoing” port.   No all programs that use normal COM port can use these ports. When you connect in the program the blinking red light will turn steady red when connected. It take a second or 2.

The Reboot Issue.

Normally Arduinos reboot when you connect. This is due to a trick with the DTR signal. The HC-06 cannot do this trick, so a Bluetooth connection does not reboot the Arduino. This should not be a problem, but some firmwares, like Grbl, send some identifying information at boot. Some senders look for this. They open the COM port and wait for that information. If they don’t see it, they think something is wrong and give an error.

Some senders don’t care and some senders have been using another trick. If they don’t see the information they send a $I command to ask for it.  Ideally all sender will adopt this over time if they want to play with Grbl over Bluetooth and Wi-fi.

The HC-05

There is another device called the HC-05. It is actually more advanced than the HC-06. It can be a master or a slave device. This makes setup a little more complicated, so it was good that I chose the HC-06.  The one thing I want to try is there might be a way to fix the boot issue. The HC-05 might be able to send a connected signal to force that reboot.

 

 

The midTbot. A New Flavor of H-Bot?

H-Bots

There is a family of 2 axis mechanisms called H-Bots. They use 2 motors on a single belt to generate motion in 2 axes. The most basic type is the classic H-Bot. ‘H’ comes from the outline of the belts.

Image from Galil Motion Control

The motors turn the same direction for motion in one axis. They turn opposite directions for motion on the other axis. If only one motor turns both axis will move evenly (like 45°, etc). All other angles are possible with the right drive ratios.

CoreXY

The H-Bot is simple, but imparts some twisting forces on the mechanism under some loads that work against accuracy.  For example, look at left diagram in the image above. The belt is pulling down on the left side of the ‘H’ and up on the right side. This tries to twist the gantry if there is a resistance to the carriage movement in X. CoreXY addresses this by crossing the belts at one end. A longer belt does increase belt stretch issues though.

Image from CoreXY.com

T-Bots

T Bots are the simplest variety and work well with light loads.

I actually played with a T-Bot concept way back in 2011.

The AxiDraw is a good example of a T-Bot.

The midTbot

I was trying to make the smallest and simplest drawing machine with a reasonable work area. T-Bots are pretty simple, but the motors on the ends seemed to waste space. I also wanted integrated electronics. Moving the motors to the middle carriage seemed to solve a lot of these problems. It does add the motors to the mass of the moving parts, but only on one axis and they are directly over the linear bearings. It really has an elegant and smooth look to it. The midTbot name comes from middle mounted motors on a T bot. Here is an image of just the XY mechanism running.

Electronics

The ideal place for the electronics is right by the motors. This will reduce the wiring as much as possible. Putting the homing switches on the middle carriage would further clean up the wiring.

I designed a modular controller that mounts to the top of the middle carriage and under the motors.

The controller will soon be available on Tindie.

I sell on Tindie

Scalability

It is very scalable because you only need to change the rod and belt lengths. No wiring needs to change. The middle mounted motors makes the platform very stable, but if allow the pen carriage to go too far forward, it could tip forward. I think you would need to extend the feet a little forward to counteract that.

Demo

Here is a demo video of the complete machine.

 

 

 

 

 

 

Polar Coaster Updates

I made some basic changes to the Polar Coaster lately to make the electronics a little more robust. I added 2 little mounting points to the rear of the base part.

They attach to one side of the Pen/Laser Control PCB. The mounting height allows the use of 12mm standard spacers. You can still use a Raspberry Pi. The overall height is just a little taller.

I also tried printing one with the spoke pockets going all the way through. This reduces print time by almost an hour and is just as strong.

I’ll be putting all the files on Thingiverse soon.

 

I sell on Tindie

 

 

 

 

Getting More Program Space on an Arduino Nano

I recently compiled Grbl with the COREXY features enabled. To my surprise, the upload to my Nano failed because it did not have enough program space. I was surprised because the Nano and Arduino UNO use the same ATmega328p microcontroller. A little researched showed that they use different bootloaders.

Normally you a special programmer to program microcontrollers like Arduinos. You plug the programmer into the ICSP (In Circuit Serial Programming) pins on the microcontroller.

Bootloaders eliminate the need for this by putting the programmer right on the microcontroller. When you start (boot) the microcontroller, the bootloader runs first. It looks for someone trying to load a program. If it does not see that it switches to running the last uploaded program in another part of memory. The only penalty to this is that the bootloader needs to use a small amount of memory and it delays the start of your program a little. The total amount of memory available to the users is the flash memory size (32k for the …328P chip) minus the bootloader. The Nano and UNO use different bootloaders. The Nano uses a 2k bootloader and the UNO uses a 0.5k bootloader.

To get more memory of the Nano we have two options. We can use an ICSP programmer to use all of the memory. This removes the bootloader. The other option is to use a programmer to put the smaller UNO bootloader on the Nano.

Changing the Bootloader

You will need a programmer. you can get any of a dozen types of dedicated programmers, but you can also use another Arduino with a special sketch loaded on it.

How to use an UNO to Program a Nano

Use the Arduino IDE to upload the Arduino ISP (In-System Programmer) sketch to the UNO.

You will need 6 jumper wires. It is helpful to have a few colors to make it easy to verify the connections. They should have male pins on the UNO side and typically female sockets on the Nano side.  These ribbon style jumpers are nice because you can peel off what you need and they have a lot of colors.

Arduino Uno (the programmer) Arduino Nano (the target)
5V 5V
Gnd Gnd
D13 Reset
D10 D10
D11 D11
D12 D12

Install the Bootloader.

Be sure UNO is selected in the boards menu. This will make sure the UNO bootloader is used.

Change the programmer to Arduino ISP in the programmer menu. Remember to return it to current setting, typically AVR ISP, after you are done installing the bootloader.

Now select the Burn Bootloader menu. This will now install the UNO bootloader onto the Nano using the Arduino UNO as a programmer.

Using the Nano.

The Nano should now have the smaller UNO bootloader. When programming from now on, be sure to select UNO in the boards menu. The IDE will no longer be able program it as a Nano. You might want to mark the Nano so you remember this.

Extra Reading…..

How does the USB cable reboot the microcontroller?

In order to program the microcontroller via USB it needs to restart (boot). It does this using a special trick. Arduinos show up as a serial port (COM port).  The Arduino only uses the Tx and Rx signals to transmit data. The USB adapter supports other RS232 signals. The DTR (Data Terminal Ready) signal is used to reset the Arduino. The DTR signal can be controlled by the program uploading the firmware.

Not shown in the schematic is a 1K pull up resistor on the reset pin near the ATmega328p. To reset the microcontroller you pull the reset pin to ground. The uploader program pulls the DTR signal low. The cap passes this change through, causing a reset, but the 1k pull up returns the reset back to the high (run) state. Remember: Capacitors pass changes (AC), but block a steady voltage (DC). 

Why do they use different bootloaders?

I do not know the answer, but it probably due to the fact that they use different USB chips.

 

 

LewanSoul Lobot LX-16A Serial Servo Review

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.

 

Pen/Laser Bot Controller

This a CNC controller I designed for small laser engravers and drawing machines. It is for sale on Tindie. It is designed for machines that are primarily 2 axis, but may use a servo for the Z axis.  The controller is designed for use with Grbl firmware running on on an Arduino Nano controller. It uses plug in modules (not included) for the micro controller and stepper drivers. This keeps costs down and gives the user more options. Everything is pinned out for the default configuration of Grbl. This is compatible with all of my recent projects.

Features

  • Power Connector: A standard barrel connector for motor power for the stepper drivers. Typically this will be 12V, but can be run up to 24V if your parts are compatible with higher voltages.
  • Controller: Arduino Nano Footprint.
  • 2 Stepper Drivers: Pololu Footprint
  • Servo Connector: The connector is the standard pinout for most servos.
  • 5V Power Supply: 1 Amp power supply to power the servo.
  • Laser Connectors: There are 2 connectors. One is power and ground for the laser. The other is for the PWM signal to fire the laser.
  • Aux Power Connectors: There is a connector with the primary motor power. This can be used for fans, relays, etc.
  • Limit Switch Connector: X and Y limit switches are available on the connector with convenient ground pins.
  • Control Switch Connector: Feed hold and start switches can be connected to this.
  • Raspberry Pi Interface: This is an optional interface to plug in a Raspberry Pi or any compatible controller that shares the  standard header connector.

Microcontroller

The footprint is designed for an Arduino Nano. These are available from many sources and can cost as little as less than $4. Be sure to install it in the correct orientation. The controller is typically powered by the USB cable, but will automatically switch to the 5V power supply is the USB is removed.

There are several other controllers that share the same footprint. They can be used, but you might need to change a few components if the voltage is not 5V. Make sure you plug it in correctly. While the pinout is the same it might need to be rotated 180 degrees. Contact me directly if you have questions regarding alternate controllers.

Use this view to confirm the orientation (note the pin labels on the Nano. Click to enlarge)

Stepper Drivers

This is designed to use Pololu compatible stepper drivers. The pinout is shown below. Insert them correctly or you could destroy them and possibly other items. There are dozens of compatible designs.  Pololu makes very good ones, but much cheaper version can be found on eBay and Amazon.

Servo Connection

Std Grbl does not support Servos

Limit and Control Switches

Laser Connection

Note: Lasers are very dangerous and no system is completely safe. The firmware is not fail safe and the laser could fire at any time power is available to it. Use safety glasses at all times power is applied. Enclose the laser with an interlock to remove power if covers or doors are open. Evaluate the entire circuit including this controller to determine if it provides the safety you need. If this controller is part of a laser you built, you are responsible for all aspects of safety.

The lower white connector is for the laser power. It is labeled VMot and Gnd. VMot is the voltage that is supplied on the barrel connector. Make sure you have the right power for your laser module.

The upper white connector is for the laser on/off control.  Pulse is the signal and there is a ground pin if you need it.

 

Raspberry Pi (Optional)

This can work as a HAT for a Raspberry Pi. It connects the hardware UART on the Pi to the Nano.

Solder in the supplied connector on the bottom of the board. It is not installed by default to allow more mounting flexibility if you don’t use a Raspberry Pi.

Setup the Raspberry pi to use the serial port. By default the port is used as a serial console. You need to stop that and free it up for your use. See this post for more information.

Do not use the USB while a power Pi is connected or the there will be two things trying to talk to the controller. This includes uploading firmware.

Note: Arduinos use a trick with a DTR control line in the USB-UART on the Arduino. This forces a reboot every time a connection is made. The Raspberry Pi cannot do this. Some senders are expecting Grbl to reboot when connected to and can be a little confused at startup. If you connect a serial terminal you will notice there is a no Grbl startup string at connection. Just type $I (with carriage return) to see the Grbl version info.

Open Source

 

 

I sell on Tindie

 

A Polar Pre-Processor for the Pen Bot Written in Python

I got a little push back on the Cartesian to Polar gcode processor because it was a Windows, Visual Studio C# program. I rewrote it in Python, to make it more accessible to other operating systems.

I don’t do much Python programming, so I probably did some thing in a very non Python style, but here is is.

Usage: The program will accept 1 or two command line arguments. The first is the file you want to convert. The second the the output file name.  If you skip the second, it will just append “_polar” to the input file name.  For example box.gcode will be converted and output as box_polar.gcode.

PolarPreProcessor.zip (python file)

Before and After Example GCode

Here is the gcode for the logo if you want to test.

Visual Examples

To get a feel for what the translation looks like, here is what a simple square looks like in gcode before translation.

And here is is after translation

Here is what that python logo in the first image looks like in gcode after translation.

Video

Here is a video of it drawing the Python logo.

 

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.

 

 

 

Coasty Update

Here is a quick update on Coasty. Several people have asked if I am releasing the source files or selling a kit. I am adjusting the design to make that more viable.  The original version was made with parts I had laying about and not necessarily the best design choices for an open source project.

X Axis.

Originally I used an TR8-8 ACME thread lead screw. It was mounted to the motor by drilling a hole in the lead screw and epoxying it to the motor shaft. This worked well, but you needed a lathe to drill the hole and a special low backlash nut. The axis was also a little loud with and all metal design.

I changed to use a GT2 open belt cut to length.  Belts and pulley are really easy to get and don’t cost too much.

Electronics

Need to shorten some wires after testing.

There were some issues with the EleksMaker electronics that I did not like. The laser circuit did not appear to have a pull down on the signal and it tended to fire if the Arduino was not pulling it low. This would happen during reboot and other scary times. The wiring was also quite a pain. There were no connectors for the limit switches so you had to directly solder to the Arduino Nano.

I changed to use a custom PCB that is the entire rear panel. This contains all of the circuits including the limit switches. Building a Coasty was a little like building a ship in a bottle. Now the bottle has no bottom and there are less parts inside.

Front Door.

The front door now has a window. This makes the machine more fun to watch and no glasses are required.

Next Steps.

I have one build and am testing it for a while. If all goes well, I will release the source files and consider a kit.