I would like to buy this inclinometer from the company leveldevelopments:
I wrote them and they said the PCB-only version is also available for easier setup with Arduino. The problem is my knowledges are limited and I have no idea how to extract the 2 main information from this module i.e. X and Y (from pitch and roll axes). When plugged to a PC (using the RS232 or RS485 interface), a software is provided from the company to extract these data. In my case, I would like to connect it to an ESP8266.
If you read the datasheet (the pdf is at the top of the link above), I have a feeling it would be possible to get these data (see p.8 and after) but I don't know where to start. Before buying one, I would like to make sure I will be able to.
Can someone tell me please if it would be feasible and give me a direction?
They seem to have their own "LD Standard Communication Protocol".
There is information about that, but there are a few things not well explained.
If a command is send, then it returns the data.
I think this is all that you need:
Reading that data and converting it into variables is no problem. That is just normal programming and we can help with that.
Perhaps a delay is needed at startup or between the commands. Perhaps they made a mistake and it returns "OK<CR>" instead of "OK". There are a few things to sort out, but it is not hard.
Warning: Do not connect a RS-232 signal directly to your ESP board.
Thanks for helping me on this.
Actually, I would prefer to use the ESP8266 if possible.
If I can simply use these commands get---x and get---y in my arduino program, that would be fantastic. Would it be that easy? No problem for the conversion into variables indeed.
Can I just connect the inclinometer directly to the ESP? They provided me the scheme of the PCB from another series but it should be very similar:
Those pins "UART Rx" and "UART Tx" are hopefully normal TTL level signal.
What happens if you apply 5V to pin 1 of Connector 1 (and GND to pin 2) and measure pin 5 and 6 of Connector 2. If the "UART Tx" is near 5V, then you might be able to connect that to a ESP8266 (I would use a protection resistors of 1k). Maybe those are normal logic signals meant for a RS-485 module.
Note: The ESP8266 is more or less 5V tolerant. The ESP32 is not. If you want to upgrade to a ESP32, then you need a level shifter to convert the signals to 3.3V.
You could try to power the Connector 1 with 3.3V and hope that the serial communication still works. It is out of spec, but it might work.
Can you measure both GND pins 2 are connected to each other ?
Maybe they have a optical isolation for the serial port.
Where do you get that extra serial port of the ESP8266 from ? You need the first serial port for the Serial Monitor of the Arduino IDE and to upload a sketch.
Thanks a lot for all these info. I think I will try one and see what happens.
I will let you know. I mean it might take time as they are located in UK
Thanks again
@Koepel Sorry, another quick (and stupid) question. I was looking at the RS232 to TTL converter you mentioned. Just to be sure, if my device needs 12V and the ESP 3.3V, I need to connect the 12V on the VCC of the converter, and separately connect 3.3V on the ESP, right?
Everything is online, but you have to know how to find it
This is for the ESP8266 side:
Seeed (in that link) says: "Supply Voltage 3.3V / 5V".
That means the VCC pin on the ESP side should be 3.3V for 3.3V boards or 5V for 5V board.
Wikipedia explains the voltages of the RS-232: https://en.wikipedia.org/wiki/RS-232#Voltage_levels
They can be up to -15V ... +15V.
So how can that module interface with the higher voltages of the RS-232 ?
The chip that is used is a MAX3232.
This is the manufacturer's page: https://www.maximintegrated.com/en/products/interface/transceivers/MAX3232.html
Read the datasheet, and you see that it has a charge-pump.
So the MAX3232 makes those higher voltages by itself from the 3.3V or 5V.
For the RS-232 side:
The MAX3232 has a low input threshold. It does not need signal levels of 12V. If you can power your device with 5V, that will be safer.
There are many manufacturer's that take a shortcut with RS-232 signals. You might have to test that.
Default: RS-232 with -12V and +12V levels
Good: RS-232 with -15V and +15V levels
Good: RS-232 with -5V and +5V levels
Still accepted by the MAX3232: RS-232 with -3V and +3V levels
Bad: RS-232 with 0V and +5V levels or 0V and +12V.
Worse: inverted RS-232