loading

This Arduino and Raspberry Pi based project takes sensor data from the Arduino and sends it over USB to the Raspberry Pi. The data is then formed into a web page on the Pi. The web page is fully customizable. Here we use the Freetronics IR Thermometer Module to supply a stream of data to the Arduino then to the Pi. Its good if you want to have the Arduino host webpages that contain sensor data but you don’t have a Ethernet Shield. Just send it to the Pi to take advantage of more computing power.

NOTICE: THE SITE THAT THE FILES ARE HOSTED ON (PROTOTYPING CORNER) IS DOWN AT THE MOMENT :( I AM REBUILDING THE SITE AFTER A FATAL ACCIDENT WITH THE SITE. ALSO SOME OF THE INSTRUCTIONS HERE ARE OUT OF DATE. IF YOU INSTALL GIT AND CLONE THE FOLLOWING REPO YOU CAN DOWNLOAD THE FILES, HOWEVER NOTE THAT THE INSTRUCTIONS ARE SLIGHTLY DIFFERENT. RUN THIS COMMAND

git clone http://git-lab.inticdev.com.au/jedhodson/pi-ardui...

You can view this project on Prototyping Corner

If you Like the work I do please DONATE!

Step 1: You Will Need

● Raspberry Pi B, B+, 2 (So long as it has a USB port and Ethernet) & Power Supply
● Arduino (Any model with USB connectivity will work) & USB Cable
IR Thermometer from Freetronics (Or you can use any sensor compatible with the Arduino. Just modify the code to suit)
● Cable to connect sensor to Arduino

Step 2: Construction - Wire It Up

Wire up the sensor to the Arduino. If you are using the IRTEMP module you may like to refer to here. Alternatively you can connect the IRTEMP module directly to the Arduino by connecting it to pins 3 – 6 on the Arduino (Refer to image).

Step 3: Flash the Pi

Flash an SD card with the latest version of Raspbian. Refer to this guide for more information

Step 4: Program Arduino

If you are NOT using the IRTEMP module then you will need to write a piece of code for the Arduino that sends the output of the sensor over serial at a speed of 9600. If you ARE using the IRTEMP module then download the IRTEMPUSB.ino file from Prototyping Corner

Step 5: Begin the Pi

Now we will program the Raspberry Pi, so make sure that you have flashed the SD card with Raspbian and connected the Pi to your local network (Internet access required on Pi) and plug into power. Wait a minute for the raspberry pi to boot then find the IP address of the Pi. You can do this by logging into your router and looking at a list of devices on your network. Once you have found the IP address proceed.

Step 6: SSH the Pi

SSH into your Pi. You can use on of the many methods listed here. If you are using windows then I recommend PuTTY.

Step 7: Setup the Web Server

We now need to setup the Pi as a web server. We do this by first updating the Pi with sudo apt-get update then sudo apt-get upgrade. Then we install the packages required;
sudo apt-get install apache2 libapache2-mod-wsgi python-setuptools python-flask python-serial. This may take a while depending on your Pi and internet connection.

Step 8: Edit the Vitual Host

Once installed we need to make changes to the Virtual Host in /etc/apache2/sites-enabled. This can be done by first making a copy of the original file with; cd /etc/apache2/sites-enabled/ then
sudo cp 000-default 000-default.orig. Now that we have a backup of the file we can download and install the new one with sudo wget -O 000-default https://www.prototypingcorner.me/?ddownload=113


The code changes from the downloaded file can be found here.

Step 9: Finnish Apache

Now we need to make some changes to the user permissions. We do this by typing
sudo usermod –a –G dialout www-data then sudo a2enmod wsgi. Now we restart apache with
sudo /etc/init.d/apache2 restart. Now you have set up apache

Step 10: Install Files

Now for the last part in setting up the software on the Pi, we need to install the html files that will make it serve the web pages. First navigate to the web pages directory with cd /var/www then make a directory to hold the files with sudo mkdir serialData (you don’t have to name it serialData, just remember whatever you name it). Then move to the directory with cd serialData. We then need to install a program call unzip. You do this with sudo apt-get install unzip. Once that finishes you need to download the hosting files. You do this with sudo wget -O serialData.zip https://www.prototypingcorner.me/?ddownload=116 then to unzip the files
sudo unzip serialData.zip

Step 11: Finnished

Congrats! You have setup the Pi. Now all you have to do is start the script with python index.py then plug in the set-up Arduino and navigate to http://YOURIP/serialData/index.py and you should see something similar like that shown below. To stop the script use CTRL+C.

Thanks for reading. You can view this project and many more over on Prototyping Corner

Or if you liked it please DONATE!

<p>Has anyone actually got this to work ?</p><p>I have 2 issues </p><p>#1 sudo usermod &ndash;a &ndash;G dialout www-data (error)</p><p>#2 Directory created is serialData but one inside that is SerialData</p><p>Paul</p>

About This Instructable

7,496views

44favorites

License:

More by jedhodson:Wunderlist Task Printer Arduino and Pi in harmony - As a sensor web server! Large Temp Display 
Add instructable to: