Search This Blog

Thursday, November 19, 2020

Smart Bedframe

Recent gap in posts is due to moving. Now going from a 1 br apt to a house, there are plenty of new things to automate. First project is to make a light controller for the bedroom. 

I want this device to control: 
- RGB led strip under the bed
- White led strip under the bed
- 2 dimmable lights connected to the headboard

I had planned to just use a nodemcu but due to the mosfets and 2 AC dimmers all requiring a PWM signal. I had to go with an Arduino nano paired with an ESP01. Sounds easy enough... but I vastly underestimated how much extra code that added to the project. In retrospect I would probably go with a bigger espressif board. Here is a pic of how I layed out all the boards in fritzing and then physically layed out.


And here it is fully wired up. Code is 95% ready. The ESP can connect to the MQTT server and relay commands to the Arduino Nano.
And now it is installed on the bedframe under the mattress. The 3d printed box pictured is a housing the cover up a screw terminal for the AC and 12v lines.
Biggest hiccup in this project is the AC dimmers library uses internal timer 2, which prevents you from using 2 of the 5 PWM signals. I solved this by just using a digital signal for the RGB mosfets, so I just can't dim the RGB colors anymore. Not a big deal.