Problem to IMU

Hi Friends;
I working on the project that I need driving 4 gyro by Due board. I downloaded a sample program from the internet that uses 13g4200.h library. Every thinks are OK when I use Arduino 2560. With 2560 module, when I rotated the IMU, I got correct data in negative and positive numbers(depending on the direction of rotation).
But when I used Arduino DUE, every thinks be confused. From this time, I got a many numbers as positive number and in normal stat I had only 65535!! Unfortunately by Due I can't give any negative numbers.
Please help me if yo had this problem or you know what can I do it?

You need to post a link to where you bought the gyros. Is it the New York Gyro on University or else? :wink: DUE uses 3.3V logic so there might be some issues when you try to connect a 5V gyro board with it. The solution could be as easy as removing a resistor or cut a trace but I won't know where until you tell me where you got your gyros. Is it the downtown gyro place? They charge extra for hot pepper!

Dear Iiuder;
thanks for regard.
I have use gyro: GY-50. I supplied gyros by 3.3V, so gyros could connected and transfer data to DUE directly. As I researched about that, understand that variables of x,y,z are int numbers. In Arduino int number has 4 bytes, but int number in 13g4200.h liberary that wrote in C++ language is 2 bytes. What is your solution in this case?

Arduino integer has 2 bytes. Long integers has 4 bytes. Can you post a link to the library, actual product you bought and a spec sheet or will you have me do it?

Arduino integer has 2 bytes. Long integers has 4 bytes. Can you post a link to the library, actual product you bought and a spec sheet or will you have me do it?

On the Due integers are 4 bytes wide.

The Due has a SAM chip and the other Arduinos are AVR chips. The two are not the same and take different code. Many libraries that work for one are not going to be compatible with the other.

Dear Delta;
what's your solution for clear this problem? what should I do? ::slight_smile: what's your suggest?

Post the links I asked. Someone may be able to help if you post them.

Dear Iiudr;
Good day and thanks. I bought this gyro from Iran. So unfortunately it doesn’t have any information on the board. Just typed “gy-50”. Therefor I can’t post link for it. (Maybe it is made in China.)
Of course I guess found the problem, but I can’t solve it. According to my research, gyros uses 8 bit for data. And as you can see in the following program code, in first, Arduino receive MSB data then LSB. Then shifted MSB data 8 bit to left an finally does OR by LSB and save it in a 16 bit variable.

void getGyroValues(){

  byte xMSB = readRegister(L3G4200D_Address, 0x29); // This register get X values
  byte xLSB = readRegister(L3G4200D_Address, 0x28); // This register get X values
  x = ((xMSB << 8) | xLSB);

It is OK for Arduino 2560, because this type, has 8 bit data bus. In Due, data bus is 16 bit and begins my problem from here.
If I find a way that gives ability to me for compatible 8 bit to 16 or 32 bit, I think this problem could be clear.

There isn't any one to help me?!!

Nobody has ever is not had like this problem?

Can I suggest you wait 24hours, some of us are asleep at one time or another around the world.

If you google gy-50 arduino due library

what happens?

Tom… :slight_smile:

:smiley: :smiley: Yes you have right. Maybe you are asleep now :wink: .
According to your suggest I searched "GY-50 Arduino Due Library". But I couldn't find anything. I hope that find someone to help me.

Did you search without the " ".
The search produces a list of forum posts

It has some answers.

Tom..... :slight_smile:

This link works