Skip to content

surendharreddy/Arduino-MySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

#Logging Arduino sensor data into MySQL table using Python.

Follow the steps below to complete your project.

  1. Connect your sensor to Arduino as shown in circuit. (Here I'm using TMP36, a temperature sensor and reading only voltage from it)

Arduino TMP36

  1. Next, from the downloaded code, copy code fromArduinoMySQL.inofile and then paste it in your Arduino IDE.
  2. To check if the code is working or not, open serial monitor and get confirmed.
  3. Now, create a database in your localhost and then a table in it using phpMyAdmin.

phpMyAdmin MySQL table

  1. If you're not using phpMyAdmin using the following script to create tables.
CREATE TABLE IF NOT EXISTS `tempdata` (
`ID` int(11) NOT NULL,
`Date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`voltage` varchar(4) NOT NULL
) 
  1. Then, get ArduinoMySQL.py from the downloaded code and paste it any one of your prefered code editor.
  2. Change the Database credentials in the line 5. The credetials include your Database username, password and Database name.
  3. Finally, save the code and run the Python script. Then, go and check you table, you'll find that data.

Arduino Data Log

Possible Errors

You might see an error such as the error shown in the image below.

Arduino Data log error

Then, you need to upgrage you python MySQLdb library. Use pip install --upgrade MySQL-python==1.2.4 command to upgrade the library.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages