Introduction: Alexa Controlled Bookshelf Lighting

About: I'm programmer and an electronics hobbyist. I try to find that point where software meets hardware meets art. "Necessity is the mother of all creation, but laziness is the father." "The best way…

- This is a Bookshelf with a unique staggered shelf design.

- It also has inbuilt soothing warm-white LED diffused lighting.

- With wireless On/Off and brightness control through Amazon Alexa voice commands!

This is a great looking and eye-catching conversation-starter type of Bookshelf, but then totally blows away everyone's mind when I order Alexa to 'Turn On Bookshelf'.

Besides being good for showing off my book collection, it also acts like a mood lighting and lifts the ambiance of the room. Best of all, it is located near my bed, so I can use it to read book in bed(it gives enough light at full brightness) and command it to turn off when I feel sleepy. No more getting out of bed to turn off the light!

Step 1: Materials Needed

  • A plank of wood. I got 1.5" thick 10 feet long pine wood plank. It needs to be thick enough to cut a groove and insert LED strips
  • L-angles
  • Wall anchors
  • Wall screws 1.5"
  • Wood screws 0.5"
  • LED strip
  • NodeMCU ESP32
  • IRLZ44N Logic Level N-Channel Mosfet

Step 2: Some Background

We bought a new house. My room had this tall empty cavity in a wall for some unfathomable reason. I used it to pile all my books but trying to get a book at the bottom of the pile was a pain. So it was obvious I needed to put a few shelves and convert this space into a bookshelf.

I didn't have any experience with woodworking and was eager to learn. So I went and got a 1.5 inch thick 10 foot long pine plank, which I squarely placed in the middle of our lobby without much of an plan of what to do or how to proceed.

This was 2.5 years ago and the project has progressed bit by bit all this time:

  1. First I cut and put up the shelves and used it like that for a few months.
  2. Then decided to stain and varnish it to match rest of the furniture and used that for a few months.
  3. Then finally I cut grooves into them, add LED strips and electronics to control it all by Amazon Alexa.

I can say that it finally matches what I imagined in my head, and can call it a completed project.

Step 3: Cutting Plank to Make Shelves

I had this huge 10 foot long plank in my lobby and and a hand saw to cut it down to shelf slabs. To get straight cuts with a hand saw, I first marked the cut line and then clamped a 2x4 to the left and another to the right of the cut line, keeping the saw blade's thickness in consideration. This acted as a guide for the saw blade to get straight cuts, which worked good enough for my use case. It wasn't perfect and at times there was a bit of error but it was fixed with some sanding. I learned this trick from this seejanedrill video.

But the biggest problem was that I had seriously underestimated the hard work requited in cutting a 1.5" plank multiple times. After managing to cut a few shelf slabs, I had blisters on my hand. This was the most strenuous and time-taking part of the whole project and since the house lobby was the only place large enough to hold the long plank, it was filled with sawdust and sawing sounds for a few weeks.

Step 4: Install L-Angles

This is the simple but repetitive part:

  1. Mark shelf position. Measure twice, drill once.
  2. Make sure the shelf will be level using a spirit level.
  3. Drill holes for L-angles
  4. Hammer in the wall anchors
  5. Screw in L-angle with the long wall screws
  6. Repeat for all shelves

For the 2 full length shelves at the bottom, I went with inverted L-angles on the sides since they aren't visible and to give maximum load carrying capacity.

For the half-shelves, I went with upright L-angles so most of the vertical part is covered by the thickness of the shelf. I also needed to add a single L-angle on the back wall to provide support to the side wall L-angles and prevent the shelf from sagging/tilting under weight.

While the wood screws I purchased were black, the wall screws and the L-angles were in chrome finish. So for aesthetics, I spray painted them black. The paint will chip from the screw heads when screwing them in but a dab of paint later on can easily remedy that.

Step 5: Add Shelves

Mark on the bottom of shelves where the holes for L-angles will go. Then drill the marked location and use short wood screws to attach shelves to L-angles.

For the shorter half shelves, I had to cut grooves on the back side to accommodate the L-angle so the shelf would sit flush with the front of the wall. The L-angles on the sides do not need the groove as a shelf extending a few mm over the middle of the cavity isn't noticeable.

Step 6: Stain and Varnish

I experimented with a few permutation and combinations of stain and varnish to get a good look with the shelves. The shelves were stained to match the color of the rest of the furniture in the room. I was facing challenges with getting a uniform color so got help with this. After staining, a coat of varnish was added to protect the wood.

Step 7: Cut Grooves for Light Bar

To put the light tubes, a 15mm wide and 15mm deep groove was cut in all the shelves. It was cut 15mm away from the edge. It is preferable to use a table saw for this but I used a circular saw since I only had that, which I bought AFTER having spent ages cutting the plank with a hand saw. Sigh.

First the left and right edges were cut using perfectly measured guide lines. Then multiple passes of the circular saw were made to create thin strips of wood to be broken away easily. Then the bottom of the groove is sanded smooth.

Repeat for all the shelves.

Step 8: 3D Print Light Bars

Light-bars are just 3D printed cuboids with bottom side open to difuse the LEDs. These were 3D printed using white PLA filament.

Light-bars for the half-shelves were 3D printed of size 200mm x 15mm x 15mm.

The light-bars for the 2 bottom full-shelves are 400mm long which just barely fits diagonally on the 300x300mm bed of my CR-10S.

The design took a few iterations as the side edge would be darker than the rest of the tube. So had to thin out the walls in the side edge.

The attached Fusion360 file is parametric so any value can be edited to suit your requirement.

Step 9: Setup LED Bar

Cut out 2 LED strips of 20 mm each. Solder a triple-joint of 2 LED strips along with a pair of wire. Ensure that the positives of both the LED strips go together and the negative together.

Stick LED strips on the inner sides of the light-bar as far away from the top as possible to better diffuse the light. I stuck them slightly offset so that the LED of one is directly opposite the gap between the LEDs of the other. This way we can get a more uniform lighting instead of getting bands of alternating bright and dark. Take out the wire from the holes provided on the side of the light-bar.

Insert the LED bar in groove and use some glue on its sides to stick it to the groove. Repeat for all shelves.

Note that since all light-bars are throwing light upwards, the bottom-most shelf area would not have any light as it does not have any shelf at the bottom, only solid floor. So to light it up, I cut a very shallow groove in the bottom side of the bottom-most full width shelf, added a LED strip and diffused it by gluing a white sheet of paper or thin white plastic over it.

Supply 12V power and test. The image captures my first test with a spare shelf block which looked magical!

Step 10: Wiring the Shelves

The 12V power supply is placed at the bottom-most area and wires carrying power go upwards from it at both left and right sides. The wires follow the corners to be least visible and prefer a color of cable that blends in with the wall color, which is white in my case.They will mostly be covered by books when the bookshelf gets populated.

The power carrying wire is spliced at each shelf position and connected to the light-bar's wires so all light-bars are connected in parallel. Some hot glue or double-sided tape keeps the wire stuck to the side edge of the shelf. This will come between the side wall and shelf side edge, so won't be visible. For this, the shelf should be a few mm away from the wall, else a groove will be required on the side edge of slab to route wire.

Step 11: Making PCB

The MOSFET is wired to act as a switch. The D1 pin on ESP32 is connected to the GATE pin of the MOSFET which turns the LED strip on and off. Using PWM, we can also set brightness.

The 12V supply for LED strips is also connected to the VIN of the ESP32 which allows us to power it using its on-board regulator.

The circuit is simple enough to not require a custom PCB fabricated for it so I made it on a perfboard.

Step 12: Making PCB Enclosure

3D Print the top and bottom part of enclosure for electronics.

Insert the PCB into the bottom enclosure with wires for the 12V power input coming out on one side and PWM controlled 12V power supply for the LED strips coming out on the other side. The top lid should snap fit the bottom part.

The USB port is easily accessible for quick upload of code changes. Two screw holes are provided for easy mounting.

Step 13: Attaching PCB and Wiring Cleanup

A perfect out-of-view spot for the electronics and power supply is on the bottom side of the lower-most shelf. This area is not visible for anyone standing or sitting.

The PCB enclosure has 2 mounting holes which can be used to screw to the bottom of shelf. Same with the power supply. I designed and 3D printed wire clamps to prevent wires from falling all over the place.

A power strip can be placed on the bottom, smartly hidden behind a stack of books. This provides power to the power supply and Amazon Echo.

Step 14: Software

Download the Arduino Sketch for ESP32. You will need to download and install library for ESP32 to upload it using Arduino IDE. Replace the SSID and Password in code with your own WiFi credentials in credentials.h file. I used fauxmoESP library for connecting ESP32 to Alexa.

The on-board LED on ESP32 should blink to denote it is attempting to connect to WiFi. Once it connects, it turns on continuously.

Also, connecting Alexa app to Bookshelf is trivial:

  1. Make sure your phone, Echo and ESP32 are all connected to the same WiFi network.
  2. Open the mobile app for Alexa.
  3. Open the hamburger menu on top-left.
  4. Select Add Device.
  5. Set Type Of Device as 'Other'.
  6. It will ask you to discover devices.
  7. It should show 1 found device. Click on 'Setup Device'.
  8. Then it should show 'bookshelf' device should be setup and ready to use.
  9. Say "Alexa, turn on bookshelf". If you have an LED strip connected to ESP32, it should light up.
  10. You can also set the brightness by saying "Alexa, set bookshelf to 50 percent".

Sometimes, Alexa will say that the device 'bookshelf' is not found when you ask it to turn it on, but the ESP32 has a constant light on which means it is connected to WiFi. In that case, instead ask Alexa to set brightness of bookshelf instead and that always does the trick and Alexa can find it again. Not sure why.

Step 15: All Done!

That is all is needed to make your own Alexa controlled Bookshelf lighting!

It was a labor of love of 2.5 years. I kept learning new things and adding them to the bookshelf till I felt it to be perfect. The electronics part was easy for me but I fumbled around a lot with the woodworking part as it was a new field for me.

If you do recreate the project, please click the 'I Made It' button and share an image.

Woodworking Contest

Participated in the
Woodworking Contest