hitechnic Gyro sensor (NGY1044) noise

Discussion specific to the intelligent brick, sensors, motors, and more.
philoo
Posts: 76
Joined: 29 Sep 2010, 09:04
Location: Paris, France
Contact:

Re: hitechnic Gyro sensor (NGY1044) noise

Post by philoo »

mattallen37 wrote:The "5v regulator" does not regulate the voltage, at least it doesn't seem to. Why then is the sensor supply voltage said to be in the range of 4.3v-4.7v? None of MY voltage regulators (lm317, 7805...) have THAT much variance.
(The components references come from NXT schematics included in Hardware Development Kit)
The 5V regulator itself (XC6202P50, U13) is as good as any other. The wide voltage variation of VCC IO comes from current limiter (Q8, Q10 and associated components) that limit current to about 180mA... but also kills voltage regulation precision.
I looked up the "regulators", and they are extremely low dropout, variable "regulators" rated for (I think) 150-500ma (based on specific regulator). The dropout is only like 670mv @ 100ma, based on what little I found. That means that the NXT should run on slightly less than 6v (which seems to be the case, based on my experience).
Actually it's a bit more complex since 5V regulator is fed by a switching regulator (U5) that runs off batteries (this keeps efficiency high).
Philo
nxtreme
Posts: 246
Joined: 29 Sep 2010, 03:53
Location: 192.168.1.2

Re: hitechnic Gyro sensor (NGY1044) noise

Post by nxtreme »

mattallen37 wrote:That means that the NXT should run on slightly less than 6v (which seems to be the case, based on my experience).
I don't want to make this topic go OT, I just want to say that I've successfully run the NXT at voltages down to 5.1v. It might run on lower voltages but that was as low as I have tested it. Of course, this wasn't using motors but it powered up successfully (with low battery icon blinking) and I could navigate around in the menu.

I wonder how many volts I could run it on before it blew up. I know that the motors would most likely give up ~11-12 V but if all the internal electronics are run off of the voltage regulators you could probably run your NXT from a 12v (usually 13-14 V real life) car power supply. Of course, you'd have to deal with power spikes (can sometimes get up to 30-40 V) and the horrible amount of electrical noise involved in cars. I really wouldn't suggest it though... :)
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: hitechnic Gyro sensor (NGY1044) noise

Post by gloomyandy »

Typical! I have four NXTs and I ran my tests on two of them and saw no impact of using motors. However I want to use the gyro on my test robot which is equipped with tracks and is what I use to run tests that require a mobile robot. Guess what when I run the tests using that NXT I do see a drop in the output values when the motors are running... How strange (and annoying!)...

Andy
philoo
Posts: 76
Joined: 29 Sep 2010, 09:04
Location: Paris, France
Contact:

Re: hitechnic Gyro sensor (NGY1044) noise

Post by philoo »

nxtreme wrote:I wonder how many volts I could run it on before it blew up. I know that the motors would most likely give up ~11-12 V but if all the internal electronics are run off of the voltage regulators you could probably run your NXT from a 12v (usually 13-14 V real life) car power supply. Of course, you'd have to deal with power spikes (can sometimes get up to 30-40 V) and the horrible amount of electrical noise involved in cars. I really wouldn't suggest it though... :)
Actually, not so much... The motors drivers, that run directly off battery supply, have an absolute maximum rating of only 10.5V. See the datasheets here for ports B/C and here for port A. As a side note, since the PF receiver motor driver is the same LB1836M chip, the same max voltage applies.
Philo
nxtreme
Posts: 246
Joined: 29 Sep 2010, 03:53
Location: 192.168.1.2

Re: hitechnic Gyro sensor (NGY1044) noise

Post by nxtreme »

philoo wrote:Actually, not so much... The motors drivers, that run directly off battery supply, have an absolute maximum rating of only 10.5V. See the datasheets here for ports B/C and here for port A. As a side note, since the PF receiver motor driver is the same LB1836M chip, the same max voltage applies.
Well, that's nice to know before I go plug my NXT into the car :). I was thinking along the lines of a dash mounted UI of sorts that did something, not sure what yet. Well, maybe I could use some sort of automotive regulator (like the LM2937). Thanks though!
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

