LRADC Keyboard Part 1 - Hardware

One of the key features for this generation of the CarPC is the integration with the stock steering wheel controls on my 2008 Honda. This should make using the CarPC while driving much safer, since I'll be able to perform basic control functions without taking my eyes off the road or hands off the steering wheel.

The buttons luckily work on the same principle that the A10 devices commonly use for their hardware buttons, such as Volume and Power. Depending on what button is currently being pressed a different resistance is presented across a pair of wires according to the following table:

None - 10k
Mode - 6k
Next - 2k
Prev - 840
Vol+ - 370
Vol- - 100

Because this setup is so common, the A10 Android source code already contains a driver for using the LRADC0 pin as a keyboard input. I'll get in to the software modifications in the next post, but for now I'll detail my development setup.

The testing circuit is pretty basic. It is basically a voltage divider with a button and an extra resistor in order to mimic the behavior of the stock wiring. Here's the schematic:

All the pins that you will need are located next to each other on U15. The LRADC0 input is pin 41, AVCC is pin 39, and Ground is available on pin 37.

R1 is only necessary since my final setup will have a resistance even when nothing is pressed ("None" above). If you are building your own resistor network then you can omit this and simply have an open circuit when the buttons are not pressed, but it is required in my setup.

AVCC is a regulated 3V source intended solely for use with the LRADC circuits, so it is high precision and low noise. The LRADC pins have a detection range of 0V to 2V. It is safe to feed 3V into the LRADC pin, but it will not be read. In fact, this is the principle behind how the Interrupt-based code works in the A10. Any value above 2V is simply ignored, but as soon as it falls below the 2V threshold an Interrupt fires and the value is reported. This is perfect for my situation, since it allows me to pick a fixed R3 such that 10k falls above this cutoff and 6k is below.

R2 is the placeholder for the resistor presented by the steering wheel controls. For testing I've used various values here, but the important thing is just to mimic approximately what you're final circuit will use.

So that about sums up the circuit. It is very easy to build in a breadboard (see my last post for some tips on breadboarding with the cubieboard). While building it, I would suggest connecting just AVCC and Ground and hold off connecting the LRADC pin until you've verified that the voltage is in the range that you're expecting with a multimeter (wouldn't want to fry the input by feeding it too much voltage).

My next post will go in to details about the software modifications needed to enable the functionality behind the pins. As I mentioned before this is a common use for this input, so really it is mostly a matter of configuring a the driver that already exists.