48

Anyone with kids knows they never help with the toilet paper. Anyone know how to track when it's low or out and sound an audible alarm? I just don't know what sensor to use that may help.

Some that came to mind are: by weight, by reflection (the color of the paper) or some laser tripwire - all right on the spool. I don't mind building it, it's just I don't know which sensor. Anyone know which to use?

asheeshr
  • 3,847
  • 3
  • 26
  • 61
Jose Leon
  • 735
  • 1
  • 6
  • 11

17 Answers17

47

Bring up several rolls at a time and hang one for use. Put the other two on a short vertical pole within reach of the sitter. Sitter can take another roll when needed.

Mechanically sense lack of weight on the shelf at the bottom of the pole. Alarm triggers when the last roll is removed. No one has to get caught short.

To sense the weight use a force sensitive resistor such as the FSR 400 (see datasheet). Alternatively, you could use a lightweight coil spring to rest the toilet paper on with a micro switch that is released when both rolls are removed. Another option would be an IR beam break detector where the circuit is completed when the last roll is removed.

jlbnjmn
  • 978
  • 2
  • 9
  • 15
JRobert
  • 15,407
  • 3
  • 24
  • 51
22

I believe the reed sensor concept put forth by jfpoilpret and jmathew is the easiest to accomplish. I have drawn a diagram of how I think it would look.

You could adjust sensitivity by adjusting the height of the lower contact.

This really only gets you to a "low" condition and not necessarily out. Unless you want to change rolls while there are still a few sheets left this doesn't seem to me to be a satisfactory solution. I'd rather have an "out" indicator and have an audible buzzer to prompt/shame the user into replacing the roll.

This design could be accomplished using standalone electronics (no arduino needed). However it you wanted to gamify the changing of the roll you could use an arduino for that.

Note also for color based optics sensors, while the vast majority of cardboard tubes used for this purpose are brown, I have seen white ones in use as well.

Reed Sensor Diagram

Arluin
  • 321
  • 1
  • 3
14

I think I saw this in series 1 episode 2 of James May's Manlab.

Similar to jfpoilpret, use a wide piece of material on a spring that makes contact with the roll at all times. I say 'wide' so that when the roll is empty the reed touches with a contact on one of the roll holders on the side. When it touches it completes a circuit to your alarm.

Here's a crude image describing what I mean.

In Arluin's response it was mentioned that this method would not show that the the roll was empty. Thats pretty much true. If the top contact is as thick as the TP cardboard roll and the bottom contact is positioned inside the inner part of the cardboard roll it should get close enough for practical purposes. One foot of TP roll is not enough after taco night.

Behold the image of my imagination

jmathew
  • 241
  • 1
  • 4
9

Use a radiation detector to detect the amount of paper left on the roll. Place some amount of radioactive material in the middle of the spool rod, and place the radiation detector somewhere else (you could mount it on the other side of the surface the roll holder is mounted to, if you want; radiation sensors are extremely flexible), and measure the radiation amounts to determine how much paper is left on the roll.

Alternately, you could have an electronically controlled toilet paper dispenser (push button to dispense a preprogrammed length of toilet paper) and have the arduino just keep track of how much has been dispensed.

Or, attach a rotary encoder to the side of the spool rod (make sure it fits without slipping inside the roll), and count the rotations of the roll to determine how much has been used.

Of course, with any of these methods, you will have to do tests and collect data depending on the exact type/brand/material/etc of toilet paper.

Especially for the second and third ideas, I would recommend taking data from the system regularly, to keep track of the typical length of a roll so you can adjust the program for any significant variation. Even within one type of toilet paper, I would imagine that there would be some variation in roll length.

For even more fun, you could instrument the detector to collect time series data, so later you can upload it to a computer and make a "toilet paper usage over time" graph or something.

AJMansfield
  • 225
  • 1
  • 11
7

I think 'Arluin' and 'jmathew' have the right idea. Use a lever resting on the top of the roll.

I would do it slightly different however. Rather than rely on contacts shutting you can use a potentiometer. With this system you can measure the amount left instead of simply being notified when it gets low.

With a contact such as those suggested already, you might get paper stuck in the contact as it closes and then low paper would not be detected.

(You may need a weight, shown in blue on the diagram, to push the lever down as the roll is used)

You would need to try and get the pot as close to the roll as possible for maximum swing of the pot and therefore maximum resolution of amount remaining.

Another thing you might want is some kind of roller on the end of the lever so that the paper roll can move easily with little drag where the lever contacts the paper.

Proposed setup

Lex
  • 171
  • 4
5

