Getting an Ultrasonic sensor working over I2C (M5stack RCWL-9620)

I’ve got an M5Stack Ultrasonic sensor (RCWL-9620). I’ve had others like the A02YYUW but they’re UART.

This one is plugged into a PoESP32 unit, and the I2C is showing it finds it at 0x57 correctly:
image

But I can’t work out a configuration to get it to show the distance.

It doesn’t appear on the supported device list here unfortunately:
https://esphome.io/api/classesphome_1_1i2c_1_1_i2_c_device.html
Is there a way to set it up as a custom device of some description / get it to work?

Any advice / guidance on making it play ball would be appreciated

Edit: The docs from M5Stack: m5-docs

Have you read:

https://esphome.io/custom/i2c.html

I hadn’t, thanks for the heads up. I had a feeling there would be a custom one somewhere.
Much obliged :slight_smile:

Had a try, didn’t have any luck getting things to go based off the libraries from the M5stack site. Unfortunately I’m not a developer.

If there is anyone who’s managed to get that particular model working, I’d love to hear the specifics of how.

In case somebody chances across this in the future, I had someone help incorporate the library from M5Stack:

Instructions for the RFID2 and Ultrasonic I2C RCWL-9620 should now be good there. Tested both, confirmed working well on an Atom Lite and a PoESP32 device :+1:

2 Likes

Can you send me sample of your yaml as I get complieation errors when using the external components. Is there other changes I need to make ?

Does it work if you manually download it to your custom_components?

Thank you! Worked out of the box for me. Very helpful.
I use a ESP32 DevKit and HC-SR04 (RCWL-9610 design) from eBay (HC-SR04)
This one can work in 4 different modes: GPIO, IIC, UART and OneWire. I needed IIC and it works fine!

1 Like

Glad to hear it! :slight_smile: