W600-PICO with HC-SR04 Sensor

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
johncharris
Posts: 3
Joined: Mon Feb 10, 2020 4:19 am

W600-PICO with HC-SR04 Sensor

Post by johncharris » Mon Feb 10, 2020 5:26 am

I have been unable to get the HC-SR04 sensor to work with this board. I am using the driver at https://github.com/rsc1975/micropython-hcsr04 modified to pull Pin.PULL_FLOATING on lines 26 and 30 to get it to run on this board.

The command

Code: Select all

pulse_time = machine.time_pulse_us(self.echo, 1, self.echo_timeout_us)
returns a -2. I believe this means the pin never read high from the sensor. This is explained at https://docs.micropython.org/en/latest/ ... -functions.

Any ideas on what the issue may be or how to troubleshoot this.

Thank you,

John

User avatar
Werner_G
Posts: 17
Joined: Fri Sep 13, 2019 8:15 am
Location: Dortmund / Germany

Re: W600-PICO with HC-SR04 Sensor

Post by Werner_G » Mon Feb 10, 2020 11:34 am

The HC-SR04 is a 5V-device. Do you connect to W600-PICO direct?

johncharris
Posts: 3
Joined: Mon Feb 10, 2020 4:19 am

Re: W600-PICO with HC-SR04 Sensor

Post by johncharris » Mon Feb 10, 2020 4:37 pm

It is directly connected with a resistor on the the echo pin. VCC goes to the 5v pin. I was able to use this setup on an ESP32 so I just assumed it would work here...

John

johncharris
Posts: 3
Joined: Mon Feb 10, 2020 4:19 am

Re: W600-PICO with HC-SR04 Sensor

Post by johncharris » Sat Feb 15, 2020 7:12 pm

Ok, added a level shifter to this with no success. Upon playing around more I found that the I can only get a good value from

Code: Select all

machine.time_pulse_us
when the value starts high then goes low.

The pin seems to be overly sensitive. If I just have a wire connected to it that is not connected to anything else, that is enough for the to finish reading. If nothing is connected it will run until it times out.

Any thoughts on this hardware issue?

John

Post Reply