GivinTheRaspberry
Posts: 5
Joined: Mon Oct 15, 2018 5:09 am

Need simple sample stepper code to learn from

Wed Nov 14, 2018 6:27 am

hi ,

I have the following:

Raspberry Pi 3B+
DM556T Stepper Controller
NEMA 24 Stepper Motor wire BiPolar Series
48VDC Power Supply

Motor wired bipolar series, hooked to controller
Controller hooked to 48VDc supply

Need sample program
Need GPIO connections to DM556T controller
Pul+
Pul-
Dir+
Dir-
Ena+
Ena-



Looking for a sample program so I can hook up the correct gpio pins to the six connections above and turn the motor at around 25RPM. I think if someone would be so helpful as to show me how to do that, I can then modify it as needed from there

thanks

pws
Posts: 89
Joined: Mon Apr 11, 2016 4:16 pm

Re: Need simple sample stepper code to learn from

Wed Nov 14, 2018 2:39 pm

When your Google is working again, it will provide lots of answers and examples.

GivinTheRaspberry
Posts: 5
Joined: Mon Oct 15, 2018 5:09 am

Re: Need simple sample stepper code to learn from

Wed Nov 14, 2018 3:36 pm

already tried that too many variables, need something VERY simple to turn this motor and I can go from there. thanks

GivinTheRaspberry
Posts: 5
Joined: Mon Oct 15, 2018 5:09 am

Re: Need simple sample stepper code to learn from

Sat Nov 17, 2018 5:09 pm

Still looking for this, any code example would be greatly appreciated.

If don't have code example to offer, please save the comments like "do a search" it doesnt help because my situation is simple but unique to itself. Once I have basic python code to look at for my setup (see setup above) I can build on it form there.

Thank You

pcmanbob
Posts: 6401
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Need simple sample stepper code to learn from

Sun Nov 18, 2018 8:44 pm

If you look at the data sheet for your controller you will see that it required 5v to operated the inputs, so you cant just connect it directly to the gpio you will need a transistor to interface the gpio to the controller to do the 5v switching.
https://www.omc-stepperonline.com/download/DM556T.pdf

Image

Edit
So some thing like this

Image

if you don't want to use the Enable line ( ENA) then just leave it un-connected and it will be enabled by default.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

GivinTheRaspberry
Posts: 5
Joined: Mon Oct 15, 2018 5:09 am

Re: Need simple sample stepper code to learn from

Mon Nov 19, 2018 6:28 am

Thanks bob!

Looks to me that whats happening is 5VDC+ is being supplied to the DM556T control pins, and each pin's negative is switched by a NPN transistor when the corresponding Pi pin does something through that resistor. Is the Pi control pin grounding the Base of the transistor? Or applying some kind of power?

Also, another question, the numbers in the Pi's GPIO pins in the boxes are the pin numbers, 1-40, what are the other numbers on each pins? Some are voltages and some are just numeric?

I actually seem to have some of those transistors, they say 2n222 on them. Are those resistors 470k ohms? if so I should have those right here as well.

I'm new at electronics so forgive these basic questions...
Attachments
IMG_20181119_012630 (Custom) - Copy.jpg
IMG_20181119_012630 (Custom) - Copy.jpg (171 KiB) Viewed 1093 times

User avatar
rpdom
Posts: 14701
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Need simple sample stepper code to learn from

Mon Nov 19, 2018 6:38 am

GivinTheRaspberry wrote:
Mon Nov 19, 2018 6:28 am
Also, another question, the numbers in the Pi's GPIO pins in the boxes are the pin numbers, 1-40, what are the other numbers on each pins? Some are voltages and some are just numeric?
The pins marked with voltages are fixed voltage supply or ground/0V pins. Their state cannot be changed. The ones with numbers are the GPIO numbers, often referred to as BCM numbers (for BroadCoM, the makers of the chip at the heart of the Pi). There is another numbering scheme called WiringPi, but that is not used here.

If your code sets (BCM) GPIO 27 to output mode and writes a "1" to it, pin 13 on the board will change from 0V to 3.3V.

An interactive guide to what each pin is capable of is shown at https://pinout.xyz/#

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Need simple sample stepper code to learn from

Mon Nov 19, 2018 6:51 am

GivinTheRaspberry wrote:
Mon Nov 19, 2018 6:28 am
I actually seem to have some of those transistors, they say 2n222 on them. Are those resistors 470k ohms? if so I should have those right here as well.
Those resistors should be 470 ohm.

GivinTheRaspberry
Posts: 5
Joined: Mon Oct 15, 2018 5:09 am

Re: Need simple sample stepper code to learn from

Mon Nov 19, 2018 7:16 am

"If your code sets (BCM) GPIO 27 to output mode and writes a "1" to it, pin 13 on the board will change from 0V to 3.3V"

does that mean that in the diagram and your example above, my code turns on 3.3v from GPIO Pin 13, which goes through 470ohm resistor to the Base pin of the transistor, turning it on? And that connects the (-) of the control pin of the DM556T to ground which completes the circuit ton trigger that with the 5 volts?

Brandon92
Posts: 773
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Need simple sample stepper code to learn from

Mon Nov 19, 2018 8:03 am

GivinTheRaspberry wrote:
Mon Nov 19, 2018 7:16 am
"If your code sets (BCM) GPIO 27 to output mode and writes a "1" to it, pin 13 on the board will change from 0V to 3.3V"

does that mean that in the diagram and your example above, my code turns on 3.3v from GPIO Pin 13, which goes through 470ohm resistor to the Base pin of the transistor, turning it on? And that connects the (-) of the control pin of the DM556T to ground which completes the circuit ton trigger that with the 5 volts?
Yes, you could say it in that way :)

A somewhat more "detailed explanation":
Your code enables a p channel mosfet inside the SoC that is connected to the 3.3v power rail. So, you will see the 3.3v* on the output. In fact it is a bit lower because of the voltage drop over that mosfet. And this means there will be a current going through the resistor. And this will bring the npn transistor in conduction. And this allows a certain current through the collector. So, you can say that is is connected to the 0v rail. And your stepper motor controller response to this.

Return to “Python”