# Voltage regulation of 1.23V

Hi Everyone

How should i get a 1.23V Vref for my LPY5150AL gyro? I am using the Arduino-Uno

Regds Sam

LPY5150AL has an internal 1.23V reference. This is available externally on the vref output pin from the chip so this is not something you supply.

When used with an Arduino, you can power the chip with 3.3V. Use 3.3V as external analog reference for the Arduino and read vref and gyro oututs from the chip. The analog value obtained from vref should be subtracted from the analog values read from the gyro outputs as this is your zero (no rotation) reference.

Thanks Ben, so in other words, vref is an output of the gyro, that is connected to any analog input pin on the Arduino If i understand you correctly, i must connect 3.3V to AREF? But is this necessary as the 3.3V itself is obtained from the Arduino Uno pin?

Should the code be as follows analogReference(EXTERNAL);//AREF connected to 3.3V const int zpin = A1; const int xpin = A2; const int analog_ref=A0;//Is connected to VREF on gyro int wx = (analogRead(xpin)-analogRead(analog_ref)); //But how do i map wx to deg/sec? The documentation for analogRead says that it maps, input voltage from 0-5 to 0-1023? But is my range 0-3.3? I think the datasheet for the gyro mentions 1deg/sec maps to 1/1500 Volts

Thanks Sam

The documentation for analogRead says that it maps, input voltage from 0-5 to 0-1023? But is my range 0-3.3? I think the datasheet for the gyro mentions 1deg/sec maps to 1/1500 Volts

0-5vdc for 0-1023 counts is the default range for arduino analogRead statements. However if you change the reference to EXTERNAL and wire a 3.3vdc voltage to the Aref pin your analog Read range will become 0-3.3vdc = 0-1023 counts.

http://arduino.cc/en/Reference/AnalogReference

Lefty

The documentation for analogRead says that it maps, input voltage from 0-5 to 0-1023? But is my range 0-3.3?

If your arduino runs off 3v3 then it maps, input voltage from 0-3.3 to 0-1023.
Or if you connect any voltage to the Aref (and switch to it in software) then it maps, input voltage from 0-Aref voltage to 0-1023?

Note Aref must always be below the chip’s supply voltage.

So is the code fragment that i posted correct? How do i go from a count of 0-1023 to units like deg/sec?

You need to first convert the raw analogue read value to a voltage, and then convert the voltage to a temperature reading. Don’t forget to use floating point values or you will get odd results. Then you need to record the temperature at some fixed time interval to work out the degrees / second figure you want.