LibraryBox

Introduction

This how-to is used to create a computerized LibraryBox, also known as a "Little Free Library". It uses a raspberry pi and other peripherals to lookup the ISBN number on the internet, grab book information, and store that data in a database in the cloud. Each LibraryBox can be displayed on a map here: https://libraryboxweb.azurewebsites.net/ to view each box's contents.

This how-to does NOT cover the physical library box itself, but rather the components to create the computer and peripherals needed to connect and run the application here: https://github.com/mkyle1121/LibraryBox

There are many sites on how to create a LibararyBox: https://littlefreelibrary.org/build/ or just buy one.


There are 2 methods to build this:

  • Power Over Ethernet (POE) method

  • Power + Wifi method

The POE method requires a POE switch but provides power and internet to the raspberry pi.

The Power/Wifi method only requires power to the raspberry pi and wifi for internet.

Choose which works best for you.


This is a DIY project and is not perfect. It may require some extra tools and things that are not displayed (e.g. drill, nails, wood, screwdrivers, etc...), but feel free to use your creativity and adjust the solution!

Setup The Raspberry Pi

There are a multitude of resources for setting up a Rasp Pi so no use in re-inventing the wheel. The official site has a great step-by-step guide:

https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/0

Install POE Hat (POE Method Only)

Here is the end result:

Start by assembling the standoff screws like this. Do this 4 times and install these in the 4 screw sockets on the raspberry pi board.

Pull out 3 different header pins from the kit.

  1. 6 pin long

  2. 8 pin long

  3. 6 pin block short

Attach the header to the GPIO pins. Notice the 8 pin header is moved up ONE from the bottom right. The 6 pin is all the way on the bottom left. Place the 6 pin block on the 4 POE pins at the top.

Place the POE hat on top and screw it in.

This will eventually go in the "Large Junction Box Container".

Setup Keypad / LCD / Button

Here is the end result:

Cut a piece of wood that is just shy of 5.1 inches by 3.2 inches (The inside measurements of the small junction box).

Drill a hole for the button on the backside of the wood. Drill a larger hole first and a smaller hole second. The smaller is so the backside nut has wood to hold for mounting. Attach the button to the front of the wood.

Disasemble the keypad. There are screws on the back that need to be removed. Mount the keypad to the front of the wood. The removed screws can be re-used for this if needed.

Place the keypad cover back on.

Drill 3 holes into the front of the wood for mounting the LCD screen and screw in 3 standoff screws. (The 4th is not needed because the jumper wires will not connect the LCD with the 4th standoff in place). Screw in the LCD screen with the screws in the standoff kit.

Drill another hole to feed the wires through.


This will eventually go in the "Small Junction Box" container. There will need to be support between the back of the junction box and the wood. I used a small vertical 2x2 wood block behind for support.

Combine The Two Boxes Together

Drill 2 holes.

1 at the bottom of the small junction box.

1 at the top of the larger junction box.

This will be for the wires to pass through from the keypad/LCD/button, and into the raspberry pi in the box below.

Mount the small box above the big box on the LibraryBox.

The insulation is covered on the outside of the larger box. This is to reduce sun rays into the large box and reduce heat for the raspberry pi. I noticed about a 10-20 degree difference with the insulation. That can be cut and applied now if needed.

Add the jumper wires to the LCD and Button wires to extend the length. Electrical tape can be used to secure the wires together.

POE Method

Non POE Method

The pinout for the wires are as follows:

LCD Screen (Top to Bottom)

  • Orange

  • Blue

  • Green

  • Yellow

Button

  • Red (positive)

  • Black/Brown (negative)

Setup The Library Box Application

Request An API Key And Confirm Address

Send an email to:

admin@libraryboxmap.com

Request an API Key and send the exact Address for the new LibraryBox. This will get loaded into the database and will be used in the application configuration as well.


Download The Source Code

The Release code can be found here:

https://github.com/mkyle1121/LibraryBox/releases

"LibraryBox.zip"

Extract the contents of the zip.

Find and Edit the "LibraryBox.dll.config" file.

Setup The LibraryBox Application On The Pi

Login/SSH into the Raspberry Pi

Open Windows Powershell

ssh pi@<IP ADDRESS>

Make a new directory in /home/pi

mkdir LibraryBox

exit


Transfer Files To The Pi

Open Windows Powershell and navigate to the folder where the LibraryBox files were extracted.

scp -r ./* pi@<IP ADDRESS>:/home/pi/LibraryBox/

  • scp is secure copy

  • -r means recursive

  • ./* is the source and means current directory all contents

  • pi@<IP ADDRESS>:/home/pi/LibraryBox/ is the destination


Enable The I2C Interface And VNC

Login/SSH into the pi.

sudo raspi-config

Select 3 Interface Options

Select I5 I2C, then YES to enable.


Select 3 Interface Options

Select I3 VNC, then YES to enable.


Select FINISH.


Detect I2C Bus Address

The LCD Screen MUST be connected for the I2C detection to work.

Login/SSH into the pi.

sudo i2cdetect -y 1

There should be a bus address with "27", this is the LCD Screen. If it says "3f" or is blank send an email to admin@libraryboxmap.com to sort it out.

Start The Application

Use a VNC application to login to the pi.

https://www.realvnc.com/en/connect/download/viewer/

Open a terminal.

cd /home/pi/LibraryBox

chmod +x ./LibraryBox

./LibraryBox