SlideShare a Scribd company logo
1 of 23
Remote Tank level Monitor
Prepared by : Parshwadeep Lahane
Summary
• The project uses ultrasonic sensor and ESP8266 to monitor tank water
level at any point of time.
• The monitoring aspect has 2 objectives:
• To check water level at any given point (achieved with the help of cloud connectivity through Thingspeak)
• To send an alert message when tank is filled or empty (achieved with the help of Notify My Android app)
Things needed
6Pin USB 2.0 to TTL
UART Module Serial
Converter
HARDWARE
ESP8266 – 01
Microcontroller with
WiFi capability
HCSR-04
Ultrasonic Sensor
Multi Power Supply
(5V and 3.3V)
Jumper wires Male to
Male
Jumper wires Female
to Female
Jumper wires Male to
Female
12V adaptor (1Amp)
Bread Board
Laptop
Breadboard Adapters
(optional)
WiFi connection
Any android mobile
Things needed
SOFTWARE
NodeMCU firmware (free)
Scripting language (free)
Account on Thingspeak (free)
Account on NMA (free)
Premium one at $5
Windows (any other
also would do)
Costing
• ESP8266 Rs300
• UART Rs180
• HCSR 04 Rs180
• Multipower supply Rs90
• 12V adapter Rs100
• Jumper wires(12) Rs30
• Bread board Rs70
• Premium NMA membership Rs350
TOTAL COST ~Rs 1400
Note: The price quoted is as per what I got on SP road in Bangalore,India. It may be cheaper online/offline at other places so cost can come down further.
Assumptions:
1. WiFi connection already exists
2. Laptop with windows is available
3. Android Mobile phone available
Overview
Water level
measurement
Over WiFi
Power Supply
Over WiFi
Continuous
monitoring
Alerts !
1.ESP8266
microcontroller from Chinese manufacturer Espressif that includes Wi-Fi capability
Cadence Tensilica LX106 microcontroller
• Operates at 3.3V
• Firmware upgrade is needed as first step after purchase
• GPIO 0 should be grounded for firmware upgrade mode
• RST and GPIO2 to be left open
• Connect RX of ESP8266 to TX of FT232RL
• Connect TX of ESP8266 to RX of FT232RL
• Supply external voltage of 3.3V to VCC and CH_PD
• GND to be connected to ground (FT232RL and ESP8266 ground should be
common)
Once the connections are done. RED LED on ESP8266 should be on. BLUE LED
will flash momentarily.
PIN PIN Description
VCC 3.3V
RST Reset (low active)
CH_PD Chip Power down (low active)
TXD Transmit data (3.3V level)
RXD Receive data (3.3V level)
GPIO 0 General Purpose Input / Output
GPIO 2 General Purpose Input / Output
GND Ground
Steps for firmware upgrade: http://www.whatimade.today/loading-the-nodemcu-firmware-on-the-esp8266-windows-guide/
2. Lua
powerful, fast, lightweight, embeddable scripting language
What is Lua?
Lua is a powerful, fast, lightweight, embeddable scripting language.
Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and
extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has
automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid
prototyping.
Where does Lua come from?
Lua is designed, implemented, and maintained by a team at PUC-Rio, the Pontifical Catholic University of Rio de Janeiro in
Brazil. Lua was born and raised in Tecgraf, formerly the Computer Graphics Technology Group of PUC-Rio in 1993. Lua is
now housed at LabLua, a laboratory of the Department of Computer Science of PUC-Rio.
What's in a name?
"Lua" (pronounced LOO-ah) means "Moon" in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun.
More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should
be written in lower case with an initial capital, that is, "Lua".
3. NodeMCU firmware upgrade
Lua based firmware for wifi-soc esp8266
• http://benlo.com/esp8266/esp8266QuickStart.html
• Plug the USB to serial adapter into your PC. Most adapters are automatically recognized by
Windows 7 and 8. Users of XP or older versions of Windows may need a driver which should be
supplied by the manufacturer of the USB adapter. The adapter will appear as a new COM port
on your system. Check the Device Manager if necessary.
• Run ESP8266Flasher.exe
• NodeMcuFlasher
• If you only have one COM device, the port will appear automatically. If you have more than one,
select the correct one from the drop down menu.
• The flasher program comes with default NodeMCU firmware in memory. This is unlikely to be
the latest version, but to get started quickly, use the default internal image. Later, you can
download the latest firmware, then select the [Config] tab and choose the new .bin file. Select
the 0x7C000 default and 0x7E000 blank sections. Uncheck the box for the 0x10000 IROM
section.
• Click on Flash(E) to start the programming process.
• https://www.youtube.com/watch?v=Gh_pgqjfeQc
• https://github.com/nodemcu/nodemcu-firmware
• https://bigdanzblog.wordpress.com/2015/04/14/installing-nodemcu-lua-firmware-on-esp8266-wifi-module/
• http://www.roboremo.com/flashing-nodemcu-firmware-to-esp8266.html
Videos:
Sketch for ESP8266 firmware upgrade
ESP 8266-01FT232RL
TXD
TXD
RXD
RXD
GND GND
GPIO 0
GPIO 2
+3.3V
Multi-Power
Supply
VCC CH_PD
GND
USBconnectiontoLaptop
3 pins used 7 pins used
Note: use a bread board to get connections in place.
A
4.HC SR04 Ultrasonic Sensor
0 of ESP8266
2 of ESP8266
along with ESP8266 and FT232 ground pins
External power supply
• The sensor emits a short ultrasonic burst and then
"listens" for the echo.
• Under control of a host microcontroller (trigger pulse), the
sensor emits a short 40 kHz (ultrasonic) burst.
• This burst travels through the air at about 1130 feet per
second, hits an object and then bounces back to the
sensor.
• The sensor provides an output pulse to the host that will
terminate when the echo is detected, hence the width of
this pulse corresponds to the distance to the target.
Basic working principle:
5. ThingSpeak
The open data cloud platform for the Internet of Things
ThingSpeak API Quick Start
1. Sign Up for a ThingSpeak account
2. Go to Channels, and click New Channel
3. Complete the channel settings, and click Save Channel.
4. Update your Channel via URL:
5. https://api.thingspeak.com/update?api_key=YOUR_CHANN
EL_API_KEY&field1=7
6. View your Channel feed:
7. https://api.thingspeak.com/channels/YOUR_CHANNEL_ID/f
eeds.json
Video Link: https://www.youtube.com/watch?v=I_Jm6Q4z7ig
6. Notify My Android(NMA)
platform that allows you to deliver push notifications from virtually any application to your Android device
NMA API Quick guide
1. Sign Up for a NMA account
2. Go to Manage API Keys and Generate New Key
3. Key details will appear in Key Description field.
4. Update NMA alerts via URL:
conn:send("GET /publicapi/notify?apikey=YOUR API KEY
&application=ESP8266&event=TANK_EMPTY&description=text
1%20text2%20text3&priority=2rn HTTP/1.1rn")
7. ESPlorer
Integrated Development Environment (IDE) for ESP8266 developers
• The essential multi-platforms
tools for any ESP8266 developer
from luatool author’s, including
a LUA for NodeMCU and
MicroPython.
• Download link :
• https://github.com/4refr0nt/ESPlorer
• http://esp8266.ru/esplorer/#download
Code (init.lua)
print("Setting up WIFI...")
wifi.setmode(wifi.STATION)
--modify according your wireless router settings
wifi.sta.config(“SSID",“PASSWORD")
wifi.sta.connect()
tmr.alarm(1, 1000, 1, function()
if wifi.sta.getip()== nil then
print("IP unavailable, Waiting...")
else
tmr.stop(1)
print("Config done, IP is "..wifi.sta.getip())
dofile("hcsr04.lua")
device = hcsr04.init()
tmr.alarm(0, 30000, 1, function() notify() end)
end
end)
Code (hcsr04.lua) function notify()
if device.measure() < 10 then
print("ALERT: TANK IS FULL")
if n == 1 then
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
conn:connect(80,"50.116.34.97")
conn:send("GET
/publicapi/notify?apikey=YOURAPIKEY&application=ESP8266&event=TANK_FULL&description=Tank%20is%20full%20now&priority=2rn
HTTP/1.1rn")
conn:send("Host: notifymyandroid.comrn")
conn:send("Accept: */*rn")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)rn")
conn:send("rn")
n = 0
else n = 1
end
elseif device.measure() > 150 then
print("ALERT: TANK IS EMPTY")
if m == 1 then
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
conn:connect(80,"50.116.34.97")
conn:send("GET
/publicapi/notify?apikey=YOURAPIKEY&application=ESP8266&event=TANK_EMPTY&description=Tank%20is%20empty%20now&priority=2rn
HTTP/1.1rn")
conn:send("Host: notifymyandroid.comrn")
conn:send("Accept: */*rn")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)rn")
conn:send("rn")
m = 0
else m = 1
end
else
print("TANK OK")
print (device.measure())
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
-- api.thingspeak.com 184.106.153.149
conn:connect(80,'184.106.153.149')
conn:send("GET /update?key=YOURAPIKEY&field1="..device.measure().."HTTP/1.1rn")
conn:send("Host: api.thingspeak.comrn")
conn:send("Accept: */*rn")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)rn")
end
end
--https://github.com/loiphin/ESP8266/blob/master/hcsr04.lua
n=0
m=0
hcsr04 = {};
function hcsr04.init(pin_trig, pin_echo)
local self = {}
self.time_start = 0
self.time_end = 0
-- Choose the correct GPIO pins for the trigger and echo of the HC-SR04 module
self.trig = pin_trig or 3
self.echo = pin_echo or 4
gpio.mode(self.trig, gpio.OUTPUT)
gpio.mode(self.echo, gpio.INT)
function self.echo_cb(level)
if level == 1 then
self.time_start = tmr.now()
gpio.trig(self.echo, "down")
else
self.time_end = tmr.now()
end
end
function self.measure()
gpio.trig(self.echo, "up", self.echo_cb)
gpio.write(self.trig, gpio.HIGH)
tmr.delay(100)
gpio.write(self.trig, gpio.LOW)
tmr.delay(100000)
if (self.time_end - self.time_start) < 0 then
return -1
end
return (self.time_end - self.time_start) / 58
end
return self
end
Sketch for SW update and working model
ESP 8266-01FT232RL
HC-SR04
Ultrasonic Sensor
TXD
TXD
RXD
RXD
GND GND GND
GPIO 0
GPIO 2
TRIG
ECHO
+5V+3.3V
Multi-Power
Supply
VCC CH_PD
VCC
GND
USBconnectiontoLaptop
3 pins used 7 pins used 4 pins used
Note: use a bread board to get connections in place.
B
Important for software upload on ESP8266
• FIRST UPLOAD hcsr04.lua on ESP8266
by clicking on Save to ESP in ESplorer.
• NEXT UPLOAD init.lua on ESP8266 by
clicking on Save to ESP in ESplorer.
• Wait for 1-2 min after upload. The setup
should work and updated data points
available on Thingspeak channel and
alerts on Notify My Android as per
distance monitored.
Sketch for post software update on ESP8266
ESP 8266-01
HC-SR04
Ultrasonic Sensor
TXD
RXD
GND GND
GPIO 0
GPIO 2
TRIG
ECHO
+5V+3.3V
Multi-Power
Supply
VCC CH_PD
VCC
GND
5 pins used 4 pins used
C
Tracking sensor data on ThingSpeak
Alerts on mobile with NMA app
In a Nutshell
• Get ESP8266 upgraded with NodeMCU firmware with help of UART (Sketch A)
• Open accounts on Thingspeak and Notify My Android App and get the API keys to be used
in code
• Connect HCSR-04 to ESP8266 and upload the code on ESP8266 using ESPlorer (Sketch B)
• Check the working of init.lua on serial monitor:
• Check Tank Full condition alert on mobile
• Check Tank Empty condition alert on mobile
• Check Tank OK and Charts on Thingspeak scenario
• Remove UART connections and check standalone working of ESP8266 and HCSR-04
(Sketch C)
Next Steps
• Get the things working on circuit board with minimal size
• Implement it in real tank environment
• Look for alternate economical battery sources for powering ESP8266
and HCSR04
END

