Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Fastrax UP501 Cold fix tooks too long. on: November 24, 2012, 11:33:44 am
Update:

I remove the DHT11 library (in order to have more free memory) and still couldn't get a fix.
I put some cables on the GPS and remove it from the "board" for around 3 cm. And -voila-, GPS fix in 46 seconds.
2  Using Arduino / Networking, Protocols, and Devices / Re: Fastrax UP501 Cold fix tooks too long. on: November 23, 2012, 09:28:29 pm
I mean that I know that is overloaded, but I guess that as it's working (or at least, it was working) without any problems, it's ok.

But tomorrow (as it's almost 4:30am here) will try to remove some libraries, to check if that's the problem.


Thanks and goodnight,

Antonis.
3  Using Arduino / Networking, Protocols, and Devices / Re: Fastrax UP501 Cold fix tooks too long. on: November 23, 2012, 08:40:45 pm
It's marginal but it (was) working good  smiley-razz
4  Using Arduino / Networking, Protocols, and Devices / Re: Fastrax UP501 Cold fix tooks too long. on: November 23, 2012, 07:28:10 pm
Does it take 20 minutes every time? There is a lot of data that needs to be obtained from the satellites, but this only needs to happen each time a new satellite is encountered. The first time that you turn a new GPS on it takes a while to get all the data, because the GPS has never seen any of the satellites it is now finding.

Have you somehow programmed the GPS to not remember this data?

I just checked the settings. Nothing is saved and nothing is forced right now to the GPS. It just receives NMEA data.

BUT when I put it away (10cm) from the board, it looks that the GPS fix tooks just 40" (ok, that's normal). My current problem is that I need to go out with the laptop for debugging NMEA output, to see if everything works OK. (I have on the arduino a led to lit when GPS fix is present, and then save the data on SD. The led works, the SD recording not, but I don't know if it's a SD failure).
5  Using Arduino / Networking, Protocols, and Devices / Re: Fastrax UP501 Cold fix tooks too long. on: November 23, 2012, 06:16:44 pm
Quote
It works OK, but it tooks TOO LONG for GPS fix. For example, today it needs more than 20' for fix.
Twenty feet for a fix doesn't sound bad at all.

20' (minutes) I guess are is too long period of time.

Quote
Quote
The software I guess is not a problem (as it works excellent, except the fix time).
Worth looking at it, anyway.

Here it is.

By the way, I will try to move the GPS 10cm away from the arduino/board, to see what's going on (maybe noise?)...
6  Using Arduino / Networking, Protocols, and Devices / Fastrax UP501 Cold fix tooks too long. on: November 23, 2012, 02:50:19 pm
Hello.

In my project, I have installed a Fastrax GPS (UP501).
It works OK, but it tooks TOO LONG for GPS fix. For example, today it needs more than 20' for fix.
I check with my 2 handheld GPSes (at the same position) and I had great reception (>7 satellites).

The hardware of the project consists of an ADXL345, the GPS, a SD card module and an Arduino Nano. They are powered from a 2 cell LiPO and a 7805 voltage regulator. While I'm testing I have no case. (Of course I have the GPS outdoors, for sky view.).
The software I guess is not a problem (as it works excellent, except the fix time).

Any ideas why it is sooooo slow?
What's your fix time? How long is normal?
7  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 11, 2012, 11:27:24 am
Updated code:

Code:
 accel.setFullResBit(1);
  accel.setRangeSetting(8);

..
..

  int *x,*y,*z;
  accel.readAccel(x,y,z);  
  xyz[0]=(*x*0.0078);
  xyz[1]=(*y*0.0078);
  xyz[2]=(*z*0.0078);

(0.0078 = 8/(2^10) - I guess that's correct for scaling 8Gs ? Is it?
8  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 10, 2012, 10:47:30 am
with setRangeSetting you are setting the upper (and lowest) limit. because the value are 10bit (form 0 to 1024), changing the limit also change the precision of the reading...

with limit of 2, a read of 512 (zero)+(512/2=256) is 1G. BUT at limit 8, 1G it is 512+(512/8=64)

(value are just example, they can be wrong. for example, al 16G the sensor can use 16bit precision.

That means after reading the values (I'm using this library) I have to convert them?

Here is reading procedure of the library:

Code:
void ADXL345::get_Gxyz(double *xyz){
  int i;
  int xyz_int[3];
  readAccel(xyz_int);
  for(i=0; i<3; i++){
    xyz[i] = xyz_int[i] * gains[i];
  }
}

It looks like it multiplies the result with gains (for the 3 axis). I need to do further calculations, like the ones you suggest?
9  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 10, 2012, 07:17:04 am
Question:

To measure G forces, I'm using that code:

Code:
#include "ADXL345.h"
ADXL345 accel;

...

  accel.powerOn();
  accel.setFullResBit(1);
  accel.setRangeSetting(8);
  accel.get_Gxyz(xyz); 

Is it correct? When I'm changing from 8 to 2 or to 4 for example, I get different readings. I just want the upper limit to be more than 4 Gs.
10  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 08, 2012, 05:43:56 pm
gps have 2 meter radius precision AND normally 1 or 5 Hz output... i don't think it is enough.

Low-cost GPS have up to 10Hz sampling rate. The precision is about 2 meters (WAAS/EGNOS-enabled), but -if I'm not wrong- that's not affecting the results. If it's 2m, it will be also 2m here (sample #1) and 2m there (sample #2). So the results will be -almost- the same...
11  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 08, 2012, 05:33:44 pm
OK, now I get it.
So, no low-cost gyro can provide what I need.
So, bye bye angle-meter smiley
12  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 08, 2012, 04:30:28 pm
You cannot measure bike leaning with only an accelerometer.  The vector will always be straight down with respect to the bikes axis.  A cheap gyro cannot do much better in the real world on a full size bike.  Because of all the vibration.  Using GPS only you can measure G-forces because you know the radius and speed.  The code for this is complex.  Questions?

I get it smiley
So I have to keep the accelerometer for the G forces, and a 3ple axis gyro for the leaning...
The vibrations are not too much (I guess). Running on a track, with a "street" bike...

Thanks.
13  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 06, 2012, 06:29:22 pm
without a gyro you can only know your inclination on lateral axes, because (hopefully) they are not influenced by acceleration

Thats the axis I want to know for bike leaning. Just left & right degrees.
And the Gs on acceleration, brakes, left leaning, right leaning. So I can see what forces and what angle the bike has..
14  Using Arduino / Sensors / Re: ADXL345 information/help/problem/guidance etc :) on: November 06, 2012, 05:25:55 pm
Quote
It will log the acceleration (in Gs) on X/Y/Z axis and the angle (in degrees) on X & Y axis

They are one and the same. No point in storing the angles.

Quote
Is it normal?

Yes. Your acceleration on X/Y is being combined with the gravity (-1g on Z).

Now I get it, thanks.

So the problem now is how to seperate the leaning (on one axis, left/right) of a bike from total acceleration? With a second accelerator or something else?

Ultimatley I found that I could not interpret the data in a way that I could translate to faster lap timers so I build a lap timer instead - you can quickly gain a few seconds around the track with the instant feedback a lap timer provides.

Anyway, its all in the link

Duane B

rcarduino.blogspot.com

I have already found your site some days ago. I don't want to get lap times right now. What I need is to find out how much acceleration in G forces can do (when accelerating, on brakes, on turns) and how much the rc bike can lean (in degrees) before it starts to slide/crash/etc smiley

BUT I have already bookmark your site, as a lap timer is not a bad idea, at least for the local parking track we race with some friends smiley
15  Using Arduino / Sensors / ADXL345 information/help/problem/guidance etc :) on: November 05, 2012, 07:52:35 pm
Hello.

I'm trying to create an accelerometer logger for my R/C bikes (and cars, why not?).

The project will consists of an Arduino Nano, an ADXL345, a RTC, a GPS and a SD card module.
It will log the acceleration (in Gs) on X/Y/Z axis and the angle (in degrees) on X & Y axis (to see how much it leans at the corners, what was the maximum lean before crash etc). Also it will log the long/latt data from GPS and will be saved on SD card as KML (for Google Earth review). Power will be supplied either from the ESC's BEC or from a channel of the RX (with a 7805 voltage regulator and a diode for protection).

So far it looks that works OK, but there are two problems related with the accelerometer.

First problem is that when I'm trying to move it left/right/front/back on a table (keeping the Z axis steady), the acceleration changes, but it changes the angle too. Is it normal?

Second problem is that I don't know too much about accelerometers, and I'm not sure if it counts the G forces OK. It looks good, but when I'm accelerating for example, it changes the angle a lot, and I'm not leaning.

Here is my code so far. If I have any errors in calculations (I'm totally newbie to accelerometers), please help! Oh, and please contribute if you like smiley

Code:
#include <Time.h>  
#include "Wire.h"
#include "ADXL345.h"
#include <DS1307RTC.h>
#include <EEPROM.h>


#define GreenLed    13
#define RedLed      12
#define ButtonWrite 11

int x,y,z;
int xx, yy;
int defaultXX, defaultYY, defaultZZ;
double xyz[3];
double calibratedAccelXYZ[3];
double currentAccelX, currentAccelY, currentaccelz;
double differencexx, differenceyy, differencezz;
  
int CurrentFront = 0;
int CurrentBack = 0;
int CurrentLeft = 0;
int CurrentRight = 0;

double maxX = 0;
double maxY = 0;
double maxZ = 0;
int maxAngleLeft = 0;
int maxAngleRight = 0;
int maxAngleFront = 0;
int maxAngleBack = 0;

ADXL345 accel;

#define debug 1

void setup(void)
{
  pinMode(RedLed, OUTPUT);
  pinMode(GreenLed, OUTPUT);
  // Turn on the red led to define that calibration
  // process will be started
  pinMode(ButtonWrite, INPUT);
  digitalWrite(GreenLed, HIGH);
  digitalWrite(RedLed, HIGH);
  setSyncProvider(RTC.get);        // Get the time from RTC
  delay(100);
  if (debug==1)
  {
    Serial.begin(9600);
    Serial.println("Begin");
  }
  accel.powerOn();                 // Power On the Accelerator
  
  accel.setRangeSetting(8);        // Set maximum range to 8G
 
  digitalWrite(GreenLed, LOW);
  digitalWrite(RedLed, LOW);
  delay(100);
  digitalWrite(RedLed, HIGH);
  delay(100);
  digitalWrite(RedLed, LOW);
  delay(100);
  digitalWrite(RedLed, HIGH);
  delay(100);
  digitalWrite(RedLed, LOW);
  delay(100);
  digitalWrite(RedLed, HIGH);
  delay(100);
  
  // Read acceleration data and store them as default/inactive values
  accel.readAccel(&x, &y, &z);
  defaultXX = (atan2(y,z)+3.14)*RAD_TO_DEG;
  defaultYY = (atan2(x,z)+3.14)*RAD_TO_DEG;
  accel.get_Gxyz(xyz);
  calibratedAccelXYZ[0] = xyz[0];
  calibratedAccelXYZ[1] = xyz[1];
  calibratedAccelXYZ[2] = xyz[2];
  
  // Turn on the green led - ready to start
  delay(250);
  digitalWrite(RedLed, LOW);
  digitalWrite(GreenLed, HIGH);

  // Display previous records from EEPROM
  ReadFromEEPROM();
  
  // zero the variables to store the new maximum values
  maxX = 0;
  maxY = 0;
  maxZ = 0;
  maxAngleLeft = 0;
  maxAngleRight = 0;
  maxAngleFront = 0;
  maxAngleBack = 0;
  if (debug==1)  
    Serial.println("Ready!");
}




void loop()
{
  if (digitalRead(ButtonWrite) == HIGH)
    WriteToEEPROM();
  
  if (debug==1)  
  {
    Serial.print(TimeDate());
    Serial.print(" | ");
  }
  
  accel.readAccel(&x, &y, &z);
  xx = (atan2(y,z)+3.14)*RAD_TO_DEG;
  yy = (atan2(x,z)+3.14)*RAD_TO_DEG;
  
  accel.get_Gxyz(xyz);
  currentAccelX=abs(calibratedAccelXYZ[0]-xyz[0]);
  currentAccelY=abs(calibratedAccelXYZ[1]-xyz[1]);
  currentaccelz=abs(calibratedAccelXYZ[2]-xyz[2]);
  
  if (currentAccelX>maxX)
    maxX = currentAccelX;
  if (currentAccelY>maxY)
    maxY = currentAccelY;
  if (currentaccelz>maxZ)
    maxZ = currentaccelz;
  
  if (debug==1)
  {
    Serial.print("Acceleration X: ");
    Serial.print(currentAccelX, 1);
    Serial.print(" - Y: ");
    Serial.print(currentAccelY, 1);
    Serial.print(" - Z: ");
    Serial.print(currentaccelz, 1);
    Serial.print(" | ");
  }

  
  differencexx = defaultXX-xx;
  if (differencexx < -180)
    differencexx += 180;
  if (differencexx > 180)
    differencexx -= 180;

  if (differencexx<0)
    CurrentLeft=abs(differencexx);
  else
    CurrentRight=differencexx;

  
  differenceyy = defaultYY-yy;
  if (differenceyy < -180)
    differenceyy += 180;
  if (differenceyy > 180)
    differenceyy -= 180;
    
  if (differenceyy<0)
    CurrentFront=abs(differenceyy);
  else
    CurrentBack=differenceyy;
    
  if (CurrentFront>maxAngleFront)
    maxAngleFront=CurrentFront;
  if (CurrentBack>maxAngleBack)
    maxAngleBack=CurrentBack;
  if (CurrentLeft>maxAngleLeft)
    maxAngleLeft=CurrentLeft;
  if (CurrentRight>maxAngleRight)
    maxAngleRight=CurrentRight;

  if (debug==1)
  {
    Serial.print("Front: ");
    Serial.print(CurrentFront);
    Serial.print(" - Back: ");
    Serial.print(CurrentBack);
    Serial.print(" - Left: ");
    Serial.print(CurrentLeft);
    Serial.print(" - Right: ");
    Serial.print(CurrentRight);
    Serial.println("");
    delay(50);
  }
}


String TimeDate()
{
  String datetime;
  
  if (hour()<10)
    datetime=String("0");
  else
    datetime=String(hour());
  if (minute()<10)
    datetime += String(":0");
  datetime += String(":")+String(minute())+String(":");
  if (second()<10)
    datetime += String("0");
  datetime += String(second())+String(" / ");
  if (day()<10)
    datetime += String("0");
  datetime += String(day())+String("/");
  if (month()<10)
    datetime += String("0");
  datetime += String(month())+String("/")+String(year());
  
  return datetime;
}


void WriteToEEPROM()
{
  digitalWrite(RedLed, HIGH);
  digitalWrite(GreenLed, LOW);
  Serial.println("");
  Serial.println("Write to EEPROM");
  int foo;
  foo = maxX*100;
  EEPROM.write(0,foo);
  foo = maxY*100;
  EEPROM.write(1,foo);
  foo = maxZ*100;
  EEPROM.write(2,foo);
  EEPROM.write(3,maxAngleFront);
  EEPROM.write(4,maxAngleBack);
  EEPROM.write(5,maxAngleLeft);
  EEPROM.write(6,maxAngleRight);
  delay(500);
  digitalWrite(RedLed, LOW);
  digitalWrite(GreenLed, HIGH);
  Serial.println("Done!");
}

void ReadFromEEPROM()
{
  Serial.println("");
  Serial.println("");  
  Serial.println("Reading EEPROM");  
  maxX = EEPROM.read(0);
  maxY = EEPROM.read(1);
  maxZ = EEPROM.read(2);
  maxAngleFront = EEPROM.read(3);
  maxAngleBack = EEPROM.read(4);
  maxAngleLeft = EEPROM.read(5);
  maxAngleRight = EEPROM.read(6);
  Serial.println("");
  double foo = 0;
  Serial.print("Max X Acceleration: ");
  foo = maxX/100;  
  Serial.println(foo, 2);
  Serial.print("Max Y Acceleration: ");
  foo = maxY/100;  
  Serial.println(foo, 2);
  Serial.print("Max Z Acceleration: ");  
  foo = maxZ/100;  
  Serial.println(foo, 2);
  Serial.println("");
  Serial.print("Max Angle Front: ");
  Serial.println(maxAngleFront);
  Serial.print("Max Angle Back: ");
  Serial.println(maxAngleBack);  
  Serial.print("Max Angle Left: ");
  Serial.println(maxAngleLeft);  
  Serial.print("Max Angle Right: ");
  Serial.println(maxAngleRight);  
  Serial.println("");
  Serial.println("");
  delay(2000);
}

PS 1: I haven't receive the GPS & the SD card module yet, so it only displays the data on screen (and saves the max values @ EEPROM when button is pressed).

PS 2: I want to log the crashes (don't forget it's a RC Bike, it has lot of crashes). I guess that's possible with the tap detection. Any ideas how to do that?


Thank you,

Antonis.
Pages: [1] 2