You could just crack open one of those playing birthday cards and adapt the switch to the holder arm. Once you hear 'Happy Birthday" chiming from the toilet you know you're in trouble! (and because they are very low-power these things chime on forever ;-) ) I've shown a LED setup here but you get the idea...

happy birthday

Grit
  • 61
  • 1
3

I built a reflectance tachometer for an Arduino that'd probably solve your problem. The basic circuit is quite simple:

tachometer circuit

I had a photoransistor laying around that responded well to red light, and another from Radio Shack that was quite sensitive to the IR output of old TV remote LED's. For your purposes, green wire would be hooked up to Analog Pin 0 of Arduino, and you just have to sample periodically, not set up an interupt driven sketch. The trick to getting a reflected signal difference between white paper and grey roll is knowing that light sensitivity of a photransistor increases w increasing resistance to GND, but the dark voltage also goes up. I came by the 5 and 3 megohm values empically, by checking the AtoD values off dark and light objects at a distance of a few inches from the detector. Same procedure should work for your detection of grey vs white. Although some things that look quite different visibly have the same reflectance in IR. Here's a pic of the finished red light tachometer: enter image description here

It should be simple to make the sensor board small enough to fit into the back of your paper dispenser. IR version is even smaller, but buried too deeply in a home-built centrifuge to get a pic of it today.

3

I think another decent and cheap option to use is a proximity sensor like the ones on the phone or a fixed field infrared sensor. These sensor are pretty accurate and can easily be used to "look" at the back of the toilet roll by mounting the sensor to the holder or the wall where the toilet roll is placed. All the other ideas I saw on the post were either fairly inaccurate or felt intrusive towards the toilet roll which in the long run I feel may provide contamination. A proximity sensor is not only fairly cheap and easy to use, if calibrated well, they can allow a very good amount of accuracy and reliability. This model is already in wide usage in men urinals to auto-flush. For example on your phone: Your phone will accurately provide a distance of 2.0 inches or infinity when your hand or your face is near the screen.

2

One idea that comes to mind would be something like that:

  • stick a small magnet inside the paper roll, i.e. inside the cardboard part (this has to be done every time you change it; though)
  • use a reed contact (electro-magnetic switch) at the tip of a stick mounted with a spring to be always in contact with the paper roll
  • one pin of the reed contact can be directly connected to an input logical pin (set it up as a pullup resistor input)
  • the other pin of the reed contact is to be connected to the ground

Thus, as soon as the distance between the magnet and the reed contact is under some limit, the switch will close the circuit. That distance will decrease while the paper roll gets drawn.

Note that, instead of a reed contact, you may also use a Hall Effect sensor, the principles remain the same, only technology and characteristics change.

The difficulty here will be to find the right sensitivity of the reed contact (or the force of the magnet) so that the reed contact gets closed when the distance between it and the magnet is small enough to avoid an alarm that would be activated too soon).

jfpoilpret
  • 9,162
  • 7
  • 38
  • 54
2

An short-range ultrasound distance sensor might be an effective (and fairly cheap) option. You can get an emitter+sensor combination mounted on a chip. Different sensors may work in different ways (always check the datasheet). A common output though uses the length of a pulse to indicate the distance sensed. You could process that in Arduino using the pulseIn() function.

In terms of installation, you'd probably fit it directly behind the toilet paper, pointing at the centre of the spool. The readings are often quite erratic, so you want to take several measurements and average them (or use a simple moving average). With a bit of calibration, you could determine what distance represents an empty spool.

When you detect that distance repeatedly for a significant period (e.g. a minute or more), you'd sound the alarm.

A reflectance-based sensor might be another possibility, although I wonder if you might struggle to find one which will work properly on toilet paper (depending on how soft your preferred brand is!).

Peter Bloomfield
  • 10,982
  • 9
  • 48
  • 87
2

Sounds like a cool project, here are my 2 ct:

Point a camera to take photos of the roll from sideways, that is probably the only way to really find out how much paper is left. (edit: You could use a raspberry pi with the csi camera and create an output signal corresponding to the number of sheets and feed that signal to the arduino?!)

For an estimate it might also be enough to count rotations of the roll, but you need to fiix the roll better so it doesn't slip. Or you can use magnets like you do on bicycles, but they need to be attached to the roll directly then.

(edit: one more idea, mesure the thickness of the roll by measuring the angle of the lid)

Paperboy
  • 29
  • 2
2

The simplest, yet best solution afaict, would be to use an optocoupler made of one IR LED and an opto-transistor. You make the LED lighten towards the roll, the LED being within the roll tied to the "handle". Once you remove the cardboard roll, the opto-transistor gets the IR light from the LED and triggers a pin change interruption on the Arduino, which can then alert you through many ways (light, SMS, twitter, alarm…).

