RPi stepper driver and relay build log

Hi Everyone,

I’m building an automated precision cutting system. I’ve been building the electronics using prototype boards and want to get some PCBs fabbed.

I’m new to KiCAD, PCB fabrication and electronics in general. I have a bit of knowledge from some classes in high school many years ago. That being said, I am interested and have learnt a ton in short period of time. All of this has been due to some wonderfully patient and helpful people like Rob, Martin, Hermit, Jim, Dale, Keruseykaryu, Joan_Sparky, David and Niluje (from KiCADInfo Forum) - thanks everyone!

I’m moving on from the schematic design (attached) to the PCB layout.

To be continued…

1 Like

I’ve designed and printed one small board recently. It was single sided and just a means to get my feet wet.

The current layout is more complicated and I have a few questions…

Right now I’m playing with calculating trace widths for some of the more current heavy parts of the board. For a 2 oz copper board, at 2A the calculator suggesting a width of 1.25 mm for short runs. No problem. If all the steppers were running I may need about 8 Amps. I am wondering if it is common to run thick traces (5-10mm) or if it is better to solder some wires?

Attached is an image a test layout I am working on for the stepper drivers.

Any comments, tips or suggestions very welcome!!



I would create a zone for the power rails, and enclose the required pads within it.

The question about trace thickness is complicated, because it is about thermal dissipation. There are many factors involved, and can’t be taken in isolation. For example, if the PCB is enclosed in a small box with no airflow vs a card in a rack with forced airflow. Effectively, the copper area of a trace acts as a heatsink, with more area providing better heat dissipation. Copper conducts heat well, but is impeded by narrow strips. FR4 conducts relatively poorly.

For the motor connections A1,A2 etc I would use the thickest trace that is allowed by the clearance requirement. I think with 2oz copper, the traces you have would be ok.

If you have a well ventilated case, I would suggest a fan for DRV8825 anyway, then the finer thermal considerations become a bit moot.

Thanks Bob,

The board will be in a small enclosed case and I’m running both intake and exhaust fans. There is quite a bit of air flow.

All the best


Hey Adam! Welcome! Thanks for moving over here!

Are you creating a 3D model for the heatsink/airflow path? This looks like an awesome project!

Also, what is your expected/allowable temp rise inside the enclosure? That normally drives a lot of the specs on the width of the copper (though adding some margin isn’t bad!)

Also I noticed you aren’t planning on putting in an ID chip on pin 27, 28?


This looks like a great project. What type of cutting system? Mill, laser cutter, water jet, plasma? And, what are you planning to cut?

Hi Chris,

Thanks for the advice !

