Arudino UNO and CHR-6d IMU

Hello,

for my application I use Arduino UNO

and CHR-6d IMU (datasheet : http://www.pololu.com/file/0J342/chr6d_datasheet.pdf)

I have problems with communication between board and sensor. I have almost no experience in programming so I would need some help how to send proper packets to sensor and see response.

I think I wired it correctly. 3.3V to 3.3V, GND to GND, Rx to Tx, and Tx to Rx.

Below is my code, which is not working.

byte byteRead;
uint8_t my_serial_bytes[] = {0x73, 0x6E, 0x70, 0x83, 0x00, 0x01, 0xD4};
void setup() {                
  Serial.begin(115200);
  delay(1000);
  Serial.write(my_serial_bytes,sizeof(my_serial_bytes)); 
}

void loop() {
  /*  check if data has been sent from the computer: */
  if (Serial.available()) {
    /* read the most recent byte */
    byteRead = Serial.read();
  }
}

How do you know that the code is not working ?
What do you expect it to do ?

First I would like to send packet to sensor SET_SILENT_MODE.

Then I eould like to SET_ACTIVE_CHANNELS, because I want just some particular data(accelerations)

Then I would like to monitor measured data.

I am sorry since I am full of questions and no solution, but this is my first "programming" challenge.

I would appreciate any help on this topic. When I'll figure how to communicate with sensor and receive data from it, everything will be much easier

Best regads,

Where did you get the code that you posted and what are the command bytes in the array intended to do ? If they are intended to issue the commands that you have listed, then where did you get the values from and how will you know if the commands have worked ?

my last code :

byte byteRead;
uint8_t SET_SILENT_MODE[7] = {0x73, 0x6E, 0x70, 0x83, 0x00, 0x01, 0xD4};
uint8_t GET_DATA[7] = {0x73, 0x6E, 0x70, 0x01, 0x00, 0x01, 0x52};
void setup() {                
  Serial.begin(115200);
  delay(1000);
  Serial.write(SET_SILENT_MODE,sizeof(SET_SILENT_MODE));
  Serial.write(GET_DATA,sizeof(GET_DATA)); 
}

void loop() {
  /*  check if data has been sent from the computer: */
  if (Serial.available()) {
    /* read the most recent byte */
    byteRead = Serial.read();
    
    Serial.print("I received: ");
                Serial.println(byteRead, HEX);
         delay(100);      
  }
}

I send commands for SILENT_MODE and GET_DATA. Then I receive first packet which says COMMAND_COMPLETE and second one, SENSOR_DATA.

Then i continously receive packets BUFFER_OVERFLOW. Even if i just set SILENT_MODE i get overflow.

Can you help me on that?

Best regards,

What are you using the Serial instance to talk to? The PC or the IMU? Both is the wrong answer.

I don't actually understand the question.

I believe it is simple but, but i don't have enough knowledge about that.

Can you describe it a little bit more? :slight_smile:

If it helps : I have IMU connected to Tx and Rx on Arduino UNO. Arduino is connected and powered through USB. And above is code which I use.

Last problem is buffer overflowing response from sensor

Best regards and BIG thanks for help,

RX and TX on the UNO, pins 0 and 1, are used by the hardware Serial interface so you cannot communicate with the IMU and the Serial monitor at the same time. If you require another serial interface you could use the SoftwareSerial library and define your own RX and TX pins to talk to the IMU,

Thanks. It make sense :slight_smile:

Will try it and report back.

Best regards,