Storm in a Box (Maker Faire New York)
Per request .. assisting in (doing) the construction of a display project for IONYC and the Boys and Girls Club of Astoria for Maker Faire NYC. The original proposal was for a Raspberry Pi 'weather station' .. but seeing as 'weather' is not abundant at a booth in Queens, we (me) decided to bring the weather to the weather station.


Ingredients
(2) Arduino Uno
Raspberry Pi
Wind Vane
Anemometer
Rain Gauge
Adafruit Neopixels
Water Pump
12V Fan
Servo



Notations
1. Acrylic acquired from disposed picture frames. So .. so much waste.
2. Wind is windy .. stop being so negative pressure!
3. Deadline was this project's undoing; shd have dome'd.
4. Due to circumstances .. SIAB will be left to a third party to operate (?!) at MFNY



Lightning Code
// Lighting Cloud
// James Bruce

#include "FastLED.h"

#define NUM_LEDS 70
#define DATA_PIN 3

enum Mode {CLOUD, ACID, OFF, ON, RED, GREEN, BLUE, FADE};
Mode mode = CLOUD;
Mode lastMode = CLOUD;

int fade_h;
int fade_direction = 1;

CRGB leds[NUM_LEDS];

void setup() {
FastLED.addLeds(leds, NUM_LEDS);
Serial.begin(9600);
}

void loop() {

constant_lightning();

}

void single_colour(int H) {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( H, 255, 255);
}
if (lastMode != mode) {
FastLED.show();
lastMode = mode;
}
delay(50);
}

void colour_fade() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( fade_h, 255, 255);
}
if (fade_h > 254) {
fade_direction = -1;
}
else if (fade_h < 0) {
fade_direction = 1;
}
fade_h += fade_direction;
FastLED.show();
delay(100);
}

void reset() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( 0, 0, 0);
}
FastLED.show();
}

void acid_cloud() {
for (int i = 0; i < NUM_LEDS; i++) {
if (random(0, 100) > 90) {
leds[i] = CHSV( random(0, 255), 255, 255);
}
else {
leds[i] = CHSV(0, 0, 0);
}
}
FastLED.show();
delay(random(5, 100));
reset();
//}
}

void rolling() {
for (int r = 0; r < random(2, 10); r++) {
for (int i = 0; i < NUM_LEDS; i++) {
if (random(0, 100) > 90) {
leds[i] = CHSV( 0, 0, 255);
}
else {
leds[i] = CHSV(0, 0, 0);
}
}
FastLED.show();
delay(random(5, 100));
reset();
}
}

void crack() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CHSV( 0, 0, 255);
}
FastLED.show();
delay(random(10, 100));
reset();
}

void thunderburst() {
int rs1 = random(0, NUM_LEDS / 2);
int rl1 = random(10, 20);
int rs2 = random(rs1 + rl1, NUM_LEDS);
int rl2 = random(10, 20);
for (int r = 0; r < random(3, 6); r++) {
for (int i = 0; i < rl1; i++) {
leds[i + rs1] = CHSV( 0, 0, 255);
}
if (rs2 + rl2 < NUM_LEDS) {
for (int i = 0; i < rl2; i++) {
leds[i + rs2] = CHSV( 0, 0, 255);
}
}
FastLED.show();
delay(random(10, 50));
reset();
delay(random(10, 50));
}
}

void constant_lightning() {
switch (random(1, 10)) {
case 1:
thunderburst();
delay(random(10, 500));
Serial.println("Thunderburst");
break;
case 2:
rolling();
Serial.println("Rolling");
break;
case 3:
crack();
delay(random(50, 250));
Serial.println("Crack");
break;
}
}

Archive
https://hackaday.io/project/161295-storm-in-a-box

23:17:27 186-018