Hardware Hump Day: The Toi-LIT

We like to potty! We like, we like to potty!

A few weeks ago a friend introduced me to this very exciting product.

alt text

It’s called “Glow Bowl,” and it’s life changing. This little gadget hooks onto your toilet seat and illuminates the inside of the bowl with an RGB LED, essentially acting as a night-light for your toilet. The idea is to avoid turning on the bathroom lights at night because there is nothing worse than the harshness of bright overheads when you are half asleep.

Naturally, when I was introduced to the Glow Bowl my first thought was “I can make that!”

...And so I did. Because why buy when you can DIY?! I decided that my Glow Bowl should activate in darkness and that it should have several color modes. I also decided to call my version the “Toi-LIT” --- because this toilet is LIT.

I started with the hardware. In order to make my Toi-LIT behave the way I wanted, I used the following supplies:

Resistor Kit - 1/4W (500 total)

COM-10969
$8.95

Hook-Up Wire - Assortment (Solid Core, 22 AWG)

PRT-11367
$21.50

SparkFun RedBoard - Programmed with Arduino

DEV-13975
$21.50

Heaterizer XL-3000 Heat Gun

TOL-10326
$14.95

Mini Photocell

SEN-09088
$1.60

Rotary Potentiometer - 10k Ohm, Linear

COM-09939
$1.05

Arduino Stackable Header Kit

PRT-10007
$1.75

Electrolytic Decoupling Capacitors - 1000uF/25V

COM-08982
$0.45

Soldering Iron - 30W (US, 110V)

TOL-09507
$10.95

LED RGB Strip - Addressable, Sealed (1m)

COM-12027
Retired

The below diagram illustrates the Toi-LIT circuit:

alt text

Having a hard time seeing the circuit? Click on the wiring diagram for a closer look.

Once I had put the circuit together on a breadboard, I wrote my program using the Arduino IDE. The code is provided below, and I have included comments for you to follow along!

//Toi-LIT by Melissa Felderman for SparkFun Electronics
//Wheel and rainbow functions have been copied directly from Adafruit Neopixel library example code

//include the adafruit neopixel library
#include <Adafruit_NeoPixel.h>

//declare pins
int photocell = A1;
int pot = A0;
int LEDpin1 = 4;

//amount of LEDs included in strip
int numPix = 2;

//declare the neopixel strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(numPix, 4, NEO_GRB + NEO_KHZ800);


void setup() {
// begin serial communication
Serial.begin(9600);  

//declare pins as input 
pinMode(motionPin, INPUT_PULLUP);
pinMode(photocell, INPUT);
pinMode(pot, INPUT);

//initialize neopixel strip
strip.begin();
strip.show();
}

void loop() {
// read sensor input and store in variables for later
int photoval = analogRead(photocell);
int potVal = analogRead(pot);

//map potentiometer value to values between 0 - 8 
int colorMode = map(potVal, 0, 1023, 0, 8);


//conditional: if the photocell is registering mostly darkness, LEDs will illunimate. Potentiometer position determins color. 
if(photoval <= 600){  

  if (colorMode == 0) { 
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 255, 255, 255);
    }
    strip.show();
  } else if (colorMode == 1) {
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 255, 0, 0);
    }
    strip.show();
  } else if (colorMode == 2) {
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 255, 100, 0);
    }
    strip.show();
  } else if (colorMode == 3) {
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 255, 255, 0);
    }
    strip.show();
  } else if (colorMode == 4) {
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 0, 255, 0);
    }
    strip.show();
  } else if (colorMode == 5) {
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 0, 0, 255);
    }
    strip.show();
  } else if (colorMode == 6) {
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 255, 0, 255);
    }
    strip.show();
  } else if (colorMode == 7) {
    for (int i = 0; i < numPix; i++) {
      rainbow(20);
    }
    strip.show();
  }else if(colorMode == 8){
    for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  }
}else if(photoval > 600){

for (int i = 0; i < numPix; i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
    strip.show();



}


//Serial communication for debugging
Serial.println(colorMode);
Serial.print("motion sensor: ");
Serial.print(motionVal);
Serial.print(", button: ");
Serial.print(photoval);
Serial.print(", pot: ");
Serial.println(potVal);


}


//fucntions from the adafruit neopixel example code - will create a slow changing rainbow effect 
void rainbow(uint8_t wait) {
uint16_t i, j;

for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
  strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

Then I tested the program and the circuit. Once I knew it worked, it was time to fabricate. First, I soldered the circuit together on a SparkFun Arduino Protoshield. I used this shield because I needed to keep my hardware compact enough to attach to the outer ledge of a toilet bowl, as seen here:

alt text

Then I needed to consider how to get the LEDs on the inner ledge of the toilet bowl while keeping the rest of the hardware on the outer ledge. For this I decided to take an existing toilet clip and alter it for my purposes. I bought a Lysol No Mess Automatic Toilet Bowl Cleaner and removed the block of cleaner from the bottom.

alt text

Then I took the bare plastic hook to the toilet and used a heat gun to reshape it to fit snuggly around the ledge. I hot glued my SparkFun RedBoard to the outer arm and the LEDs to the inner arm, as seen in the images below. If you are using a bare LED strip like I am, I recommend covering it with some Saran Wrap to protect it from the elements!

alt text

alt text

alt text

Finally, it was time to see the Toi-LIT in action! I snapped it in place on my toilet and was extremely pleased with the results!

alt text

alt text

alt text

alt text

I added a nifty rainbow mode because who doesn't want their toilet bowl to have at least some unicorn qualities?

alt text

Now I’ll never have to deal with bright bathroom lights in the middle of the night again!

Let us know your thoughts on the Toi-LIT in the comments below!

Interested in learning more about LEDs?

See our LED page for everything you need to know to start using these components in your project.

Take me there!