Introduction: ShelfChecker - a Smart Bookshelf

A bookshelf that tells you where a book should belong and whether it's placed onto the right place. It also has a fully integrated library system with users who can log in and out and keeps track of which books are borrowed by which users.

Step 1: What Do You Need?

Technical knowledge:

  • Know the basics of a Raspberry Pi
  • Know how to upload code to a Raspberry Pi and to an Arduino
  • If you want to adjust the code, know some python
  • Know the basics of MySQL and how to add MySQL to a Raspberry Pi
  • Understand wiring schemes
  • Know how to solder

Material

Tools:

  • Soldering Iron + some tin
  • Drill
  • Cable Stripper
  • Cable Cutter
  • Ruler
  • Stapler

Approximate cost:

100€ / 110$ / 90£

Step 2: Wiring

Here you can see how everything will be connected. You do not need to connect right now, let's build the casing first!

Step 3: Saw the Wood in the Right Size

Depending on how big you want your shelf to be. Mind you can only add 8 books on the shelf (this is a limitation of the MCP3008 and can be expanded but that will not be explained here)

I chose for:

  • 600x200 for main shelf
  • 600x100 for back
  • 200*100 for side
  • 200*30 for bottom

Step 4: Add Light Sensors to Shelf

  1. Drill holes the same size as the LDR's. These holes should be placed at regular intervals. Keep in mind the plastic box will be placed at one of the sides of the shelf(you can choose which side, I chose left side) so do not drill a hole for the LDR's where the box will be.
  2. Place LDR's trough the holes
  3. Insulate them with your insulation material
  4. Fasten them with staples

Step 5: Add Other Planks to Shelf + Place Corner Braces

  1. Nail all remaining planks together
  2. Place corner braces in such a way one book can be detected by one light sensor. The corner braces are used as dividers so the user will know where a book should belong.

Step 6: Make Holes in Box

  1. Drill in a square or saw a square in the plastic box so the USB port of your raspberry pi is visible. (I also made some extra space so I could connect with the Ethernet Port but this is unnecessary)
  2. While your at it, also remove a part from one of the small sides so you can place the LCD screen in front (see further steps for pictures)
  3. Attach the box to the shelf with two nails

Step 7: Wiring of Light Sensors

  1. Take the wiring scheme at the beginning of this instructable
  2. Solder one cable on one side of the LDR, this will be the data cable
  3. Solder another cable on the other side of LDR, this will be the ground
  4. At the same end of the data cable, add a resistor of 10k ohm
  5. Connect the resistors, this will be the plus side

You can use your jumper cables to do this, make sure one end of the cables are male

Optionally you can add some insulation beneath the wires, depending which wires you used. As you can see on the picture I used some uninsulated cables, so I added some insulation.

Step 8: Drill Holes for Cables

  1. Drill a hole so the cables of the LDR's can pass through
  2. You can also immediately drill some holes for the power cable of the Raspberry Pi and the three cables of the NeoPixel Strip.

Step 9: Add LCD Screen to Box + Prepare Cables

  1. Drill some small holes in the box
  2. Screw the LCD screen onto the box (optionally with some small bolts so there's some distance between the box and the screen)
  3. Solder three female wires onto the potentiometer
  4. Since there's only two 5V pins on a Raspberry Pi, solder some jumper wires together so you only need one pin to give current to the LCD screen

Step 10: Add NeoPixels

  1. Extend the cables of the NeoPixel strip. You only need one data cable, one red cable and one black cable. The end of these cables should be male.
  2. Whilst the soldering iron is still hot, you can also add some male ends to the battery holder. After you have done this, you can turn off you soldering iron.
  3. Add some double sided tape on the front of the shelf
  4. Place led strip in such a way its cables are on the same side as the box.

Step 11: Optionally: Tie Cables Together

The title says it all, use some cable ties to tie the cables together for a bit of a cleaner look (it's all on the bottom so it doesn't really matter). You could also place another plank on the bottom if you like, to hide everything.

Step 12: Finishing Touch

  1. Connect your Arduino to your computer and upload the NeoPixels code
  2. Connect your Raspberry Pi to your computer and upload all other code (do not forget to enable serial communication in raspi-config so the Pi and the Arduino can communicate)
  3. Create a database on the raspberry pi and add the data of your books in it. (see attached dump file for an example)
  4. Place the arduino, level shifter and MCP on a breadboard if you have some male cables left, otherwise use female cables and no breadboard
  5. Place the breadboard (or Arduino + level shifter + MCP), the battery holder and the Raspberry Pi in the box
  6. Connect everything according to the scheme at the beginning of this instructable
  7. Connect the barcode scanner to the USB port of the Raspberry Pi
  8. Put the lid on the box
  9. And you're done!

Step 13: Final Product

For more info on how to use the shelf, you can set up a webserver on the pi with this code or download the pdf of the manual.