Introduction: IOT - Smart Jar Using ESP8266 , Arduino and Ultrasonic Sensor Publishing Data in Local Server

Picture of IOT - Smart Jar Using ESP8266 , Arduino and Ultrasonic Sensor Publishing Data in Local Server

Hello All ! Thanks For Viewing our Instructable . In this Instructable We will Show you the Steps for Making a prototype Like this . Here we are Creating a Database in Localhost Server . A link is made to communicate the ESP8266 to the DB through PHP Script . And the Details are displayed in another PHP Script . Please download the Images and view it properly ., because we have provided Photos so you can See it offline too . Happy Learning !

Step 1: Things Needed for Making a Smart Jar

Picture of Things Needed for Making a Smart Jar

As explained in the Introduction this Product is a Basic Prototype . It Doesn't Require Costly Elements . The Following are the Things and Software Needed to make this ! Happy DIYing !

Components :

  1. Arduino UNO
  2. Ultrasonic Sensor
  3. A Empty Jar ( Plastic or Transparent is Recommended )
  4. Bread Board
  5. Main Guy : ESP8266 (Wifi Module )
  6. Jumper Wires (15 - 20)
  7. Program loading Cable
  8. Resistors ( 2K ) - 2 Nos

Software :

  1. Arduino IDE
  2. Sublime Text or Notepad ++
  3. Apache Server or Any Hosted Server
  4. Mysql Database

Step 2: ESP 8266 and Ultrasonic Sensor Connection

Picture of ESP 8266 and Ultrasonic Sensor Connection

The Above Image will Clearly explain the Connections For The ESP 8266 and Ultrasonic Sensor with Arduino .

Step 3: Programming Arduino for ESP and Bluetooth

#include <SoftwareSerial.h>

SoftwareSerial esp(2, 3);

long duration ;

int distance;

void setup() {

// put your setup code here, to run once:









esp.println("AT+CWJAP=\"Wifi Name SSID \",\"Wifi Password\"");





void loop() {

// put your main code here, to run repeatedly:






duration = pulseIn(10,HIGH);

distance = duration*0.034/2;

esp.println("AT+CIPSTART=\"TCP\",\"Your IP Address\",80");




esp.print("GET Your Link with the IP address You Used ");





void response(int waitTime) {

for (int i = 0 ; i < waitTime; i++)

{ if (esp.available() > 0)

{ char x =;




} }

Step 4: Website Programming - Inserting Data

Picture of Website Programming  - Inserting Data

The Following Code is to Typed in Text Editor . It is the Code for Inserting data into Database .

Step 5: Website Programming - Displaying Data

Picture of Website Programming  - Displaying Data

Please Refer the Image for the Code of Displaying Values .

Step 6: Setting Up the Database - I Have Used PHPMyAdmin Pannel

Picture of Setting Up the Database - I Have Used PHPMyAdmin Pannel

This is a General GUI . If you have doubts in SQL . Feel free to mail us at With Subject Instructable - Smart Jar .

Step 7: Done ! Time to Test

Please make sure you use the correct Baud Rate . If ESP8266 gives error We request you to set the baud rate properly . For any further queries don't hesitate to Mail UsThanks for Following the Steps .

Project Made By

Narendra Santhosh N <>

Ajay Karthik K <>

Subash C


Bhargav007 (author)2017-03-19

please can someone help??

mail id :-

Cancerianb (author)2017-02-19


Nice project . I got some errors in it Please help me . Firstly connection error ,and secondly i think webpage is not complete . Please share full code of webpage and connection .Thanks

Bhargav007 (author)Cancerianb2017-03-19

can you help me please

mail id:

i dont know what to do after connections

JayaC4 (author)2016-08-09

Really proud of you.Inspiration for a reason! Keep going :)

BowrnikaK (author)2016-08-08

Hi santy..its adorable!!as you are progressing in betterment of ur career.. Really appreciate you!! Hope ur best is about to reach u... My hearty wishes for ur innovations..keep going!!

seamster (author)2016-08-08

Very nicely done, thank you for sharing :)

About This Instructable




More by santy_naren:Sense-arise Automation for HomeIOT - Smart Jar using ESP8266 , Arduino and Ultrasonic Sensor Publishing Data in Local Server
Add instructable to: