temperature server

combine the analog input of BBB with the built in ethernet connection to produce a server for temperature, as a proof of concept

Posted by Angel on 2013-09-07T14:50:40-04:00

One of the problems of Adafruit_BBIO is that you need to be root to use it. Running a server is a non-root user process. By running temperature as a superuser under crontab, saving the result as a text string, then having the server running php can pick up the info and output it to the world.

Install ubuntu os. When you plug in BBB to usb, and see mass storage connect window pop up, the start.html file are the instructions for booting ubuntu and other operating systems. Use the eMMC flasher img, don’t use the first one. See http://elinux.org/BeagleBoardUbuntu#eMMC:_BeagleBone_Black

Connect using ssh

I use PuTTY, but from linux box, you can use in terminal $ssh ubuntu@192.168.7.2 the password for the above ubuntu distribution is temppwd.

Follow burning to SD card instructions, then install python on BBB:  http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation

Check that python is working by measuring temperature:  http://learn.adafruit.com/measuring-temperature-with-a-beaglebone-black

Modify the tmp36.py to print to a file. I put it into a shell script. Don't forget to make your shell script executable: $chmod a+x scriptnamehere.sh Run the tmp36.py or the script  from a crontab, but it has to be as a superuser
$sudo crontab -e
The Adafruit_BBIO function ADC.setup() needs to be run by superuser.
Check via ssh what ethernet ip is 
$ssh ubuntu@192.168.7.2
$ifconfig eth0 should give the ethernet port IP address
Login from a browser, see apache warning that it is running, but no site served up.
You have to write the index.php. You need the usual http stuff at top, and what you want to display. The php uses system function to read file created by tmp36.py
$dummy = system('tail templog.txt', $retval)
The $retval should be 0, the $dummy will include the last line of tail, but the entire tail output will appear on screen, because it is in between php tags.

Comments are not currently available for this post.