Step 10: Software

You can grab the binary here, or the full source right here. Instructions on how to program your Propeller Platform in Windows, Linux, or Mac are here. You can also use the audio samples I've created right here. Download them and copy to the root of your microSD card. Here's an overview of how the program works, which you'll find especially useful if you want to customize it;

Main Loop

the main program runs through this code, checking for a reason to play a sample;


seatstatus := seatposition
lightstatus := checklight
IF (lightstatus == 1 AND seatstatus == 1)


IF (lightstatus == 0 AND seatstatus == 1)


IF (lightstatus == 3 AND seatstatus == 0)


First, it runs the method seatposition and stores the value returned in the variable seatstatus. Then it does the same thing with checklight, storing the returned value in lightstatus.

If lightstatus == 1 and seatstatus == 1, the seat is up and the light is on. Toilet buddy goes ahead and plays cover.wav. If the light is off and the seat is up, seat.wav is played.

If lightstatus == 3, that means the light timeout has been reached. Then it plays the light.wav file.


This method checks if the bathroom light is on. It uses the rctime object (part of the Propeller Tool download) to accomplish that. It charges up the capacitor connected to the photoresistor and counts how long it takes to discharge with a single line;


The variable RCValue will store the discharge time. If it's greater than the limit we set, that means not very much light is hitting the photoresistor, and we return 0. If more light is hitting it, we increment the light timer and return 1, until we reach the light timer limit.


We check the status of the seat with this method. We use ir object to accomplish this, which is also part of the Propeller Tool download. First, we have to tell the ir method what pins the IR LED and receiver are connected to - we do this at the beginning of the program with;

ir.init(IRAnode, IRCathode, IRSensor)

Then, when we call ir.distance, it will return the measured distance of an object in front of the sensor.


This method actually takes care of the audio playback. It's a simplified version of rayman's wav player. First, it opens up the file we requested. Then it reads the header to see if the wav file is 44khz or 48khz. Then it starts up the wav player in a second core. Our first core then fills the audio buffer for the second core.

The important thing to keep in mind is this player will only playback 16-bit stereo wavs. Also, the headers on the wav file need to be empty so the player can find the sample rate.
I think people are a little confused here. The bit that seems to be going up and down in the video is the lid, not the seat. The lid is only there for you to sit on or stand on in the rare occasions the need arises. Since anyone will know they want to do this it is not necessary to remind anyone.<br><br>The actual seat, of course is left up or down on different occasions (which is reasonably balanced) by a certain sort of person (generally, the male of the species) and always down (unfairly biased) by another sort of person (usually the female of the species).<br><br>What I would like would be a gadget that reminds people that once in a while they should be reasonable and leave the seat up for the next user!<br>
Actually when you flush the toilet it flings particles of waste into the air. It's more sanitary to close the lid before flushing.
QUITE A CLOCK you have there!<br>Any more information about that clock with 2 pendulums and 3 dials,<br>Is that clock striking you have in the WAV files?<br>regards, Bob
I'm actually thinking of using a modified version of this as a Skinnerian training device. One of my children seems to have difficulty remembering to use paper when he's finished. Any suggestions for a TP roll sensor?
sickest and most useless Instructable EVER! LMAO! :D
<strong>Sheldor said: </strong>sickest and most useless Instructable EVER! LMAO! :D<br> <br> &nbsp;&nbsp;&nbsp; May I direct your attention to a possible contender for the title you have just bestowed?<br> http://www.instructables.com/id/The-Twittering-Office-Chair/
Or, you could just tell your 'toilet buddy' to deal with it.
You flush when you lift the cover? I thought one was supposed to flush AFTER one used the toilet.
Does this courtesy reminder go off while you're in the shower with the light on?
nice device, but wouldnt you already be out of the room before it played the sound to remind you to shut off the lights?
What I want is a white noise generator, so if I go into a public restroom I can turn it on and mask the sounds of using the toilet. I hate having restroom standoffs because I need to take a dump, but I'm worried that the person next to me will think I'm disgusting.
Its really perfect!
It really needs a female voice, as that's the sound you've always been used to for minor toilet violations. XD<br>Sorry ladies, I'm speaking from experience though.
Evacution Com--Evacuation Com---Evac----Evacuatio--<br><br>Evacuation Complete<br>
Need it to flush the toilet when I forget! Wifey doesn't like that!
pretty cool device gives extra ideas....
Cool device! <a href="http://forum.sat-plus.com.ua/">cardsharing</a>
Cool device! <a href="http://forum.sat-plus.com.ua/">cardsharing</a>

About This Instructable


96 favorites

More by Gadget Gangster: Hack Your Car Talking Resistor Calculator Bananaphone: A Touch Capacitance Synth
Add instructable to: