Archive for the 'Uncategorized' Category

Coasty Controller Setup and Use Instructions

 

I have receive a lot of requests to sell Coasty laser cutters. It just is not practical for me to do this at this time, but the parts are easy to buy and/or print yourself. The only part that is difficult is the custom controller. I have about 10 extra ones and will sell them. If they go quickly I may buy more. They are here in my Tindie Shop.

What you get with the controller.

  • Fully assembled PCB
  • Arduino Nano programmed with Grbl and setup for the Coasty
  • An HC-05 Bluetooth module programmed with the proper settings baud rate.
  • (2) TI DRV8825 stepper motor drivers with heatsinks and the current set to a recommended value
  • (2) Fans with wires trimmed and connectorized.
  • A cable for the laser module
  • A door switch switch with proper length wires and connector.

These are the only electronic items you need to provide.

  • Laser Module: It is designed for the Eleksmaker 3.5W LA03-3500. Most other types probably won’t fit in the tight size of the Coasty or bolt properly to the PCB
  • 12V Power Supply: I recommend about 5A of current. They can be found on Amazon for less than $10. Make sure it has a standard barrel connector end.

Default Calibration

The controller will come setup with settings that work for me. You can fine tune the settings later, but these should get you started. Here are the settings you see if you send the $$ command to Grbl. The setting codes are listed here.

$0=10
$1=25
$2=0
$3=0
$4=0
$5=0
$6=0
$10=2
$11=0.010
$12=0.002
$13=0
$20=0
$21=0
$22=1
$23=3
$24=300.000
$25=2000.000
$26=250
$27=2.000
$30=1000
$31=0
$32=1
$100=88.889
$101=79.906
$102=250.000
$110=10000.000
$111=15000.000
$112=500.000
$120=750.000
$121=350.000
$122=50.000
$130=200.000
$131=200.000
$132=200.000

The homing switches locate the edge of the coaster and the left extent of the laser travel. This is not the X,Y zero of the work area on the coaster. That is set by the G54 work offset. The G28 and G30 locations are also set so they can be used as a coaster eject command. Here are the offsets you will see if you send the $# command.

[G54:-186.500,-245.000,0.000]
[G55:0.000,0.000,0.000]
[G56:0.000,0.000,0.000]
[G57:0.000,0.000,0.000]
[G58:0.000,0.000,0.000]
[G59:0.000,0.000,0.000]
[G28:-141.000,-138.000,0.000]
[G30:-141.000,-138.000,0.000]
[G92:0.000,0.000,0.000]
[TLO:0.000]
[PRB:0.000,0.000,0.000:0]

Note: If you want to reset the G54 to the value above send this command  G10 L2 P0 X-186.500 Y-245.000 Z0.000 For more information regarding work offsets see this video. You could also manually jog the machine to the exact position you want the 0,0, to be and send this command G10 L20 P0 X0 Y0 Z0

Testing

