Detecting If I Am In Bed - Page 1
Forum section: electronics / beginners

author: CBP
author_rank: Contributor
timestamp: December 12, 2014, 09:58:07 pm
content: Afternoon AllI have a Home Automation system and one of the things I have always been missing is the ability to detect whether or not I am in bed, detecting this can help with turning lights off in rooms/turning the temperature down/locking doors etc etc. I've never managed to do it and I am wondering if anyone has any ideas, these are things I have thought of;1) Pressure Pads - tried and too unreliable (rapid on/offs as the pad is between the mattress and the top sheet), also feels like sleeping on rubber sheets (that is the main issue, I could get around the first one)2) Ultrasonics - mounted in the roof directly above the bed, it is unlikely to be able to work out the difference between me and a pillow on the bed or me forgetting to make the bed in the morning. Don't really want a transducer in my face all night.3) IR distance sensing - the same as 2)4) Strain gauge - the bed does have slats across the middle (think this as an examplehttp://www.bedslats.co.uk/media/catalog/product/cache/30/image/9df78eab33525d08d6e5fb8d27136e95/w/h/whinfell_solid_oak_bed_angle_4.jpg) that do flex with the load on the bed however this is across several tens of slats and a without building a network of gauges on different ones I am not sure it would be reliable. I also thought about one on the legs of the bed but it is resting on carpet so it will not be on a hard surface, again I don't know if you can measure strain against carpet really.5) Some sort of passive detection like carrying a Tile presence sensor round with me etc, I can't always make sure that I will take it to bed and I am not implanting any RFID chips in my neck!6) Thermal Non Contact Sensing - thinking mounted in the roof down onto the bed. Will it detect body heat through sheets? How would I work out the difference between warm sheets from getting out of the bed to what is really actually me.Has anyone else any ideas about how I could do this? The most simplest solution is just to have a button and press it when I go to bed but I will always forget to do it.Thanks

author: dr.diesel
author_rank: Super Contributor
timestamp: December 12, 2014, 10:00:05 pm
content: Quote from: CBP on December 12, 2014, 09:58:07 pmDoes it have to be just you, or anybody your size/weight?Sorry.... O0

author: mtdoc
author_rank: Super Contributor
timestamp: December 12, 2014, 10:14:26 pm
content: Do an online search for "hospital bed alarm".Hospitals use these routinely so I'm sure multiple companies make them. There should be info available on their design.

author: Marco
author_rank: Super Contributor
timestamp: December 12, 2014, 10:26:09 pm
content: Load cells under the bed posts?

author: IanB
author_rank: Super Contributor
timestamp: December 12, 2014, 10:28:31 pm
content: Put a switch on the bedroom door that detects when it is closed? Then simply close the door when you go to sleep for the night and leave the door ajar at other times.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 12, 2014, 11:09:14 pm
content: under my car driver seat there is switch to detect and give seatbelt warning. its no ordinary switch but its like in the keyboard. its plastic laminate 2 layers and somesort of carbon contact in between.

author: jlmoon
author_rank: Unknown
timestamp: December 12, 2014, 11:40:41 pm
content: Quote from: dr.diesel on December 12, 2014, 10:00:05 pmLOL..that didn't take long!

author: jlmoon
author_rank: Unknown
timestamp: December 12, 2014, 11:43:04 pm
content: Quote from: Marco on December 12, 2014, 10:26:09 pmI can hear the line now.. c'mon in here honey.. let me show you how these load cells work.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 12, 2014, 11:59:25 pm
content: Quote from: jlmoon on December 12, 2014, 11:40:41 pmand some people dont like light to be turned off that momentso a manual button near the bed head is still golden. if you asleep and forgetting that button, i dont thing for that type of person, turning the light off will be necessary.

author: Psi
author_rank: Super Contributor
timestamp: December 13, 2014, 12:39:49 am
content: Place the load-cell under one leg of the entire bed structure, the carpet wont matter.The loading is the same on any surface but you may want a small metal plate between the cell and carpet. It only has to be the width/length of the cell itself. Maybe a 40x40x5mm block of aluminium.Assume it will sense ~1/4 of the weight of the bed + contents.So make sure the load-cell is good enough to detect 1/4 of a persons weight, maybe 1kg resolution or better, and of course make sure it can handle the total weight ok with a good margin.You can then code some simple logic to detect if someone is in bed using a threshold equal to halfway between an empty bed and a full bed.

author: Circlotron
author_rank: Super Contributor
timestamp: December 13, 2014, 01:09:39 am
content: If you had an inflatable mattress you could measure the difference in air pressure, similar to a hydraulic weighbridge. A system like that, being able to measure actual weight, could even log if Goldilocks is sneaking in.

author: dannyf
author_rank: Super Contributor
timestamp: December 13, 2014, 01:44:24 am
content: QuotePut some sharp objects in your bed. When you lay down on it, the sharp objects will pinch you and you will know then that you are in your bed.Side effect: you may have to clean the rest of your house of any sharp objects so you will never be confused when you get pinched.Hope it helps.

author: dannyf
author_rank: Super Contributor
timestamp: December 13, 2014, 01:46:44 am
content: Having solved the in-bed detection problem, can I suggest to you a harder problem to conquer?How do you detect that you are really you?

author: rs20
author_rank: Super Contributor
timestamp: December 13, 2014, 02:48:20 am
content: The load on a bed is not magically equally distributed amongst the four legs. Even if the mass is perfectly centered, if diagonally opposite legs are slightly longer, or the floor is correspondingly uneven, they'll take almost all of the weight between them. In practice, there's some flex to the wood, so it will be more even than that, but still not totally even? But legit idea nevertheless, just abandon the idea of assuming that dividing by 4 is the right thing to do.On the other hand, if you have a three-legged bed, then you're totally sorted. /3, (iff your centre of gravity is located at the centroid of the three legs).<partial thread derail>From where does one source load cells / strain gauges? I can find some on eBay, but it's really hard to find ones well-suited to a particular requirement. Take the 100 kg per leg case here for example (you don't want to load cell to break if you sit on the corner of the bed and place your entire weight essentially on that one leg).

author: miguelvp
author_rank: Super Contributor
timestamp: December 13, 2014, 03:11:40 am
content: Why not just detect capacitance variation? Of course you'll probably want to time how long the capacitance change stays so it doesn't trigger when you are making the bed.just some wires attached to the mattress will do.Or a PIR (like the motion detection domes) mounted on the ceiling pointing down.On both methods you'll probably want to wait 10 minutes or so, maybe even only 5 minutes to determine that you are there to stay. Also you can combine it with an RTC so you can have windows of when the system will activate.But if you have dogs that like to sleep in your bed when you are not there it will trigger it with both methods

author: pickle9000
author_rank: Super Contributor
timestamp: December 13, 2014, 03:45:33 am
content: Loop sensors like they use at a traffic stop. Pressure switch in a flat bag.Angry hamster under the sheets and a whistle detector to catch the screams while you are in bed. No screams for 10 minutes indicates you are no longer there.

author: mhwlng
author_rank: Contributor
timestamp: December 13, 2014, 08:29:11 am
content: I have (zwave) motion detectors in every room.If the last motion detected was in the bedroom and that room has been occupied for > 15 minutes, then I assume that I'm going to bed.In that case, the central heating is switched off (until motion is detected in any other room, in the morning.) and the wake-up alarm will be enabled.In this case, the lights will not be switched off automatically. (I read in bed.)There is a Visonic MCT-201 WP button next to the bed to control the lights.In the morning, the lights are automatically switched on gradually over a 30 minute period, before the wake-up alarm starts.

author: Retep
author_rank: Regular Contributor
timestamp: December 13, 2014, 02:29:41 pm
content: If you go for something that reacts to the load on the bed you better implement some debouncing. Otherwise the whole neighborhood will know when you are having a good time with your wife/girlfriend/boyfriend or whatever

author: zapta
author_rank: Super Contributor
timestamp: December 13, 2014, 02:36:32 pm
content: If you or your wife snore you can use a microphone as a sensor.

author: casper.bang
author_rank: Frequent Contributor
timestamp: December 13, 2014, 06:22:53 pm
content: For all the fun ways this could be done, I would probably just use an ATTiny with a thermistor. Let a tiny wire with the PTC resistor run to the center of the mattress (where your butt would be) and let your body temperature be the trigger. The MCU would allow you to use just about any sensor you want, tweak the trigger range and also add some hysteresis. If you just want to monitor your sleep, there are easier way to do it, i.e. with an Android app - which also takes "settling down" into account in its statistics (using the phones gyro to detect movement).

author: magetoo
author_rank: Frequent Contributor
timestamp: December 14, 2014, 12:44:41 am
content: Quote from: rs20 on December 13, 2014, 02:48:20 amTrue. Fortunately, humans aren't symmetrical; the head end will take most of the weight. (OP, are you human?) If you can have sensing on those two legs then things should work. I guess just one would work too.Plus, at least for me, sitting on a corner usually happens at the foot end.Quote from: dannyf on December 13, 2014, 01:46:44 amAssume you are you, unless dreaming. (Anything can happen in dreams.)If you are not you, then someone else will be you, and they would have the exact same problem of knowing whether they are you; therefore the two cases "you are you" and "someone else is you" are identical.So it would seem that the solution to this problem is the same as the solution to the first!Unless dreaming while sleepwalking, so that has to be detected too.

author: dannyf
author_rank: Super Contributor
timestamp: December 14, 2014, 12:55:42 am
content: All the approaches proposed so far can only detect if something is in the bed. The weight approaches for example would not make a difference between a 300lb man or a 300lb pig or 300lb of rocks.The OP's ask was "Detecting If *****I***** Am In Bed", emphasis mine.So having detected the existence of "something" in the bed, you have to develop a mechanism that assures the OP that that something is him/her indeed.I would say that a restart is needed.

author: magetoo
author_rank: Frequent Contributor
timestamp: December 14, 2014, 01:01:17 am
content: OP, lock the bedroom door.

author: dannyf
author_rank: Super Contributor
timestamp: December 14, 2014, 02:08:54 am
content: All of that, and then some, can be fairly easily defeated and seem to be overly and overtly complex and unnecessary.I would propose a simpler approach: a (reasonably intelligent) human. it can be a maid, a (girl/boy) friend, an employee, a bartler, etc. who would take a look at the "thing/being" in bed and confirm if it is OK.It would go like this:OP: "Arthur, am I in my bed?"Arthur/OP detector: "Yes, Sir. You are surely in your bed and I can see that with my naked eyes."

author: pickle9000
author_rank: Super Contributor
timestamp: December 14, 2014, 02:10:10 am
content: So I did mention a couple before (plus a joke). Both of the ones mentioned loop sensor a bag are real.You can easily simulate a bag sensor with a pressure sensor mounted on the end of run of surgical tubing (cork the other end). Place between the mattress and box spring. You may have to pressurize the tube a bit get it to work. These can also sense a heart rate if rigged properly. These are very robust rigs and last well.

author: Maxlor
author_rank: Frequent Contributor
timestamp: December 14, 2014, 02:16:13 am
content: A light barrier directly under the slats of the bed might work. As soon as there is some weight on the bed, the slats will be pushed down and thus be breaking the barrier.

author: Rerouter
author_rank: Super Contributor
timestamp: December 14, 2014, 09:45:10 am
content: As the definition was that the op was in bed, and assuming he doesn't free-ball at night, slip some waterproof RFID tags in his underwear and have a loop antenna under the mattress to read it,bonus point is he can then wear level his underweare.g.http://www.ebay.com.au/itm/like/111079728923?limghlpsr=true&hlpv=2&ops=true&viphx=1&hlpht=true&lpid=107&chn=psyou will be close to an RF source, but it should not be any more powerful than the wifi router you likely sleep next to

author: dannyf
author_rank: Super Contributor
timestamp: December 14, 2014, 11:08:51 am
content: -Or for an inverted logic case just tie the OP to the bed,-I think we are on the right track. However, that particular suggestion sound like a cruel and unusual punishment.

author: DVDRW
author_rank: Newbie
timestamp: December 14, 2014, 02:40:28 pm
content: Scale sensor under foot bed maybe?http://www.nerdkits.com/videos/weighscale/I'm searching sensor that detects if human is in room then ceiling light is on. When not in room or bed then light off.PIR wont work.2014 and still we don't have arduino human sensor, really?

author: HighVoltage
author_rank: Super Contributor
timestamp: December 14, 2014, 02:50:08 pm
content: Almost every new car has such a low cost sensor built in to the seats to detect, if the seat belt warning system has to be activated. A friend drives a small Volvo and that one is so sensitive, that a small book on the passenger seat will trip the warning.

author: pickle9000
author_rank: Super Contributor
timestamp: December 14, 2014, 08:05:10 pm
content: For a pir to work, use in pairs. Inside and outside door, on and next to bed last one on indicates location. Ideally in this situation 4, 2 at the door, 2 at bed. That way an out of sequence pair will indicate another person.

author: jeroen79
author_rank: Frequent Contributor
timestamp: December 15, 2014, 12:01:01 am
content: Some digital scales have four loadcells, one on each corner.You could put those under the fet of the bed and then adjust the circuit to trigger at the weight of the bed plus half your weight.You could thread thermocouples into the mattress to detect if there is something warm in them.Or place a CO2 detector near the pillow to detect your breath.

author: DVDRW
author_rank: Newbie
timestamp: December 15, 2014, 05:04:26 am
content: evb149 good point. I' m there where last PIR detected me.PIR-s cost like ~1.5$ piece and draws ~60uA currentBut I have 2 catsMaybe some kind of RF wrist device?

author: babysitter
author_rank: Frequent Contributor
timestamp: December 15, 2014, 03:16:59 pm
content: Zigzag wire woven under the bed (really, lots of Z stacked or sinusoidal). Use as L in a LC oscillator, say emitter coupled pair. Go for AM Frequency Range. Listen to Radio if you get a acceptable signal variation, if not, vary wire position/capacitor. Hack up something to measure frequency, e.g counter pin of a µC directly. Slow changes --> drift, fast changes --> movement on top of the bed!Source of inspiration:http://en.wikipedia.org/wiki/Respiratory_inductance_plethysmography

author: sunnyhighway
author_rank: Frequent Contributor
timestamp: December 15, 2014, 07:44:02 pm
content: Get rid of the bed.This simplifies the equation. Now the answer is alwaysNO

author: Jeroen3
author_rank: Super Contributor
timestamp: December 15, 2014, 08:56:40 pm
content: Absolute PIR would be the cheapest option. You could also run image processing on an IR camera, but you didn't mention your budget.Otherwise use your smartphone, if it is plugged in and horizontal between 21.00 and 6.00, you could assume with fair certainty that you are next to it.Aren't you?

author: free_electron
author_rank: Super Contributor
timestamp: December 15, 2014, 08:59:44 pm
content: similar approach to skieers in an avalanche trying to find up or down :pee. if the sheets get wet you are in bed.if your pants get wet chances are you are up and about.if the water in the toilet colors yellow : you are clearly not in bed...

author: dannyf
author_rank: Super Contributor
timestamp: December 15, 2014, 09:45:05 pm
content: How about a little needle? When you want to confirm if you are in bed, pinch that thing in bed with the needle. If you are the one screaming, you are in bed. If somebody else is screaming, you are not in bed.How's that for a simple solution?

author: BillyD
author_rank: Regular Contributor
timestamp: December 15, 2014, 10:10:45 pm
content: Have you considered a hammock? If so you could easily sense weight/tension at the suspension points.Or a waterbed? (Apologies if somebody already mentioned this earlier in the thread.) If so, you could relatively easily sense an occupant by the change in pressure.Problem with some beds is that they have a lot of legs or castors, mine consists of 2 platforms, each on 4 wheels so unfortunately it would be difficult to sense pressure on these.Nice idea though, quite clever to use your presence in bed as an input to those systems.

author: os40la
author_rank: Regular Contributor
timestamp: December 15, 2014, 10:15:41 pm
content: How about one of these sensors.

author: SeanB
author_rank: Super Contributor
timestamp: December 16, 2014, 07:38:12 am
content: Quote from: os40la on December 15, 2014, 10:15:41 pmThen you need to have a 3 bean salad every night for dinner. Or some of Kara Nicha's nice beans curry. Nice food, all vegetarian, and ranges from mild to tasty, though some people tend to catch on fire. You can ask for the hot stuff as extra if it is too mild.

author: Scrts
author_rank: Frequent Contributor
timestamp: December 16, 2014, 09:27:50 am
content: When I was in the university, I worked on a project to detect oil products (like diesel) in a very harsh environment. The barrels were not metal - they were made of special composite, where even ultrasonic sensors were not so reliable. We've used capacitance sensors, which were really sensitive. It will really detect when you're in bed if you'd put two electrodes below the mattress. The other problem would be if the 5 pints of the beer you drank last night would be decided to be released when you're sleeping... Probably it would detect that you're still in bed. But that doesn't happening frequently, huh?

author: Alex30
author_rank: Regular Contributor
timestamp: December 16, 2014, 12:06:08 pm
content: Quote from: os40la on December 15, 2014, 10:15:41 pmBahahahaha... I think that would be the drunk on homebrew sensor for me