Michael <
michael...@gmail.com> wrote:
> Using a Pi and RISC OS, how do I detect the differences in voltages?
>
> This would need to be done programmatically using a SWI or something
> through BASIC?.
You first need some hardware for measuring analogue voltages, as there's no
analogue input to the Pi.
Are the resistors actually connected to power in the car, or do you just get
both ends of them? If there's no power connected, you could try timing a
capacitor charge:
3.3V ---- R (unknown) ----X----- C (known) ------ GND
Connect point X to a Pi GPIO, which you can drive from RISC OS using Tank's
GPIO module. Turn X into an output and take it low for a while, which will
discharge the capacitor. Then turn X into an input (high impedance) and
time how long it takes for the capacitor to charge so that the input is a 1.
Some caveats:
The Pi will have a maximum current it can sink, which will fight against R
(unknown). If the Pi current isn't enough, you'd have to drive X with a
transistor.
You don't know exactly the voltage at which the Pi will switch from 0 to 1.
But you can use other GPIOs to calibrate it - the same capacitor (preferably
one with low tolerance) with known resistors to test against.
The R/C curve is exponential, so you need to do a bit more work in fitting
to it. But you only have 16 points to worry about.
Theo