Glenn
- 10th May 2011, 19:23
I trying to build something and want to read a value from a inbuilt (as in, I can't change it) sensor that have a resistance from 0-500ohm. I am going to use PIC16F887 (with internal oscillator) and have very few pins free, basically just 8 (RE0/AN5) and 9 (RE1/AN7).
pot command does not support such low ohm values, and also, to be honest I have had alot of problems using pot in the past, so I guess using an ADC is better, especially since the free pins actually are analouge too.
So how would I do this ? creating a voltage divider I guess.. but then how do I calculate this ? if I simply build it of the sensor and another 500ohm resistor I going to have a swing of 0-2.5V, thats fine I guess, IF I could put a reference voltage of 2.5V to VREF ? ..but I can't since that pin is used..
If I take like well 10ohms, I get a swing between 0.01-5V, fine but then I get two other problems, it wouldnt be linear at all and the total resistance would in "worst case" be 10ohm, and that would draw 500mA (U/R=I), wich is way too much.
What would the best way to solve this be ? use an OPAMP ? ..would rather not if I can avoid it..
..As I said in the PBP-book thread earlier.. it would be really nice if there was a "cookbook" in how to interface different types of sensors from PBP with different solution for different types.. I would buy such a book without blinking, especially if I dont have to read five chapters of "how you install this really old software on this really old operating system" in the beginning of all books.
pot command does not support such low ohm values, and also, to be honest I have had alot of problems using pot in the past, so I guess using an ADC is better, especially since the free pins actually are analouge too.
So how would I do this ? creating a voltage divider I guess.. but then how do I calculate this ? if I simply build it of the sensor and another 500ohm resistor I going to have a swing of 0-2.5V, thats fine I guess, IF I could put a reference voltage of 2.5V to VREF ? ..but I can't since that pin is used..
If I take like well 10ohms, I get a swing between 0.01-5V, fine but then I get two other problems, it wouldnt be linear at all and the total resistance would in "worst case" be 10ohm, and that would draw 500mA (U/R=I), wich is way too much.
What would the best way to solve this be ? use an OPAMP ? ..would rather not if I can avoid it..
..As I said in the PBP-book thread earlier.. it would be really nice if there was a "cookbook" in how to interface different types of sensors from PBP with different solution for different types.. I would buy such a book without blinking, especially if I dont have to read five chapters of "how you install this really old software on this really old operating system" in the beginning of all books.