That design is really cheap, easy and fast to build. Though there's still one thing you need to do: when there's no more toilet paper, you need to actually have the cardboard roll removed ;-)

Otherwise, the same kind of solution for the spare rolls is even a better idea :-)

zmo
  • 1,518
  • 10
  • 16
2

A lot of the options here seem overcomplicated and intrusive.

Color Sensor

Another option, slightly complicated (but fun) to implement, but unintrusive and easy-to-install, is to build a cheap color sensor and mount it on the wall behind the roll. When you detect the color of the roll (or the absence of the color of TP), it's low.

You can also just buy one for $8.

You can adjust the threshold by taking advantage of the thinness of TP and the fact that it starts to look a little darker when there's only a few sheets left.

If necessary, calibration can be done by pressing a button after a new roll is installed with the bathroom lights on.

You would have to make a few adjustments depending on the specifics of your bathroom. If you added some extra complexity and powered it off an AC outlet that was tied to the bathroom light switch, you could only have it powered on when the bathroom lights were on, which would filter out a lot of unreliable data.

This is very easy to install and doesn't involve modification to the roll itself. You could stick the sensor to the wall with double-sided tape, or put it on a tiny shelf under the roll facing up (or on top facing down).

IR beam break

Mount a small IR LED on one side of the dispenser, just above the spool. Mount an IR photo sensor on the other side of the dispenser. When the sensor sees the LED, the roll is low. Could be done with a cheap laser too (e.g. an off the shelf laser pointer on one side and a photosensor on the other; but don't hurt your eyes!)

This is also easy to install (e.g. hot glue to dispenser) and doesn't involve modification to the roll, although the location of the sensors might make them easy to damage when you're replacing rolls.


I also really like the reed sensor and range sensor (BTW: $10 gets you a great short range distance sensor) options here.

Jason C
  • 121
  • 6
1

I say get a weight sensor, and program it for the roll's weight. When it drops below a certain weight, start flashing an LED or make a beep.

I. Golsby
  • 161
  • 4
1

You have a few options:

Note: The links given are just the first ones that come up. Most of them are pricey compared to other sites. eBay buy it nows can be fairly cheap for most of these items. Check other places, too, including Sparkfun.

  • Ultrasonic Ping Sensor. This isn't ideal by any means, but they're easy to use. Just add one with an enclosure. It isn't ideal because it won't be accurate enough to tell when exactly it's empty. It might be a little over/under sensitive. Weight would be harder, though if it shifts at all.
  • Color sensor (preferable, but costs more). You mentioned this and this is probably the best idea. It'll give you analogue values (to read with Arduino) for red, green, and blue. [Assuming that the higher the content of that color, the higher the voltage,] white should be pretty much all of those at 100% and brown I would image that most of them would be about 30-40%. (More later, if you don't understand this, skip this part)

I'm going to go into more detail on the color sensor:

Colors are read with three values here: red, green, and blue. There are three sensors on the board. One filters out everything except red, another blue, and the other green. The sensors on the board detect the amount of incoming light and then convert that to a voltage: between 5V ("100% red/green/blue") or 0V ("0% red/green/blue"). This then can be converted into a number by the Arduino (0-1024 on an analogue pin).

A problem with lighting: This sensor, from what I can tell, has a LED that's always on. You'll want to either desolder that or cover it up, unless you want an illuminated toilet paper holder. Now wait... your sensor will think that when it's dark, it's brown. No problem... here's something for you mind to think about.

Use a color picker like I'm using and select a brown. On the left of this one, you can control the "simulated brightness." Besides that is the hexadecimal form of RGB. You'll want to convert that to standard values with this calcuator.

In brown, the color blue is almost nonexistent. We should ignore that color, unless you want a way to double check that it's brown. I'd say it should always be under 40% for pretty much any shade of brown.

From what I can tell with a sample shade of brown, the red is pretty much 2x the green. That ratio may vary, but you should verify that it is somewhat existent. For white/grey/black, all the colors are proportional 1:1:1. You can use this to detect if it's dark, or if it's brown.

int rPin = A0;      //Red Pin
int gPin = A1;      //Green Pin
int bPin = A2;      //Blue Pin
int ledPin = 13;    //I made this code with a LED, not a speaker
boolean testTwice = false;

void setup() {
  pinMode(ledPin, OUTPUT);  
}

