In order to measure the distance of the colored paper sheet from the sensors we use the HC-SR04 ultra-sonic distance sensor.
As can be seen from the photo, the modules has 4 connections:
These are the connection we make:
Vcc | 5V |
Trig | gpio 23 |
Echo | gpio 24 via the level converter |
Gnd | Gnd |
Here is a Python test program demonstrating the readout:
https://afnog.iotworkshop.africa/pub/AFNOG/Ultra-sonicSensor/hc-sr04.py.txt
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
hc-sr04.png | r1 | manage | 172.8 K | 2018-03-06 - 13:45 | UliRaich | |
![]() |
hc-sr04.py.txt | r1 | manage | 0.9 K | 2018-03-06 - 13:59 | UliRaich |