I recently got Sparkfun Pro Micro clone from Ebay. In order to flash it with a hex file I had to quickly ground the reset pin twice and then run:
avrdude -v -patmega32u4 -cavr109 -P/dev/cu.usbmodem1411 -b57600 -D -Uflash:w:MassStorage.hex:i
syntax-highlighter
Showing posts with label electrical. Show all posts
Showing posts with label electrical. Show all posts
Sunday, November 29, 2015
Sunday, May 26, 2013
Smooth Feedrate Envelopes for Motion Control, Part II
In the previous post, I derived equations for smooth feedrate control of stepper motors, claiming that by using a smoother feedrate envelope that the motors could be driven faster with less chance of skipping steps and losing position.
In this post, I demonstrate this with a real stepper motor and show that it actually does work: using the envelopes does actually prevent the motors from losing steps. My test setup is a single NEMA 17 stepper, driven by one of my A4988 driver breakouts, which is controlled by an Arduino sketch running on the Arduino Due. I'm using half-stepping on the motors, driven by a 200KHz timer interrupt step callback which decides whether or not to step based on the interpolated supplied delays for the start and end of each move. The move itself approximates a square wave, first accelerating from a slow feedrate, then performing a constant speed portion, then decelerating back to the initial feedrate.
The video below shows the stepper being driven using a constant acceleration profile, which causes the kinks in the feedrate graph in my previous post. You can clearly see it moving around on the table and stalling frequently before it reaches the top speed.
In contrast, here is the result using the third-order cubic feedrate envelope for the same set of moves. The stepper is easily able to handle the top speed and jerks around considerably less on the table. Of course this comes at a price, a higher pulse-frequency must be used to resolve the acceleration profile.
You can get the code I used for this from following link: https://sites.google.com/site/jamesgregson/tmp/linear_move.zip, it includes a multi-axis DDA implementation suitable for use with timer-interrupts as well as the code for evaluating the feedrate envelopes.
In this post, I demonstrate this with a real stepper motor and show that it actually does work: using the envelopes does actually prevent the motors from losing steps. My test setup is a single NEMA 17 stepper, driven by one of my A4988 driver breakouts, which is controlled by an Arduino sketch running on the Arduino Due. I'm using half-stepping on the motors, driven by a 200KHz timer interrupt step callback which decides whether or not to step based on the interpolated supplied delays for the start and end of each move. The move itself approximates a square wave, first accelerating from a slow feedrate, then performing a constant speed portion, then decelerating back to the initial feedrate.
The video below shows the stepper being driven using a constant acceleration profile, which causes the kinks in the feedrate graph in my previous post. You can clearly see it moving around on the table and stalling frequently before it reaches the top speed.
In contrast, here is the result using the third-order cubic feedrate envelope for the same set of moves. The stepper is easily able to handle the top speed and jerks around considerably less on the table. Of course this comes at a price, a higher pulse-frequency must be used to resolve the acceleration profile.
You can get the code I used for this from following link: https://sites.google.com/site/jamesgregson/tmp/linear_move.zip, it includes a multi-axis DDA implementation suitable for use with timer-interrupts as well as the code for evaluating the feedrate envelopes.
Labels:
CNC,
code,
electrical,
embedded,
linear motion,
making,
random,
software
Sunday, March 24, 2013
Minimal HTTP Server Example with WiFly RN-XV and Teensy3.0
The following code is a minimal example for serving content from a Teensy3.0 using the RN-XV WiFly module. The code assumes that the WiFly has been set up to use a baudrate of 115200 bps and has also been set up to receive connections on port 80 via the commands:
The basic setup procedure that I used is detailed in a previous post covering how to set up an ad-hoc network to configure the WiFly along with some example code make a Teensy3.0 and WiFly operate as an echo server.
Assuming this is done, the following code will serve up a simple HTML page that alternately displays "Welcome!" or "Booyah!" when the page is reloaded.
This is obviously some pretty brittle and stripped down code, there is no bounds checking on input, nor are the input requests parsed to see what they actually are. Parsing the cmd string in the handle_connection function would handle this, however it does demonstrate serving pages from the Teensy. Output is as expected when the IP for the RN-XV is entered into Firefox, alternating "Welcome!" and "Booyah!" as the page is reloaded.
With some simple input parsing, this would make it easy to do basic querying of the state of the Teensy.
set uart baudrate 115200 set ip localport 80
The basic setup procedure that I used is detailed in a previous post covering how to set up an ad-hoc network to configure the WiFly along with some example code make a Teensy3.0 and WiFly operate as an echo server.
Assuming this is done, the following code will serve up a simple HTML page that alternately displays "Welcome!" or "Booyah!" when the page is reloaded.
int read_message( const char *msg, int len ){
for( int i=0; i<len; i++ ){
while( !Serial3.available() ){ }
if( Serial3.read() != msg[i] )
return 0;
}
return 1;
}
int read_line( char *line ){
int pos = 0;
char c = '\0';
while( c != '\n' ){
if( Serial3.available() ){
c = Serial3.read();
line[pos++] = c;
}
}
line[pos] = '\0';
return pos;
}
void send_response( const char *data ){
Serial3.print( "HTTP/1.1 200 OK\r\n");
Serial3.print( "Content-Type: text/html\r\n" );
Serial3.print( "Content-Length: " );
Serial3.print( strlen( data )+1 );
Serial3.print( "\r\n" );
Serial3.print( "Connection: Close\r\n" );
Serial3.print( "\r\n" );
Serial3.print( data );
Serial3.write( (byte)0 );
}
void handle_connection( int val ){
char cmd[128], line[128];
if( !read_message( "*OPEN*", 6 ) )
return;
Serial.println("client connected!");
read_line( cmd );
Serial.println( cmd );
while( read_line( line ) > 1 ){
Serial.print( line );
if( line[0] == '\r' )
break;
}
const char *page[] = {
"<html><body>booyah!</body></html>\n",
"<html><body>welcome!</body></html>\n"
};
Serial.println("responding with" );
Serial.println( page[val%2] );
send_response( page[val%2] );
read_message( "*CLOS*", 6 );
}
void setup(){
Serial.begin(115200);
Serial3.begin(115200);
}
int id = 0;
void loop(){
handle_connection(id++);
}
This is obviously some pretty brittle and stripped down code, there is no bounds checking on input, nor are the input requests parsed to see what they actually are. Parsing the cmd string in the handle_connection function would handle this, however it does demonstrate serving pages from the Teensy. Output is as expected when the IP for the RN-XV is entered into Firefox, alternating "Welcome!" and "Booyah!" as the page is reloaded.
With some simple input parsing, this would make it easy to do basic querying of the state of the Teensy.
Setting up the WiFly RN-XV with a Teensy 3.0
A recent order from Sparkfun arrived, including a 3.3V Serial LCD and a Roving Networks RN-XV WiFly module. The RN-XV module is intended to be a drop-in replacement for an XBee, except that it operates over WiFi. At about $35, it is just about the cheapest way to make your project wireless enabled.
The module is 3.3V, meaning some form of level shifting is needed with a 5V system like an Arduino. You can use this module with an Arduino via an XBee shield pretty easily. However it is even easier to use with the 3.3V Teensy 3.0 ARM board, provided you have a breakout for small-pitch XBee module footprint. The Teensy is also nice for this application because it has multiple serial ports, so you don't need to use the SoftwareSerial library, or program the board, then disconnect to use the wireless.
Setting everything up was pretty easy once I knew what to do, but this post summarizes the process should I ever need to do it again.
The setup that I am using is shown below:
Only four connections are needed once you're set up, 3.3V, GND and two data connections. DOUT from the Teensy3.0 Serial3 connects to DIN of the RN-XV and DIN from the Teensy to DOUT to the RN-XV. This makes the module operate as just a serial port, making it pretty easy to interface with. The remaining orange wire connects the Serial LCD display, more on this later.
To get started, I found it was easiest to set the RN-XV in ad-hoc mode. This can be done by connecting pin 8 to 3.3V and will cause the module to create its own wireless network. When this happens you will see the status LEDs blinking green, orange and red; they're doing it, but you can't really see in this picture. Note the additional green wire to 3.3V connected to the 8th pin.
You can then look for the network. On a Mac it's pretty easy, it just shows up in the list of networks in the status bar:
The WiFly shows up towards the bottom as WiFly-GSX-a8 or something similar. If you connect to this network, you can then telnet to the module using the IP address: 169.254.1.1, port 2000. The module should then respond with a *HELLO* string, at which point you type $$$ to enter command mode. Command mode allows you to set up the module for your network.
When the module is ready, it will respond with the CMD message to indicate that you're in command mode. To set up your network you can issue the commands:
You can also issue commands to assign a static IP address to the module, but I didn't do this. For more information, see this excellent introduction http://www.tinkerfailure.com/2012/02/setting-up-the-wifly-rn-xv/
I found that sometimes the module would respond with a confirmation and sometimes would not. I repeated the process a few times in the hopes that some combination would stick. After this process, remove the power and and connection from pin 8 to 3.3V. This will cause the device to try to connect to your wireless network.
You should now be able to telnet to the device, but this time with your computer and it connected to your normal WiFi network rather than the ad-hoc network that the device creates. However first you need to find the IP address of the module. To do this, I went into my router configuration page:
Conveniently the WiFly module had an entry: 192.168.1.106. Depending on your router, you should be able to set up a specific IP address for the router to assign to the module based on the MAC address. However my POS router does not allow this.
I could then telnet to the module's IP address, again using port 2000. This module responds with the same *HELLO* prompt, indicating that everything was successful and the module is on the network and communicating.
With the connections above the Teensy should now see the module as just another serial port. To test this, I attached the Serial LCD and uploaded the following code to the Teensy:
My LCD is a 2x16 character display. The code above just polls for available data on the third serial port and, when a newline is encountered, prints it out onto the display. Lo and behold, after the following session:
The result on the display is below:
Hooray! An utterly useless internet thingy!
The module is 3.3V, meaning some form of level shifting is needed with a 5V system like an Arduino. You can use this module with an Arduino via an XBee shield pretty easily. However it is even easier to use with the 3.3V Teensy 3.0 ARM board, provided you have a breakout for small-pitch XBee module footprint. The Teensy is also nice for this application because it has multiple serial ports, so you don't need to use the SoftwareSerial library, or program the board, then disconnect to use the wireless.
Setting everything up was pretty easy once I knew what to do, but this post summarizes the process should I ever need to do it again.
The setup that I am using is shown below:
Only four connections are needed once you're set up, 3.3V, GND and two data connections. DOUT from the Teensy3.0 Serial3 connects to DIN of the RN-XV and DIN from the Teensy to DOUT to the RN-XV. This makes the module operate as just a serial port, making it pretty easy to interface with. The remaining orange wire connects the Serial LCD display, more on this later.
To get started, I found it was easiest to set the RN-XV in ad-hoc mode. This can be done by connecting pin 8 to 3.3V and will cause the module to create its own wireless network. When this happens you will see the status LEDs blinking green, orange and red; they're doing it, but you can't really see in this picture. Note the additional green wire to 3.3V connected to the 8th pin.
You can then look for the network. On a Mac it's pretty easy, it just shows up in the list of networks in the status bar:
The WiFly shows up towards the bottom as WiFly-GSX-a8 or something similar. If you connect to this network, you can then telnet to the module using the IP address: 169.254.1.1, port 2000. The module should then respond with a *HELLO* string, at which point you type $$$
When the module is ready, it will respond with the CMD message to indicate that you're in command mode. To set up your network you can issue the commands:
set wlan phrase (password); set lan ssid (your network name); save reboot
You can also issue commands to assign a static IP address to the module, but I didn't do this. For more information, see this excellent introduction http://www.tinkerfailure.com/2012/02/setting-up-the-wifly-rn-xv/
I found that sometimes the module would respond with a confirmation and sometimes would not. I repeated the process a few times in the hopes that some combination would stick. After this process, remove the power and and connection from pin 8 to 3.3V. This will cause the device to try to connect to your wireless network.
You should now be able to telnet to the device, but this time with your computer and it connected to your normal WiFi network rather than the ad-hoc network that the device creates. However first you need to find the IP address of the module. To do this, I went into my router configuration page:
Conveniently the WiFly module had an entry: 192.168.1.106. Depending on your router, you should be able to set up a specific IP address for the router to assign to the module based on the MAC address. However my POS router does not allow this.
I could then telnet to the module's IP address, again using port 2000. This module responds with the same *HELLO* prompt, indicating that everything was successful and the module is on the network and communicating.
With the connections above the Teensy should now see the module as just another serial port. To test this, I attached the Serial LCD and uploaded the following code to the Teensy:
#include<stdio.h>
void setup(){
Serial.begin(9600);
Serial2.begin(9600);
Serial3.begin(9600);
}
void write_lines( const char *L0, const char *L1 ){
Serial2.write( 0xFE );
Serial2.write( 0x01 );
delay(10);
Serial2.write( 0xFE );
Serial2.write( 128 );
delay(10);
Serial2.print( L0 );
Serial2.write( 0xFE );
Serial2.write( 192 );
delay(10);
Serial2.print( L1 );
}
void loop(){
if( Serial3.available() ){
char L0[17];
char L1[17];
int pos = 0;
L0[0] = '\0';
L1[0] = '\0';
while( Serial3.available() ){
char c = Serial3.read();
if( c == '\n' ){
pos = 0;
Serial.print('\n');
} else if( c == '\r' ){
} else {
if( pos < 16 ){
L0[pos] = c;
pos++;
L0[pos] = '\0';
} else if( pos < 32 ){
L1[pos-16] = c;
pos++;
L1[pos-16] = '\0';
}
Serial.print( (char)c );
}
}
write_lines( L0, L1 );
}
delay(100);
}
My LCD is a 2x16 character display. The code above just polls for available data on the third serial port and, when a newline is encountered, prints it out onto the display. Lo and behold, after the following session:
Jamess-MacBook-Pro:~ jgregson$ telnet 192.168.1.106 2000 Trying 192.168.1.106... Connected to 192.168.1.106. Escape character is '^]'. *HELLO* This is James
The result on the display is below:
Hooray! An utterly useless internet thingy!
Saturday, November 3, 2012
Low Cost CNC Part VIII - Built-in electronics
In Part VII, I finally got the CNC cutting, but it was still a bit rough. Cables ran everywhere, it was powered from a wall-wart and the electronics were sitting next to it on the table. You can see the setup below:
Since finding the big C-channel piece that makes up the base of the machine, I've always planned to build the electronics into the base to give a nice, compact and clean machine. I'd been waiting for a power-supply to arrive before doing this, but last week it came so I got to work.
The electronics are currently mounted to a piece of plywood that hooks on a key at one end and has bolt holes to bolt to some 3D printed plastic standoffs. It fits into the base pretty nicely.
The plywood is a bit of an old shipping box; it had my address on it, hence the black tape. Undoing two nuts on the right hand side allows the plywood to come loose:
Running approximately left-to-right, you can see the Arduino running GRBL, the three stepper driver carrier boards, a solid-state AC relay for spindle control as well as the power-supply and finally the E-stop button. All the mains power is wired with 14 gauge household wiring connected with Marretts. The E-stop button cuts all mains power to the power-supply and relay, thus rapidly immobilizing the machine. The Arduino is unaffected by the E-stop, being powered from USB. In this way, the E-stop also functions as an optional operator stop, allowing you to de-energize the machine, reposition it manually or change tools and then start it back up, knowing that it won't starting moving or cutting with your hands in there.
Looking from the back, the USB socket for the Arduino is accessible, as is the scavenged spindle socket and power cable. In a subsequent revision I plan to replace these with panel-mount components, but I couldn't locate them locally last week.
It's still a bit ghetto, but quite functional and self-contained at this point. I intend to finalize the electronics layout and then make a sheet-metal replacement for the plywood with front and back panels and all panel-mount components. But for the moment, it's working pretty well and I can easily pick it up and move it without rewiring the whole thing.
The other, straightforward, addition was cable drags on all the axes. This has really helped to clean up the machine, giving me something that looks more like an actual tool than before. Hopefully I will be able to start using it for projects soon.
Since finding the big C-channel piece that makes up the base of the machine, I've always planned to build the electronics into the base to give a nice, compact and clean machine. I'd been waiting for a power-supply to arrive before doing this, but last week it came so I got to work.
The electronics are currently mounted to a piece of plywood that hooks on a key at one end and has bolt holes to bolt to some 3D printed plastic standoffs. It fits into the base pretty nicely.
The plywood is a bit of an old shipping box; it had my address on it, hence the black tape. Undoing two nuts on the right hand side allows the plywood to come loose:
Running approximately left-to-right, you can see the Arduino running GRBL, the three stepper driver carrier boards, a solid-state AC relay for spindle control as well as the power-supply and finally the E-stop button. All the mains power is wired with 14 gauge household wiring connected with Marretts. The E-stop button cuts all mains power to the power-supply and relay, thus rapidly immobilizing the machine. The Arduino is unaffected by the E-stop, being powered from USB. In this way, the E-stop also functions as an optional operator stop, allowing you to de-energize the machine, reposition it manually or change tools and then start it back up, knowing that it won't starting moving or cutting with your hands in there.
Looking from the back, the USB socket for the Arduino is accessible, as is the scavenged spindle socket and power cable. In a subsequent revision I plan to replace these with panel-mount components, but I couldn't locate them locally last week.
The other, straightforward, addition was cable drags on all the axes. This has really helped to clean up the machine, giving me something that looks more like an actual tool than before. Hopefully I will be able to start using it for projects soon.
Labels:
Arduino,
CNC,
electrical,
embedded,
linear motion,
making,
mechanical
Wednesday, October 24, 2012
Low Cost CNC Part VII - It LIVES!!!
So for the last, nearly two years, I've been working on building a low-cost, homemade, 3-axis CNC milling machine. Today for the first time, I can say that I've done just that, having finally actually cut something. As far as I know, it's the first milling machine build largely from 3D printed parts.
You can see the entire process, from the beginning, in the previous six posts: Parts I, II, III, IV, V and VI.
The mill is shown below, along with the 3-axis CNC controller that I've posted about before.
The spindle is a low-cost Dremel tool, currently attached with a Shapelock bracket. It will no doubt get replaced with something less awful in the future (I am referring to both the Dremel and bracket, of course).
I have a Rotozip spiral-saw bit in the Dremel tool, to stand in for a proper milling bit. It's a bit flexible, but more than up to tearing through MDF.
The whole setup is shown above and gives a good sense of scale. My 3-Axis controller board is in the bottom right, controlled by my laptop. The CNC itself has around a 6x6x4" working volume, although this is arbitrarily expandable in the X-direction. The controller board runs GRBL, for which I have written a simple GUI for adjusting settings and jogging the machine. I plan to release the code for this when it stabilizes a bit, since GRBL needs a decent GUI. I intend to add some basic features, like simple pocket/contour milling. But for the time being, it's simply a software pendant.
So with everything set up, it was time to start cutting. I attached my 3D printed iPhone mount to the XY table, started the Dremel, pressed record and began jogging the machine. The result is pure awesomeness, for me anyway.
I had either the cutting depth or the feedrate too high for the spindle speed, since the bit began 'climbing', rounding the edges of the square when the feedrate was high.
But guess what? I don't care! 'Cause the CNC that I started nearly two years ago, which has been my preferred hobby while simultaneously being intensely frustrating has finally, finally, cut something. Praise Jebus!
Obviously there's refinement to be had. For one thing, the ~10 mm long square sides should actually be one inch. And I should make sure that the axes are actually square (I'd be shocked if they are). Also I want to package the electronics in the base extrusion, provide a proper power-supply, perhaps some heat-sinks on the stepper drivers and maybe attach a real spindle. And then there's ballscrews/belts.
But that's for later. For the time being, my CNC actually cut something.
To my knowledge, this is also the first milling machine built substantially with 3D printed parts. I hope in the not-to-distant future to get the feedrates up to the point of being able to 3D print with the mill itself. I also intend to build a tapping attachment to tap the holes used in the aluminum plates, which is -really- time-consuming and error-prone. This would make the machine as much of a RepRap as most 3D printers are, but considerably more solid. But that's for later.
You can see the entire process, from the beginning, in the previous six posts: Parts I, II, III, IV, V and VI.
The mill is shown below, along with the 3-axis CNC controller that I've posted about before.
The spindle is a low-cost Dremel tool, currently attached with a Shapelock bracket. It will no doubt get replaced with something less awful in the future (I am referring to both the Dremel and bracket, of course).
I have a Rotozip spiral-saw bit in the Dremel tool, to stand in for a proper milling bit. It's a bit flexible, but more than up to tearing through MDF.
The whole setup is shown above and gives a good sense of scale. My 3-Axis controller board is in the bottom right, controlled by my laptop. The CNC itself has around a 6x6x4" working volume, although this is arbitrarily expandable in the X-direction. The controller board runs GRBL, for which I have written a simple GUI for adjusting settings and jogging the machine. I plan to release the code for this when it stabilizes a bit, since GRBL needs a decent GUI. I intend to add some basic features, like simple pocket/contour milling. But for the time being, it's simply a software pendant.
So with everything set up, it was time to start cutting. I attached my 3D printed iPhone mount to the XY table, started the Dremel, pressed record and began jogging the machine. The result is pure awesomeness, for me anyway.
I had either the cutting depth or the feedrate too high for the spindle speed, since the bit began 'climbing', rounding the edges of the square when the feedrate was high.
But guess what? I don't care! 'Cause the CNC that I started nearly two years ago, which has been my preferred hobby while simultaneously being intensely frustrating has finally, finally, cut something. Praise Jebus!
Obviously there's refinement to be had. For one thing, the ~10 mm long square sides should actually be one inch. And I should make sure that the axes are actually square (I'd be shocked if they are). Also I want to package the electronics in the base extrusion, provide a proper power-supply, perhaps some heat-sinks on the stepper drivers and maybe attach a real spindle. And then there's ballscrews/belts.
But that's for later. For the time being, my CNC actually cut something.
To my knowledge, this is also the first milling machine built substantially with 3D printed parts. I hope in the not-to-distant future to get the feedrates up to the point of being able to 3D print with the mill itself. I also intend to build a tapping attachment to tap the holes used in the aluminum plates, which is -really- time-consuming and error-prone. This would make the machine as much of a RepRap as most 3D printers are, but considerably more solid. But that's for later.
Labels:
CNC,
electrical,
embedded,
linear motion,
making,
mechanical
Saturday, August 11, 2012
Mint Tin Parallax Protoboard
I recently bought a Parallax Propeller Protoboard. This seems like a nice little processor, 160 MIPS, 32bit, 32 IO pins all at $25. The ability to have eight cores is also nice, it seems like it would make a good embedded CNC controller, particularly since it is now supported by GCC, so the ongoing GCode interpreter that I'm occasionally working on should be portable to this platform, but be able to offer extended capabilities like a pendent or DRO. But it doesn't come with a case so I decided to build it into an Altoids tin, a la the Mintduino.
Nothing difficult, a few drilled holes and one filed opening for the USB cable. I couldn't fit the cable into the tin with the Protoboard unfortunately, so an elastic keeps it together. Inside I soldered on male headers just below the female headers. I left out one pin, which allows an IDE cable to be used and provides a polarized connection for other projects. I will probably design a small board breaking out the IDE connector to screw terminals sometime in the future to be able to easily interface with the Protoboard.
The IDE cable is cut down to just the first two connectors, allowing it to be rolled up into the Altoids tin when not in use. The board itself is supported on a anti-static foam, which raises the board a bit but insulated from the board with a layer of thin cardboard, since the foam is slightly conductive and could short everything otherwise.
Nothing difficult, a few drilled holes and one filed opening for the USB cable. I couldn't fit the cable into the tin with the Protoboard unfortunately, so an elastic keeps it together. Inside I soldered on male headers just below the female headers. I left out one pin, which allows an IDE cable to be used and provides a polarized connection for other projects. I will probably design a small board breaking out the IDE connector to screw terminals sometime in the future to be able to easily interface with the Protoboard.
The IDE cable is cut down to just the first two connectors, allowing it to be rolled up into the Altoids tin when not in use. The board itself is supported on a anti-static foam, which raises the board a bit but insulated from the board with a layer of thin cardboard, since the foam is slightly conductive and could short everything otherwise.
Friday, August 10, 2012
3-Axis CNC Controller
In a previous post, I showed the single axis stepper driver boards that I sent out to be made by OSH Park. These seemed to be electrically fine, although it was tricky to properly test without the connectors and other components. After a quick order from DigiKey, I had the bits I needed.
I'm pleased to say that these work as expected, allowing the microstep mode to be chosen by DIP switch, breaking out all inputs and outputs with screw terminals, and providing the connections needed for high and low limit switches. I've assembled three of these and screwed them to a piece of MDF to serve as the basis for a 3-Axis CNC controller board based on an Arduino Uno and GRBL.
The start of this board is shown above. Before it's complete I need to add the power connections for the high-power side, along with the limit switches. I have the GRBL firmware flashed onto the Arduino and have connected a few motors to this setup and everything works great!
Shown below is a closeup of the boards. The screw terminals in the front connect the limit switches for the high and low endstops. These have pulldown resistors and are connected to two of the screw-terminal positions on the logic side of the board (the two un-wired stops). The remaining pulldown resistors are connected to the microstep selection pins, which are set by the red DIP switch. On the right side of the board are the motor connections (the 4-position terminal block) and the motor power connections (the two position terminals). All connections are with 3.5mm terminal blocks, which actually meet the power requirements for multi-amp 24V operation. They also allow multiple connections to be made which allows the daisy-chain type wiring shown above. The low-power side also has these connections since even though they are not needed it's nice to only need one screwdriver to do the wiring.
I'm quite pleased with my first attempt at getting a board made. It worked first try, the quality of the boards is excellent and I think these drivers can form the basis of a good many other projects.
I'm pleased to say that these work as expected, allowing the microstep mode to be chosen by DIP switch, breaking out all inputs and outputs with screw terminals, and providing the connections needed for high and low limit switches. I've assembled three of these and screwed them to a piece of MDF to serve as the basis for a 3-Axis CNC controller board based on an Arduino Uno and GRBL.
The start of this board is shown above. Before it's complete I need to add the power connections for the high-power side, along with the limit switches. I have the GRBL firmware flashed onto the Arduino and have connected a few motors to this setup and everything works great!
Shown below is a closeup of the boards. The screw terminals in the front connect the limit switches for the high and low endstops. These have pulldown resistors and are connected to two of the screw-terminal positions on the logic side of the board (the two un-wired stops). The remaining pulldown resistors are connected to the microstep selection pins, which are set by the red DIP switch. On the right side of the board are the motor connections (the 4-position terminal block) and the motor power connections (the two position terminals). All connections are with 3.5mm terminal blocks, which actually meet the power requirements for multi-amp 24V operation. They also allow multiple connections to be made which allows the daisy-chain type wiring shown above. The low-power side also has these connections since even though they are not needed it's nice to only need one screwdriver to do the wiring.
I'm quite pleased with my first attempt at getting a board made. It worked first try, the quality of the boards is excellent and I think these drivers can form the basis of a good many other projects.
Labels:
CNC,
electrical,
linear motion,
making,
mechanical
Friday, July 27, 2012
A4988 Single Axis Carrier Board
I recently ordered some simple boards from OSH Park. These are single-axis versions of my 3-axis carrier board for the Pololu A4988 stepper carriers and (will) include pulldown resistors for the microstepping pins (which can be set using DIP switches), as well power and pull-down resistors for high- and low-limit switches. All connections are made using 3.5mm screw terminals and the boards have mounting holes for more permanent installation. They also feature a diode for reverse voltage protection on the logic supply (but not on the motor supply).
A quick test seems to indicate that the boards are electrically sound, although I have yet to fully populate one and test it fully. If they work properly, I plan to fix a silkscreen error where the logic supply voltage and ground connections are unlabeled. I also plan to break out the enable pin on the driver and the large capacitor across the motor supply suggested by the Pololu site. When I'm content with how the boards work, I'll release the Eagle files.
A quick test seems to indicate that the boards are electrically sound, although I have yet to fully populate one and test it fully. If they work properly, I plan to fix a silkscreen error where the logic supply voltage and ground connections are unlabeled. I also plan to break out the enable pin on the driver and the large capacitor across the motor supply suggested by the Pololu site. When I'm content with how the boards work, I'll release the Eagle files.
Labels:
CNC,
electrical,
embedded,
linear motion,
making
Sunday, June 10, 2012
3-Axis A4988 Stepper Driver Carrier
More on the perpetually in-progress CNC (see the mechanical stuff in parts I, II, III, IV)
I've recently built a prototype board for the Pololu A4988 stepper drivers carriers. These little drivers are inexpensive (about $12) and fairly gutsy (2A per phase), but can blow fairly easily. Using male headers they can easily be used as drop in modules for a larger CNC controller board. My board breaks out the microstepping pins to DIP switches and adds screw terminal connections for the high-power side, with female headers for the TTL control inputs and low-power supply.
The two-pin set of female headers on the left is the low-power supply, the middle six-pin set of headers is the step/direction controls for each of the axes and the bottom six-pin header is for upper and lower limit switches for each axis. The top set of two-pin screw-terminals is the motor power-supply and the remaining 3x6 pin connectors are the motor winding connections with the bottom two terminals for upper and lower limit inputs. Unfortunately I ran out of space on the board to provide a 5V supply to the limit switches, so these will have to be wired externally to 5V. I may also add some pull-down resistors to the backside of the board, since the switches are currently floating, although this does not seem to be a problem in practice for some reason.
There's a surprising number of solder joints needed for this simple board, largely due to using point-to-point wiring, but it seems to be electrically sound:
This board really cleans up my testing rig for the CNC, just a few jumper wires are all that's needed to connect my Arduino to the two mostly-finished translation stages. Using screw-terminals instead of soldered on connectors is also much more convenient when rewiring the steppers as bipolar parallel/serial during testing:
The final machine will probably not end up using this board, I'm considering investing in a proper 3-axis board, since they can be found quite cheaply on Ebay. That said, it's a nice tidy little package that allows the stepper drivers to be replaced as needed as well as preventing the inevitable wiring mistakes that happen when developing on breadboards.
I've recently built a prototype board for the Pololu A4988 stepper drivers carriers. These little drivers are inexpensive (about $12) and fairly gutsy (2A per phase), but can blow fairly easily. Using male headers they can easily be used as drop in modules for a larger CNC controller board. My board breaks out the microstepping pins to DIP switches and adds screw terminal connections for the high-power side, with female headers for the TTL control inputs and low-power supply.
The two-pin set of female headers on the left is the low-power supply, the middle six-pin set of headers is the step/direction controls for each of the axes and the bottom six-pin header is for upper and lower limit switches for each axis. The top set of two-pin screw-terminals is the motor power-supply and the remaining 3x6 pin connectors are the motor winding connections with the bottom two terminals for upper and lower limit inputs. Unfortunately I ran out of space on the board to provide a 5V supply to the limit switches, so these will have to be wired externally to 5V. I may also add some pull-down resistors to the backside of the board, since the switches are currently floating, although this does not seem to be a problem in practice for some reason.
There's a surprising number of solder joints needed for this simple board, largely due to using point-to-point wiring, but it seems to be electrically sound:
This board really cleans up my testing rig for the CNC, just a few jumper wires are all that's needed to connect my Arduino to the two mostly-finished translation stages. Using screw-terminals instead of soldered on connectors is also much more convenient when rewiring the steppers as bipolar parallel/serial during testing:
The final machine will probably not end up using this board, I'm considering investing in a proper 3-axis board, since they can be found quite cheaply on Ebay. That said, it's a nice tidy little package that allows the stepper drivers to be replaced as needed as well as preventing the inevitable wiring mistakes that happen when developing on breadboards.
Subscribe to:
Posts (Atom)





