Using Ethernet Shield to Send ARDUINO Sensors Data to a MySQL Database and Display It on a Website With PHP, HTML & CSS

For this, you will need to have basic knowledge on Arduino Programming, MySQL, PHP, HTML & CSS (optional)...

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things You Will Need

Arduino Development Board (Arduino Mega 2560 Recommended)

Arduino Ethernet Shield

A Wireless Router with Internet Connection

Cat 5 RJ 45 Connector Network Cable (any other can work) (check the images and pick one)

3 Male - Female Jumper Wires and some Male To Male Jumper Wires

A Web Hosting Account (get a fee one at 000webhost.com or 0fees.us, i used 000webhost.com)

DHT 11 / 22 Temperature Sensor

LCD 16X2 LCD Display

A Breadboard

MySQL Connector Library (Download from github Thanks to ChuckBell)

I got the hardware from amazon and I am sure they still have some more... :-)

Step 2: Connecting Things Together

The Ethernet Shield

Stack The Ethernet Shield over the Arduino Mega Board. (make sure all the pins are in their respective holes)

The DHT 22 Sensor

Connect the +pin (left most) to the +line(red Line) at the edge of the breadboard

Connect the -pin / Ground pin(right most) to the -line (Blue line) at the edge of the breadboard

Connect the out pin to digital pin 2 of the Arduino

The LCD

Connect as follows

Pin 1 (VSS) -> Pin 16(K) To the ground of the breadboard

Pin 2(VDD) -> Pin 15(A) To the +line of the breadboard

pin 3(VO) Through a 1kohm resistor to the ground

Pin 4 (ES) To the Arduino 32

Pin 5 (RW) To the Ground

Pin 6 (E) to the Arduino 30

Pin 11 (D4) to the Arduino 28

Pin 12 (D5) To the Arduino 26

Pin 13 (D6) To the Arduino 24

Pin 14 (D7) To the Arduino 22

The Breadboard

Connect the Red Line of the breadboard to the 5V of the Arduino

The Blue Line to the Ground

Step 3: Deploying

Download the zip file and extract it

copy the ev folder into the htdocs directory of your web server

goto the browser and type in localhost/ev/setup.php

the script will setup the sql database and tables

goto the codes folder and

open the ev.ino file in arduino and upload to the arduino mega board

set the baud rate to 115200

when it is done uploading and everything is connected properly

you

Step 4: The Working

If you like this project please vote me up and hit the like button...

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    13 Discussions

    None
    VitruviusB

    8 months ago

    The INSERT QUERY was not included in the source code, how did you implement it?

    None
    mkhannn

    9 months ago

    Hello
    please make video all this process
    i am confuse i don't know where i pack MySQL library and php files and i also use windows 10
    please give me tips what to do

    None
    AzizS25

    1 year ago

    Thank you Sir,

    Could you please send the complete code to this e-mail : azi_z30@yahoo.com

    If I want to send the data to a website using ASP.net what is the possible change could be made?

    1 reply
    None
    EdrisaT1AzizS25

    Reply 1 year ago

    It's possible... But please inbox me

    None
    jisaac6

    Question 1 year ago on Step 3

    Please I am a novice on Arduino still practicing. I want help to write a code to monitor a battery bank of 24V (A0 probably), an AC 230V (A1 probably), an auxillary ac volt 230V AC (A2 probably), temperature and humidity probably A3/A4. Also would want them accesible on the web remotely and possible in graphical and block form.

    Please how do i start or how can i achieve this please. my email: isaacjohnsong007@gmail.com

    1 answer
    None
    JorgeG239

    1 year ago

    Little help here, im using ubuntu 18.04, with arduino IDE 9.0 beta, i have a "Connection failed..." problem, im using MariaDB since all the lamp tutorials i saw use mariadb instead of mysql, as far as im concerned they are almost the same, back to the point im trying to comunicate arduino with php, a simple led control interface from php to arduino and arduino sending data to php, via serial port or ethernet shield pref.

    Your example is amazing and its just what i need, i suspect my problem is probably at database, please any tips, help its gratefully acepted.

    jorge_garza_lmad@hotmail.com

    1 reply
    None
    zeesh1979

    1 year ago

    your arduino code is incomplete. one file has just output. other file is not using ethernet functionality. you are just displaying data on LCD. attach correct file please...i am waiting

    1 reply
    None
    Celamon

    2 years ago

    the ev.ino file is not a sketch, it is just a data post

    None
    emmanuel.ani

    2 years ago

    Hi Edrisa, can you pls send me all your code including the main arduino code you used to complete this particular project.

    kindly send it to this email eani286@gmail.com

    Thanks

    None
    dobro7

    2 years ago

    Is there any way I could get a copy of the main.ino file? I am new to this and would like to see how to implement the INSERT function from the Arduino to the web server.