Introduction: Monitor Tank Water Level or Distance on Your Desktop

Using Wemos D1, an ultrasonic sensor and Thingio.AI IoT platform.

Step 1:

Just you need to interface your Wemos D1 and ultrasonic sensor as shown in diagram.

Then upload code onto your Wemos D1 and show the output on your desktop.

Link :

Code is available for you and just you need change your wi-fi ssid and password and also change your product id and slave id as per iot platform.


Step 2: Step by Step Process

Step 3: Hardware Description

Wemos D1 :

Features :

11 digital input/output pins, all pins have interrupt/pwm/I2C/one-wire supported(except for D0) 1 analog input(3.2V max input) Micro USB connection Power jack, 9-24V power input. Compatible with Arduino Compatible with nodemcu

Technical specs :

Microcontroller --> ESP-8266EX

Operating Voltage --> 3.3V

Digital I/O Pins --> 11

Analog Input Pins --> 1(Max input: 3.2V)

Clock Speed --> 80MHz/160MHz

Flash --> 4M bytes

Length --> 68.6mm

Width --> 53.4mm

Weight --> 25g

Pin :

Pin | Function | ESP-8266



A0 | Analog input, max 3.3V input | A0

D0 | IO | GPIO16D1 | IO, SCL | GPIO5

D2 | IO, SDA | GPIO4

D3 | IO, 10k Pull-up | GPIO0

D4 | IO, 10k Pull-up, BUILTIN_LED | GPIO2

D5 | IO, SCK | GPIO14

D6 | IO, MISO | GPIO12

D7 | IO, MOSI | GPIO13

D8 | IO, 10k Pull-down, SS | GPIO15

G | Ground | GND

5V | 5V | -

3V3 | 3.3V | 3.3V

RST | Reset | RST

UltraSonic Sensor :

If you are sourcing a ultrasonic ranging module , the HC-SR04 is good choose . Its stable performance and high ranging accuracy make it a popular module in electronic market .Compared to the Shap IR ranging module , HC-SR04 is more inexpensive than it . But it has the same ranging accuracy and longer ranging distance.

Specifications :

  • Power supply: 5V
  • DC Quiescent current: <2mA
  • Effectual angle: <15°
  • Ranging distance: 2cm – 500 cm
  • Resolution: 1 cm
  • Ultrasonic Frequency: 40k Hz

A short ultrasonic pulse is transmitted at the time 0, reflected by an object. The senor receives this signal and converts it to an electric signal. The next pulse can be transmitted when the echo is faded away. This time period is called cycle period. The recommend cycle period should be no less than 50ms. If a 10μs width trigger pulse is sent to the signal pin, the Ultrasonic module will output eight 40kHz ultrasonic signal and detect the echo back. The measured distance is proportional to the echo pulse width and can be calculated by the formula above. If no obstacle is detected, the output pin will give a 38ms high level signal.