I need to sample a 12v signal with a PIC...

Hello, Sorry to be a nuisance but I'm afraid I'm a little stuck. I need to sample 12v signals with a PIC uC. I'm not an engineer nor do I pretend to be, and if I don't know the answer, or how to find it I ask :)

Anyway, I'll tell you the reason I need to do this. I need to decode stepper motor phases. I've already written most of the firmware for the uC, and I know how to implement the rest of the device bar this 12v matter. It's a one-off thing for my own interest (initially anyway) so the simpler the better. by simpler I mean cheaper.

Any help with this would be greatly appreciated. Thankyou in advance to all those that do.

Tristan.

--
-----> http://members.dodo.com.au/~izabellion1/tristan/index.html
Reply to
Tristan Mumford
Loading thread data ...

Could you provide a bit more information on exactly what you are trying to do?

It sounds like you have a stepper driver and wish, for some reason, to detect (measure?) the voltages going to the motor coils.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
 Click to see the full signature
Reply to
Spehro Pefhany

The usual method to sample voltages above the power supply level (and reference voltage) is to use a voltage divider. You can probably find more information on this by doing a web search, but basically it is just 2 resistors connected in series. The voltage at the contact between the resistors is a fraction of the original voltage according to the value of the resistors. For example, if you connect a 10K resistor to the high voltage and a 5k resistor to ground, the voltage at the contact of the 2 resistors is 1/3 of the original voltage (5/(10+5)). Of course, like any ADC connection, you may need capacitors to control noise and must take into account the amount of current used by the ADC in setting the value of the resistors.

Reply to
Gary Reichlinger

If you only need to sample the presence or absence of the stepper phases or polarity, just put a 22K series resistor in line to the PIC pins. Most of the PIC pins have internal diodes to Vdd and Vss. The resistor just limits the current in the diodes. Check the data sheet to be sure that the pins you are using have both the diodes. The limiting resistor makes such sampling even good for 115VAC if you use a 5 Meg resistor.

Don

Reply to
Donald Harris

Sure. I might as well say exactly what it is. As people may or may not be familiar with, the apple ]['s disk ][ controller provides fairly raw signals to the floppy drive. I'm making an interface for connecting a 3-1/2" PC floppy drive to the preexisting controller. It is intended to be a drop-in replacement. Essentially no skills required to install and no firmwar patches etc needed for it to work. Although a special formatting program will be required.

My initial idea was to modify a preexisting 3-1/2" drive. However i quickly discovered it was impossible because the 5-1/4" drives use unipolar steppers, and the 3-1/2" drives use a bipolar stepper.

The uC logic handles the directional translation to direction and step signals, and a few other features.

So anyway, the firmware is mostly done. it needs optimising before it will be usable though. There is a usable amount of time to do the processing and step the 3-1/2" drive's head.

I hope this answers your question.

Tristan.

--
-----> http://members.dodo.com.au/~izabellion1/tristan/index.html
Reply to
Tristan Mumford

Oh yeah. That makes sense. I've worked with analog, and digital, but have never really known how to combine the two :)

I guess i should shoot for the lowest reliable current though. Still that's dead easy, small and cheap. thanks for that!

--
-----> http://members.dodo.com.au/~izabellion1/tristan/index.html
Reply to
Tristan Mumford

That i would have to check. It's been a while since I've used a 16f628a. Most things have been on somewhat larger uCs, but anything bigger would be overkill.

True enough about the current limiting. It's the difference between a sample and a barbecue.

Thanks for your help!

--
-----> http://members.dodo.com.au/~izabellion1/tristan/index.html
Reply to
Tristan Mumford

The only I/O pin on the PIC16F628A that doesn't have both protection diodes is the RA5/MCLR* pin. It only has the one to Vss.

Be careful of voltage dividers. If the ground connection is lost, the magic smoke tends to escape and things don't work after that.

Don

Reply to
Donald Harris

... snip ...

Also watch out for the capacitance of the input pin. Using the 22k suggested above (22 x 10e3) and a capacitance of 5 pf (5 x 10e-9) the time constant is 100e-6, or 100 uS. For a 12 V signal to rise to 1/3 will take about 1/3 the TC, or about 30 uS. Also, slow rise times on input pins play havoc with internal logic and power dissipation. A divider is probably better controlled.

--
 
 
 Click to see the full signature
Reply to
CBFalconer

Is getting ones Pico and Nano farads confused, as bad, or worse, than top-posting ? ;)

-jg

Reply to
Jim Granville

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.