More Related Content

What's hot

NodeMCU ESP8266 workshop 1
NodeMCU ESP8266 workshop 1NodeMCU ESP8266 workshop 1
NodeMCU ESP8266 workshop 1Andy Gelme
 
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...David Fowler
 
Programando o ESP8266 com Python
Programando o ESP8266 com PythonProgramando o ESP8266 com Python
Programando o ESP8266 com PythonRelsi Maron
 
lesson1 - Getting Started with ESP8266
lesson1 -  Getting Started with ESP8266lesson1 -  Getting Started with ESP8266
lesson1 - Getting Started with ESP8266Elaf A.Saeed
 
IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019Jong-Hyun Kim
 
Esp8266 NodeMCU
Esp8266 NodeMCUEsp8266 NodeMCU
Esp8266 NodeMCUroadster43
 
Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266Baoshi Zhu
 
lesson2 - Nodemcu course - NodeMCU dev Board
 lesson2 - Nodemcu course - NodeMCU dev Board lesson2 - Nodemcu course - NodeMCU dev Board
lesson2 - Nodemcu course - NodeMCU dev BoardElaf A.Saeed
 
Nodemcu - introduction
Nodemcu - introductionNodemcu - introduction
Nodemcu - introductionMichal Sedlak
 
Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Alwin Arrasyid
 
