Using step/direction controllers

Has anyone modified sangaboard software to drive 2-pin step/direction controllers (like DRV8825)?

Those controllers are designed for bipolar steppers, whereas the microscope and Sangaboard are designed around unipolar steppers.
There are few threads on here about possible modifications to use NEMA steppers, which are usually driven as bipolar steppers. Those threads may have something helpful for you.

If you want to use the same motors with a DRV8825 driver you’ll need to convert it from bipolar to unipolar. To do this you have to remove the blue plastic case over the electronics housing and cut the central connection. You then need to make sure the DRV8825 is on the lowest current setting.

I’m sorry, this was an off-topic question and I should have been more explicit. I need to drive a couple of larger motors on a non-microscope instrument, and I like the interface that the Sangaboard firmware offers so I was hoping to use it for my project without too much effort :slight_smile: In particular, the ASCII command interpreter and the Python scripting makes for a very flexible package which the other libraries don’t offer. Other drivers (such as AccelStepper library (AccelStepper: AccelStepper library for Arduino) have the option of generating the step sequence directly or using a controller chip, but they don’t go beyond the library. I’ve seen similar questions similar to mine in the forum and I wondered if anyone had actually done it. If not, I’ll take a stab at doing it myself. I would hijack the 2-pin definition and replace the sequencing with a simple step pulse and direction generator. If you guys are interested I would submit the code back to you. If you think this is the wrong approach, please tell me what I should do.
And yes, I did modify one of my small motors as you indicated when I first started playing with the drv8825 chip, as a test bed, but those motors don’t work for my project.

2 Likes

It is really nice to have the feedback that you like the interface :grinning:. I think there are probably a number of arduino CNC libraries that have an ASCII interface, whether they also have a nice python wrapper I am not sure.

If you are modifying the library we’d love to see the code. I think it would be incredibly useful to have a way to drive bipolar motors from the same software. Thanks!

I have the code working now. There is a lot of commented-out code which makes it pretty hard to read. Do you need it to be left in there. In particular, it seems the user is expected to comment out the type of driver (2,4 or 5 wires) and uncomment the one they need. Did anyone try to use ifdefs together with a #define to make it easier to switch?

I think the honest answer is that it was hacked together a while back, and adjusted every so often, but it never needed enough work on the code for us to invest the time in cleaning it up to make it easier to switch things around. We are certainly not against it being more flexible ifdef and define seem like a much tidier way to do things.

OK, I made a start :slight_smile: I noticed a couple of things which you might clarify:
The 5-pin unipolar code will fail to release the motors since the release command just sends step 8, which switches off all four phases for the four-pin variant, but not for the 5-pin.
The 2-pin unipolar variant is strange. The link to the schematic does not give a schematic for a 2-pin design. I can see how it could be done, but it would only have four steps, not eight (i.e. full-step, not half-step). Does anyone actually use these variants? I couldn’t find a unipolar 5-phase stepper online, and 5-phase bipolar steppers are complicated to drive.
Any comments? My temptation is to strip them both out.