Browse Source
This is a rough transfer of my personal notes in to the public doc's for the Relay project. I've not gone through it properly so expect mistakes and it needing a good proof-read.stable
Craig Oates
3 years ago
8 changed files with 155 additions and 0 deletions
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 120 KiB |
@ -0,0 +1,20 @@ |
|||||||
|
digraph overview { |
||||||
|
node [fontname = Arial]; |
||||||
|
l1 -> server; |
||||||
|
l2 -> server; |
||||||
|
server -> r1; |
||||||
|
server -> r2; |
||||||
|
r1 -> server; |
||||||
|
r2 -> server; |
||||||
|
l1 [label = "Light Meter 1", color = lightblue, style = filled]; |
||||||
|
l2 [label = "Light Meter 2", color = orange, style = filled]; |
||||||
|
r1 [label = "Relay 1", color = lightblue, style = filled]; |
||||||
|
r2 [label = "Relay 2", color = orange, style = filled ]; |
||||||
|
server [label = "Midpoint (Server)"]; |
||||||
|
subgraph cluster0 { |
||||||
|
style = filled; |
||||||
|
color = lightgrey; |
||||||
|
r1; |
||||||
|
r2; |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 887 KiB |
@ -0,0 +1,135 @@ |
|||||||
|
# Return to Ritherdon: Relay |
||||||
|
|
||||||
|
Relay is one of three smaller projects which make-up the 'Personal |
||||||
|
Flash in Real-Time' -- which is one artwork with the main 'Return to |
||||||
|
Ritherdon' project.You should view the three smaller projects as one |
||||||
|
project. And, for the purpose of this documentation, I will refer to |
||||||
|
'Personal Flash in Real-Time' as a system instead of an artwork. |
||||||
|
|
||||||
|
For more information on the 'Return to Ritherdon' project, use the |
||||||
|
following link: |
||||||
|
|
||||||
|
- [Return to Ritherdon Overview](https://git.abbether.net/return-to-ritherdon/rtr-docs) |
||||||
|
|
||||||
|
### 'Personal Flash in Real-Time': Project Overview |
||||||
|
|
||||||
|
The overall system ('Personal Flash in Real-Time') consists of three |
||||||
|
separate/smaller projects. You should not view them as individual |
||||||
|
pieces within the overall project. From an artwork point-of-view, |
||||||
|
'Personal Flash in Real-Time' is one piece. The name of the software |
||||||
|
projects are 'Light Meter' (which is this one), 'Midpoint' and |
||||||
|
'Relay'. All three projects reside in their own git repositories. You |
||||||
|
can find the repositories at the following links: |
||||||
|
|
||||||
|
- [Light Meter](https://git.abbether.net/return-to-ritherdon/light-meter) |
||||||
|
- [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 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 (Light Meter). |
||||||
|
2. Receive the light readings and store them in a database and make |
||||||
|
them available for others to access (Midpoint). |
||||||
|
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 (Relay). |
||||||
|
|
||||||
|
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. |
||||||
|
|
||||||
|
![Main Project Architecture](attachments/main-proj-architecture.png) |
||||||
|
|
||||||
|
## Hardware Specifications |
||||||
|
|
||||||
|
Here are a list of parts used in this project: |
||||||
|
|
||||||
|
- [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.) |
||||||
|
- [Single Channel 5v Relay](https://www.amazon.co.uk/Dealikee-Module-Indicator-Channel-Arduino/dp/B08ZJ9T355/ref=sr_1_12?dchild=1&keywords=5v+relay+module&linkCode=gs3&qid=1635877670&qsid=262-0370227-8667213&sr=8-12&sres=B08YK9V3V6%2CB07RKH9KLM%2CB06XK6HCQC%2CB01H2D2RI0%2CB08MTD5BPJ%2CB07PZC9ZMM%2CB07CNR7K9B%2CB08ZJ9T355%2CB07V1YQQGL%2CB07MY2R2ML%2CB07G71S7VP%2CB09C2ZHXXP%2CB08GPF9FNX%2CB09CN81J32%2CB07SDLJSWB%2CB08YJ6TS29%2CB08V15SNZS%2CB09DS3DD1J%2CB08KWPMP2V%2CB07TTVYGC8&srpt=RELAY) |
||||||
|
|
||||||
|
### Checking Your Raspberry Pi's Hardware Layout |
||||||
|
|
||||||
|
Because there are multiple versions of the Raspberry Pi, the layout of |
||||||
|
the General Purpose Input/Output (G.P.I.O.) Pins differ. A quick way |
||||||
|
to find out how the G.P.I.O. pins are laid out, for the Pi you are |
||||||
|
currently working on, is to open a terminal and entering the following |
||||||
|
command `pinout`. |
||||||
|
|
||||||
|
Doing this will lead to you seeing something similar to the image |
||||||
|
below, |
||||||
|
|
||||||
|
![pinout-terminal](attachments/pinout-terminal.png) |
||||||
|
|
||||||
|
More information about this can be found at the following URL: |
||||||
|
|
||||||
|
- [Checking Raspberry Pi Board Version](https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/][Raspberry Pi Board Information) |
||||||
|
|
||||||
|
## Wiring-Up the Relay |
||||||
|
|
||||||
|
- [Wiring Single Channel Relay with Raspberry Pi](https://www.14core.com/wiring-single-channel-relay-with-raspberry-pi-on-wiringpi-python/] |
||||||
|
|
||||||
|
I used this article/blog post (linked above) as a starting-point for |
||||||
|
the relay part of the project. It includes software written in C and |
||||||
|
Python but I have stuck to just Python for this project. You can see |
||||||
|
how the relay is wired-up to the Pi in the image below. |
||||||
|
|
||||||
|
#+Caption: Wiring Diagram for the Relay Project |
||||||
|
#+Name: wiring-diagram-relay |
||||||
|
![Wiring Diagram Relay](attachments/wiring-diagram-relay.png) |
||||||
|
|
||||||
|
### General Overview of Controlling Relays |
||||||
|
|
||||||
|
- [Four Ways to Control Electronic Relays](https://makezine.com/2018/03/19/control-electronic-relays/) |
||||||
|
|
||||||
|
This is a primer for understanding how to control relays and the |
||||||
|
various types of relays at your disposal. The list is not exhaustive |
||||||
|
but is enough to get you going. |
||||||
|
|
||||||
|
- [YouTube Guide](https://www.youtube.com/watch?v=58XWVDnB7Ss) |
||||||
|
|
||||||
|
I find the guy in this video difficult to understand but he gets his |
||||||
|
message across well enough. He explains how a relay works and how to |
||||||
|
connect it to an *Arduino Board* and control a light bulb. If you are |
||||||
|
not familiar with how relays work, this video should give you a good |
||||||
|
grounding in it. /Note: This video does not use a Raspberry Pi so the |
||||||
|
information is limited to just the relay and the light part of the |
||||||
|
project. |
||||||
|
|
||||||
|
- [How to Set-up a 5v Relay](https://www.circuitbasics.com/setting-up-a-5v-relay-on-the-arduino/) |
||||||
|
|
||||||
|
The link above focuses on using an *Arduino Board* but you can |
||||||
|
determine what pin does what. The example in the link, also, |
||||||
|
includes a thermistor in its set-up which does not apply to this |
||||||
|
project. The image below is taken from the site and |
||||||
|
highlights what each pin is. |
||||||
|
|
||||||
|
![Relay Pins Layout](attachments/5v-relay-pins-layout.png) |
||||||
|
|
||||||
|
- **NO (Normally Open)**: In the normally open configuration, when the |
||||||
|
relay receives a HIGH signal the 120-240V switch closes and allows |
||||||
|
current to flow from the C terminal to the NO terminal. A LOW signal |
||||||
|
deactivates the relay and stops the current. So if you want the HIGH |
||||||
|
signal to turn ON the relay, use the normally open terminal. See |
||||||
|
/figure [[no-configuration]]/ for further information. |
||||||
|
- **NC (Normally Closed)**: In the normally closed configuration, a HIGH |
||||||
|
signal opens the switch and interrupts the 120-240V current. A LOW |
||||||
|
signal closes the switch and allows current to flow from the C |
||||||
|
terminal to the NC terminal. Therefore, if you want the HIGH signal |
||||||
|
to turn OFF the 120-240V current, use the normally closed |
||||||
|
terminal. See /figure [[nc-configuration]]/ for further information. |
||||||
|
|
||||||
|
![Relay Normally Open Layout](attachments/5v-relay-normally-open-layout.png) |
||||||
|
|
||||||
|
![Relay Normally Closed Layout](attachments/5v-relay-normally-closed-layout.png) |
Reference in new issue