IOT Talking to Webserver - how to
IOT Talking to Webserver - how to IOT Talking to Webserver - how to
IOT Talking to Webserver - how to Indraneel Ganguli
 
Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015mycal1
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseEueung Mulyana
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kitResearch Design Lab
 
Internet of Things
Internet of ThingsInternet of Things
Internet of ThingsAndy Gelme
 

What's hot (20)

WiFi SoC ESP8266
WiFi SoC ESP8266WiFi SoC ESP8266
WiFi SoC ESP8266
 
Esp8266 basics
Esp8266 basicsEsp8266 basics
Esp8266 basics
 
NodeMCU ESP8266 workshop 1
NodeMCU ESP8266 workshop 1NodeMCU ESP8266 workshop 1
NodeMCU ESP8266 workshop 1
 
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
IoT simple with the ESP8266 - presented at the July 2015 Austin IoT Hardware ...
 
Programando o ESP8266 com Python
Programando o ESP8266 com PythonProgramando o ESP8266 com Python
Programando o ESP8266 com Python
 
lesson1 - Getting Started with ESP8266
lesson1 -  Getting Started with ESP8266lesson1 -  Getting Started with ESP8266
lesson1 - Getting Started with ESP8266
 
IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019IoT Hands-On-Lab, KINGS, 2019
IoT Hands-On-Lab, KINGS, 2019
 