void loop() {
  int rValue = analogRead(rPin);
  int gValue = analogRead(gPin);
  int bValue = analogRead(bPin);

  if (bPin < 256) { //If this is false, either something is in the way or it's white. Going to verify that something's not in the way...
    int minRed = rPin * 0.4; //A little under a half for padding... this values may need to be adjusted. Adjust this one and the one below farther apart for less sensitive.
    int maxRed = rPin * 0.6; //A little over a half for padding... this values may need to be adjusted.
    if (gPin < maxRed && gPin > minRed) { //Verifys that red between minRed and maxRed
      digitalWrite(ledPin, HIGH);
      delay(5000);
      digitalWrite(ledPin, LOW);
    }
  }
  delay(5000); // No need to waste power... you might want to add an actutal sleep function if on battery power
}

First, it verifies that the blue is less than 25%. Then, it verifies that the red and green are equal... give or take 20%. (i.e. red = 100 green = 80, red = 110 green = 90, etc.). If that is true, you can pretty much establish that it's brown. Then, a LED turn on for five seconds.

You can modify the LED to be a buzzer if you want. You might have to adjust the if statement with verifying that the blue is less than 256/1024 (1024 = resolution of analog pin) if it isn't working in a lot of light or is working in dark light. Since the code later verifies that the red is about 2x the green, any shade of white shouldn't pass that if statement. You may also have to adjust the minRed and maxRed to be farther (if not detecting brown) or closer (if detecting brown when it's white). I can't really test this code with no color sensor.


Note: these can be a little fidgety. I would recommend a LED instead so the whole house isn't woken up in the middle of the night just because of low toilet paper. Also, if you obstruct the sensor at all... If it wasn't in the bathroom, I would recommend a camera and have it take a shot every time it gets very low with a reed switch like @jfpolipret's answer... but... (no pun intended) :)

Anonymous Penguin
  • 6,365
  • 10
  • 34
  • 62
1

Your best option is attaching a rotary encoder to the side of the roll, and count the rotations of the roll to determine how much has been used. Once you know the number of rotations per roll,you can set where you want your notification to fire. Attach it to a logging system of sorts and you'll have historical data of paper use as well as toilet use.

stav
  • 171
  • 3
0

Another way to do it, in case you just want to for the fun of it would be to put a metal rod inside the roll, and a metal plate on the outside, and measure the capacitance which should change with the TP remaining due to the dielectric constant of the paper.

But that would be taking the "scenic route" for sure. Still, the Arduino can measure capacitance pretty easily and it might even be sensitive enough, and it would stay out of the way because it would just be a metal plate behind the roll and a metal rod in the roll. You might even be able to retrofit an existing holder without it being noticed.

An easier way would be a stick attached to the shaft of a potentiometer held up by the top of the roll. Less TP, shaft goes lower and turns the pot. Might need a long shaft for leverage because you can't press too hard without impeding the function of pulling toilet paper.

As AJMansfield suggested, Radioactivity actually is used to measure the thickness of things in industrial settings. If you really wanted to go crazy maybe you could use an extremely low energy radioactive source like a can of that weird tasting salt substitute which is a tiny bit above background levels and average over extremely long times(toilet paper shouldn't change much from hour to hour), so this could actually be a reasonable if expensive way to do things.

Infrared beam break sensors are also good, and if you position it right you could get it to block more light the fuller the roll was instead of just giving you and on or off signal.

EDIT: Working Proof of concept of the capacitative approach. Only needs an arduino and 2 stiff wires. Precise to about an 8th of an inch, with a lot of noise. Pretty sure you could reliably get at least 1inch accuracy. Measurement time is about a minute. It's really sensitive to it's surroundings. You'd have to make sure anything metal within a foot stayed where it was or use shielding.

float difference;
unsigned long i;
unsigned long j;
unsigned int temp;
volatile unsigned char blah;

void setup()
{
  pinMode(5,OUTPUT);
  Serial.begin(9600);
}

void loop()
{
 difference =0;
 Serial.print("Measuring: ");

 for(i=0;i<100;i++)
   {
     for(j=0;j<5000;j++)
     {
       digitalWrite(5,LOW);

       temp=analogRead(A0);

       digitalWrite(5,HIGH);

       temp = analogRead(A0)-temp;
       if(temp<1024)
       {
         difference += temp;
       }

     }
     //Random delay every 5000 samples helps avoid problems with interference by staggering the samples to cancel aliasing.
     delay(random(1,50));
     Serial.print("|");

   }
   Serial.print("\n");
   Serial.print("Value: ");
   Serial.print(difference/500000);
   Serial.print("\nMeasurement Complete. Press Enter to begin another test.\n");

   while(!Serial.available())
   {
     blah = 20;
   }
   Serial.read();


}

http://pastebin.com/2W5y81AB

sachleen
  • 7,565
  • 5
  • 40
  • 57
EternityForest
  • 377
  • 1
  • 4