I will pre-test every controller, but there are many machine dependent things that need to be tested before safely operating the machine. You should only need to run these tests once.

  1. Watch this video completely before testing anything. You will get a general overview of the machine that will help you understand and successfully test it.
  2. Remove the Bluetooth Module. It will be easier to test with USB. Never use USB with the Bluetooth Module installed.
  3. Do not connect the external power supply until advised.
  4. Make sure the little power push button switch on the controller is in the off (out) position. This switch controls the laser and fans only. Other circuits remain on regardless of switch position.
  5. Connect a USB cable.
  6. Open a serial terminal connection at 115200. The terminal should be setup to send a carriage return at the end of each line. The Arduino IDE Serial Port Monitor is an easy terminal to use.
    1. It should reply with Grbl 1.1f [‘$’ for help] and  [MSG:’$H’|’$X’ to unlock] when connected
  7.  Send a question mark ?
    1. It should replay with some status like <Alarm|WPos:186.500… , but not have any switch status like Pn:…
  8. Send the $$ command.
    1. The values in the response should match the values listed in the calibration section above.
  9. Send the $# command
    1. The replied values should match the values listed in the calibration section.
  10. Connect power to the controller, but do not turn on the controller’s power switch. Be ready to pull the plug if anything goes wrong. The machine might make some motor noises as the motors engage for brief period.
  11. Open the door.
  12. Manually slide the laser carriage to the left to activate the X home switch.  While it is activating the switch send ? again.
    1. You should see Pn:X in the response.
  13.  Block the IR detector with a coaster and send ? again. Note: The IR detector requires external power and will always register as “on” when there is not external power.
    1. You should see Pn:Y in the response
  14. The next step is to test homing. There is a chance that it will home the wrong way, so be ready to disconnect power. You must pull the plug at the controller to fill power. Watch for the laser to move to the left and the coaster to move in.
  15. Send the $H command at the serial terminal.
    1. As soon as the motors start, watch for the laser to move to the left and you should feed in a coaster.
    2. If either go the wrong way, pull the plug.  See fixing direction errors below.
    3. The machine will only try homing for a few seconds. If you were unable to get it started in time, try $H again.
    4. If the coaster does not run smoothly you might need to sand the track a little.
  16. After a successful homing, send G1 X0 Y0 F400
    1. The machine should move so the laser is over the lower left corner of the coaster.
  17. Send G28 to eject the coaster. Remove it completely from the machine.
  18. Close the door and screw it shut.
  19. Turn on the laser with the push button. You should hear the fans turn on, but the laser should not fire.
  20. You will now test fire the laser. You only want to test fire it for a should period of time at low power.  Send the following commands. While the power will be low, do not leave it on for more than a second or 2.
    1. $X (this will make should the machine is not in alarm mode)
    2. G91 (this will allow you to move it in incremental mode)
    3. S10 (This will set the beam power to 1%. Full power is S1000)
    4. G1 X3 F400 (This will move the laser 3mm to the right. The primary purpose is to put the controller into g1 mode where we can turn on the laser)
    5. M3 (should turn on the laser. It will not be very bright.
    6. M5 (turn it off)
  21. Assuming all tests passed, the machine should be ready to use.

Fixing motor direction Errors

The easiest way to fix direction errors is to rotate the connector for the problem motor by 180°. The upper motor is for the X (the laser carriage) and the lower motor moves the coaster.

Rev 2.0 PCB Issues

  • There was one mistake on the PCB due to net naming issue. The 12V input did not get connected to the 12V to 5V DC power supply.  A small rework wire has been added on the back side of the PCB.

Source Files

Use Instructions

See this blog post … [Coming Soon]


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.

ESP32: Sending short pulses with the RMT

Well that was easy!  About an hour ago I wrapped up a blog post on creating stepper motor driver pulses with the ESP32 using timer interrupts. I added a to do list at the end to look into using the RMT peripheral to do this. It only took about an hour to figure out.

RMT stands for “remote control”. It was designed for things like an IR remote control where tight timing on GPIO is required. The peripheral has a lot of features that make it good for a lot of things. Some people have been using it for the notoriously tight timing of the NEO Pixels.

The documentation is pretty complete on the API, but there are very few examples and tutorials. Most that do exist are for complicated things and not too well commented. This Ebook by Neil Kolban has a good example that my code started from. Look for the section called “RMT – The Remote Peripheral”. Due to my limited knowledge of the RMT, I will only go over my implementation.

Basically you start with two structures…(also see code below)

rmt_config_t config;

This is used to setup the configuration. I set config.clk_div = 80 so that each unit of time in my setup is 1us.

rmt_item32_t items[1];

This is an array of items that represent the outputs transitions that you want. In my case I only want a transition to high for 3us and then transition to low with no duration . Here is the definition of that struct.

typedef struct {
    union {
        struct {
            uint32_t duration0 :15;
            uint32_t level0 :1;
            uint32_t duration1 :15;
            uint32_t level1 :1;
        };
        uint32_t val;
    };
} rmt_item32_t;

Here is my code. I had the pulse repeat with a 1us delay, so that is would be easy to catch some on my logic analyzer.

#include <driver/rmt>

#define STEP_PIN  GPIO_NUM_17

// Reference https://esp-idf.readthedocs.io/en/v1.0/api/rmt.html

rmt_config_t config;
rmt_item32_t items[1];



void setup() {
  // put your setup code here, to run once:
  config.rmt_mode = RMT_MODE_TX;
  config.channel = RMT_CHANNEL_0;
  config.gpio_num = STEP_PIN;
  config.mem_block_num = 1;
  config.tx_config.loop_en = 0;
  config.tx_config.carrier_en = 0;
  config.tx_config.idle_output_en = 1;
  config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
  config.tx_config.carrier_level = RMT_CARRIER_LEVEL_HIGH;
  config.clk_div = 80; // 80MHx / 80 = 1MHz 0r 1uS per count

  rmt_config(&amp;config);
  rmt_driver_install(config.channel, 0, 0);  //  rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int rmt_intr_num)
  
  items[0].duration0 = 3;
  items[0].level0 = 1;
  items[0].duration1 = 0;
  items[0].level1 = 0;  

}

void loop() {
  // esp_err_t rmt_write_items(rmt_channel_t channel, rmt_item32_t *rmt_item, int item_num, bool wait_tx_done)
  rmt_write_items(config.channel, items, 1, 0);
  delay(1);
  
  
}

Here is a screen shot of the output on a logic analyzer. (Step/dir signals are swapped in the labels)

Conclusion

I think this will work great. This will will be very efficient and rum completely in the background. I will definitely try to move ahead with this method.


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.

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.

 


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

 

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.

Source Files (Open Source – Creative Commons – Share Alike – Attribution 4.0)

 

 


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

 

 

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.

See the files on Thingiverse.

 

I sell on Tindie

 

 


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

 

 

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.

 


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

 

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

 


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