Re: hitechnic Gyro sensor (NGY1044) noise

Post by aswin0 »

Back to the gyro.

I found out that there is a strong relationship between the battery level and gyro offset. When battery power drops, the gyro offset drops as well.

Below is a graph of the relationship. In mathematical terms the relationship is: offset= 0.004981 * mVolt + 558.7103. In plain english this means that if the battery power drops with 0.2 volt the offset off the gyro will drop with 1 degree. In some cases this is enough to make corrections usefull.
voltageVersusOffset.jpg
voltageVersusOffset.jpg (37.68 KiB) Viewed 15306 times
Some words about the experiment. I used a stationary NXT with a Gyro and two (port A and C) free running motors attached. During 4 minutes samples were taken of the gyro, motor power and battery level. A sample was taken every 5 mSec. I ended up with 34649 data points (some points were lost due to blue tooth). During this time different levels of (uncontrolled) motor power were applied to both of the motors. The motor power levels ranged from -100 to 100 in steps of 10. Every ten seconds a new power level was selected.


A disclaimer:
There is not only a strong relationship with battery level and offset but also with motor power and offset. This is obvious as the motors cause the power drop in the first place. So why am I so sure that the power drop is the cause of offset drop, and not the motor power? Well, to be fair, I am not sure at all. One needs another experiment to find out.

Another disclaimer:
I have assumed the relationship between power and offset is lineair. I do not know if that is true for the full power range.



Samples were not logged on the NXT but sent straight away to excel over bluetooth with NXT2excel.
My blog: nxttime.wordpress.com
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

are there gyros which are working e.g. by I²C and which are not affected by power fluctuations as we have it normally on a driving robot?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: hitechnic Gyro sensor (NGY1044) noise

Post by mattallen37 »

There may be an I2C type board, but all the gyro chips that I have seen, are analog. Probably the best way to have it more "isolated" would be to use an I2C ADC, and use some pretty good voltage regulating.

I use 7805s a lot, but even they pass through noise. Probably the best thing I have come up with to silence this, is an audio transformer with the 8 ohm side shorted, and a resistor and capacitor across the 500 (or 1000) ohm side. I put that in series with the power input of the 7805, and it seems to make it really quiet. I also usually put a large capacitor in parallel to the input, and another in parallel with the output.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: hitechnic Gyro sensor (NGY1044) noise

Post by gloomyandy »

The noise we are getting here is interesting. It's worth noting that it is very small (1 in 1024) which in most cases is not really an issue. The problem here is that because we often want to integrate the output from the gyro any noise (particularly a bias), will cause a big impact on this...
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: hitechnic Gyro sensor (NGY1044) noise

Post by HaWe »

