This project logs the light intensity measured by a photoresistor. The data is graphed in near real-time on a web page.
- Arduino (Leonardo)
- Raspberry Pi 3 (Model B v1.2)
- Running Raspbian GNU/Linux 8 (jessie)
- Requires Python 2.7
- Power Supply for Raspberry Pi
- USB to Micro-B cable
- 10k Resistor
- Photoresistor (Cad)
- Jumper wires suitable for a breadboard
- Build the circuit on the breadboard
Arduino/Photoresistor.inosketch to the Arduino board
Connect the Arduino to the Raspberry Pi (if not already connected)
log-serial.pyscript on the Raspberry Pi. This will save a reading from the photocell to a CSV file every second.
python ./log-serial.py &
server/server.pyscript. This may require the installation of the Flask pip module. Run the following commands from the project root:
python ./server/server.py > /dev/null 2>&1 &
Or if running while logged in to the Raspberry Pi via ssh, you can execute the following
command to run the script in the background, and not stop when you log out. This also suppresses
nohup.out file that is generated by default.
nohup python ./server/server.py > /dev/null 2>&1 &