Powering the stepper motors

I know there have been some posts on here about how to power the steppers. But I have to admit that I am still a bit confused. The general consensus is to power to motors and the RPi Pico with a separate power supply than the RPi V4. The connection diagram shows a barrel connector for that. But I do not see anywhere in the BOM for a barrel connector or any cutouts in the electronics drawer for such a unit.

Is there any guidance on what to buy and how to install it for the stepper motor power supply connection?

There are so many different ways to do it. You just need to supply 5V to the motors separately from the supply to the Pi. This could be a barrel connector, or a USB socket breakout, or any other way to get 5V. I use a cut USB cable, but you need to find one with wires that are thick enough to solder to by hand. A barrel jack or USB breakout board are probably simplest.

The documented workaround motor controller is Arduino Nano, rather than Pi Pico.

Yea, I saw the standard Nano but then saw that the firmware had been adjusted to support the Pico and the git master had a nano conversion board variant. So, why not right. :). Just have to dig around for the firmware which I saw was discussed in one of the other threads.

My stepper controller boards were also different so I adjusted the nano conversion board to support those controller board. Finally, I also added some troughs right below the Pico through-holes to allow for solder connections. Here is an image of my changes. Not sure if my changes are worth complicating the project with though. Not sure how common that controller board (from Microcenter) is. I do like it as it is much smaller than the more standard ones.

1 Like

Those controller boards look very neat. It is a bit of a squeeze with the normal ones and a Pico. Let us know how you get on with the converter plate with the troughs. I have not tried it in a complete microscope, but the aim was to have enough room for the soldered pins. I tested in the electronics drawer with the Pico with commercial headers and with hand-soldered headers. Depending on the height of the pins the USB port sometimes sits high in the hole. The retainer clip does not work particularly well on the Pico and could benefit from rethinking.

If you made the changes in OpenSCAD it would be useful to see them in a Merge Request. Posting the STL on the Forum in the Contributions section would be another way for people to use it.

Is there a clear answer anywhere on this with the default suggested BOM of 7.0? Do you actually need 2 power supplies, do the stepper motors draw that much current i.e. when using a Sangaboard?

1 Like

Hi @Eiki, the default for V7.0.0 will be the Sangaboard V0.5. This then has a single power supply which is fed to the Pi through the Sangaboard. The electronics part of the documentation for V7 is incomplete and still being finalised to get from Beta to an actual release.

Without a Sangaboard V0.5, using either the Arduino Nano electronics work around or Sangaboard V0.3 or V0.2, it is strongly recommended to have a separate power supply. It is not so much about the typical motor current draw, but more about the consequences of failure modes. The motor current is not huge, but also not trivial. It also seems to be very variable across different batches - there are a few posts and treads about motors getting hot, for example Keyboard shortcuts and motor temperature - #26 by WilliamW.

The typical current that I measured of around 0.6A is within the capabilities of being driven from the Pi, but if there is a problem then this can go up, in the extreme case an accidental short circuit will give a very large current. Putting that current through the traces on the Pi circuit board is likely to damage the Pi which is an expensive part.

With the Pi 3B+ and earlier, an additional issue is that the power is delivered through a Micro-USB connector. These are not designed to deliver even the normal 2A that the Pi may need. Micro-USB connectors all seem to have a high contact resistance and cause regular low-voltage warnings on the Pi desktop. Adding more current draw by connecting motors just makes that issue worse.

So a single 2A or 3A standard Pi power supply has enough capacity, but you want to split the motor power off before the Pi. Then if something goes wrong you are most likely to damage only the motor and drivers rather than the Pi main board as well.

The Sangaboard V0.5 does all of this for you, and with a USB-C connector which is designed for the higher currents. Voltage warnings seem to go away on a Pi 3B+ when powered through the Sangaboard V0.5 because of the better power connector.

1 Like

It looks like it will work pretty good. As far as the changes, I did do them in OpenSCAD so I could provide a pull request. As the work is done it would only take a few minutes. It would also be an easy PR to merge as the changes are isolated to that convertor board and have no impact on other elements.

As for the firmware. I thought I saw that somebody had already done it. I would be happy to take a look at the code as I would like to see this running. It is my understanding that the system performs better with the RP2040 vice the Arduino. This is what drove the Sangaboard to switch to the RP2040 I thought. Also, you cannot argue with the $5 price point for the Pico.

I will need to think about how I want to address the power issues here. I do wish there was an official answer to the question baked in to the microscope. The flexibility is nice, but sometimes overwhelming.

1 Like

The other thread where you replied ( Raspberry Pico based motor stage - Contributions - OpenFlexure Forum) has a port for Pico from a contributor. We are still working on getting the instructions for a Pico work-around with supported firmware.

The answer to a standard motor control is the Sangaboard V0.5, which is custom but is available, or the Nano-workaround. The work-arounds offered do assume more affinity with building things, and are not proscriptive because people want to work around elements of the workaround.

Just to note, the Arduino Nano (and Sangaboard V0.3 which uses the same microcontroller) are perfectly capable as the motor controller. The change to RP2040 (the Pico micorcontroller) for Sangaboard V0.5 is partly (or mainly) about cost and availability of the part. Also I think ease of implementation on a custom board, and then it also offers more flexibility in GPIO to add functions beyond a 3-axis motor driver. Cheap Arduino Nano clones will do everything the microscope actually needs.

HA! I punted and just bought a Sangaboard 5. Although, I was disappointed to see that shipping outside the EU is on hold till the 20th.

Doing the build with the workaround seemed like fun, but I think I am getting to a point I felt there were so many bandaids. Lets just get the thing built! :wink:

