CPX Book Light

by TyR10 in Circuits > Gadgets

38 Views, 0 Favorites, 0 Comments

CPX Book Light

Screenshot 2025-11-05 145233.png

We created a mechanism that fits over a book. The light on the CPX lights up when the room gets too dark which illuminates the pages. The orientation of the light can also be changed by pressing a button to move the servo. The light also has another mode which makes it a blue color and can be changed by moving the switch on the CPX.

Supplies

3D Printing

There are two pieces that must be 3d printed in order to create this book light. One of them is a thin sheet, and the other is a thicker piece that has a pocket for the battery pack. These pieces will be combined in the assembly step. The files for the two models are listed below.

  1. Our print A is a flat 3”x 3.5” rectangle with a smaller box on top with one side open for the battery and loose wires to fit into
  2. Our print B is a flat thinner 3”x 3.5” rectangle with a small edge on one side to connect it to print A
  3. The design with the battery pocket should be printed with supports


Coding the CPX

Screenshot 2025-11-15 235012.png
Screenshot 2025-11-15 235031.png

You can copy and paste the code into you Mu Editor, where you can both load it onto your cpx and edit the code as necessary. It was quite a challenging process converting the code to Circuit Python, so there may be some kinks that need to be worked out.

If the code works, it should:

  1. move the servo between 0 and 45 degrees depending on which button (A or B) is pressed
  2. Turn the LEDs on when the light level of the room goes beneath 10
  3. Change the color of the lights from white and blue depending on which way the switch is flipped

The code for the CPX is as follows:

Google Doc

I had to put it in a Doc because the formatting on Instructables wasn't favorable

Wiring

circuitpython_CPXServo_bb.jpg

In order for the servo motor to work, the alligator clips must be attached to the Circuit Playground in a very specific way. The red wire will be connected to the spot labeled "VOUT", the yellow or orange will be connected to "A2", and the black or brown will be connected to "GND".

Assembly (3d Printed Pieces)

Screenshot 2025-11-05 145233.png
Screenshot 2025-11-12 141359.png

Once all your pieces are ready, it's time to begin assembling the book light. The two 3d printed pieces will need to be glued together. Make sure that the pocket on the back of print A is facing upwards (the side with the hole facing upwards) like shown in the original photo. The thin sheet that was printed (print B) will be attached so that the small part coming off of it is glued to the top of print A. This will allow for it to go over the pages of your book.

Assembly (Servo and CPX)

Screenshot 2025-11-16 102640.png

Next, the servo motor must be glued to the back of the device (the top left of print A, when looking at it from the back). Two of the small white pieces that get attached to the top of the servo will need to be glued together to make it long enough, and then the CPX is glued facing down, towards where the book will be. It may also be valuable to use a screw on the servo motor as to make the device more stable. When the battery is attached to the CPX, it will be placed in the pocket, and it should fit properly. If it doesn't, take off the part of the battery that covers the batteries inside, as it should make it slimmer.