Arduino Forum

Using Arduino => General Electronics => Topic started by: aerosam on Feb 16, 2011, 12:00 pm

Title: Voltage regulation of 1.23V
Post by: aerosam on Feb 16, 2011, 12:00 pm
Hi Everyone

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

Regds
Sam

Title: Re: Voltage regulation of 1.23V
Post by: borref on Feb 16, 2011, 03:32 pm
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.
Title: Re: Voltage regulation of 1.23V
Post by: aerosam on Feb 16, 2011, 06:18 pm
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





Title: Re: Voltage regulation of 1.23V
Post by: retrolefty on Feb 16, 2011, 06:23 pm
Quote
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
Title: Re: Voltage regulation of 1.23V
Post by: Grumpy_Mike on Feb 16, 2011, 06:25 pm
Quote
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.
Title: Re: Voltage regulation of 1.23V
Post by: aerosam on Feb 16, 2011, 07:29 pm
So is the code fragment that i posted correct?
How do i go from a count of 0-1023 to units like deg/sec?
Title: Re: Voltage regulation of 1.23V
Post by: Grumpy_Mike on Feb 16, 2011, 07:33 pm
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.

Need more information about your project to be more precise.
Title: Re: Voltage regulation of 1.23V
Post by: borref on Feb 16, 2011, 09:13 pm

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

It looks about right.

You need to work out the ratio of degrees to voltage from the gyro datasheet. Your readings (with a 3.3V external reference) would be V = (Ax - Vref) * 3.3 / 1024 and then you multiply this with the degree to voltage ratio to get what you ask for.
Title: Re: Voltage regulation of 1.23V
Post by: MarkT on Feb 17, 2011, 12:53 pm
If you also connect the Vref from the sensor to another analog input pin you can read the voltage reference and calibrate the other readings from it.  Then you don't need to calibrate for the individual 3V3 supply on the Arduino (which is not high accuracy).