1
Edit with Answer:  I had forgot to switchback to using BCM pin numbering from DPI.

https://pinout.xyz/pinout/pin18_gpio24  

Thanks for the helpful comments.

My Sonic Sensor is reporting only zero cm and I don't know how to troubleshoot it. It was working for a time, but something's gone wrong and I can't find what.

I have a spare sensor and have swamped them out with the same result so I don't think that's it. I didn't change any wiring on the breadboard between the success and failure so I don't think that's it.

My code is below and I've attached a screen shot of the results of the last test of it running with my hand moving in front of the sensor.

What should I test next?

# https://github.com/MarkAHeywood/Bluetin_Python_Echo
from Bluetin_Echo import Echo  # HCSR04 Module
from time import sleep


DistSense = Echo(19, 20)

def report_dist():
samples = 4
try:
    while True:
        d = DistSense.read('cm', samples)
        print(d, 'cm')
        sleep(.5)
except KeyboardInterrupt:
    pass


report_dist()

DistSense.stop()

print('End Of File.')

Terminal Output

4
  • Perhaps try different software? Here is one of my pigpio examples abyz.me.uk/rpi/pigpio/…
    – joan
    Jul 26, 2020 at 16:08
  • Thanks for the suggestion. I also tried it with the CircuitPython module and got the same result. circuitpython-hcsr04.readthedocs.io/en/latest/api.html
    – ManOAction
    Jul 26, 2020 at 16:10
  • We need a picture of the wiring and voltage divider circuit please. You can edit the question to add them in.
    – user115418
    Jul 26, 2020 at 16:40
  • Thanks ya'll. It was a mixup between using BCM and DPI pin numbering.
    – ManOAction
    Jul 26, 2020 at 18:21

1 Answer 1

1

I needed to use BCM Pin numbering instead of DPI.

It was the switching between HC-SR04 modules that tripped me up. The Adafruit Circuit Pi modules were using DPI and the Bluetin Echo modules was using BCM.

Thanks for the help and comments!

1
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year.
    – Ingo
    Jul 29, 2020 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.