11. Output devices.¶
Output devices. Making something do something. For this week I wanted to recreate the design I did in Wokwi in Assignment 5, Embedded Programming.
Group Assignment¶
Hero Shot¶
Research/Testing¶
After going over what we have available here in the lab I didn’t find any Pololu A4988 Stepper Driver Carriers but we did have two Polulu DRV8825 boards. After reading up on the difference between the two and this guide I realized the two were similar enough to use semi-interchangeably. The main differences are:
- The A4988 has a supply voltage of 8-35V whereas the DRV8825 can handle 8-45V. In my case I used 12V.
- The A4988 can do 1/16 microstepping, The DRV8825 can do up to 1/32.
- The A4988 has a minum STEP pulse length of 1µs where the DRV8825 is 1.9µs. Not very relevant for what I’m doing but could matter for high-speed applications.
- The A4988 needs logic power supplied to the VDD pin whereas the DRV8825 gets it’s logic power fed through the RESET and SLEEP pins and the VDD pin is replaced by a FAULT pin used for signaling. The A4988 wants the RESET and SLEEP pins bridged.
- The default state of the ENABLE pin on the DRV8825 is enable the driver when in a low state. This means the DRV8825 is enabled even when the ENABLE pin is unconnected. Supplying the pin with a logic voltage turns the driver off.
First step was finding a motor and figuring out which way the polarity goes. I found a few different sources online with several options for the color pairs. The first motor I tried using is paired like so:
PAIR A | PAIR B | |
---|---|---|
+ | RED | GREEN |
- | BLUE | BLACK |
I tested this by bridging the connections and spinning the motor by hand. If connected properly between pairs the motor moves smoothly but with great resistance.
Andri suggested I start off doing this on a breadboard. I started off by recreating the layout from this guide from Makerguides.com which also includes a section on setting the current limit. I wasn’t able to find any information on the mystery stepper I had so I went with a limit of 1A. The formula for setting the limit is as follows:
Current Limit = Vref * 2
which means to get a current limit of 1A I should be measuring .5V from the variable resistor on the DRV8825. Using the layout from the guide I went to test this. After setting what I thought was the correct limit I switched the breadboard to the layout as per the instructions. Turns out I absent mindedly reversed the formula. So I measured 2V, Setting a current limit of 4A, 12V at 4A is a whopping 48W. Which the teeny tiny heatsink did not like at all. Motors moved roughly and when I checked if the driver was heating or not I burnt a hole on my thumb. I’m documenting this two weeks later (Yes. I know) and I still have a mark on my thumb. I guess I won’t forget this lesson any time soon. After that incident I was worried I’d fried the driver but I managed to set the voltage to the correct value after a bit of confusion. Having it set the current limit to 1A the motor didn’t move at all. Instead of continuous tinkering I decided to switch to a different stepper motor that was actually labelled. These were the ones Andri ordered to use for Machine week. They have a current limit of 1.5A so setting the current limit was simple. Here’s the breadboard layout running my code from Week 4 powered by a QCHack board.
Design¶
Time for KiCad. I wanted to be able to use the DRV8825 with a socket and while the fab library had no footprint for the DRV8825 it did have one for the A4988 but not using socket headers. So I used the footprint editor to create a footprint for the DRV8825. I’m not confident enough in it’s “correctness” to submit it to the library but it’s good enough for what I’m doing here. Main thing that mattered was getting the pin assignments correctly in the schematic and making sure the spacing is correct as the gap for the Xiao socket is larger than the gap for the DRV8825. Here’s the schematic:
Schematic:¶
I’m placing a 100uF capacitor on the 12V power to account for load spikes as recommended in the guide and using an “S4B-XH-SM4-TB” JST header matching the one on the 42x42x38mm Nema 17 stepper motors Andri ordered for Machine Week.
PCB:¶
Here’s the PCB, I designed it using two separate grounds, One for the 12V power and one for 5V but it turns out the DRV8825 links the two anyway. I suppose it could matter anyways so I kept it anyway.
Manufacture¶
I milled it using the Roland MDX-20 and I’m 100% convinced the 1/64th bit in the machine was broken when I started. It didn’t sound different which is the usual way I’d notice something like that but the surface was incredibly rough:
I also realized I didn’t generate drill paths for the through-hole 12V power. I solved that using a center punch and some manual drilling. The result wasn’t perfect, but good enough:
AFter that I lapped the board using the sponge. I wasn’t able to get it perfectly smooth as I bent it slightly during the drilling, But it was good enough. After that I went on to soldering. I had a bit of trouble getting the headers on as the gap was incredibly tight:
I forgot to add a photo of the completed board I’ll add one when I get to the lab.
For programming I used the code from Assignment 5, Embedded Programming. Program worked out of the box, I also played around with using the stepper acceleration library but had some strange results. Probably due to the minimum signal length. Might require some tuning. But my code from 6 weeks back worked just fine. Here’s a video of the board moving the motor on button input: