This project logs the light intensity measured by a photoresistor. The data is graphed in near real-time on a web page.
HTML Python Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Arduino
data
schematic
server
log-serial.py
readme.md

readme.md

Photoresistor

This project logs the light intensity measured by a photoresistor. The data is graphed in near real-time on a web page.

Parts

  • 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
  • Breadboard
  • 10k Resistor
  • Photoresistor (Cad)
  • Jumper wires suitable for a breadboard

Setup

  1. Build the circuit on the breadboard

Circuit Diagram

  1. Load the Arduino/Photoresistor.ino sketch to the Arduino board

  2. Connect the Arduino to the Raspberry Pi (if not already connected)

  3. Run the log-serial.py script on the Raspberry Pi. This will save a reading from the photocell to a CSV file every second.

python ./log-serial.py &
  1. Run server/server.py script. 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 the nohup.out file that is generated by default.

nohup python ./server/server.py > /dev/null 2>&1 &

License

Attribution 4.0 International