Asked — Edited
Resolved Resolved by Rich!

Do Pins Question

I read Rich's tutorial regarding the l298 h bridge which is prompting this question. There was a spin off link that Rich directed me too that actually showed a bit of code to control a stepper motor. I need to set up something like that, and so what I would like to do is set D1 on and off rapidly creating an actual pulse. PWM will not work in this situation. Anyways my controller is looking for 5vdc to fire a optoisolator (led). I am powering my ezb4 via 12vdc. The output of the D0 ports is 12vdc Correct? What voltage would come out of the white wire, if any? My stepper controller is a bit different than the l2d8 requiring only a pulse on one input and a on/off voltage for direction. The controller can work on 12vdc but requires the addition of 820ohm resistors on these inputs. Thanks for the help.


Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

United Kingdom

Why wont PWM work? PWM is basically a pulse When you say rapidly, how rapidly?

You could write a script to switch the digital port on and off quickly, simply with a code such as;

Set(D0, On)
Set(D0, Off)

That would turn the digital port on every 20ms for 10ms. The demand on the PC and on the wireless comms may be very high though.

As for the other part of your question, yes if you have 12v in you will have 12v on the Vcc pins. This is on every port of the EZ-B not just D0.

The voltage on the white (signal) pin is 3.3v however the current supplied by that pin is very small and cannot operate with a higher current demand than say an LED.


It sounds like @kamaroman68 is attempting to control a stepper motor directly from the EZ-B. I do not recommend that because the ez-b is a robot controller made to control robot hardware. It is recommended to connect a stepper motor controller to the EZ-B. The EZ-B is for doing robot specific controlling of other peripherals, such as motor controllers and servos.

For experimenting, you could write an EZ-Script to turn on and off the digital ports that would simulate a stepper motor controller - but it would consume a great deal of communication resources and is not a long term solution for a robot.


Thanks for the replies. Just for clarification purposes I am using a stepper motor controller that is normally used in automation, that normally operates via 12-24vdc but requires a pulse counting/ pulse output card in a plc. This controller requires 5 vdc on to produce "up steps" and then no voltage to produce "down steps" To make it step it requires an actual pulse. I called the manufacturer who explained to me PWM will not work with this controller , hence the actual pulsing. I was wondering if the white pin put out 5 volts so I could use that instead of adding resistors. This controller can be found at automation - stp-drv-4035, I cannot make a link to it for some reason. Thanks guys. Chris


No, white is signal only. You can't power anything from that pin. Here's what I would do, buy or build a TIP120 transistor switch. Use the white signal digital pin on ezb to turn it on and off using Rich'so script above. Use an external power supply that will give the correct voltage and run it through the tip switch and attach this setup to your motor. When the script turns on and off the switch your motor should see the voltage as your needed pulse. Hopefully the switch will operate fast enough for your needs.

United Kingdom

To be honest, I wouldn't use my script above. At 10ms between changing state it would clog up the comms and would place a huge load on the PC (plus what DJ said).

If a stepper motor driver wont work with it I would build a small circuit which will do the switching/pulsing of the logic to the pin that needs the pulse. A small 555 timer circuit may be able to do this fast enough and the EZ-B and scripting would only need a simple Set(D0, On) command.


okay, well that makes sense.when you explain it that way my idea will not work. Thanks for the clarity.


@kamaroman68 sounds like you chose the wrong stepper motor controller:) Sorry, there are a few thousand stepper motors that operate without parental supervision (i.e. some pulsing) and only one that requires pulsing. You seem to have selected the one that requires pulsing.

However, maybe that pulsing is the speed that the stepper motor will move? Perhaps the PWM tells the controller how fast to move the stepper? If that is the case then you can use the PWM.

But since this stepper motor is undocumented and foreign to the robot world, it will take some time to get it working


Thanks everyone for the replies, its not so much that I chose the wrong controller, its just the one I had laying around. I used to use these in sputtering machines where the conveyors were used with stepper motors and microstepping to provide ultra precise movement . Yes DJ you are correct the speed of the incoming pulses dictates how fast the stepper moves or in my case "climbs". I am actually using a linear stepping motor. (screw through the center of the stepper motor) I will figure this out. Thanks for the help.


Maybe someone can recommend me a stepper motor that will work in my application? Thanks Chris


Just a quick google produced all of the same results. It seems all these controllers require a 5 vdc pulse to step. Suggestions? Chris


The l298n(2.5A motor controller) in the shop has a stepper motor port. Could this work? It takes 12v I believe.


It would work but requires the code example Rich provided I believe. This code will be bad for comms and other functions of the ezb4. Thanks Chris

United Kingdom

Have a look at 555 timer circuits which pulse an output, if you wired one of these along with the TIP122 based transistor switching circuit to enable the circuit you could have the hard work done by the 555 timer and as far as comms are concerned it would be a sinle On or Off command to the port to enable/disable it.

Something like this may do it;

User-inserted image


Very interesting. Looks like it will work, only thing I don't particularly like is the 2 different voltage sources. 5 volts for the logic and xxx voltage for the motors. I may look into this further though. Thank you very much. Chris


It's very common to have two voltages feeding motor controllers. Most of them have this unless it has a on board voltage regulator.

United Kingdom

Most logic is 3.3v or 5v, the absolute maximum voltages for logic on many ICs is around this range, I haven't seen anything that uses as much as 12v or 24v for logic. I am a little green in this area since I haven't had much experience with controllers etc. though.


To clarify my earlier statement regarding the dual voltages.... I do not like the fact that I will likely have to use a power robbing voltage regulator to drop my 12 volt sla battery down to 5vdc. These regulators in my experience waste power in the form of heat. Hopefully I will be able to add a relay circuit to turn on and off that regulator so it is not constantly draining. I have called tech support at parallax regarding the device. Awaiting a call back. Thanks again


So this question remains open unfortunately. After speaking with the tech at parallax it was stated that the above mentioned controller would only work with unipolar stepper motors. Dang it , I really thought we were on to something. Thanks Chris


I think I am going to try and run my current stepper motor controller with the ezb controller. I realize it will eat comms but it will be used very infrequently. If it does prove too much for ezb I will try the 555 timer method


Thanks robot-doc I looked at that one also. If you use the magnifying glass and hover over the image you will notice that it too requires, a step pulse, an enable, and direction. Im starting to think something like this does not exist. Thanks for keeping an eye out for me! Chris

United Kingdom

I really would advise against using scripts to produce the pulse. It's not just the comms which will become saturated (causing latency in all other controls) but the PC will become very bogged down and unresponsive also. It is certainly not a long term solution.


So I'm going to mark this post as resolved. After getting this to work last night using the code that Rich presented, than modified by myself it has been deemed too slow. It seemed to take 30 minutes to move an inch. I removed both of the sleep commands basically turning D11 on and off as fast as it could and it was still just to slow. So this morning I ordered a simple 12vdc linear actuator from servo city with 10 inches of travel and a no load spped of 1/2 inch per second. Seeing I like the serial control commands I will purchase a third robo claw controller 2x 15 to control it, and use the built in potentiometer to the ezb 4 controller for position feedback. Unfortunately this will force some redesign, but in the end a much simpler alternative. Thanks to everyone that has helped with this project. Chris