Analog ratiometric sensor

I am a mechanical designer. I built a 3d printed tool. But don’t know how to wire it up.
The controller needs to be real small.

I have a “16-bit ratiometric sensor”.
The guy I bought it from (over 5 years ago) said it requires a 9V regulated power supply to reach full 16-bit analog ADC resolution.

It has 3-wires: + (Red); - (Black); and “Signal” (Yellow).

If it matters, the 9V Alkaline battery I used is not new.
It reads 9.05V or 9.06V on my Multi-meter (on different days).

I hooked this battery + to Red wire & - to Black wire.
Multi-meter from Yellow to Black wire reads from -2.52 to -6.57 V .
Multi-meter from Yellow to Red wire reads from +2.45 to +6.75 V.
(Each read separately) Seems very repeatable.

How do I read this with Arduino, even at 10-bit steps?

Possibly a different topic, I really want to read it in 4,000 steps. At least 2048 steps.

For now, I believe 6.5V is too much for Arduino so I haven’t wired it up.

I can read and debounce the rotary encoder and write the reading to my little 0.96" OLED screen but my ignorance is getting the better of me on this.

I hope I don’t have to spend another 2 months learning something else way over my head and I am looking for any help I can get.

AccuStar_I_Series-5482.pdf (325 KB)

Did you read the datasheet? It seems that you have the ratiometric version, so you'll be using the Arduino's ADC, which is 10-bit. (If you had the serial data output model, you'd be using the device's own 16-bit ADC.)

Did you notice that you don't need to use 9v? The datasheet says the ratiometric version can be powered with an input voltage as low as 5v.

In fact, you shouldn't use a 9v battery. If you do, you lose the "ratiometricity." Also, you will damage your Arduino since at certain inclinations your device's output will exceed the maximum pin voltage of your Arduino.

Power the device with the same 5v that powers your Arduino. Connect device and Arduino grounds together. Connect the device's output to an analog pin and use analogRead().

@billharpo, can you show a photo of the device with the part number, or can you tell all the numbers that are on it ? There are 8 different versions of the sensor. The sensor with the red, black and yellow wires seems to be the ratiometric one, as @DaveEvans already wrote.

The ratiometric version requires at least +5V to work according to the datasheet. That means it is already fully functional at +5V. You could do a test and power it with the 5V pin of the Arduino and read the analog signal. The output span seems to be 40%. At 5V, that is 2V output span: 1.5 V to 3.5 V. The Arduino Uno ADC is only 10-bits, for a value of 0...1023. The 40% span will be only 410 steps of the ADC, that is less than 9 bits. In theory that is 0.3 degrees accurate.

When you really want to power it with 9V or 12V, the ratiometric match between the Arduino and the sensor is lost. In that case you must have very good voltages for both the sensor and the Arduino board. For example 9.00 V or 12.00 V for the sensor and the Arduino board should be powered with an external power supply so the onboard voltage regulator makes 5.0 V. You should then use two resistors to make a voltage divider. For example two resistors of 10k or 22k.

All this trouble with 9V or 12V will make it less accurate. If you can make it work with 5V, that would be a lot easier. For more accuracy an external ADC is possible: (not ratiometric, then you need an accurate 5.0V for the Arduino board, thanks @Wawa).

[EDIT] Changed "0.15°C" to "0.3 degrees". The sensor is -60 to +60, that is a span of 120 degrees, my calculation was wrong.

Koepel: For more accuracy an external ADC is possible:

Problem is that an ADS1115 can not be uses as a ratiometric A/D. Leo..

Part# is 02110102-000 I did buy an ADS1115 module for this. But couldn't figure how to use it with this ratiometric sensor. In fact, its the ratiometric nature of this that has me confused. The more I read about using ratiometric sensors, the more confused I get.

The sales engineer I spoke with told me I wouldn't get full resolution below 9V power supply. He told me from 50° to -50° the ratiometric sensor would get better than 0.05° resolution That's why I went with the ratiometric version. He suggested the ratiometric version would out-perform the others for my application.

If I could just figure out how to connect and read these 3 wires. Maybe this dog is just too old to figure out these new tricks?

That is indeed the horizontal ratiometric version.

About sales persons... Well, let me try to put it this way: We are technicians, Arduino-enthusiast, engineers, or at least electronics hobbyists. What we have in common is that we never take for granted what a sales persons tells us. It is a cats and dogs thing.

They had probably a large stock of the ratiometric version that can not be sold. The reason is not hard to guess, it might be due to the same problems that we mentioned in our posts. The sensor part inside is the same for all, so there is no reason that the ratiometric version would outperform the others, that is just plain bull manure. Did you mention that it will be used with an Arduino board and that the Arduino microcontroller/processor runs at 5V or 3.3V ? If you told him that, he was not only full of bull poo, but lying through his teeth as well.

In my opinion the version with Serial Data Output would be easier. It runs at 5V and has the ADC inside the sensor. You would have to write code to retrieve that serial data, so you need some software skills.

The term 'ratiometric' is not hard to understand. It means that the output is relative to the supply voltage. The output is not a voltage but rather a voltage that is a certain percentage of the supply voltage. Suppose a ratiometric sensor output 1V with 5V power supply, then it outputs 0.66V with 3.3V power supply. In both cases it outputs 20% of the power supply. The microcontroller/processor on the Arduino board also measures the input voltage relative to the reference voltage. When both a sensor and the Arduino microcontroller use the same power supply and both are ratiometric, then they match and the measurement is accurate.

