How to recieve rs232 data in esphome?

i use esp32
i want to recieve rs232 data.

i found this website , but my esp wont show any recieved data.

i asked chatgpt , but the code chatgpt created was also not working.

according to google , i must be the first user of the uart in esphome.

thanks in advance

The ESP32 boards typically use 0 to 3.3Vdc for all of their GPIO pins.

True RS232 devices operate at -12Vdc to +12Vdc.

Thus, in order to interface the two devices, you will probably need additional hardware to make sure you don’t destroy the ESP32 GPIO UART pins. Maybe something like this https://www.amazon.com/Ultra-Compact-RS232-Converter-Female/dp/B00OPTOKI0 would work, if you don’t already have the correct hardware to convert RS232 to UART 3.3V.

It would be a very good idea to share a wiring diagram of how you have everything set up.

the rs232 is already converted to ttl.
so no hardware issues are related .

only the software is what is my problem

and write serial data works ,
i never recieve any bit/byte on my serial port

meanwhile i found something good , and i recieved data…
i used this example : Lambda Magic — ESPHome

however how can i convert these byte to real data ? (see image below )
eg : check if the last 2bytes are a valid CRC ?

do i have to to this in yaml ? or C++ ? or in a *.h file ?

now i have the feeling , i can see the uart-data , but how can i use it ?and do stuff with it ?

now i have the serial data in my log :

2 Likes

Take a look at this post. You need to create a sensor or sensors for the real data. The post has examples for how to do stuff to the raw bytes to get real data for the sensors.

1 Like