Arduino Plasma Toilet Air Freshener
Ionized poot poof -> fail.


Ingredients
Arduino Nano
9G Servos (2) 360 deg (1) 180 deg
5V Relay Module
Neopixel Strips (2)
1000 uf Capacitor
47 ohm Resistor
Mercury Tilt Switch
Florescent Light Ballast
Television Transformers (2)
Steel Wool



Notations
1. Printed gears on a 150$ faux CTC faux Prusa i3 .. not ideal. Sketchup plugin: jimhami42_rack_and_pinion.rbz https://forums.sketchup.com/t/involute-gear-and-worm-gear-plugin/39666/4
2. Mind the gap .. as it is not so much obtaining the sustained spark but focus on the initiation, which shd be ideally half or less before then traveling to the mhz distance.
3. Maker rage! V1 faced an -incident- of impatience of stupidity for stupidity.
4. Gears [deep breath] suck. V1 (pre-smash) was constructed before the gears had been printed - thus halving gears led to variance failures. V2 geared up first.
5. Knock off Nano was trashed - then fried a NodeMCU and servo by using a 12V usb fed power supply bcz wtf?! Burned a new bootloader to faux Nano -- back at it.
6. In principle .. am I right?! No? (>_ლ)

7. FAIL as 30,000 to 40,000 volts regardless of isolation (3 to 5 mm of PLA?!) disrupted electronics and seized the gyroscope. Lesson here? Less is more .. or shielding .. yeah, probably shielding. #lim



What Code Go Wrong?!
// Arduino Plasma Toilet Air Freshener
// Version 1.4
// Vije Miller

#include <FastLED.h>
#include <Servo.h>

// Neopixel
#define DATA_PIN 2
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
#define NUM_LEDS 3
#define BRIGHTNESS 100
#define FRAMES_PER_SECOND 120
CRGB leds[NUM_LEDS];

// Servos
Servo gyro;
Servo riser;
Servo level;

// Gyro
int gyro_pos = 95;
int gyro_stop = 95;
int rotate = 77;
int timer_rotate_initial = 3000;
int timer_rotate = 9150;
// hall sensor in next version

// Riser
int rise = 105;
int lower = 75;
int riser_stop = 91;
int timer_riser_up = 20;
int timer_riser_down = 20;

// Level
int level_pos = 125;
int up = 93;
int down = 125;

// Relay
int relay = 3;

// Trigger
// Mercury Switch
int trigger = 7;
int led = 8;
int state = 0;
int hold_state = 0;

void setup() {

Serial.begin(9600);

pinMode(trigger, INPUT);
pinMode(led, OUTPUT);

pinMode(relay, OUTPUT);
digitalWrite(relay, LOW);

gyro.attach(5);
gyro.write(gyro_stop);

riser.attach(6);
riser.write(riser_stop);

level.attach(4);
level.write(down);

FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);

// Alert Active
colorFWD(0x00, 0x00, 0xff, 100);
colorFWD(0x00, 0x00, 0x00, 100);
colorFWD(0x00, 0x00, 0xff, 100);
colorFWD(0x00, 0x00, 0x00, 100);

}

void loop() {

// Clear Strip
colorFWD(0x00, 0x00, 0x00, 100);

// Read Button
state = digitalRead(trigger);

// Lid Down
if (state == LOW) {
digitalWrite(led, LOW);
// Lid Down After Open Then..
if (hold_state == 1) {
delay(5000);
freshen();
hold_state = 0; // reset
}
// Lid Open
} else if (state == HIGH) {
hold_state = 1;
digitalWrite(led, HIGH);
}

// Testing
if (Serial.available() > 0)
{
int cmd = Serial.parseInt();
Serial.println(cmd);
if (cmd == 1) {
rise_up();
} else if (cmd == 2) {
go_down();
} else if (cmd == 3) {
turn_gyro();
} else if (cmd == 4) {
freshen();
}
}

delay(1);
}

// Whole Shabang
void freshen() {
rise_up();
delay(2000);
turn_gyro();
delay(2000);
go_down();
}

void rise_up() {
for (int x = 0; x < timer_riser_up; x += 1) {
riser.write(rise);
track_led();
// Convert to Leveler Servo
level_pos = map(x, 0, timer_riser_up, down, up);
level_pos = round(level_pos);
level.write(level_pos);
delay(500);
}
riser.write(riser_stop);
}

void go_down() {
for (int x = 0; x < timer_riser_down; x += 1) {
riser.write(lower);
track_led();
level_pos = map(x, 0, timer_riser_down, up, down);
level_pos = round(level_pos);
level.write(level_pos);
delay(500);
}
riser.write(riser_stop);
}

void turn_gyro() {
// Spin Up Gyro
for (gyro_pos = gyro_stop; gyro_pos >= rotate; gyro_pos -= 1) {
gyro.write(gyro_pos);
delay(50);
}
delay(timer_rotate_initial);

// Activate Spark
digitalWrite(relay, HIGH);
delay(timer_rotate);
digitalWrite(relay, LOW);

gyro.write(gyro_stop);
}

void track_led() {
colorFWD(0x00, 0x00, 0xff, 100);
colorFWD(0x00, 0x00, 0x00, 100);
}

void colorFWD(byte red, byte green, byte blue, int SpeedDelay) {
for (uint16_t i = 0; i < NUM_LEDS; i++) {
setPixel(i, red, green, blue);
showStrip();
delay(SpeedDelay);
}
}

void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
FastLED.show();
#endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
#endif
}

Archive
https://hackaday.io/project/161444-arduino-plasma-toilet-air-freshener-fail
https://hackaday.com/2019/08/02/fail-of-the-week-toilets-and-high-voltage-do-not-mix/

@pkvi
"...may not meet professional standards."
12,168 miters
0 miters today
203 tenons
Subscribe