Categories
Uri_ba's pit

Road to FCC, Part III – ADC and all the bits it involves.

FCC3 is basically there to get us as close as possible to the F-16 Stick. But it was always restricted by what the Cougar electronics allows you to do. I could build an equivalent and take it up a notch by giving a little bit more on the HW side. We’ve decided to start by addressing the much sought out buzz word “resolution”…

you might have heard about joysticks with “14 bit resolution” or “8 bit resolution”. in this post I’ll try to explain a bit about this and how does it affect us.

Analog to Digital conversion

Cougar is an old 8 bit cat. It was born in an era where it was enough. However, FCC3 is a precision instrument and in deserves it.

so let’s talk about it for a bit.

Joystick is a mechanical thing, it moves (or doesn’t) but in our universe “things” are always analog, there is never just true or false, 0 and 1. there is always a middle. So in order to work a joystick must have a range of values,  not just the extremes. but how can you translate the Analog input, to digital output? as the computer is digital and only understands 0&1.

The ADC helps us with that, it measures voltages between two voltage points, in our case between 0V (GND) and 5V (Vcc/Vref) and assign a digital value for them. it translates the 0-5 range to bits, and the more bits you have the better the resolution is. In 8 bits, the 5V range will be evenly divided to 256 values, or roughly 19mV (0.19V)per unit. with a 10bit ADC converter you get 1024 values, 4 times the resolution, or slightly less then 5mv (0.0048V) per “unit”.
Bump it up to 12bits, and you have 4 times the resolution again with 4096 available values.

why do I need this resolution you ask? surely your arm is not this precise, you can’t really expect all this to be useful can you?

Well, the answer is “Yes, you are correct” and “No, you need to have higher resolution” in the same breath. As the person operating it is just one element in the equation.

The Mechanical limits

So in a perfect world on a perfect device, a center will be a perfect 2.5V and the full deflection will be 0V and 5V. But we are never in a perfect world. let’s ignore the electrical stuff, and look just at the mechanical aspect of the joystick.

let’s start with an 8 bit ADC.

The machanical device in work is a potentiometer, which is basically a variable resistance resistor. most Potentiometers have a movement range of 90 degrees. so a 90 degrees will cover 0 to 255. but the joystick doesn’t move on all this range. let’s say it moves 30 degrees to each direction, so 60 degrees in total.  so in a heartbeat the actual output range is now about 170 units. which are 85 units per direction, or about 0.5degree per unit.

Now let’s change only one variable. the ADC is now 10 bits (which is a standard Arduino Built-in ADC).

10bit gives us 1024 “units” of resolution.  so a full deflection will be from 0V to 5V or from 0 to 1023.

so now, the 30% loss of resolution puts us at about 682 units of output range, 341 per direction and that is about 0.088 degrees per unit. do you see the difference  here? the range we have available in the limiter range is more then we have in the full 8 bit range.

The Electrical limit

same as with the mechanical, there are losses here too. voltage is never 0-5V, especially if you are dealing with high amplification things like strain gauges or Hall sensors. Those will usually output 0.5-4.5 volts range, as the internal OpAmps usually does not allow Rail-to-Rail (usually becaue of the large amplification needed. for example the MLX90316 is a 360 degrees rotational Hall effect sensor. it has a few models, the basic of them will output 0.5-4.5V on the whole 360 range, which means you only get 1V per 90 degrees, and when your say throttle has 66 degrees of travel, good luck using low res ADC.

Fortunately, some Hall sensors will usually have a built in ADC and will be able to output directly in digital values of up to 16bits (model dependent) instead of a needing to go via another ADC. (another type of MLX90316 works like this).

So what’s all this means?

We’ll simple.
while the Arduino ADC is more then enough with its 10 bit of resolution, I decided to opt for an external 12bit ADC to read the FCC. The resolution overhead will allow more room for manipulation on the output (for example sensitivity, and will still allow me to have more values that a 10bit ADC will use and then use a 10 bit value on the output to the computer.

Leave a Reply