If you're a student like me, some of you will definately relate to the problem that I forget. I don't have a lot of time to make my backpack, and before you know it, you forgot something.
I tried making my life easier by making a Raspberry pi project with a web interface that keeps track of your stuff.
The idea is to put RFID-stickers on everything you need, make lists with what you need on a web interface. And the moment you have to make your backpack, you open the list, scan everything and put it in your backpack.
- magnetic hall-sensor
- 16*2 LCD
- 4.7K ohm resistor
- solder tin
- heat shrinks
- raspberry pi 3b+, power supply
- micro sd card (8gb +)
- strong glue
- 13.56Mhz rfid tags
- soldering iron
- dismantle pliers
Step 1: Configuring the Raspberry Pi
Once you have all your supplies we can start!
- Put your microSD card in you computer;
- Download the Raspbian OS image from https://www.raspberrypi.org/downloads/raspbian/
- Flash the image on the micro SD-card with software like Etcher or win32diskimager;
- Go into the accesible partition of the SD-card and open the cmdline.txt file with notepad;
- Add ip=169.254.10.1 save and close;
- Now put your micro-SD card in your raspberry pi;
- once it's booted, download Putty;
- Now, connect to your raspberry pi by using the ip-adress we typed earlier;
- Login with user pi and password raspberry
- Type sudo raspi-config, change your password, go to networking options, change the hostname of your pi. Go to localisation options and change your wi-fi country and timezone. Next, go to boot options, turn wait for network at boot off and wait for splash screen off. Finally go to interfacing options and open the i2c and spi interface.
- Connect with wi-fi using the following steps connect to wifi.
- Do the commands sudo apt-update and sudo apt-upgrade.
Step 2: MySQL / Mariadb
Now we're going to add the database to our raspberry pi.
- First of al, do the following commands:
- sudo apt-get install mysql-server, mysql-client
- mysql -u root -p
- create user 'root'@'localhost' identified by password;
- GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'
- Now copy the code of the sql file and paste it in Putty and execute it
Step 3: Build the Electric Circuit
Now we're going to build the electric circuit. I suggest building this with jumper cables and a breadboard first, since it's quite a lot.
Follow the Fritzing scheme. I use long cables for the hall sensor, rfid-reader and the lcd screen. I soldered the cables to the end of a female jumper wire, so I don't have to solder everything directly to the raspberry pi pins. If you don't do this, that's fine, but you'll have to wait to solder everything to the pi.
Step 4: Build the Backpack
Now we're going to build everything in the backpack. I built everything inside the pocket circled on the image above.
- Inside this pocket, cut a hole so you can get between the two layers of fabric, we're going to use this for the cables for the rfid reader and the LCD.
- now carefully carve a square hole using the LCD screen as reference of the size.
- Now we're going to put the RFID-reader with the cables first through the hole, make sure the cables come out at the hole we carved in the inside of the pocket on the inside of the backpack.
- Now, use a strong glue to glue the rfid reader inside, I tried using superglue, but it didn't stick to the leather, I suggest you use Pattex 100% glue, since this did glue.
- Now carefully place the LCD screen cables first through the hole, and make the cables come out the other hole, and paste the LCD inside the backpack.
- Now inside the backpack, place one zipper on the full end of the backpack, and paste the magnetic hall-sensor on this zipper. On the other zipper glue the magnet. Make sure to not use to much glue for the magnet, you don't want the zipper to be stuck. For the magnetic sensor, this isn't such a big deal, due to the cable length this zipper will always remain it's position.
- Now you can solder everything to the pi, or if you used the female jumper cables, simply put them on the right place using the Fritzing scheme.
- Optionally, you can power the raspberry pi using a powerbank.
Step 5: Code
Now the building part is over, download the code here: github. Place it on a folder on your raspberry pi using (S)FTP or clone the repository on your pi directly. The code has some testing code for the sensors, make sure to check those out if you have a problem.
Step 6: Webserver
Now we're going to turn our pi into a webserver.
- Do the command sudo apt-get install apache2 -y
- Browse from your laptop to the pi's address, which should be 169.254.10.1 if you're still connected with a UTP-cable, if you see a apache page, that means it's installed succesfully.
- now move the frontend folder of the code you downloaded into /var/www/html using the mv command.
- After you placed the code in there, type the command sudo service apache2 restart.
- Now you should see the web interface if you surf to the pi's ip-adress.
Step 7: Autorun
Now we have to make sure the script runs automatically if you boot your pi up.
- Edit the rc.local file, using sudo nano /etc/rc.local
- Add the command to execute your code, this will be python3.5 /yourpath/project.py &
- Make sure to leave the exit 0 at the bottom.
- now do sudo reboot and check if it worked.
Step 8: End
Now, when you boot up your pi, the ip address should show up on the LCD-screen, surf to this screen to open the web-interface.