README.rst 1.3 KB

123456789101112131415161718192021222324252627
  1. =================================
  2. Raspberry Pi Light Sensor Example
  3. =================================
  4. This directory contains two example ThingFlow applications that read a tsl2591
  5. Lux sensor connected to a Raspberry Pi running Raspbian Linux. To run these
  6. examples, you need to install several packages, as follows::
  7. sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev
  8. sudo /usr/bin/pip install cffi
  9. git clone https://github.com/maxlklaxl/python-tsl2591.git
  10. cd python-tsl2591; python setup.py install
  11. Single Process Example
  12. ----------------------
  13. The script ``lux_sensor_example.py`` is a single process application that
  14. samples from the lux sensor, prints the events obtained, and activates an LED
  15. on the Pi's GPIO bus if a threshold lux value is exceeded.
  16. Distributed Example
  17. --------------------
  18. ``dist_lux_rpi.py`` and ``dist_lux_server.py`` implement a distributed Lux data
  19. collector. The ``dist_lux_rpi.py`` script runs on the Pi and has the same
  20. functionality as the single process example. Additionally, it sends the sensor
  21. events to a MQTT broker. The ``dist_lux_server.py`` script runs on a server that
  22. has the PostgreSQL database installed. The server-side script reads events from
  23. the MQTT queue and saves them to the database.