Espressif Introduction
Espressif IntroductionEspressif Introduction
Espressif Introduction
 
Esp8266 NodeMCU
Esp8266 NodeMCUEsp8266 NodeMCU
Esp8266 NodeMCU
 
Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266
 
lesson2 - Nodemcu course - NodeMCU dev Board
 lesson2 - Nodemcu course - NodeMCU dev Board lesson2 - Nodemcu course - NodeMCU dev Board
lesson2 - Nodemcu course - NodeMCU dev Board
 
Nodemcu - introduction
Nodemcu - introductionNodemcu - introduction
Nodemcu - introduction
 
Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]Introduction to ESP32 Programming [Road to RIoT 2017]
Introduction to ESP32 Programming [Road to RIoT 2017]
 
IOT Talking to Webserver - how to
IOT Talking to Webserver - how to IOT Talking to Webserver - how to
IOT Talking to Webserver - how to
 
Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015Esp8266 hack sonoma county 4/8/2015
Esp8266 hack sonoma county 4/8/2015
 
Esp8266 Workshop
Esp8266 WorkshopEsp8266 Workshop
Esp8266 Workshop
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Rdl esp32 development board trainer kit
Rdl esp32 development board trainer kitRdl esp32 development board trainer kit
Rdl esp32 development board trainer kit
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
 
Arduino & NodeMcu
Arduino & NodeMcuArduino & NodeMcu
Arduino & NodeMcu
 

Viewers also liked

Pump control with tank level monitoring
Pump control with tank level monitoringPump control with tank level monitoring
Pump control with tank level monitoringAsif Sheriff
 
Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...
Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...
Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...Caladhityo Dwi Prakoso
 
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNOWATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNOSri Adhiyani Sunaryo
 
Assignmet 2 selectedtopic Topic in Computer Engineer
Assignmet 2 selectedtopic Topic in Computer EngineerAssignmet 2 selectedtopic Topic in Computer Engineer
Assignmet 2 selectedtopic Topic in Computer EngineerAey Unthika
 
Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air berbasis Mik...
Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air  berbasis Mik...Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air  berbasis Mik...
Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air berbasis Mik...EM Kautsar
 
Temperature monitoring and controling using arduino
Temperature monitoring and controling using arduinoTemperature monitoring and controling using arduino
Temperature monitoring and controling using arduinoBablu Singh
 
Automatic control of street light using LDR
Automatic control of street light using LDRAutomatic control of street light using LDR
Automatic control of street light using LDRDevang Loharikar
 
Automatic Light Control using LDR and PIR Sensor
Automatic Light Control using LDR and PIR SensorAutomatic Light Control using LDR and PIR Sensor
Automatic Light Control using LDR and PIR SensorZiauddin Ridoy
 
Driving Connectivity in the Scottish Islands: Droneways and Airmasts
Driving Connectivity in the Scottish Islands: Droneways and AirmastsDriving Connectivity in the Scottish Islands: Droneways and Airmasts
Driving Connectivity in the Scottish Islands: Droneways and Airmasts3G4G
 
An Introduction to IoT: Connectivity & Case Studies
An Introduction to IoT: Connectivity & Case StudiesAn Introduction to IoT: Connectivity & Case Studies
An Introduction to IoT: Connectivity & Case Studies3G4G
 
