ShelfChecker - a Smart Bookshelf

by annelynn in Circuits > Raspberry Pi

12099 Views, 85 Favorites, 0 Comments

ShelfChecker - a Smart Bookshelf

Shelf.JPG

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.

What Do You Need?

Barcode Scanner.JPG
LCD Screen.JPG
LightSensors.JPG
NeoPixels.JPG
Pi2.JPG
Pi3.JPG
Nails.JPG
Wood.JPG
Tape.JPG

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£

Wiring

1NMCT5_Pyck_Annelynn_P1_Fritzing_Breadboard.png
1NMCT5_Pyck_Annelynn_P1_Fritzing_Elektrisch.png

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

Saw the Wood in the Right Size

Woodcut.JPG

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

Add Light Sensors to Shelf

Lightsensor hole.JPG
Lightsensor behind.JPG
Insulation.JPG
  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

Add Other Planks to Shelf + Place Corner Braces

Dividers.JPG
Dividers 3.JPG
Dividers 2.JPG
Side plank.JPG

  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.

Make Holes in Box

Make necessary holes.JPG
Hole for pi.JPG
  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

Wiring of Light Sensors

Part Of Cables.JPG
Solder on.JPG
Cables part 2.JPG
Insulation 2.JPG
  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.

Drill Holes for Cables

Cables trough holes.JPG

  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.

Add LCD Screen to Box + Prepare Cables

LCD.JPG
LCD Side.JPG
Soldered potentio.JPG
Cables LCD.JPG

  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

Add NeoPixels

Double sided tape.JPG
Cables Neopixel.JPG
LED Strip.JPG
Led strip montage.JPG
Cables battery.JPG
  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.

Optionally: Tie Cables Together

Bind cables together.JPG

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.

Finishing Touch

Components on breadboard.JPG
Holed Box.JPG
Cables done.JPG
  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!

Final Product

Shelf.JPG
Screen1.JPG
Led borrowed.JPG
Led on.JPG
Led right.JPG
Led wrong.JPG

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.