[12:44:35][C][logger:301]: Logger:
[12:44:35][C][logger:302]: Level: DEBUG
[12:44:35][C][logger:303]: Log Baud Rate: 115200
[12:44:35][C][logger:305]: Hardware UART: UART0
[12:44:35][C][ultrasonic.sensor:045]: Ultrasonic Sensor 'Ultrasonic Sensor'
[12:44:35][C][ultrasonic.sensor:045]: State Class: 'measurement'
[12:44:35][C][ultrasonic.sensor:045]: Unit of Measurement: 'm'
[12:44:35][C][ultrasonic.sensor:045]: Accuracy Decimals: 2
[12:44:35][C][ultrasonic.sensor:045]: Icon: 'mdi:arrow-expand-vertical'
[12:44:35][C][ultrasonic.sensor:046]: Echo Pin: GPIO17
[12:44:38][D][ultrasonic.sensor:040]: 'Ultrasonic Sensor' - Got distance: 0.16 m
[12:44:38][D][sensor:094]: 'Ultrasonic Sensor': Sending state 0.16035 m with 2 decimals of accuracy
[12:44:38][W][component:204]: Component ultrasonic.sensor took a long time for an operation (0.09 s).
[12:44:38][W][component:205]: Components should block for at most 20-30ms.
[12:44:43][D][ultrasonic.sensor:040]: 'Ultrasonic Sensor' - Got distance: 0.16 m
[12:44:43][D][sensor:094]: 'Ultrasonic Sensor': Sending state 0.16070 m with 2 decimals of accuracy
[12:44:43][W][component:204]: Component ultrasonic.sensor took a long time for an operation (0.05 s).
[12:44:43][W][component:205]: Components should block for at most 20-30ms.
[12:44:48][D][ultrasonic.sensor:040]: 'Ultrasonic Sensor' - Got distance: 0.16 m
[12:44:48][D][sensor:094]: 'Ultrasonic Sensor': Sending state 0.16052 m with 2 decimals of accuracy
[12:44:53][D][ultrasonic.sensor:040]: 'Ultrasonic Sensor' - Got distance: 0.16 m
[12:44:53][D][sensor:094]: 'Ultrasonic Sensor': Sending state 0.16052 m with 2 decimals of accuracy
[12:44:53][W][component:204]: Component ultrasonic.sensor took a long time for an operation (0.08 s).
[12:44:53][W][component:205]: Components should block for at most 20-30ms.
I get a constant reading of 0.16m and timeout error’s.
Hey man thanks so much for responding. I’m not sure how I missed the ESPhome section, how do I go about moving this thread?
Regarding your reply, I am still battling to understand the issue due to my lack of knowledge.
I came across a little bit of code for UART which was setup like this:
does the above code look correct to start setting up UART?
I thought I would be able to find code online I could copy/paste as that is how I have managed to build all my basic home assistant entities. Don’t get me wrong I have learnt some basics but this setup is a lot more advanced than I thought it would be. I don’t know enough to even start to problem solve this.
Not sure what to do, so I was hoping that some one could assist with some code or advice to get this thing working. If I do get it working I am definitely going to post a tutorial online for the next user as this is such an awesome project to get working and should be freely available to anyone!
You can just edit the first post and change to category
That looks OKisk to setup up the UART bus on the esp side.
I think your device (when it only works over UART) is just not supported in esphome at the moment.
Some times ultrasonic sensor actually have a way to change the output interface - maybe you are lucky and can force your device the work the simple way via trigger and echo pin.
Unfortunately my sensor came with no documentation. The local site that I purchased it from can only tell me that it is an A02 but cannot stipulate which model. There is a sticker on the sensor with the following:
A0221AU
2134013
I just want to already thank you for taking the time out to help me.
Edit: it seems to bring up alot of UART controlled sensors when googling
This is the closest thread to my issue and the user ended up getting the PWM version as he could not get the UART version to work. Seems I may have wasted a purchase.
The A01NYUB isn’t the greatest for a sump since it has an 11" blind spot.
Has anyone been able to get the a02yyuw workign with Home Assistant ESPHome? I have been futzing with this for a while and can’t get it to work. Mine is no a DFRobot but some other UART version from Amazon that at least appears identical. But I can’t get it to work. Also tried with an arduino uno and DFRobot sample code with no luck. So maybe it’s just not compatible in some way.
For anybody who may come across this forum and needs something to work for them, This is what worked for me to get my Controlled UART Sensor to show distance:
The sample code near the bottom of this page Underwater Ultrasonic Obstacle Avoidance Sensor -6m Arduino WiKi - DFRobot
Worked for my A2211AT Ultrasonic sensor (Not the sensor this code is designed for but i’ll take the win).
I am using an ESP32-WROOM-32U