CTi Inclinometer Sensor Interfacing with an Arduino Uno
Good day everyone,
I am busy designing a vehicle data collection system for my final year project and might need help regarding an inclinometer sensor (CTi TILT – 57A Dynamic Dual-Axis Inclinometer) to measure Roll & Pitch angles in degrees, accelerations, angular velocities, Internal temperature etc. But most importantly the Roll & Pitch.
I bought a TILT-57A dynamic inclinometer that communicates through USB interfacing using ASCII protocol. From there I have plugged into a male USB cable end from which I connect my four cables directly to the Arduino. (SPI protocol) but I'm still new to Arduino. I also use an external power supply to power the Inclinometer, since the Arduino does not supply enough current.
I am not sure how I can program and interface further so that I can at least see some data read from the sensor in the serial monitor using an Arduino uno. I have tried SoftwareSerial but I am too unfamiliar with Arduino software in general. I don't think I know what I am doing.
Here is some information on the serial interface and data format if it helps:
The TILT-57A uses the following ASCII format, very similar to the widely used NMEA 0183 protocol, for data output:
Inclinometer message: $CSEAG,U,αX,αY,AX,AY,AZ,GX,GY,GZ,TCC*
Which:
AX,AY,AZ: X, Y and Z accelerations in milli g (three-axis accelerometer data)
GX, GY, GZ: X, Y and Z angular velocities in deg/s (three-axis gyroscope data)
αX, αY: Roll & Pitch angles in degrees
T: Internal temperature in degrees Celsius
U: Device unit number
CC: Checksum (Two ASCII characters)
: Carriage return, and line feed characters
Within the inclinometer message, the temperature, accelerometer, gyroscope, or angle portion of the message may be turned on or off. See Section 8 for specific commands.
The inclinometer message may run in full at an output data rate of up to 500 Hz. With only 2 of the 3 data message portions turned on (accelerometer, gyroscope or angles), the inclinometer message may be run at an output data rate of up to 1 kHz. With only 1 of the 3 message portions turned on, the inclinometer message may be run at an output data rate of up to 2 kHz. When running at 1kHz and 2kHz, it is recommended that the other message portions (temperature and unit number) be turned off if they are not needed.
Is there a simplistic program that anyone can help me with just to extract the data and maybe print the lines in the serial monitor for example:
$CSEAG,1,+006.756,-003.813,+0116.53,-0065.42,+0981.42, ,+000.21,-000.16,-000.27,+29.7*68
I have already used the PC software created for the sensor (WinCTi-Tilt-57®), but my main goal is to be able to read and extract the data from the sensor to the Arduino Uno.
I would like to understand this better though. I am having difficulties writing a code to just basically read any data being sent from the sensor with an Arduino Uno, but the Arduino reads nothing.
Datasheets:
Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 7); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
//Serial.println("Failed");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Arduino Ready");
}
void loop()
{ // run over and over
if (mySerial.available() > 0)
{
Serial.println(mySerial.read());
}
if (Serial.available())
{
mySerial.println(Serial.read());
}
delay(1000);
}