Git Product home page Git Product logo

post-arduino-data-wireless's Introduction

POST-Arduino-Data-Wireless

In less than 60 minutes, this repo will give you the ability to record data on the Arduino, wirelessly send (POST) and store that data into a MySQL database, and then retrieve and display that data in the browser.

Items You'll Need

Arduino (Uno or similar)
Arduino WiFi Shield
USB cable for Arduino

Getting Started

Setup MySQL Database

  1. Create MySQL Database (I used my web hosts GUI)
  2. Create MySQL User
  3. Give newly created MySQL User access to your newly created MySQL Database
  4. Give newly created MySQL User full privileges to your newly created MySQL Database
  5. Create a table for your database (I used my web hosts phpMyAdmin GUI)
  6. Add 2 columns to your table: yourdata, timestamp
  7. For timestamp column, change the type to DATETIME and the index to PRIMARY

Edit INSERT script

  1. Download insert_mysql.php
  2. Edit the $username, $password, $database, and $tablename to match your setup
$username = "test_user";
$password = "test_password";
$database = "test_db_name_here";
$tablename = "test_table_name_here";
$localhost = "localhost";
  1. Upload insert_mysql.php to your web host (remember this URL for later)

POST Arduino data to MySQL Database

  1. Download arduino_post/arduino_post.ino
  2. Edit yournetwork (wireless network name) and yourpassword (wireless password) to connect to your router
char ssid[] = "yournetwork";  // wireless network name
char password[] = "yourpassword"; // wireless password
  1. Edit www.yourdomain.com (for char server[]) to the domain you are hosting insert_mysql.php (not the full path to the file)
char server[] = "www.yourdomain.com"; // This could also be 192.168.1.18/~me if you are running a server on your computer on a local network.
  1. Edit the POST url to match the path to insert_mysql.php
client.println("POST /insert_mysql.php HTTP/1.1");
  1. Edit www.yourdomain.com for ("Host: www.yourdomain.com"); to the domain you are hosting insert_mysql.php (not the full path to the file)
  2. Connect the Arduino WiFi shield to your Arduino
  3. Connect your Arduino to your computer using your USB cable
  4. Upload your sketch to your Arduino
  5. You should now be POSTing data from your Arduino to your MySQL database. Yippee!

Edit DISPLAY script

  1. Download display_mysql.php
  2. Edit the $db_user, $db_pwd, $database, and $table to match your setup
$db_user = 'yourdbuser';
$db_pwd = 'yourpassword';
$database = 'yourdatabase';
$table = 'yourtable';
  1. Upload display_mysql.php to your web-host (remember this URL for later)
  2. You should now be able to view your database in the browser

Enhancements

POST multiple data points into database
Update Strings in arduino_post

Credits

Dhaval Karwa
Ben Salinas
Tom Igoe's WiFiWebClientRepeating sketch
Display MySQL Tutorial
1% to me.

post-arduino-data-wireless's People

Contributors

ericbenwa avatar bsalinas avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.