Skip to content

ionoid-io-projects/workshop_ultrasonic_distance_sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Material needed:

  1. Raspberry Pi 3 or Raspberry Pi Zero WiFi

  2. HC-SR04 Ultrasonic distance sensor

HC-SR04

  1. 1KΩ et 2KΩ Resistors

Cables

  1. Power supply

The design

Mesure distance

wiring

Follow link below for pin connections https://projects.raspberrypi.org/en/projects/physical-computing/14

wiring

Code

1- Power your raspberry

You can achive it with connecting it to your pc trought the Micro USB Port of the raspberry pi

power

2- Connect to your raspberry pi

Using putty if you're on windows, Ssh if you're on a linux based os Follow the following instruction if you dont know how to connect to raspberry pi Connect to Raspberry Pi using Putty

3- Download the binary file

Assuming you're connected with... copy and past this command If you're using Raspberry zero

curl -O https://raw.githubusercontent.com/ionoid-io-projects/workshop_ultrasonic_distance_sensor/master/bin/arm6/udistance

If you're using Raspberry 3 b

curl -O https://raw.githubusercontent.com/ionoid-io-projects/workshop_ultrasonic_distance_sensor/master/bin/arm7/udistance

make it executable

chmod +x udistance

4- execute binary to make led blink

./udistance

How to stop the program

To quit or stop the program click on Ctrl+C

Congratulation.

For explanation

https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi

Other references

https://pimylifeup.com/raspberry-pi-distance-sensor http://espace-raspberry-francais.fr/Composants/ https://github.com/rhiller/pi-distance