Skip to content

Tommystus/hc-sr04test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ultrasonic HC-SR04 Test

Overview

Concept testing of time measurement from HC-SR04 ultrasonic sensor echo pulse on Mongoose OS. Interrupt code based on IR library. Eventually, code need to be converted to a lib for general use.

Examples build:

git clone https://github.com/Tommystus/hc-sr04test.git
mos build --arch esp8266
mos flash

Wiring circuit for this test: HC-SR04-Test

The diode is there to protect ESP8266 from 5v signal of the HC-SR04 module (just in case!).

Much time was spent on moving code around to prevent trigger interrupt from interfering with timer. See code comment. Also, keep trigger and echo lines separated to prevent signal crosstalk which may cause false trigger.

Rough formula for converting echo pulse width micro-second time to centimeter: d = (t+14)/55

Examples ping to sound pingbuz.js demo video

About

HC-SR04 Ultrasonic module test with Mongoose OS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published