Skip to content

Arduino Master Slave using I2C and Posting the Data To the Local Server Running On Apache2 using mySql and PHP

Notifications You must be signed in to change notification settings

anilkunchalaece/MasterSlavePiLocalServer

Repository files navigation

MasterSlavePiLocalServer

Arduino Master Slave using I2C and Posting the Data To the Local Server Running On Apache2 using mySql and PHP
Done by : Kunchala Anil

Email : [email protected]

Date : July 2 2016

PreRequisites

1.To Install Apache2 in Raspberry Pi use the Command ;
sudo apt-get install apache2 php5 libapache2-mod-php5
2.After Finished Installing Use the Following Command to Restart the apache2 Server
sudo service apache2 restart

3.After Restarting Check your Pi Ip Configuration with Command
ifconfig

4.Enter the ipNumber in the Web browser in locla lan. you can see Sample Webpage as
It Works

You can Edit the source file Location using
sudo nano /var/www/html/index.html
note : You need to Change the Above file before Using It

5.Installing Php5 In Raspberry Pi : use the following command to install the Php
sudo apt-get install php5 libapache2-mod-php5 -y

6.Installing My Sql on Raspberry Pi : Use the Following Command to Install The mySql
sudo apt-get install mysql-server python-mysqldb
This will install the mysql server and Python MySQLdb Module Also

7.Installing Php My Admin : use the following Command to Install the Phpmyadmin
sudo apt-get install phpmyadmin

8.Configure Apache2 to Work with Php My Admin
nano /etc/apache2/apache2.conf

naviagate to the Bottom of the File and add the Following Line
Include /etc/phpmyadmin/apache.conf

9.restart the apache2
/etc/init.d/apache2 restart

Before Running the Code create a Database in the SQL using Terminal
To enter in to the mysql shell enter

mysql -u root -p where root is the username

use the Command
a.CREATE DATABASE database_name to Create a Database

b.USE database_name to change the current database

c.CREATE TABLE table_name To Create a table in the Current Database

Files Description

MasterCodeV3.ino: This is a Arduino Sketch for Master Which Receives the Data From 3 slaves via I2C and send the Data to the Raspberry Pi via UART

SlaveACodeV3.ino: This is a Arduino Sketch for SlaveA which reads the Data from Sensor And sent it to the Master Via I2C. In this Code I Used Potentiometer as a sensor. It is Connected to the pin A0.

SlaveBCodeV3.ino: This is a Arduino Sketch for SlaveB which reads the Data from Sensor And sent it to the Master Via I2C. In this Code I Used Potentiometer as a sensor. It is Connected to the pin A0.

SlaveCCodeV3.ino: This is a Arduino Sketch for SlaveC which reads the Data from Sensor And sent it to the Master Via I2C. In this Code I Used Potentiometer as a sensor. It is Connected to the pin A0.

csvWriter.py: This is a Python Code runs in the Raspberry pi and Receives the Code from Arduino Master Via UART and Writes it into the CSV File for Storing Purpose.

mysqlWriter.py: This is a Python Code runs in the Raspberry Pi and Receives the Code from Arduino Master via UART and Sends the Values to the mySQLdb on Apache2 server Running On raspberry Pi

sensorData.php: This is a Php code to Receive the Data From mySQl Datatbase from server and Displays it on the Webpage

sensorDataTb.php: This is a Php Code to Receive the Data From mySQL Database from server and Displays it on the Webpage in Tables

mysqlEx.py: This is a python Code to check connection to the mysql Database

mysqlBug.py: Code is a improvisation for the mysqlEx.py

References


1.http://raspberrywebserver.com/sql-databases/using-mysql-on-a-raspberry-pi.html

2.https://www.stewright.me/2012/09/tutorial-install-phpmyadmin-on-your-raspberry-pi/

3.http://raspberrywebserver.com/sql-databases/using-mysql-on-a-raspberry-pi.html

4.https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md

5.https://www.jeremymorgan.com/tutorials/python-tutorials/how-to-connect-to-mysql-with-python/

6.http://stackoverflow.com/questions/5785154/python-mysqldb-issues-typeerror-d-format-a-number-is-required-not-str

7.http://forum.arduino.cc/index.php?topic=409677.new#new

8.http://jamesreubenknowles.com/arduino-i2c-1680

9.http://www.berryjam.eu/2014/07/advanced-arduino-i2c-communication/

About

Arduino Master Slave using I2C and Posting the Data To the Local Server Running On Apache2 using mySql and PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages