Hi everyone,
I’m having a hard time getting a specific sensor (sen0311) working with my NodeMCU-32S / esphome.
I’ve tried a lot, but this seems to be getting way above my experience level.
So i bought this sensor because it looked like it was pre-integrated in esphome.
Relevant yaml configuration:
uart:
id: uart3
baud_rate: 9600
rx_pin: GPIO16
tx_pin: GPIO17
sensor:a
- platform: "a02yyuw"
name: "Distance"
uart_id: uart3
When i compile esphome and upload/restart the nodemcu/sensor the whole nodemcu won’t boot. (no ping, no webserver, etc)
Disconnecting GPIO16 and powercycling makes the nodemcu work properly but obviously without any sensor data as GPIO16 is disconnected
So i tried hot-plugging GPIO16 after the nodemcu was booted.
This results in data being received for a short while, but after some seconds the nodemcu locks up. (Webinterface inaccessible, no more debug messages)
14:23:34 [D] [sensor:094] 'sensor_distance': Sending state 150.00000 mm with 0 decimals of accuracy
14:23:34 [D] [sensor:094] 'sensor_distance': Sending state 101.00000 mm with 0 decimals of accuracy
14:23:34 [D] [sensor:094] 'sensor_distance': Sending state 67.00000 mm with 0 decimals of accuracy
14:23:34 [D] [sensor:094] 'sensor_distance': Sending state 77.00000 mm with 0 decimals of accuracy
14:23:34 [D] [sensor:094] 'sensor_distance': Sending state 77.00000 mm with 0 decimals of accuracy
So then i found the esphome page that describes how to debug uart integrations:
So i removed the sensor definition from the yaml and changed the uart yaml to:
uart:
baud_rate: 9600
rx_pin: GPIO16
tx_pin: GPIO17
debug:
direction: BOTH
dummy_receiver: true
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
This results in debug console messages:
14:42:49 [D] [uart_debug:158] <<< "\xFF\x02\xCD\xCE\xFF\x02\xCD\xCE\xFF\x02\xCD\xCE"
14:42:49 [D] [uart_debug:158] <<< "\xFF\x02\xCD\xCE\xFF\x02\xD1\xD2"
14:42:49 [D] [uart_debug:158] <<< "\xFF\x02\xCD\xCE\xFF\x02\xD1\xD2"
14:42:49 [D] [uart_debug:158] <<< "\xFF\x02\xD1\xD2\xFF\x02\xCD\xCE\xFF\x02\xD1\xD2"
But now the kicker, without any nodemcu lockups, it just keeps going for hours.
So my first thought was that the sensor must be flaky, so i bought a second one.
Unfortunately that one show exactly the same behaviour.
So now i’m stuck, i’ve identified two possible routes to follow;
1 - Troubleshoot to see why platform: “a02yyuw” locks up
2 - Create a parser based on raw uart data
But with my limited experience both are way above my comfort zone.
Anyone care to help? and give me a push in the right direction?
Thanks!
Z