#!/bin/bash
# Checks for Internet connectivity and changes to an alternative wifi network if
# it detects a problem.
# Needs to have a wpa_supplicant file for each network:
# wpa_supplicant_1 for SSID! and wpa_supplicant_2 for SSID2
# Can easily be extended to more than 2 possible networks
# function to bring down wireless interface, stop wpa_supplicant service and
# then bring up wlan0 again
A Pi and SenseHAT
Two options. Both really rely on the SenseHAT being somewhat accessible so that participants can actually change the environment. Ideally the PI and SenseHAT would be on the table (perhaps in a 3d printed flight case with with cables glued in to secure it?). Alternatively, there could be a hole cut in perspex screen so that participants can blow on the SenseHAT (to change humidity and temperature).
Note that I spoke to the creator of this project who said that they were a few bugs in the original code as published. This gist uses the updated, fixed code.
A Pi with Minecraft installed
There should be a Minecraft window open and an editor with the almost-complete code alongside. There should be two tabs open in the editor.
- Get a usb drive. At least 8GB
- Format the drive as a FAT32 single partition with a MBR
-
Insert USB drive into Desktop Raspbian laptop. Copy the iso for Desktop Raspbian onto this machine.
-
Install gparted onto the laptop:
sudo apt install gparted
from gpiozero.pins.pigpio import PiGPIOFactory
from gpiozero import DistanceSensor
pigpio = PiGPIOFactory()
ds = DistanceSensor(14,15, max_distance=200, pin_factory=pigpio)
or
The rain sensor detects water that falls on the metal circuit strips on its sensor boards. The sensor board acts as a variable resistor that will change from 100k ohms when wet to 2M ohms when dry. This change in resistence will cause a change in the outout voltage, which we can read using an anlog pin on the Arduino. There is also a digital pin which is pulled HIGH when the resistence falls below a threshold value set by the sensitivity dial (which is another variable resistor)
int RainPin = 0;
int RainDigitalPin = 2;
from gpiozero import TonalBuzzer
from gpiozero.tones import Tone
from time import sleep
t = TonalBuzzer(21) # change to whatever pin the buzzer is connected
v1 = ["G4", "G4", "G4", "D4", "E4", "E4", "D4"]
v2 = ["B4", "B4", "A4", "A4", "G4"]
v3 = ["D4", "G4", "G4", "G4", "D4", "E4", "E4", "D4"]
You can use another analog device - a Light Dependent Resisitor (LDR) - to meausure how bright it is (light intensity). As you can probably guess from its name. the resistance of an LDR changes depending on how much light falls on it. By making a voltage divider with another resistor, you can measure a voltage that will change depending on how bright it is.
You can then use an array of LEDs to create a visual indicator of light intensity. As the light level increases, the number of LEDs that are on will also increase. Don't foget every LED needs a current-limiting resistor. To make building the circuit easier you can use a resistor array that has a number of resistors linked togther with a common pin.
const int analogPin = A0; // the pin that the LDR is attached to