Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 2.05 KB

README.md

File metadata and controls

51 lines (40 loc) · 2.05 KB

POST-Arduino-Data

A simple way to send data from an Arduino and save it to a database (MySQL) over WiFi.

Items You'll Need

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

Getting Started

Setup MySQL Database

  1. Create MySQL Database
  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
  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
  3. 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), yourpassword (wireless password) to connect to your router
  3. Edit www.yourdomain.com (for char server[]) to the domain you are hosting insert_mysql.php (not the full path to the file)
  4. Edit the POST url to match the path to insert_mysql.php
  5. Edit the Host: www.yourdomain.com to the domain you are hosting insert_mysql.php (not the full path to the file)
  6. Connect the Arduino WiFi shield to your Arduino
  7. Connect your Arduino to your computer using your USB cable
  8. Upload your sketch to your Arduino
  9. You should now be POSTing data from your Arduino to your MySQL database. Yippee!

Credits

Dhaval Karwa
Ben Salinas
Tom Igoe's WiFiWebClientRepeating sketch