vieiraf / itg-3200driver

Automatically exported from code.google.com/p/itg-3200driver
GNU Lesser General Public License v3.0
2 stars 2 forks source link

Callibrate() #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This isn't really an issue but would you mind adding a calibrate function?
I'm currently writing one. If you'd like to add it I'll share it with you. BTW 
thanks for the lib, hope you get the Wire crashing bug out.

cheers

Original issue reported on code.google.com by nee...@gmail.com on 10 Dec 2010 at 10:57

GoogleCodeExporter commented 9 years ago
Hello neefsj,

There are several ways of doing calibration, I've used once a very simple one 
that would average values for a few seconds to calculate offsets. Could you 
elaborate on your calibrate function? 
Any contribution for the lib is welcome.

Regarding the wire crash bug, there are still doubts about the source of the 
problem. For a start I still need to know how to reproduce it. Do you have any 
example code that I could use to reproduce the crash?

Fil.

Original comment by fil.vie...@gmail.com on 10 Dec 2010 at 1:05

GoogleCodeExporter commented 9 years ago
My calibrate function is about the same take 5000 samples of all axis and use 
the negative average as offset.

How can I reasure myself that it's wire that is crashing?

Sometimes code just stops executing. But it's very unlogical. This morning it 
all worked perfectly but this afternoon it just does a few 100 readgyro's and 
it stops the number is always different.

One thing that could be the problem is, as I'm working with non soldered 
connections and that I2C cannot handle possible changes in resistance due to 
bad connections.

Original comment by nee...@gmail.com on 10 Dec 2010 at 2:23

GoogleCodeExporter commented 9 years ago
Hi Fil.

Here a somewhat changed version of your lib (all i added was calibrate)
it crashes after 4 minutes at least with me, could you try running it?

Original comment by nee...@gmail.com on 10 Dec 2010 at 3:16

Attachments:

GoogleCodeExporter commented 9 years ago
Hello neefsj,

I've tested your code with no changes for 4 hours and no problems. Not a single 
crash! Here are my test conditions:

Hardware:
- Arduino MEGA;
- ITG-3200 Breakout;
- Currently I'm using and ITG-3200, BMP085 and ADXL345 sharing same I2C bus;
- No pull resistors;
- Have soldered connections only for sensors board, but not for breadboard 
connections;
- SCL       -> pin 21;
- SDA       -> pin 20;
- CLK & GND     -> pin GND; 
- INT       -> not connected;
- VIO & VDD -> pin 3.3V;

Software:
- Arduino Software 0021;
- OS Windows 7 x64 (2x3.0Ghz 4GB);

At the end, still no clues about the crash. It would be nice to know if someone 
else was able to run your code without problems.
Regarding the Calibrate() function, I've tried it and is working fine, I would 
just  add two parameters for number of samples and sample delay.

Fil.

Original comment by fil.vie...@gmail.com on 23 Dec 2010 at 6:15

GoogleCodeExporter commented 9 years ago
I found the problem I guess. Since i've added "Wire.begin()" in the constructor 
 everything ran without crashing for some hours.

Hope I get some feedback on this possible sollution.

Maybe Filipe, you initiate the wire library earlier in your code or the arduino 
mega is always a master on I2C. I believe wire.begin intiates a device as 
master or slave and that without this initiation the slaves/masters do'nt know 
how to act in different situations

Original comment by stud...@gmail.com on 26 Dec 2010 at 1:41

GoogleCodeExporter commented 9 years ago
Hi Studioj,
From Arduino Reference manual, wire will join the bus as master is address 
parameter is not specified. So you could try:
 a) Specifying address parameter (specify who is master/slave); or
 b) I’ve read several discussions about wire and some people used the following initialization code:

    Serial.begin(9600);
    Wire.begin();
    delay(1000);

Please let me known is any of these worked.

Fil.

Original comment by fil.vie...@gmail.com on 26 Dec 2010 at 5:25

GoogleCodeExporter commented 9 years ago
well that is what i did and that is what solved the problems. (i didnt use the 
delay though.

Original comment by stud...@gmail.com on 28 Dec 2010 at 3:36

GoogleCodeExporter commented 9 years ago
Just created a new branch (fil.testing) with calibrate and wire changes.

Fil.

Original comment by fil.vie...@gmail.com on 29 Dec 2010 at 5:13

GoogleCodeExporter commented 9 years ago

Original comment by fil.vie...@gmail.com on 19 Jan 2011 at 3:15

GoogleCodeExporter commented 9 years ago
Thank you I will try this later next week.

btw i used another email addy studioj at gmail is also me

Original comment by nee...@gmail.com on 19 Jan 2011 at 9:54