5G Network Architecture and Design
5G Network Architecture and Design5G Network Architecture and Design
5G Network Architecture and Design3G4G
 
3GPP Standards for the Internet-of-Things
3GPP Standards for the Internet-of-Things3GPP Standards for the Internet-of-Things
3GPP Standards for the Internet-of-ThingsEiko Seidel
 

Viewers also liked (14)

Pump control with tank level monitoring
Pump control with tank level monitoringPump control with tank level monitoring
Pump control with tank level monitoring
 
Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...
Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...
Instrumentation Project "Monitoring And Control Water Level With Arduino Uno"...
 
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNOWATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
WATER LEVEL MEASURE AND CONTROL WITH ULTRASONIK SENSOR AND ARDUINO UNO
 
Assignmet 2 selectedtopic Topic in Computer Engineer
Assignmet 2 selectedtopic Topic in Computer EngineerAssignmet 2 selectedtopic Topic in Computer Engineer
Assignmet 2 selectedtopic Topic in Computer Engineer
 
Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air berbasis Mik...
Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air  berbasis Mik...Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air  berbasis Mik...
Sistem Monitoring Digital Penggunaan dan Kualitas Kekeruhan Air berbasis Mik...
 
Echolocation
EcholocationEcholocation
Echolocation
 
Temperature monitoring system
Temperature monitoring systemTemperature monitoring system
Temperature monitoring system
 
Temperature monitoring and controling using arduino
Temperature monitoring and controling using arduinoTemperature monitoring and controling using arduino
Temperature monitoring and controling using arduino
 
Automatic control of street light using LDR
Automatic control of street light using LDRAutomatic control of street light using LDR
Automatic control of street light using LDR
 
Automatic Light Control using LDR and PIR Sensor
Automatic Light Control using LDR and PIR SensorAutomatic Light Control using LDR and PIR Sensor
Automatic Light Control using LDR and PIR Sensor
 
Driving Connectivity in the Scottish Islands: Droneways and Airmasts
Driving Connectivity in the Scottish Islands: Droneways and AirmastsDriving Connectivity in the Scottish Islands: Droneways and Airmasts
Driving Connectivity in the Scottish Islands: Droneways and Airmasts
 
An Introduction to IoT: Connectivity & Case Studies
An Introduction to IoT: Connectivity & Case StudiesAn Introduction to IoT: Connectivity & Case Studies
An Introduction to IoT: Connectivity & Case Studies
 
5G Network Architecture and Design
5G Network Architecture and Design5G Network Architecture and Design
5G Network Architecture and Design
 
3GPP Standards for the Internet-of-Things
3GPP Standards for the Internet-of-Things3GPP Standards for the Internet-of-Things
3GPP Standards for the Internet-of-Things
 

Similar to Remote tanklevelmonitor

ESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started GuideESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started Guidehandson28
 
esp32-complex-waveform-generator-v2.pdf
esp32-complex-waveform-generator-v2.pdfesp32-complex-waveform-generator-v2.pdf
esp32-complex-waveform-generator-v2.pdfDaniel Donatelli
 
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup
 
[MakerHN] [IoT] [01] Intro 2
[MakerHN] [IoT] [01] Intro 2[MakerHN] [IoT] [01] Intro 2
[MakerHN] [IoT] [01] Intro 2Công Hoàng Văn
 
Gas leakage detection system
Gas leakage detection systemGas leakage detection system
Gas leakage detection systemAashiq Ahamed N
 
ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...
ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...
ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...IoTdevices
 
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT WorkshopRepublic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT WorkshopAlwin Arrasyid
 
“Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems” “Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems” GlobalLogic Ukraine
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with PythonLelio Campanile
 
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A GlanceAVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A GlanceScott Faria
 
Electronics ESP processors
Electronics ESP processorsElectronics ESP processors
Electronics ESP processorsLeopoldo Armesto
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BJingfeng Liu
 

Similar to Remote tanklevelmonitor (20)

Chapter 2.doc
Chapter 2.docChapter 2.doc
Chapter 2.doc
 
ESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started GuideESP32 WiFi & Bluetooth Module - Getting Started Guide
ESP32 WiFi & Bluetooth Module - Getting Started Guide
 
esp32-complex-waveform-generator-v2.pdf
esp32-complex-waveform-generator-v2.pdfesp32-complex-waveform-generator-v2.pdf
esp32-complex-waveform-generator-v2.pdf
 
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
 
