Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Interfacing PIC to logic circuits

Status
Not open for further replies.

Czinczar

Electrical
Mar 24, 2005
3
0
0
CA
I am using a PIC18F452 to run program controlling a stepper motor and i need to interface a driver circuit to supply the power needed to move the motor. The program works fine and the logic output from the PIC is good. My problems come at the power stage. I have tried the ULN2804A witch is a hex driver that can operate at 50v max and 500 mA max but i cant get any output from it. Then i tried to use the discret components approch. My goal was to inverts the logic signals from the PIC using a DM74LS04N and use it to controls tansistors but the inverter behavied weerdly (some of the pin had 0.88v, other were at 2.8v, other at 4.1). Could a PIC be unable to drive some type of inverter? I am developping on a breadboard, could the signal from the crystal cause noise on the circuit?
 
Replies continue below

Recommended for you

Sounds like this is a relatively small motor as far as power requirements. I am not familiar with interfacing to stepper motors but for standard type motors we almost always used a transistor driver to energize a relay (all on board with the electronics and this energizes a contactor). This affords you some isolation between the motor and the electronics. Some might even use an opto. There should be no reason to invert the logic to make this work (again, maybe steppers have some strange requirements but I dont see why this would be necessary).

You should be able to use normal NPN type transistors (depends on load) on each output of the PIC to drive the load (with appropriate resistors in the base).
 
If you just put resistor pullups (instead of the stepper coils) at the output of the ULN2804 do you see the expected waveforms?

Are you sure that you are working with the right type of stepper for your logic? Unipolar vs bipolar coils?

Inverting the logic? Since you have a PIC you can just invert the outputs from your program.

Too many things that you don't seem to master. It sounds like a school project...
 
I may still be at school, but this isnt a school project. :) With pullups the drivers output are fine. Forget about the inverter, i had to use the both signal, inverted and non-inverted, on the discret components circuit. Its hard to explain without showing you the circuit. The program use bipolar coniguration. Ill stick with the driver. The motor, witch come from a deceased printer, should make steps when i follow this sequence for its four "coils"
0101
0110
1010
1001
(repeat)

Thanks for the help
 
Czin:

Google for ""hook up stepper motors"" and things like it.
There are a huge number of sites that show schematics and explain EVERYthing about these buggers. Here's just one of them from the Embedded Systems Programming an excellant engineering magazine. Note: Figure 8.


The main thing you need to do is puzzle out what kind of stepper motor you've stumbled across otherwise you will let the smoke out of it and have a lot of frustration.
 
Hi,if I remember right the driver is just a darlington array, I cant be bothered to look it up, in which case you can't get bipolar drive, only unipolar. You will also need a fairly high drive voltage and a series resistor in each line to limit the current.
 
Hi-

For a bipolar stepper with the "defunct printer" stepper motor
class, you might wander over to the fine site:



For a bipolar design, you have to have an H bridge circuit.

By going to that link you can find both a circuit and
more importantly the theroy behind it. For the stepper
that I implemented, I used good old 2N2222's and 2K
resistors. Ran it off 12 Volts and drove the logic with
a 16F648A PIC. Runs just fine.

Fun project.

BTW, I'm not affiliated with the univ. of Iowa, nor
professor Jones. He just has a great site for stepper
motors.

Oh, and noise from the crystal will NOT be a problem
with this.


Hope this helps!

Cheers,

Rich S.
 
Thanks for the info guys i found what i was doing wrong. I was mess up between unipolar and bipolar. So with few change to my code i am now able to drive unipolar motor with a darlington driver and will soon be able to drive a bipolar with an H bridge.
 
Cool glad that you figured it out. Just to clarify, you should have no problem running the gate of a FET directly from the PIC. In fact, I am doing that right now with a circuit that I designed. The PIC pins can usually sink between 10 and 25mA depending on which model you get. I am passing 28V and about 4A through each FET when I turn it on (it's a high torque stepper motor). Luckily for me I only have to have it on for about 2 seconds, so heat is not a big issue.
 
Status
Not open for further replies.
Back
Top