diff --git a/HC-SR04.md b/HC-SR04.md new file mode 100644 index 00000000..35320fdd --- /dev/null +++ b/HC-SR04.md @@ -0,0 +1,38 @@ +HC-SR04 (HC-SR04P and JSN-SR04T) is an ultrasonic ranging sensor. Provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit. See [HC-SR04 Ultrasonic Sensor](https://www.sparkfun.com/products/13959) for more information. + +Buy example: +- [AliExpress](https://www.aliexpress.com/item/4000124226294.html) +- [Sparkfun](https://www.sparkfun.com/products/13959) + +## Configuration +### Wiring + + +| HC-SR04 | ESP8266 | +|---|---| +|Vcc |5V | +|GND |GND | +|Trig |GPIOx | +|Echo
use voltage divider! |GPIOy | + +The HC-SR04 operates at 5V and therefore the echo signal will be 5V as well. Connecting the echo pin via a voltage divider (see schematic) will divide the 5V to 3.3V, which is the operating voltage of an ESP8266. + +There is a variant of the HC-SR04, called HC-SR04P. It mainly operates at 3.3V and then it doesn't need the voltage divider but you will notice a range drop of about 1 meter. +![image](https://user-images.githubusercontent.com/5904370/68340827-75155880-00e7-11ea-8f79-efd47bd421bc.png) + +### Tasmota +In the _Configuration -> Configure Module_ page assign: +1. GPIOx to `SR04 Tri (69)` +2. GPIOy to `SR04 Ech (70)` + +![image](https://user-images.githubusercontent.com/5904370/68340227-4ea2ed80-00e6-11ea-90bf-c6da3cd6eb22.png) + +### Tasmota Main +After a reboot webUI displays the HC-SR04 distance. + +![image](https://user-images.githubusercontent.com/5904370/68340187-39c65a00-00e6-11ea-8c27-22527368e3d5.png) + +Sensor sends a `tele/%topic%/SENSOR` JSON reponse: +```json +{"Time":"2019-01-01T22:42:35","SR04":{"Distance":16.754}} +``` diff --git a/Peripherals.md b/Peripherals.md index fa9348aa..860a5af7 100644 --- a/Peripherals.md +++ b/Peripherals.md @@ -24,7 +24,7 @@ More about [general configuration](Sensor-Configuration). - [**DS3231**](DS3231) - Real-Time-Clock (I2C) - [**HM16/HM17**](iBeacon-driver) - Bluetooth iBeacon reader (serial) - **HR-E** - Water Meter Encoder interface (serial) -- [**HC-SR04 (SR04+, SR04T)**](Wemos-D1-Mini-and-HC-SR04-Ultrasonic-Sensor) - Ultrasonic Sensor +- [**HC-SR04 (HC-SR04P, JSN-SR04T)**](HC-SR04) - Ultrasonic Sensor - [**HC-SR501**](PIR-Motion-Sensors#HC-SR501) - PIR Motion Sensor - **Honeywell HIH** - Temperature and Humidity sensor (I2C) - **Honeywell HPMA115S0** - Particulate Matter Sensor (serial) diff --git a/Supported-sensors.md b/Supported-sensors.md index 108da0be..c417d890 100644 --- a/Supported-sensors.md +++ b/Supported-sensors.md @@ -17,7 +17,7 @@ - [**DS3231**](DS3231) Real-Time-Clock (I2C) - [**HM16/HM17**](iBeacon-driver) Bluetooth iBeacon reader (Serial) - **HR-E** Water Meter Encoder interface (Serial) -- [**HC-SR04 (SR04+, SR04T)**](Wemos-D1-Mini-and-HC-SR04-Ultrasonic-Sensor) Ultrasonic Sensor +- [**HC-SR04 (SR04+, SR04T)**](HC-SR04) Ultrasonic Sensor - [**HC-SR501**](PIR-Motion-Sensors#HC-SR501) PIR Motion Sensor - **HTU21** Temperature and Humidity sensor (I2C) - **HX711** Load Cell sensor (GPIO) diff --git a/Wemos-D1-Mini-and-HC-SR04-Ultrasonic-Sensor.md b/Wemos-D1-Mini-and-HC-SR04-Ultrasonic-Sensor.md deleted file mode 100644 index 6644e3ea..00000000 --- a/Wemos-D1-Mini-and-HC-SR04-Ultrasonic-Sensor.md +++ /dev/null @@ -1,35 +0,0 @@ -## HC-SR04 Ultrasonic Sensor - - - -"This is the HC-SR04 ultrasonic ranging sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit." See [HC-SR04 Ultrasonic Sensor](https://www.sparkfun.com/products/13959) for more information. - -Buy example: -- [AliExpress](https://aliexpress.com/item/Free-shipping-1pcs-Ultrasonic-Module-HC-SR04-Distance-Measuring-Transducer-Sensor-for-Arduino-Samples-Best-prices/690139020.html) -- [Sparkfun](https://www.sparkfun.com/products/13959) - -### Connecting the HC-SR04 to a Wemos Mini D1 - - -| Wemos | HC-SR04 | -|---|---| -|GND |GND | -|5V |VCC | -|D6 (gpio12) |Echo via voltage divider | -|D7 (gpio13) |Trigger | - -The HC-SR04 operates best at 5V, therefore the echo signal will be 5V as well. Connecting the echo pin via a voltage divider (see schematic) will divide the 5V to 3.3V, which is the operation voltage of the Wemos D1 Mini. -Please note there is a variant of the HC-SR04, called HC-SR04P. It mainly operates at 3.3V and then it doesn't need the voltage divider but you will notice a range drop of about 1 meter. - -### Tasmota Configuration -In the Configuration -> Configure Module page, select the following: -1. **Module Type : 18 Generic** -2. **D6 GPIO12 : 70 SR04 Ech** -3. **D7 GPIO13 : 69 SR04 Tri** - - - -### Tasmota Main -After reboot of the device the displays the HC-SR04 distance. - - \ No newline at end of file