1
0
Fork 0
Browse Source

edit the readme.

pull/1/head
Craig Oates 4 years ago
parent
commit
445adcc53a
  1. 42
      README.md

42
README.md

@ -2,7 +2,7 @@
## ![light-meter-logo](attachments/light-meter-logo.png) Light-Meter
**Disclosure: This file was written by Craig Oates and all information cited about other parties where taken from their respective websites. I have, also, applied minor editing in places to help readability - in the context of this file. Please use the links listed for original/official version of the sourced material. Craig is the author of the software in this repository.**
**Disclosure: This file was written by Craig Oates and all information I have cited about the other parties where taken from their respective websites. I have, also, applied minor editing in places to help readability - in the context of this file. Please use the links listed below for the original/official version of the sourced material. Craig is the author of the software in this repository.**
## Project Overview: Return to Ritherdon
@ -18,7 +18,7 @@ Nicola is interested in the properties, value, function and circulation of mater
### About the Manufacturer: Ritherdon
Established in 1895, they have been manufacturing a variety of electrical enclosures and related products for many decades. A combination of a passion for innovation with close working relationships with their customers means that they are continually developing and expanding their product ranges.
Established in 1895, Ritherdon have been manufacturing a variety of electrical enclosures and related products for many decades. A combination of a passion for innovation with close working relationships with their customers means that they are continually developing and expanding their product ranges.
### About: Arts Council England
@ -30,16 +30,18 @@ They were set up in 1946, by Royal Charter, to champion and develop art and cult
This project is one of several artworks created by Nicola Ellis throughout the course of the residency. For the sake of brevity, this file will focus on the technical aspects of the project. The same is true for all files in the repository.
The overall project consists of three separate/smaller projects. The names of the smaller projects are a by-product of the software development process. You should not view them as individual pieces within the overall project. From an artwork point-of-view, "UNNAMED ART WORK" is one piece. The name of the software projects are "light-meter" (which is this one), "mid-point" and "relay". All three projects reside in their own git repositories. You can find the other project's repositories are the following links:
The overall project consists of three separate/smaller projects. The names of the smaller projects are a by-product of the software development process. You should not view them as individual pieces within the overall project. From an artwork point-of-view, "UNNAMED ART WORK" is one piece. The name of the software projects are "light-meter" (which is this one), "mid-point" and "relay". All three projects reside in their own git repositories. You can find the other project's repositories at the following links:
- [Mid-Point](https://git.abbether.net/return-to-ritherdon/midpoint)
- [Relay](https://git.abbether.net/return-to-ritherdon/relay)
The (technical) aim of the project is to turn a set of lights on the gallery when welding machines are active in the welding booths in Ritherdon. The solution we arrived at was a three-stage process. The stages are as follows:
The (technical) aim of the project is to turn a set of lights on at the gallery when the welding machines are active in the welding booths at Ritherdon. The solution we arrived at was a three-stage process. The stages are as follows:
1. Monitor the light levels in the welding booths at Ritherdon and send that information to a sever.
2. Receive the light readings and store them in a database and make them available for others to access.
3. Have the lights installed at the gallery connected to wi-fi enabled relays which request the latest light readings from the server. If the readings are above a certain threshold, have the light in the gallery turn on (otherwise, turn off).
3. Have the lights installed at the gallery connected to wi-fi enabled relays which request the latest light readings from the server. If the readings are above a certain threshold, have the light in the gallery turn on (otherwise, turn off). The relays are responsible for turning the lights on and off.
Each step should require no human intervention.
For more information on how each project accomplishes its task, please use the (repo.) links above. Otherwise, here is an diagram to help explain the three stages mentioned above.
@ -47,18 +49,28 @@ For more information on how each project accomplishes its task, please use the (
## Project Overview: Light-Meter
This is a Python 3 based project. I wrote the code in this repository to run on a Raspberry Pi in a unmanned capacity. The main machine I tested the code on was a Raspberry Pi 4 (2 G.B.) but I did get it to work on a Raspberry Pi 1 (Model B) so do with that what you will. Software-wise, I have only used Raspbian Buster throughout the development of this project. So, I do not know how well this will run on other Linux-based operating systems. I must stress, this is a Linux-only endeavour. This will not work on Mac OS and Windows -- that includes Windows Subsystem for Linux (W.S.L. 1 and 2).
This is a Python 3 based project. I wrote the code in this repository to run on a Raspberry Pi in an unmanned capacity. The main machine I tested the code on was a Raspberry Pi 4 (2 G.B.) but I did get it to work on a Raspberry Pi 1 (Model B) -- so do with that what you will. Software-wise, I have only used Raspbian Buster throughout the development of this project. So, I do not know how well this will run on other Linux-based operating systems. I must stress, this is a Linux-only endeavour. This will not work on Mac OS and Windows -- that includes Windows Subsystem for Linux (W.S.L. 1 and 2).
For the final version (exhibition context), I focused my efforts of running this project on Raspbian Buster Lite. That is the version of Raspbian without a (desktop) G.U.I.
For the final version (exhibition context), the intended operating system is Raspbian Buster Lite. That is the version of Raspbian without a (desktop) G.U.I.
The full list of parts this project requires is as follows:
The full list of parts required for this project is as follows:
- [Raspbian](https://www.raspberrypi.org/downloads/raspbian/)
- [Raspberry Pi 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/)(I am assuming you have the appropriate power cable, S.D. cards Etc.)
- [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) (You can use the G.U.I. or "headless" version)
- [Raspberry Pi 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) (I am assuming you have the appropriate power cable, S.D. cards Etc.)
- [2 x 1kΩ Resistor](https://www.amazon.co.uk/1K-Resistors-50-Pack-Electronics/dp/B00JGUE0L0)
- [330nF Capacitor](https://www.alibaba.com/product-detail/ODOELEC-334-0-33uf-330nf-50v_60626664828.html)
- [Breadboard](https://thepihut.com/products/raspberry-pi-breadboard-half-size)(Optional but recommended if you do not know how-to solder or you don't feel comfortable doing it)
- [Jumper Wires](https://thepihut.com/products/rpi-premium-jumper-wires-40pk-male-female-100mm?_pos=18&_sid=4d08c5200&_ss=r)(I'm assuming you are using the breadboard. If are not, you might need different cables like Female-to-Female or ones without a connector on the end)
- [Breadboard](https://thepihut.com/products/raspberry-pi-breadboard-half-size) (Optional but recommended if you do not know how-to solder or you don't feel comfortable doing it)
- [Jumper Wires](https://thepihut.com/products/rpi-premium-jumper-wires-40pk-male-female-100mm?_pos=18&_sid=4d08c5200&_ss=r)(I'm assuming you are using the breadboard. If are not, you might need different cables like Female-to-Female or ones without a connector on the ends)
### Initial Raspbian Set-up
Upon the initial installation of Raspbian on to the Pi, you need to make sure the following is established:
- The username is "rtrp".
- The hostname is "factory*" (where "*" is a number between 1 and 3).
- The Pi is set to auto-login with the "rtrp" account.
You can set the Pi up to automatically login to the desktop but the recommended option is to login to a "headless" environment (I.E. console-mode). Remember, you can only log into the desktop environment if your version of Raspbian has one. The final version of this project does not expect one.
### Hardware Preparations
@ -96,13 +108,13 @@ You can test the code is working properly by running it. You can do that by ente
**Note: For some reason, I had trouble running "cli_meter.py" without `sudo`. I would sometimes get an error message saying "RPi.GPIO is not available/installed" (paraphrased). If you manage to get it working without the use of `sudo`, remain as you were. Otherwise, keep a mental note of this if you come across the problem.**
When you are ready to run this project as intended, you can set-up a cron-job for it. To do so enter `sudo crontab -e` into the console. You might need to select an editor if this is your first time setting up a cron-job. I tend to go for Nano -- which is option "1" most of the time. When the crontab file opens, enter the following commands at the bottom of the file,
When you are ready to run this project as intended, you can set-up a cron-job for it. To do so enter `sudo crontab -e` into the console (see note about `sudo` above). You might need to select an editor if this is your first time setting up a cron-job. I tend to go for Nano -- which is option "1" most of the time. When the crontab file opens, enter the following commands at the bottom of the file,
```bash
@reboot bash /home/rtrp/repos/light-meter/startup.sh &
00 18 * * * /home/rtrp/repos/light-meter/shutdown.sh
```
These tasks make the Raspberry Pi send a message to the sever to indicate the status ("on" or "off") and makes the "cli_meter.py" script run. At this point, you should be able to walk away and let the Pi do its thing. This is assuming the server is up and running and the Pi is connected to the world-wide-web. If all is successful, you will notice the Pi will turn itself off at 18:00 (6 p.m.) and will start sending light reading when you turn it own with out no input from you. Unfortunately, the Pi can only manage the shutdown on its own. You will need to turn it on.
These tasks make the Raspberry Pi send a message to the sever to indicate the status ("on" or "off") and makes the "cli_meter.py" script run. At this point, you should be able to walk away and let the Pi do its thing. This is assuming the server is up and running and the Pi is connected to the world-wide-web. If all is successful, you will notice the Pi will turn itself off at 18:00 (6 p.m.) and will start sending light reading when you turn it on without any input from you. Unfortunately, the Pi can only manage the shutdown procedure on its own. You will need to turn it on. (This has been accounted whilst the exhibition is open.)
To make sure the Pi send a "powering down" message to the server, I tend you create an alias called `powerdown`. When you type this is, it runs the "shutdown.sh" script -- which has the shutdown command within it. To make the alias permanent, enter `alias='~/.repos/light-meter/shutdown.sh'` into `~/.bashrc`.
To make sure the Pi sends a "powering down" message to the server, I tend you create an alias called `powerdown`. When you type this into the console, it runs the "shutdown.sh" script -- which has the shutdown command within it. To make the alias permanent, enter `alias='~/repos/light-meter/shutdown.sh'` into `~/.bashrc`. This is easier to test the bespoke shutdown procedure is working as intended. You can, also, adjust the time in the crontab or run the script by running the script like you normally would but I find them to be frustrating to do in this instance.