Thanks for your quick feedbacks.

2 Likes

Hi @justacec ,
I’m sorry about the delay in shipping, I had some medical issues and am stuck away from the UK for at around 2 more weeks, I’ll ship your Sangaboard as soon as I get back.

If you do want to experiment with the pico option, the firmware is at Filip Ayazi / sangaboard-firmware · GitLab , there is some configuration in config.h and boards.h you can adjust based on your setup, the cleanest option is to define BOARD_CUSTOM_PICO as the board option in config.h instead of BOARD_AUTO and make sure the motor wiring configuration in that section of boards.h (WIRING_MOTOR_*) matches your wiring.

William is correct about the choice of RP2040 for the Sangaboard, this was several factors, mainly availability (in peak chip shortage), price, and great documentation. Higher clock speed, PWM frequency, more IO, flash, RAM etc. are needed for the extra features I wanted to add, but for a basic 3 axis stage, the Nano can handle it easily, especially as the motors can’t run very fast. The new firmware can also be flashed on a Nano based board, so some of the new features can be supported on that (like interrupting moves).

While the nano could handle the task, it seems that the Pico is the way to go as future developments will likely tend that way. Although I got the Sangaboard, I might continue to dabble with this and see where I go with it.

As for the PWM output on the pico. (I think that was where the pin limitation was hitting you on the pico vs the Sangaboard)… Without having looked at the code… I wonder if the PIO engines would be able to help with that? It is just a state machine and could most likely be coded to support an on-the-fly duty cycle which is all that is needed for the LED (I think).

I completely agree, the only potential advantage of the nano might be its ubiquity compared to the pico (for now), especially in some regions, but the nano support is more of a legacy thing, so people who have a bunch of nano’s lying around and can’t access a pico easily or cheaply can use it, it won’t block new pico only features.

I think using the pico there should be no issues with PWM given the number of channels available, if there is an issue (there are a few pins available on the RP2040 which are not available on pico), the motor wiring can be adjusted to free up a PWM pin. It was more of an issue with the nano, where the PWM frequency is fairly low and can cause flicker in the images. On the RP2040 or pico we can easily change it up to 1MHz (at lower duty cycle resolution, but still usable, 100kHz works well and has fine control).

Ok, I just put the files up as a PR. Feel free to check it out.

2 Likes

This is my take using simple math: (prices are approximate)

Description approximate price
Original Arduino Nano $25USD
Additional power supply $10USD
Wiring, labor, etc $???
TOTAL >$35USD
Sangaboard $45USD

Hence, buy the Sangaboard.

Yes, that was what I was coming to realize. The issue is that I basically already have all of the parts. I just did not want to futz with the powering solution (which would have been fairly easy I think).

As for the Sangaboard. I decided to get the Illumination kit with it and it came to a total of ~$70USD.

I know that feeling.

I actually powered x-motor driver from Nano-board 5V pin, and Y and Z motor driver bord got its power from the 5V pin header of the Raspberry 4B I’am using.

So I made my own version to fit the motor driver board and the Nano. I made a cut out to have access to the double pin row where GND and 5V can be connected.

But, there is a problem, the stepper motors runs too hot, heating up the PLA so the screws holding the motors does not hold very well. I’am thinking of inserting som current limiting regulator or may be just some resistors in the 5V supply to each driver board. Or does any one have a better solution. Are you all running the Nano board with “hold” current disabled, so the motors are released from power when not running?

Hi @mikromidas. That is a nice holder for the motor driver. I see that you are using the original v7.0.0-beta1 electronics drawer. We had some issues with that and the Sangaboard motor driver, so this will be changed in the next release. The new version gives a bit more space, but also moves the position of the mounting points for the drawer in the microscope stand and adds a convenient mounting point for the nano version of the motor driver. This is discussed in Sangaboard v0.5 now available - post 50.

The motors should not run that hot, and if they are then this is one of the failure modes that can draw too much current from the Pi. As you are using a Nano that will be powered by the USB-data connection to the Pi, be aware that this means that the Nano 5V pin is power from the Pi, so all of this excess heat from the three motors is coming from drawing excess current through the Pi board.

In previous discussions of hot motors (see the link in post 5 of this thread) it seems to be about particular batches that draw too much current, so not to do with the software. I have never had hold of a bad batch of motors, so I don’t know the characteristics. However the motors should never be more than slightly warm even when always using a holding current. The simplest solution is probably to send the motors back as faulty and get some other ones.

1 Like

Thanks for immediate response! I ordered the motors first from DigiKey 1471-1491-ND, but they had no driver boards included. So I later ordered from RS-online 1845109 which included the driver board. The motors from RS-online had longer shaft, actually too long to fit at the Z-motor mount, so had to take one motor of the DigiKey order which had shorter shaft. I also measured the motor-windings resistance, and found one of the motors to have around 22 ohm, and the other around 34 ohm if I remember right. (measuring from the center tap, so only measured half the winding). Could do more measurement when back home. The motors reach temperature around 50-60 degree Celsius I would guess. Not that critical hot, but for this application should not need to run this amount of current, so not quite happy with the result.
The adapter plate I made, I wanted to leave as much opening as possible to let hot air from the Rasperry board to escape.
Although I made screw holes to lock the driver board with screws, which I did not have, I ended up using tiny cable strips to lock down those hatches above the driver boards. I’am not into OpenSCAD, so I did the design in FreeCAD. No problem sharing the file if any one interested.

One idea that could limit the current draw is to always keep stop at step position where step phases, is only energizing only one winding, thus avoiding half-step phase stops. Could hopefully be a easy modification to the Nano board step-driver firmware if not already implemented as a drive mode.