![]() |
|||
Washington, NC Real Estate - A cool site with real estate information in Washington, Bath, and Belhaven, North Carolina. Greenville, NC Real Estate - Another real estate site with information for Greenville and Winterville, NC. Morehead City, NC Real Estate - Another real estate site with information for Atlantic Beach and Emerald Isle, NC. Jacksonville, NC Real Estate - A real estate site with information for Jacksonville, NC and Richlands, NC and homes for sale. |
Bed Occupancy Detector Node
After searching for some time, I finally came up with a viable solution. The answer to my problem involves mounting a flex sensor to the bottom of the joists on my bed. The flex sensor changes its resistance value when it flexes or bends slightly. When weight is applied to the top of the bed (for example when I lay on the bed) the downward pressure causes the joists to bend very slightly and as a result the flex sensor bends and changes its resistance value. This method gives the main controller the ability to detect when I lay on the bed and when I get off the bed without me having to do anything. Not only that, but by measuring the resistance value I can also detect when multiple people are laying on the bed. This comes in very handy as I have routines setup to control lights when only one person is in the bed even though two are home. When I walk into the master bathroom and someone is sleeping on the master bedroom bed, the lights dim on to 20% so that I don't disturb them. Then, if all people are in bed the lights are shutoff instantly without waiting for occupancy timers to expire in rooms. For example, if I am the only one home and I walk into the master bathroom the lights stay on for five minutes after I leave the room. If I lay down on the master bed then the main controller recognizes that I'm the only one home and I'm in the bed, so unset the timer and turn the lights off right away.
Building the Sensor
Because of these limitations I opted to design my own controller to monitor the Pulsor and power it with the PIC16 series microcontroller (PIC16F886 to be exact) that I call the master bed node. The node connects to the main controller via my RS485 network that I ran throughout my house. I have the Pulsor sensor epoxied to the underside of one of the joists that my mattress lays on with with a two conductor cable that I soldered to the leads coming from the sensor. At the end of the cable I soldered on a 3.5mm stereo plug so that I could easily connect and disconnect the sensor to the node when I needed. Since having an AC to DC power adapter behind the bed just for this node is really a waste since it so small anyway, I opted to use the power from my RS485 network cable that I distribute for small nodes. I added a voltage regulator to the node as well so that I could get a steady 5 volts for the PIC to operate.
I have the sensor set to measure the resistance of the Pulsor once per second. This measurement is then added to the sum of the last 9 measurements and then divided by 10. This gives me the average resistance over the past 10 seconds. If this value goes up or down by 2 or more units then the new average is reported back to the main controller and a new threshold is set. This virtually eliminates the false reporting of someone in the bed when I toss something heavy onto the bed (causing a large flex for a split second). It also stops me from falsely triggering a sensor update if I roll over to the side of the bed, or sit on the edge due to the threshold. The main controller can also query the sensor at anytime if it needs to get the current value due to a reset or bug.
|