I have not modeled the air flow but I don’t expect there to be much temp rise in the enclosure (6" sq by 4" high and I have a 6 CFM fan on both the intake and exhaust. I’ve done some tests and the air flow is very good.

I’m not really familiar with I2C at the present, is that what you mean by an ID chip on Pin 27 and 28? I see an EEPROM chip connects here. I had a quick search and it seems this is linked to PiHATS and identification. I was under the impression this could be used to expand GPIO connectivitty but it looks like more GPIO pins may be required?



Hi Hedrickbt.

Thanks for the interest!

I’m building a precision wafering saw for cutting very thin samples of hard materials (stones, metals, polymers, small devices). The blade is about 0.030" thick and diamond coated. It ‘wears’ through samples and is cooled by immersion in a water bath.

Saws like this often produce sub mm thick sections that are then ground and polished for further analysis. Analysis is usually performed by transmitted light or scanning electron microscopy.

I have used and built manually operated saws but wanted an automated one for making repetitive cuts. Imagine cutting a cucumber where each cut takes 30 mins and is 0.5 mm thick and you do this for the entire length. It takes days! I also wanted a project where I could learn about automation and electronic design. So far its been perfect.

After fiddling with prototype boards I’m REALLY looking forward to a PCB. I figured at the price they could be printed it was a worthwhile approach. I also have to say I’m really enjoying all of this. It has been challenging but I’ve been lucky to find some some great people who were willing to share their knowledge and offer their advice.


Correct, it allows the board to identify “official” HATs. Don’t think it’s necessary, was just asking if you thought about adding one.

Well keep an eye on that, especially if your copper amounts start to rise too much

There are many devices that can be connected to the I2C bus but you need to watch the voltage requirements for some devices. That is, not all 5V powered devices can be connected to 3V3 bus and vice versa. The types of devices available with I2C bus range from EEPROMs, A-D/D-A converters, power monitors, RF tuners, MEMS sensors to GPIO expanders.

EEPROMs are handy not just for hat identification but also for storing configuration data that might be different from one device to the next. Although this usually requires some kind of interface to allow changing the configuration data. I usually use a web server with an HTML page that allows me to edit the configuration data and save it to EEPROM.

Keep in mind that any GPIO added through I2C will not be as fast as the GPIO available on the PI.

It is a good idea to leave these pins unused if you don’t currently plan to add any I2C devices as it allows for future expansion without a lot of changes to your existing firmware. Perhaps provide an expansion connector so that you could add a daughter board in the future?

Thanks Rob.

Will incorporate.

Is there a specific chip that is best to use? I see 24LC256 and 24LC512 come up a few times in a web search.

On a separate note would it also make sense to switch to a beagle bone black for more GPIO pins?

All the best


The 24LC256 and 24LC512 are rather large for storing configuration data. I usually use something like a 1K or 2K chip for this purpose. You can use any size you wish the only difference (other than storage capacity) is cost.

I found a schematic for a Pi hat and modified my sketch accordingly…

Is there a preferred connector for the potential attached device?



Attached is the latest schematic.

A few things that may look strange…

I added inputs on the Relays 3 & 4 so I can bypass the board power if I want more amps. I added jumpers to connect to the board if desired. If the relays are driven by the board, I figure an 1-2A, and am guessing a standard 2 pin header jumper should work.

I added in connections so I can bypass the on-board stepper driver. I did this in case I want to run a larger stepper that needs to be powered by its own driver.

Also decided to power the Pi by its micro USB connector so I downsized the voltage regulator on the board. Figured 1A was plenty to power all the 5V circuits.

Yes, strange would be as good a term as any. :wink:

Why so many connectors on your relay outputs? Just use two - two pin connectors, one for 24V and Gnd, the other for the relay contacts, you can then wire it how ever you like. Perhaps even do that with all three relays.

I think the “I2C” label should probably read “3v3”.

What is the purpose of J28, the EEPROM connector?

Try to avoid making a “one board does all”. You’ll end up with a lot of extra components that do nothing but add cost to the board, they might even be a source of problems. Besides, the one future addition you end up needing will be the one you didn’t think of adding in the first place, better off just making a new board.

I disagree, adding a footprint might cost nothing. A board designed for personal use or development use is quite different to one for a production run. There is nothing to say you have to fit all components, we often design boards with NF components for some degree of future proofing. Breaking out all possible connections on a dev board is a good idea, having to respin a board for a trivial reason is a waste of time and money.

The only downside I have found with creating a board with a lot of options is explaining the valid combinations to the end user, but if the user is the same person as the designer that doesn’t apply.

Hi Rob,

Thanks again, the J28 connector was included as a connector in response to your comment. “Perhaps provide an expansion connector so that you could add a daughter board in the future?” I figured this was from the EEPROM, am I mistaken? Will make changes to the relays.


Hi Rob and Bob,

I’m trying to balance a few things here. It will be about $4 per board to have printed and I was planning on trying to use this for a few other projects. This many not be optimal and at the low cost to have the boards printed perhaps not wise. I am also working on a 3D printer and added the extra stepper driver so I could use this board for that as well. Its also a little different setup so I needed a few more relays. Again may be better to design a specific board…

The stepper bypass was for the likelihood that I may need to go with a bigger stepper on one of my drives and I don’t think the DRV8825 will handle it, or it will be at its limit.

There are a few more connectors with the relay b/c I preferred to have ‘plug’ connection with both +,- as inputs and outputs. I find it makes the wiring in the control box cleaner and more modular without having a bus for the common carrier - perhaps its not a big deal as I am making it.

That’s my thinking.

Added a connector to I2C. Figured any attached component this would likely need power as well.