Skip to content

Basic sensor alarm system made with ESP8266 and HC-SR04.

License

Notifications You must be signed in to change notification settings

migueltc13/HC-SR04

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HC-SR04 Sensor Alarm

Distance detection system made with HC-SR04 Ultrasonic Sensor and micro-controller ESP8266.

  • Circuit controlled by Wi-Fi with the Blynk app/website.
  • Trigger distances are customizable in centimeters (cm).
  • Delay times are customizable in milliseconds (ms).

Still in progress...


A special thanks to the ESP8266 Community for the board driver for the ESP8266 in Arduino IDE and also to Volodymyr Shymanskyy for the Blynk library used in this project for Wi-Fi connectivity.


Installation

You can use multiple IDEs, such as Arduino IDE (Genuino), to transfer the code to the micro-controller ESP8266.
There are also plugins to use in IDEs like VSCode, Sublime-text, etc.

After compiling the .ino main file the code can be sent to the ESP and the installation/programming phases are over.


Components

  • 1x - ESP8266
  • 1x - HC-SR04
  • 1x - LED*
  • 1x - 1k Resistor*
  • 4x or 6x(*) - Jumper Wires

(*) Optional - Can be replaced with other components.


Circuit Sketch

Circuit Sketch


Issues & Solutions

a) Port closed or access denied in the USB connection.

a.1) There's a shell file "ttyUSB0.sh", located in the "src" dir made to open the USB0 port to enable the ESP connection, fixing issue a).

That executes the following command:

sudo chmod -R 777 /dev/ttyUSB0 

To run simply type:

./src/ttyUSB0.sh

Feel free to modify it to your respective USB port.


Or:

a.2) You can run the following commands:

groups

To see all available groups type:

compgen -g

Most of them are self-explanatory, in this case, you want to add yourself to either the tty group or dial-out, which you would do by:

sudo usermod -a -G tty <USERNAME>

Then you should have access to tty without the use of sudo.


TODO

  • Sketch
  • Config file
  • Blynk LED
  • Blynk screenshot