A simple way to send data from an Arduino and save it to a database (MySQL) over WiFi.
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.
Arduino (Uno or similar)
Arduino WiFi Shield
USB cable for Arduino
yourdata
, timestamp
type
to DATETIME
and the index
to PRIMARY
insert_mysql.php
$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";
insert_mysql.php
to your web host (remember this URL for later)yournetwork
(wireless network name) and yourpassword
(wireless password) to connect to your routerchar ssid[] = "yournetwork"; // wireless network name
char password[] = "yourpassword"; // wireless password
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.
insert_mysql.php
client.println("POST /insert_mysql.php HTTP/1.1");
www.yourdomain.com
for ("Host: www.yourdomain.com");
to the domain you are hosting insert_mysql.php
(not the full path to the file)display_mysql.php
$db_user
, $db_pwd
, $database
, and $table
to match your setup$db_user = 'yourdbuser';
$db_pwd = 'yourpassword';
$database = 'yourdatabase';
$table = 'yourtable';
display_mysql.php
to your web-host (remember this URL for later)POST multiple data points into database
Update Strings in arduino_post
Dhaval Karwa
Ben Salinas
Tom Igoe's WiFiWebClientRepeating sketch
Display MySQL Tutorial
1% to me.