Connect the wires and do a small test. Then you know what it can do. Red to the Arduino 5V pin. Black to the Arduino GND pin. Yellow to an Arduino analog input pin, for example A0. Read the A0, convert it to an angle and try to see if you can measure 1 degree or perhaps a little better.

billharpo: He told me from 50° to -50° the ratiometric sensor would get better than 0.05° resolution Maybe this dog is just too old to figure out these new tricks?

That's 2400 steps across the 120 degree range of the sensor. Add the mV/degree sensor sensitivity to that, and this old dog calculates you need a ratiometric A/D with a resolution of 6000 steps. So find an external 5volt A/D with a resolution of at least 13-bit, without internal reference voltage.

The datasheet states a linearity of 0.1 degree for small angles (twice as bad as the sales dude promised). Means that a 12-bit A/D should still be fine (for a 0.1 degree readout). Leo..

I think this is going to work! Thanks for the great advice/support. I hooked it up at 5V to A1 pin and I'm getting about 0.26° resolution from -45° to +45°.

Just messing around, this thing seems to be close to accurate even though I haven't calibrated anything. I don't know why I was afraid to try it at 5V. Seems stable. My bad. Probably be able to do this with a nano + ADS1115 module and .96" OLED. Maybe even an attiny 85! Guess I shouldn't put so much stock in what "Sales Engineers" say!

My 10-bit code:

int sensorPin = A1; int sensorValue = 0; float LastValue = 0; void setup() { Serial.begin(9600) ; } void loop() { sensorValue = analogRead(sensorPin); LastValue = ((sensorValue/102.40) -5.0) * 27.108437; Serial.print("\nValue = "); Serial.print(LastValue, 3); delay(1000); }

The Arduino Nano runs at a lower voltage (diode voltage drop) when powered via a USB cable only. When powered with an external power supply it runs at 5V.

I prefer to write in the code the original numbers and let the compiler take care of things.

You could take many samples and calculate the average. That might increase the resolution further than 10 bits.

My calculation is different than yours ?

int sensorValue = analogRead( sensorPin);
float voltage = float( sensorValue) / 1024.0 * 5.0;   // the voltage at the pin
float degrees = (voltage - 2.5) / (0.40 * 5.0) * 120.0;  // 40% of 5V span is 120 degrees span with 2.5V offset

Using average could be like this:

const unsigned int n = 100;
unsigned long total = 0;
for( unsigned int i=0; i<n; i++)
  total += analogRead( A0);   // addition with integers, no bit gets lost.
total += n / 2;   // half bit correction
float value = (float) total / (float) n;   // average as float, to get extra resolution
float voltage = value / 1024.0 * 5.0;  // convert to voltage

For the half bit correction, see:

If you try the average (it really makes a big difference), show your complete sketch, if possible between code tags: [ code ] and [ / code ] (without the spaces).

It's a ratiometric sensor... Output voltage from the sensor at zero degrees is VCC/2 (maybe not exactly 2.5volt). You shouldn't use 5.0 in your maths line, but just subtract ~512 from the returned A/D value. Then you have an int with positive and negative deviation from zero degrees, that you can scale down to degrees (float) with a multiplication factor. Leo..

@Wawa, because it is ratiometric, using math with 5.0V will result into the correct value. I prefer to calculate the voltage first, so it can be compared with a multimeter at that analog input. The final result has that 5.0V divided out of it in every situation where a ratiometric sensor is connected. In this case even the 2.5V in the middle is correct, because in the calculation it is relative to the 5.0V. In my opinion that is the beauty of a ratiometric sensor. The 5.0V in the calculation works, even if the actual voltage is 4.5 or 5.5V.

Using 512 as the middle and scale the ADC value to degrees is also clear and straightforward.

  int sensorValue = analogRead( sensorPin);
  sensorValue -= 512;   // somewhere in the middle is 0 degrees
  float degrees = float( sensorValue) / (512.0 * 0.40) * 60.0;  // 40% span

I'm not 100% sure that this calculation is correct.

I know the result is the same.
But I think it’s a bit weird to calculate with 5.0volt knowing it rarely is 5volt.

float degrees = (analogRead(A0) - 512) * 0.xx; // could be enough

0.xx being the scale factor.

Edit: Multiple samples, and increasing that ~512 value, and adjusting the scale value, is a good idea.

int offset = 5115; // zero degrees adjust for 10 readings
int total;
float angle;

void setup() {

void loop() {
  total = 0;
  for (int i = 0; i < 10; i++) total += analogRead(A0);
  angle = (total - offset) * 0.02933;
  Serial.print(angle, 1); // one decimal place
  Serial.println(" degrees");

Thank you for all the valuable feedback. I just took the sensor and hooked it up to my UNO R3. I set the sensor level, read it, worked out some simple math to make it read zero. Then read it again at zero, +45 and -45° and worked out a scale factor.

I didn't expect much. I was amazed I was getting repeatable accurate results at 0, +30, -30, +45 & -45° with that simple code I posted. (I used my old drafting triangles).

I knew I'd have to figure out how to take it to the next level, but you guys are making this awfully easy for me. Thanks! Electronics is not in my background and I'm just learning C. At 65 years old, its hard to give up my old visual basic and learn all this new stuff at once.

This sensor is retired and no longer available new. I was hoping to get value out of this $200 thing and I want everyone to know I am grateful for the insight. The guys I work for are not willing to allow a MEMS accelerometer since they feel this is the "proven" technology .

Besides, I've had no luck finding an accurate inexpensive accelerometer for reading inclination ±0.1° that's repeatable and doesn't drift. I have about 10 of them. Only my old Memsic 2125 comes close.