Support external driver boards for steppers
Is your feature request related to a problem? Please describe. Currently we support 4 wire full steps steppers that are driven e.g., with a ULN2003 - or directly via the board
Describe the solution you'd like We would like to support, e.g., Easy Driver modules
I know you hate me for that comment.....
Usecase?
If there exist multiple situations, people can not build a Homecockpit ( like C172, A320,B737) cause some gauges are not possible with our current ULN2003.....
It YES.... I agree and vote for the Easy Drver.
If NO.... and all is possible with ULN and the EasyDriver is just another "Additonal optinal hardware" You know my opinion about hardware that is "unless" in case we still support a device that do the same !
One use case is to get a 3d printer shield (like RAMPS 1.4) for driving steppers, because those are designed for that, and are widely available at cheap price. I also have one old Velleman 3d printer motherboard that is actually an Arduino 2560 Mega and it flashes fine with Mobiflight, even the usb VID/PID match. You can find the pins for each stepper driver in the Marlin source configurations.
The advantage is that those boards have the power supply wiring figured out, and they are just a shield over a regular Mega, and pretty compact package for 5 stepper drivers. The drivers are already supported by Accelstepper lib that Mobiflight uses, the connection type just needs to be selectable in the Connector side, as we currently just support directly driving coils (and the simple "driver" that works as if it was directly connected)
So not that silly use case if you want analog standby instruments for example. It also has some FETs for the bed and hot end heaters and fans, that probably could also drive LED strips for backlight?
So I was looking at the firmware source and it appears that the firmware already supports "step + direction" driver interface, if pins 1 and 2 are the same, as well as 3 and 4. @elral might know more of this.
if (pin2 == pin4 && pin1 == pin3) // if pin1/2 are identical to pin3/4
{ // init new stepper with external driver (step and direction)
_stepper = new (allocateMemory(sizeof(AccelStepper))) AccelStepper(AccelStepper::DRIVER, pin1, pin2);
} else { // otherwise init new stepper in full 4 wire mode
_stepper = new (allocateMemory(sizeof(AccelStepper))) AccelStepper(AccelStepper::FULL4WIRE, pin4, pin2, pin1, pin3);
}
I think this is just not possible in the GUI.
Also, the pin ordering should be documented somehow, as it is now set for the UNL2003 board that expects 1-3-2-4 pin order, so pins 1,2,3,4 are actually passed to the AccelStepper as 1-3-2-4.
Connecting a small X27 motor directly works in 1-2-3-4, so it is still possible, but you need to know the above, and configure the pins as 1-3-2-4 (like, the default pins on an empty Mega are 2,3,4,5, so you need to swap the middle pins around, to be 1,3.2.4 if you dont use the UNL2003. (X27 use so little current that they can be connected to arduino pins directly).
So I think we should have a few choices in the dialog:
- Connection type: [ Use driver board UNL2003 ]
- Connection type: [ Use step+direction type driver ]
- Connection type: [ Connect two-coil automotive gauge stepper (like X27) directly]
Choices 1+3 are the same but the pin order just needs to be different. I guess we could combine them but it just needs to be documented that for X27 one should swap pin 2 and 3.
I think "step+direction" type connection should make Arduino Mega based 3d printer boards work, as they have just STEP, DIR and ENABLE pins.
Yes, the firmware supports driver boards with step/dir signals in the way described above. This was added when the firmware was refactored as preparation once the GUI is changed. In the documentation of steppers this is described since a longer time, but it couldn't work without these changes.
Choices 1+3 are the same but the pin order just needs to be different. I guess we could combine them but it just needs to be documented that for X27 one should swap pin 2 and 3 I would also propose this way. How to connect a directly connected stepper should be described without code changes. For driver boards with step/dir like the easydriver board a checkmark box could be one way. Once clicked only two pins could be entered for step and dir (should also be explained in the documentation). The GUI will set the remaining two pins automatically. Or "just" disabling the check for used pins. Another way would be to define a new device for driver boards with step/dir which could be chosed in the drop down menu while defining a new device. But that would be meaning some more changes on the GUI side (my guess) and on the firmware side while the functions (e.g. sending a new position) are the same.
One of the advantages of a driver board with step/dir is the use of micro stepping which smoothes the moving of the stepper. Also different sizes of steppers could be used. The Easydriver board is a good choice, as this board can run on 5V to drive steppers. These small boards from e.g. 3D printers need at least 7V.