PDA

View Full Version : 0 - 10V input on PIC 16F876



slayerizer
- 7th February 2008, 15:02
I have 8 Digital Inputs, and 8 Analog Inputs... I figured out the digital ones, but I need to make those Analog inputs a 0 - 10 Volt input, instead of 0 - 5V...
I read, if I exceed the internal Diode limit in the PIC of say what, 500 Microamps, the PIC will fail... but say I exceed it, is it possible to make a 10 volt input in the PIC on a different way...
I read something about a zenerdiode, maybe that helps???
thanks

Charles Linquis
- 7th February 2008, 15:12
Use two resistors in series (in the 4K ohm - range) as a voltage divider. Connect the PICs A/D input to the junction. That way, your PIC will see an input of 0-5V.

Kamikaze47
- 7th February 2008, 16:10
Charles hit the nail on the head.


0-10v input ----------+
|
_|_
| |
|R|
|_|
|
|
+--------- PIC ADC Input (0-5v)
|
_|_
| |
|R|
|_|
|
|
|
Ground

Ioannis
- 7th February 2008, 20:14
There are two good links on the matter thanks to Darrel:

http://www.picbasic.co.uk/forum/showthread.php?p=2010

http://www.pbpgroup.com/modules/wfsection/article.php?articleid=25

Ioannis

slayerizer
- 8th February 2008, 07:21
thank you :D actually it seems quite obvious, why didn't I think of it, but thanks...
but what if I want to use the 0 - 10 volts as an output...
it only sends out 0 - 5 volts...
is there some kind of transistor that when the base opens in the range of 0 - 5V, the transistor slowly opens, and sends out (from collector to emitter) a range of 0 - 10Volts... or is there another way??

Acetronics2
- 8th February 2008, 08:21
Hi,

a little search on this forum could have raised Our Friend Darrel had designed a more than fair tool for such voltage dividers calculations.

and overall some idiotproof items included ...
...

Alain

Ioannis
- 8th February 2008, 08:46
but what if I want to use the 0 - 10 volts as an output...
it only sends out 0 - 5 volts...
is there some kind of transistor that when the base opens in the range of 0 - 5V, the transistor slowly opens, and sends out (from collector to emitter) a range of 0 - 10Volts... or is there another way??

What do you mean? Take as an input 0-5 and output 0-10Volts?

Ioannis

slayerizer
- 8th February 2008, 14:34
the PIC only sends out 0-5 volts, but the PC needs to receive 0 - 10 volts... just like its sends 0 - 10 volts...
how can I send a signal of 0 - 10 Volts to the PC, when I use a PIC that only sends out 0-5 volts..

skimask
- 8th February 2008, 15:33
the PIC only sends out 0-5 volts, but the PC needs to receive 0 - 10 volts... just like its sends 0 - 10 volts...
how can I send a signal of 0 - 10 Volts to the PC, when I use a PIC that only sends out 0-5 volts..

So.......
Are you trying to make a digital output (0 or 5v) from the PIC into an analog (0-10v) output to the PC? Why would a PC need to receive 0-10v? (I smell an RS232 question coming up in the next reply)
For what reason? A PC doesn't usually have an A/D converter on it...at least not one that the average joe can use with any success...unless you've got a PCI/ISA D/A card of some sort.

krohtech
- 8th February 2008, 17:10
A lot of older theatrical dimming systems used 0-10V as a dimming reference. Is this what you want to do? You could use a DAC chip from MAXIM. How much current do you need to source?

Ioannis
- 9th February 2008, 11:18
the PIC only sends out 0-5 volts, but the PC needs to receive 0 - 10 volts... just like its sends 0 - 10 volts...
how can I send a signal of 0 - 10 Volts to the PC, when I use a PIC that only sends out 0-5 volts..

That is an easy thing to do with an op-amp and a gain of x2. Use on like LMC66x series that are rail to rail capable.

Now as skimask stated, why a PC would need 0-10Volts?

Ioannis

slayerizer
- 11th February 2008, 09:44
thanks you all, I'll manage it from here...
I was mistaken by saying I needed the 0 - 10 volts to send to pc, i am making an IO Board, that can be controlled by the PC, the analog output (0 - 10V) of the PIC will be used for controlling, what ever I want to make on that IO board...

Found info about a IO-Warrior24, that is quite similar to what I am making.

anyhow, I'll try the op-amp... that'll probably work

Robinzon Kruso
- 11th February 2008, 10:33
Charles hit the nail on the head.


0-10v input ----------+
|
_|_
| |
|R|
|_|
|
|
+--------- PIC ADC Input (0-5v)
| |
_|_ |
| | __
|R| / 5V
|_| /\
| --
| |
| ________ |
Ground

You should make sure that more than five volts not to be loaded to microcontrollers pin otherwise it could become foul. For example if for any case you have more than 10V as an input you will get more than 5V on the resistor and on PIC as well, so it is not bed to think about some zener diode on PIC ADC input. Or maybe is better to use a scheme with comparator LM239 which will sharply cut any voltage bigger than Vcc ref+ loaded on pin 6 of LM239.

Regards

slayerizer
- 12th February 2008, 07:27
ah, yes, I see.... if the voltage over the pin exceeds 5 V, the zener will pull the pin to 0...
it is yet a prototype, but when I make a final design, I should probably add it for safety...
thanks...
I think my prototype is ready for testing, Thanks all

Dave
- 12th February 2008, 12:55
slayerizer, The zener does not pull the pin to 0 volts but, starts to conduct at the breakover voltage it is designed for. It will then maintain that voltage as long as the power of the component is not exceeded. In other word it is acting as a limiter....

Dave Purola,
N8NTA

Ioannis
- 12th February 2008, 13:44
...

In other word it is acting as a limiter....



Yes but not like a switch! It is like a normal diode in characteristics slightly steeper. But has a knee. That means if voltage is increasing above about 4,3Volts the zener might start to conduct and spoil the readings of the ADC.

I may have not stated correctly in engineering terms. If anyone with native english understood, please help here.

Ioannis

Melanie
- 13th February 2008, 06:11
http://www.picbasic.co.uk/forum/showthread.php?t=6809

Post # 19

Ioannis
- 13th February 2008, 08:22
OK. That's it. Thanks Melanie for the help.

Ioannis

slayerizer
- 14th February 2008, 07:25
well, I'f tested it, and it works pretty wel...
the zener will be added, as I saw the disadvantage of it when not using. even though the problems facing when using the zener, the voltage never exeedes 10,7 volts because, so... it'll work :)
thanks