Page 1 of 1

W600-PICO with HC-SR04 Sensor

Posted: Mon Feb 10, 2020 5:26 am
by johncharris
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

Re: W600-PICO with HC-SR04 Sensor

Posted: Mon Feb 10, 2020 11:34 am
by Werner_G
The HC-SR04 is a 5V-device. Do you connect to W600-PICO direct?

Re: W600-PICO with HC-SR04 Sensor

Posted: Mon Feb 10, 2020 4:37 pm
by johncharris
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

Re: W600-PICO with HC-SR04 Sensor

Posted: Sat Feb 15, 2020 7:12 pm
by johncharris
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