[MakerHN] [IoT] [01] Intro 2
[MakerHN] [IoT] [01] Intro 2[MakerHN] [IoT] [01] Intro 2
[MakerHN] [IoT] [01] Intro 2
 
Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
 
ESP8266 Wifi Nodemcu
ESP8266 Wifi Nodemcu ESP8266 Wifi Nodemcu
ESP8266 Wifi Nodemcu
 
ESAT– ISP
ESAT– ISPESAT– ISP
ESAT– ISP
 
Gas leakage detection system
Gas leakage detection systemGas leakage detection system
Gas leakage detection system
 
ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...
ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...
ESP12.OLED_V1 Datasheet EN - Universal ESP8266 controller board with 0.96″ I2...
 
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT WorkshopRepublic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
 
“Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems” “Automation Testing for Embedded Systems”
“Automation Testing for Embedded Systems”
 
Tos tutorial
Tos tutorialTos tutorial
Tos tutorial
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with Python
 
Esp8266 v12
Esp8266 v12Esp8266 v12
Esp8266 v12
 
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A GlanceAVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
 
Electronics ESP processors
Electronics ESP processorsElectronics ESP processors
Electronics ESP processors
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
IoT Platform
IoT PlatformIoT Platform
IoT Platform
 

Recently uploaded

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Recently uploaded (20)

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Remote tanklevelmonitor

  • 1. Remote Tank level Monitor Prepared by : Parshwadeep Lahane
  • 2. Summary • The project uses ultrasonic sensor and ESP8266 to monitor tank water level at any point of time. • The monitoring aspect has 2 objectives: • To check water level at any given point (achieved with the help of cloud connectivity through Thingspeak) • To send an alert message when tank is filled or empty (achieved with the help of Notify My Android app)
  • 3. Things needed 6Pin USB 2.0 to TTL UART Module Serial Converter HARDWARE ESP8266 – 01 Microcontroller with WiFi capability HCSR-04 Ultrasonic Sensor Multi Power Supply (5V and 3.3V) Jumper wires Male to Male Jumper wires Female to Female Jumper wires Male to Female 12V adaptor (1Amp) Bread Board Laptop Breadboard Adapters (optional) WiFi connection Any android mobile
  • 4. Things needed SOFTWARE NodeMCU firmware (free) Scripting language (free) Account on Thingspeak (free) Account on NMA (free) Premium one at $5 Windows (any other also would do)
  • 5. Costing • ESP8266 Rs300 • UART Rs180 • HCSR 04 Rs180 • Multipower supply Rs90 • 12V adapter Rs100 • Jumper wires(12) Rs30 • Bread board Rs70 • Premium NMA membership Rs350 TOTAL COST ~Rs 1400 Note: The price quoted is as per what I got on SP road in Bangalore,India. It may be cheaper online/offline at other places so cost can come down further. Assumptions: 1. WiFi connection already exists 2. Laptop with windows is available 3. Android Mobile phone available
  • 6. Overview Water level measurement Over WiFi Power Supply Over WiFi Continuous monitoring Alerts !
  • 7. 1.ESP8266 microcontroller from Chinese manufacturer Espressif that includes Wi-Fi capability Cadence Tensilica LX106 microcontroller • Operates at 3.3V • Firmware upgrade is needed as first step after purchase • GPIO 0 should be grounded for firmware upgrade mode • RST and GPIO2 to be left open • Connect RX of ESP8266 to TX of FT232RL • Connect TX of ESP8266 to RX of FT232RL • Supply external voltage of 3.3V to VCC and CH_PD • GND to be connected to ground (FT232RL and ESP8266 ground should be common) Once the connections are done. RED LED on ESP8266 should be on. BLUE LED will flash momentarily. PIN PIN Description VCC 3.3V RST Reset (low active) CH_PD Chip Power down (low active) TXD Transmit data (3.3V level) RXD Receive data (3.3V level) GPIO 0 General Purpose Input / Output GPIO 2 General Purpose Input / Output GND Ground Steps for firmware upgrade: http://www.whatimade.today/loading-the-nodemcu-firmware-on-the-esp8266-windows-guide/
  • 8. 2. Lua powerful, fast, lightweight, embeddable scripting language What is Lua? Lua is a powerful, fast, lightweight, embeddable scripting language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. Where does Lua come from? Lua is designed, implemented, and maintained by a team at PUC-Rio, the Pontifical Catholic University of Rio de Janeiro in Brazil. Lua was born and raised in Tecgraf, formerly the Computer Graphics Technology Group of PUC-Rio in 1993. Lua is now housed at LabLua, a laboratory of the Department of Computer Science of PUC-Rio. What's in a name? "Lua" (pronounced LOO-ah) means "Moon" in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun. More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should be written in lower case with an initial capital, that is, "Lua".
  • 9. 3. NodeMCU firmware upgrade Lua based firmware for wifi-soc esp8266 • http://benlo.com/esp8266/esp8266QuickStart.html • Plug the USB to serial adapter into your PC. Most adapters are automatically recognized by Windows 7 and 8. Users of XP or older versions of Windows may need a driver which should be supplied by the manufacturer of the USB adapter. The adapter will appear as a new COM port on your system. Check the Device Manager if necessary. • Run ESP8266Flasher.exe • NodeMcuFlasher • If you only have one COM device, the port will appear automatically. If you have more than one, select the correct one from the drop down menu. • The flasher program comes with default NodeMCU firmware in memory. This is unlikely to be the latest version, but to get started quickly, use the default internal image. Later, you can download the latest firmware, then select the [Config] tab and choose the new .bin file. Select the 0x7C000 default and 0x7E000 blank sections. Uncheck the box for the 0x10000 IROM section. • Click on Flash(E) to start the programming process. • https://www.youtube.com/watch?v=Gh_pgqjfeQc • https://github.com/nodemcu/nodemcu-firmware • https://bigdanzblog.wordpress.com/2015/04/14/installing-nodemcu-lua-firmware-on-esp8266-wifi-module/ • http://www.roboremo.com/flashing-nodemcu-firmware-to-esp8266.html Videos:
  • 10. Sketch for ESP8266 firmware upgrade ESP 8266-01FT232RL TXD TXD RXD RXD GND GND GPIO 0 GPIO 2 +3.3V Multi-Power Supply VCC CH_PD GND USBconnectiontoLaptop 3 pins used 7 pins used Note: use a bread board to get connections in place. A
  • 11. 4.HC SR04 Ultrasonic Sensor 0 of ESP8266 2 of ESP8266 along with ESP8266 and FT232 ground pins External power supply • The sensor emits a short ultrasonic burst and then "listens" for the echo. • Under control of a host microcontroller (trigger pulse), the sensor emits a short 40 kHz (ultrasonic) burst. • This burst travels through the air at about 1130 feet per second, hits an object and then bounces back to the sensor. • The sensor provides an output pulse to the host that will terminate when the echo is detected, hence the width of this pulse corresponds to the distance to the target. Basic working principle:
  • 12. 5. ThingSpeak The open data cloud platform for the Internet of Things ThingSpeak API Quick Start 1. Sign Up for a ThingSpeak account 2. Go to Channels, and click New Channel 3. Complete the channel settings, and click Save Channel. 4. Update your Channel via URL: 5. https://api.thingspeak.com/update?api_key=YOUR_CHANN EL_API_KEY&field1=7 6. View your Channel feed: 7. https://api.thingspeak.com/channels/YOUR_CHANNEL_ID/f eeds.json Video Link: https://www.youtube.com/watch?v=I_Jm6Q4z7ig
  • 13. 6. Notify My Android(NMA) platform that allows you to deliver push notifications from virtually any application to your Android device NMA API Quick guide 1. Sign Up for a NMA account 2. Go to Manage API Keys and Generate New Key 3. Key details will appear in Key Description field. 4. Update NMA alerts via URL: conn:send("GET /publicapi/notify?apikey=YOUR API KEY &application=ESP8266&event=TANK_EMPTY&description=text 1%20text2%20text3&priority=2rn HTTP/1.1rn")
  • 14. 7. ESPlorer Integrated Development Environment (IDE) for ESP8266 developers • The essential multi-platforms tools for any ESP8266 developer from luatool author’s, including a LUA for NodeMCU and MicroPython. • Download link : • https://github.com/4refr0nt/ESPlorer • http://esp8266.ru/esplorer/#download
  • 15. Code (init.lua) print("Setting up WIFI...") wifi.setmode(wifi.STATION) --modify according your wireless router settings wifi.sta.config(“SSID",“PASSWORD") wifi.sta.connect() tmr.alarm(1, 1000, 1, function() if wifi.sta.getip()== nil then print("IP unavailable, Waiting...") else tmr.stop(1) print("Config done, IP is "..wifi.sta.getip()) dofile("hcsr04.lua") device = hcsr04.init() tmr.alarm(0, 30000, 1, function() notify() end) end end)
  • 16. Code (hcsr04.lua) function notify() if device.measure() < 10 then print("ALERT: TANK IS FULL") if n == 1 then conn=net.createConnection(net.TCP, 0) conn:on("receive", function(conn, payload) print(payload) end) conn:connect(80,"50.116.34.97") conn:send("GET /publicapi/notify?apikey=YOURAPIKEY&application=ESP8266&event=TANK_FULL&description=Tank%20is%20full%20now&priority=2rn HTTP/1.1rn") conn:send("Host: notifymyandroid.comrn") conn:send("Accept: */*rn") conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)rn") conn:send("rn") n = 0 else n = 1 end elseif device.measure() > 150 then print("ALERT: TANK IS EMPTY") if m == 1 then conn=net.createConnection(net.TCP, 0) conn:on("receive", function(conn, payload) print(payload) end) conn:connect(80,"50.116.34.97") conn:send("GET /publicapi/notify?apikey=YOURAPIKEY&application=ESP8266&event=TANK_EMPTY&description=Tank%20is%20empty%20now&priority=2rn HTTP/1.1rn") conn:send("Host: notifymyandroid.comrn") conn:send("Accept: */*rn") conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)rn") conn:send("rn") m = 0 else m = 1 end else print("TANK OK") print (device.measure()) conn=net.createConnection(net.TCP, 0) conn:on("receive", function(conn, payload) print(payload) end) -- api.thingspeak.com 184.106.153.149 conn:connect(80,'184.106.153.149') conn:send("GET /update?key=YOURAPIKEY&field1="..device.measure().."HTTP/1.1rn") conn:send("Host: api.thingspeak.comrn") conn:send("Accept: */*rn") conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)rn") end end --https://github.com/loiphin/ESP8266/blob/master/hcsr04.lua n=0 m=0 hcsr04 = {}; function hcsr04.init(pin_trig, pin_echo) local self = {} self.time_start = 0 self.time_end = 0 -- Choose the correct GPIO pins for the trigger and echo of the HC-SR04 module self.trig = pin_trig or 3 self.echo = pin_echo or 4 gpio.mode(self.trig, gpio.OUTPUT) gpio.mode(self.echo, gpio.INT) function self.echo_cb(level) if level == 1 then self.time_start = tmr.now() gpio.trig(self.echo, "down") else self.time_end = tmr.now() end end function self.measure() gpio.trig(self.echo, "up", self.echo_cb) gpio.write(self.trig, gpio.HIGH) tmr.delay(100) gpio.write(self.trig, gpio.LOW) tmr.delay(100000) if (self.time_end - self.time_start) < 0 then return -1 end return (self.time_end - self.time_start) / 58 end return self end
  • 17. Sketch for SW update and working model ESP 8266-01FT232RL HC-SR04 Ultrasonic Sensor TXD TXD RXD RXD GND GND GND GPIO 0 GPIO 2 TRIG ECHO +5V+3.3V Multi-Power Supply VCC CH_PD VCC GND USBconnectiontoLaptop 3 pins used 7 pins used 4 pins used Note: use a bread board to get connections in place. B
  • 18. Important for software upload on ESP8266 • FIRST UPLOAD hcsr04.lua on ESP8266 by clicking on Save to ESP in ESplorer. • NEXT UPLOAD init.lua on ESP8266 by clicking on Save to ESP in ESplorer. • Wait for 1-2 min after upload. The setup should work and updated data points available on Thingspeak channel and alerts on Notify My Android as per distance monitored.
  • 19. Sketch for post software update on ESP8266 ESP 8266-01 HC-SR04 Ultrasonic Sensor TXD RXD GND GND GPIO 0 GPIO 2 TRIG ECHO +5V+3.3V Multi-Power Supply VCC CH_PD VCC GND 5 pins used 4 pins used C
  • 20. Tracking sensor data on ThingSpeak Alerts on mobile with NMA app
  • 21. In a Nutshell • Get ESP8266 upgraded with NodeMCU firmware with help of UART (Sketch A) • Open accounts on Thingspeak and Notify My Android App and get the API keys to be used in code • Connect HCSR-04 to ESP8266 and upload the code on ESP8266 using ESPlorer (Sketch B) • Check the working of init.lua on serial monitor: • Check Tank Full condition alert on mobile • Check Tank Empty condition alert on mobile • Check Tank OK and Charts on Thingspeak scenario • Remove UART connections and check standalone working of ESP8266 and HCSR-04 (Sketch C)
  • 22. Next Steps • Get the things working on circuit board with minimal size • Implement it in real tank environment • Look for alternate economical battery sources for powering ESP8266 and HCSR04
  • 23. END

Editor's Notes

  1. https://en.wikipedia.org/wiki/ESP8266