I again was reading through this thread -
I probably missed something, but has anybody got a code (C-like) in order to
- calibrate the Gyro at the start of the program (until offset doesn't change), using a float GyroOffset
- using that float GyroOffset for calculating the Gyroheading out of SensorHTGyro(port, GyroOffset) ?

I tried it several times by my own, but I slowly dispair, I don't get it managed... :(
(well, it drifting just very slowly, but it's still drifting! :evil: )

(and yes, a voltage correction is still missing!)

Code: Select all

//--------------------------------------------------
// IO functions, sensors
//--------------------------------------------------

#define Menc(a) MotorRotationCount(a)

#define Beep(f,d) PlayTone(f,d)

#define printf1( _x, _y, _format1, _value1) { \
  string sval1 = FormatNum(_format1, _value1); \
  TextOut(_x, _y, sval1); \
}

const char LCDline[]={56,48,40,32,24,16,8,0};

const string clrln="                 ";

inline bool btnhit(){
   return ( ButtonPressed(BTN1, false) || ButtonPressed(BTN2, false)
         || ButtonPressed(BTN3, false) || ButtonPressed(BTN4, false));
}


void PressToContinue(char Button) {
   string msg;
   if (Button==BTNCENTER)   msg="press BtnCntr...";
   else
   if (Button==BTNEXIT)     msg="press BtnExit...";
   else
   if (Button==BTNRIGHT)    msg="press BtnRight...";
   else
   if (Button==BTNLEFT)     msg="press BtnLeft...";

   printf1(0,LCDline[7],"%s", msg);
   while (!ButtonPressed(Button, false)); while (btnhit());
}

//--------------------------------------------------
// math
//--------------------------------------------------

#define min(a,b) (a<b?a:b)

#define max(a,b) (a>b?a:b)


inline long round(float f)
{
  if (f>=0) return (f + 0.5);
  else  return (f - 0.5);
}

inline long ArrayMedianI(int src[], int len)
{
  int temp[];

  ArraySort(temp, src, NA, NA)
  return temp[(len-1)/2];
}


inline void ArrayPushI(long &src[], long _new, int len)
{
  for (int i=len; i>0; --i) {src[i]=src[i-1];} // shift up
  src[0]=_new;
}


//--------------------------------------------------
// sensors
//--------------------------------------------------

#define GYRO    S2
#define COMPASS S3

long  GyroHeading, GyroOffset=5.0, GyroValue, GyroIntegral,
      CompHeading, CompOffset,
      MencHeading ;


//--------------------------------------------------
// sensor calibration
//--------------------------------------------------



void GyroOffsetCalibration() {
  int temp;
  temp=0;                                 // 1st approximation of Gyro Offset
  for (int t=1; t<=200; ++t) {
     temp=SensorHTGyro(GYRO, GyroOffset);
     Wait(20);
     temp+=temp;
  }
  GyroOffset=GyroOffset+round(temp/200);
  Beep(400,100);
}

//------------------------------------------------------------------------------




task GetRotation(){

  long gyrodata[3], temp, d=1, GyroCalib=10400;
  
  CompHeading=CompOffset=SensorHTCompass(COMPASS);

  GyroOffsetCalibration();           // 1st approximation of Gyro Offset
  GyroOffsetCalibration();           // 2nd approximation of Gyro Offset

  temp=0;
  GyroIntegral=0;

  while (d) {                        // wait until GyroIntegral doesn't change
    GyroValue= SensorHTGyro(GYRO, GyroOffset);
    GyroIntegral+=GyroValue;
    d=abs(temp-GyroIntegral);
    temp=GyroIntegral;
    Wait(1000);
  }

  Beep(200,100);
  
  while(1) {
     ArrayPushI(gyrodata, SensorHTGyro(GYRO, GyroOffset), 3);
     GyroValue= ArrayMedianI(gyrodata, 3);
     GyroIntegral+=GyroValue;
     GyroHeading=round(GyroIntegral*360/GyroCalib);

     if (ButtonPressed(BTNLEFT, false)) {   //  press  BTNLEFT:
        GyroIntegral=0;                     // reset GyroIntegral
        while (!btnhit());
                                            // now turn robot 360°
     }                                      // then press BTNRIGHT:
     if (ButtonPressed(BTNRIGHT, false)) {  // reset GyroCalib after 360° turn
        GyroCalib=abs(GyroIntegral);
        while (!btnhit());
        GyroOffsetCalibration();
     }

     while (GyroHeading>360) GyroHeading-=360;
     while (GyroHeading<  0) GyroHeading+=360;
     
     CompHeading=SensorHTCompass(COMPASS);
     
     Wait(20);
  }
}

task DisplayValues() {
  while (1) {
     printf1(0, 56, "mot_B%6d", Menc(OUT_B));
     printf1(0, 48, "mot_C%6d", Menc(OUT_C));

     printf1(0, 40, "GValu%6d", GyroValue);
     printf1(0, 32, "GIntg%6d", GyroIntegral);
     printf1(0, 24, "GOffs%6d", GyroOffset);

     printf1(0, 16, "MotoH%6d", MencHeading);
     printf1(0,  8, "CompH%6d", CompHeading);
     printf1(0,  0, "GyroH%6d", GyroHeading);
     Wait(10);
  }
}



task main(){

  SetSensorHTGyro(GYRO);
  SetSensorLowspeed(COMPASS);


  start DisplayValues;
  start GetRotation;

  
  


  while(1);
}

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests