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
- Barcode scanner
- LCD Screen (+ header pins)
- Potentiometer
- MCP3008
- 8 x LDR Light Senors
- 8 x 10k Ohm Resistors
- NeoPixels RGB Led Strip 60 LED/m
- 1000 µF, 6.3V Capacitor
- Arduino Nano + Micro USB Cable
- Logic Level Converter
- 2 x 1k Ohm Resistors
- Battery holder
- 3 x AA Batteries
- Raspberry Pi 3B + Adapter
- Jumper Wires
- Screws (size doesn't really matter as long as they aren't bigger than the thickness of your wood)
- 7 x Corner Braces
- MDF Wood (minimum 600*500mm and the same thickness as you NeoPixels strip), you can find this at your local DIY shop
- Insulation tape / heat shrinks
- Plastic box to put electronics in (minimum 190*110*50mm)
- Double sided tape
- Optional: small breadboard, cable ties, rubber insulation
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
- 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.
- Place LDR's trough the holes
- Insulate them with your insulation material
- Fasten them with staples
Step 5: Add Other Planks to Shelf + Place Corner Braces
- Nail all remaining planks together
- 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
- 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)
- 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)
- Attach the box to the shelf with two nails
Step 7: Wiring of Light Sensors
- Take the wiring scheme at the beginning of this instructable
- Solder one cable on one side of the LDR, this will be the data cable
- Solder another cable on the other side of LDR, this will be the ground
- At the same end of the data cable, add a resistor of 10k ohm
- 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
- Drill a hole so the cables of the LDR's can pass through
- 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
- Drill some small holes in the box
- Screw the LCD screen onto the box (optionally with some small bolts so there's some distance between the box and the screen)
- Solder three female wires onto the potentiometer
- 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
- 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.
- 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.
- Add some double sided tape on the front of the shelf
- 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
- Connect your Arduino to your computer and upload the NeoPixels code
- 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)
- Create a database on the raspberry pi and add the data of your books in it. (see attached dump file for an example)
- Place the arduino, level shifter and MCP on a breadboard if you have some male cables left, otherwise use female cables and no breadboard
- Place the breadboard (or Arduino + level shifter + MCP), the battery holder and the Raspberry Pi in the box
- Connect everything according to the scheme at the beginning of this instructable
- Connect the barcode scanner to the USB port of the Raspberry Pi
- Put the lid on the box
- And you're done!
Attachments
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.