Interfacing a Dynamic Inclinometer with Arduino Leonardo

Hi There,

I am busy with a major project and might need a lot of help.

I bought a TILT-57A dynamic inclinometer that communicates through RS232 interfacing using ASCII protocol or something similar. I had the order placed with a USB cable connection. From there I have plugged into a male USB cable end from which I connect my four cables directly to the Arduino.

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. I have tried SoftSerial but I am too unfamiliar with Arduino software in general. I don't think I know what I am doing.

I am still a new user and I am therefore unable to attach the datasheet for the inclinometer but the following but 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,T*CC

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

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 would just like to at least read something.

Data sheet here: https://www.ctisensors.com/Documents/TILT-57A-Datasheet.pdf

Please explain what the following means. Are you trying to use a USB host shield?

I had the order placed with a USB cable connection. From there I have plugged into a male USB cable end from which I connect my four cables directly to the Arduino.

Normally, people use an RS232-UART adapter to interface with RS232 devices.

If yours is this: https://www.ctisensors.com/Documents/TILT-57A-Datasheet.pdf
Then the datasheet says there is user software you can download to your PC and connect your sensor do a USB port.

I realize this is my first problem, thank you for informing me.

Yes, thank you @blh64. I have done that part of the interfacing already, although for my project I have to control all my sensors with the Arduino.

I would like to understand this better though. If the Inclinometer is designed to communicate with RS232 and the Arduino has serial ports, why is it necessary to have an RS232-UART adapter (USB to Serial converter) to interface the two?

I get that, but start with the PC software to make sure it is working, then move on to the Arduino. It saves the trouble of having to solve multiple issues at the same time

The arduino runs at 5V so it is using "TTL level RS232" but the real RS232 standard is +/- 15V. It really depends on what the device is using - True RS232 or logic level RS232.

Oh, I have already used the software, it is working perfectly, it has graphs that display all the variables given in the serial string message and it is quite interactive. I would just now like to move on to the Arduino where I can attempt to establish communication with the inclinometer and then print the data string.

If I am able to get to this point, I can then attempt to extract the individual variables from the message string and print them in an organized readable structure, hope I'm on the right path.

In addition to +/- voltage levels, RS232 serial protocol has the bits inverted, relative to the Arduino serial port.

The inclinometer has a UART output option. I believe that would be your choice for an Arduino.

The type of RS232 serial interface cable intended to be plugged into a USB port on a PC (which is evidently what you have now) is not useful for Arduino in general, as that requires the Arduino to be a USB host.

Okay great, so that's why the USB to serial converter is required. With everyone's input, it all makes better sense, thanks to everyone!

I got my TTL device so I will hook it up and see if I can get it sorted out. This is just one aspect of my project. Hope you will be able to help me as I go along.

Do you think this code :point_down: will work well:


#include <SoftwareSerial.h>
#include <NMEA0183.h>

SoftwareSerial Tilt(8, 7);
NMEA0183 nmea;

void setup()
{
  while (!Serial);
  Serial.begin(115200);
  Tilt.begin(115200);
  Serial.println("NMEA0183 parser test");
}

void loop()
{
  if (Tilt.available())
  {
    char c = Tilt.read();
    if (nmea.update(c))
    {
      Serial.print("NMEA0183 sentence accepted (");
      Serial.print(nmea.getFields());
      Serial.print(" fields): ");
      Serial.write(nmea.getSentence());
      Serial.println();
    }
  }
}

I came across this :point_up_2: in my search for interfacing my specific ASCII/NMEA0183 device with Arduino. It was intended for a different ASCII/NMEA0183 device though, so I had to make a few changes.

For interest's sake, if the inclinometer is being supplied with 5V, how can it then have its RS232 output levels at +/- 15V?

SoftwareSerial.h is unlikely to work well at 115200 Baud, and perhaps not at all.

+/-15V can be generated from 5V quite simply with an oscillator, a couple of capacitors and diodes. However, the standard is not strict, and lower voltages are commonly used.

We used to use these a lot. Things have changed some.
MAX220–MAX249 - +5V-Powered, Multichannel RS-232 Drivers/Receivers (maximintegrated.com)

A point about 'Leonardo' --
"Serial" is for use with SerialMonitor (through the USB).
"Serial1" is for comms via "Pins 0,1"
SoftwareSerial unnecessary.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.