I have been trying an ultrasonic sensor, HC-SR04, on various versions of the Pi. With any of the large board Pi's the sensor gives me a maximum range of about 100cm, however, when using a Pi Zero it only gives me a max range of about 50cm. I recently got the latest version of the Pi Zero, and have the same result.
Does anyone have the same problem, or does anyone have any ideas as to why the range would be less with the Pi zero all things being equal.
-
- Posts: 32
- Joined: Mon Dec 10, 2012 9:31 pm
- Location: USA
- mikronauts
- Posts: 2821
- Joined: Sat Jan 05, 2013 7:28 pm
- Contact: Website
Re: Ultrasonic sensor on raspberry pi zero
See http://www.mikronauts.com/robot-zoo/elf-2wd-pi-robot/4/
You have to power the HC-SR04 from 5V, then divide the ECHO output down to be 3.3v safe.
The software is also a bit tricky.
You have to power the HC-SR04 from 5V, then divide the ECHO output down to be 3.3v safe.
The software is also a bit tricky.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi
Re: Ultrasonic sensor on raspberry pi zero
There is no reason at all.
You need to power the sensor with 5V and use a voltage divider to cut the echo signal down from 5V to a Pi safe 3V3 as mentioned by mikronauts.
http://abyz.co.uk/rpi/pigpio/examples.html#pdif2_SRTED should work.
You need to power the sensor with 5V and use a voltage divider to cut the echo signal down from 5V to a Pi safe 3V3 as mentioned by mikronauts.
http://abyz.co.uk/rpi/pigpio/examples.html#pdif2_SRTED should work.
-
- Posts: 32
- Joined: Mon Dec 10, 2012 9:31 pm
- Location: USA
Re: Ultrasonic sensor on raspberry pi zero
The Zero is powered with 5 Volts and the echo signal is passed thought a voltage divider to give 3.3 volts to the appropriate pin on the Pi. Although it does look like the voltage may be low somewhere.
David
- mikronauts
- Posts: 2821
- Joined: Sat Jan 05, 2013 7:28 pm
- Contact: Website
Re: Ultrasonic sensor on raspberry pi zero
The HC-SR04 also needs to be powered with 5V
electronicman wrote:The Zero is powered with 5 Volts and the echo signal is passed thought a voltage divider to give 3.3 volts to the appropriate pin on the Pi. Although it does look like the voltage may be low somewhere.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi