Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading a voltage on 2 lines using a Pi

16 views
Skip to first unread message

Michael

unread,
May 21, 2013, 8:49:53 AM5/21/13
to
Hi Guys,

As a part of my pet project, I have finally got fed up with the full blown keyboard in my car, and I would like to use my Rover 75's steering wheel audio controls.

They communicate through 2 wires, with a different resistor for each button in between as described below:

http://i1228.photobucket.com/albums/ee456/bandk56/car/09.jpg

My brother has used a voltmeter to test the different voltage levels when fitting his radio.

So my question is:

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?.

Cheers

Michael

Michael

unread,
May 21, 2013, 9:00:19 AM5/21/13
to
Hi again,

If anyone wants to point out the stupidly bleedin obvious point that Dave Higton's multimeter app, I just saw it :@P.

I will take a look at this :@)

Cheers
Michael

Theo Markettos

unread,
May 21, 2013, 1:00:45 PM5/21/13
to
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
0 new messages