💬 Bed Occupancy Sensor

  • Can i "mate" that with my fitness tracker? (pun intended) 😝

  • @petewill
    I may have missed this in the video, but exactly where are the sensor tapes placed? Under the mattress or under the sheets?

    Great project! I have been experimenting with velostat to build binary sensors to accomplish something similar but it is still buggy.

  • Hero Member

    Have you ever considered adding a weight/pressure sensor underneath the legs of your bed?
    Lets say if the weight of your bed would be 100kg, that the arduino is configured set to toggle at 110kg? 🙂

  • Admin

    @Oitzu As long as it's consensual 😉


    but exactly where are the sensor tapes placed?

    We have them placed under the sheets and mattress pad. When it is under the mattress pad nothing is disturbed when changing the sheets. I don't think it would work under the mattress unless it was really thin. I didn't do any testing on the max depth that it can sense but I would guess it's no more than 1".


    Have you ever considered adding a weight/pressure sensor underneath the legs of your bed?

    Yes, I actually have all the components to build a weight sensor sitting on my desk. I had originally planned to use them instead of the mpr121. The reason I didn't pursue it very far is I have a really heavy bed, I would have had to develop some custom platform for it to sit on and it costs more. So, to sum it up the capacitive sensor is easier and cheaper so I went with that method instead.

  • Hero Member

    I get away with a lot of stuff, but there is no way my wife would let me do this.. 🙂 Why did you turn off the YT comments?

  • Hardware Contributor

    @RJ_Make said:

    I get away with a lot of stuff, but there is no way my wife would let me do this.. 🙂

    After a second thought it's obvious that I'm in the same situation. Need to go for the more expensive weight sensor then I suppose.

  • Admin

    @RJ_Make said:

    I get away with a lot of stuff, but there is no way my wife would let me do this..

    I have my sensors under a mattress pad (which is below the sheets) so she never even sees the sensors even when the sheets are changed. You just need to do it when she is away. 😉

    Why did you turn off the YT comments?

    Strange, it says they are allowed. Are you not able to comment?


  • Hero Member

    @petewill Seems to be working this morning.. 😱

  • Realy cool project. Its very usefull ,but in my opinion,all this wires in a bed will cause problems in home:P how far it detect capacitance? if it was mounted on bed plataform would be acceptable (for wifes). OR use a load cell(20 to 100kgs maybe) on one of the foots of bed plataform

  • Oh i see its now on hackaday also. http://hackaday.com/2016/04/17/are-you-in-bed/ 👏

  • Admin

    @Tmaster Sorry, I must have missed your comment. I think it probably detects around .5 inches. Maybe a little more. We have it under a mattress pad so wires are hidden and undisturbed when changing the sheets. I'd be interested in hearing how the load cells go. I vaguely remember reading that they start to lose their ability to detect if they are under constant weight. I'm not sure if that was just for detecting minor changes though. It may still work to pick up a body. 🙂

    @Oitzu Cool! Thanks for sharing.

  • if you run domoticz or an other home automation system, adding a time in bed script could be a next level

  • i have tried making the MPR talk to arduino, but i could not find the right library for your code.. what lib are you using? the adafruit one just spews out errors..

  • Admin

    @diamantmatch It's the BareConductive library https://github.com/BareConductive/mpr121 (see the comments in the code for more info)

  • @petewill
    Did you try to use the "virtual 13th pin" of the MPR121? It can be used to have the MPR121 automatically combine the values of (for example) the first four pins and was specifically designed to handle proximity detection instead of touch.
    I wonder if this could theoretically cut down on the necessary calculations.

  • Admin

    @Nicolas-M. I never tried it. I looked into it but didn't use it because I wanted to use the same device to monitor both sides of the bed. I have wondered this on occasion as well. It would be worth looking into if you decide to build one.

  • @petewill Ah okay, understandable. I thought about the pros and cons of using two MPR121, since they are extremely cheap (1-2$?), but it would mean more cables, so it would only be worth it if it improves accuracy. I finished rebuilding your setup a few hours ago but didn't have time yet to test it much, maybe I'll build the "virtual 13th pin"-variant aswell if I find the time.

  • Admin

    @Nicolas-M. Yeah, they are definitely cheap. I can't remember why I wanted to do one. I guess because it was working and there was less to do.
    One thing I would change is I wouldn't use the copper tape any more. I have found that it gets damaged (cracked/separated) rather easily. I have actually switched to a stranded copper wire (18ga I think) that I have removed from the housing and spread out flat. I make sure it's overlapping itself in somewhat of crisscross pattern. That way if one of the wires breaks it still will make connection with other wires. Hopefully that makes sense.

  • May I ask why you did not "just" install an PIR to detect presence in bed?

  • Admin

    @Inso Unless there is another use for a PIR that I'm not aware of, a PIR will detect motion and when I'm sleeping I'm not doing much moving. 🙂 With this sensor it knows when I'm in bed so the lights don't turn on and the blinds don't go up. Hopefully that makes sense.

Suggested Topics