Configure MySQL for Arduino in Python
Published:
This guide is only applicable for Windows.
This article explains the steps associated with configuring MySQL
for Arduino in Python.
Steps
First install
XAMPP
/WAMP
. Then open its control panel and startApache
andMySQL
servers. After that, click the admin button and gotoPHPMyAdmin
and create the database to store the data.Install Python 2.7, and install
pyserial
,MYSQLdb
libraries.Install
pyserial
, you can also download it from herehttps://pypi.python.org/pypi/pyserial/2.7#downloads. Download the “.exe” file and just run it.Install
MYSQLdb
, you can also download it from https://pypi.python.org/pypi/MySQL-python/1.2.5#downloads. Download the “.exe” file and just run it.Then, create the required python program to update the database. For this, you need to add two import
import serial
andimport MysqlDb
.Install Arduino and write the program to read values from the sensor and print the values using
serial.Println(readData)
.
I referred to this code in 4 for my project; I hope this will help you.
References
- http://stackoverflow.com/questions/28335859/importerror-no-module-named-serial-in-windows-7-python-2-7-and-python-3-3
- http://stackoverflow.com/questions/8491111/pyserial-for-python-2-7-2
- http://www.instructables.com/id/Interface-Arduino-to-MySQL-using-Python/step4/Python-TIEM/
- https://github.com/surendharreddy/Arduino-MySQL