ShelfTracker

by Ayline V in Circuits > Raspberry Pi

69 Views, 2 Favorites, 0 Comments

ShelfTracker

p1_voorkant.jpg

As a student of Multimedia & Creative Technology at Howest Kortrijk, I had to create my own project, combining all the modules from the first year into one comprehensive project. I wanted to develop something that would benefit both my family and others. That's why I made an intelligent inventory management system designed to simplify and streamline household supply management.

This system includes barcode scanning for easy addition and removal of products, and a joystick for quick entry of multiple identical items. Users can access a detailed history of inventory changes and set minimum quantity alerts via a web interface, which also allows configuration of hardware features like the buzzer and neopixel ring light.

Supplies

Hardware:

  • Raspberry Pi 4 model B
  • Rasberry Pi Voeding
  • LCD Display
  • Neopixel Ring
  • 2 Buttons
  • Joystick
  • Barcode Scanner Module
  • Buzzer
  • Light Sensor
  • Connector Wires
  • SD kaart
  • Resistors
  • MCP3008
  • USB-micro Cable
  • Wood Planks
  • Silver Spray Paint
  • Breadbord

Fritzing Scheme

instruct_scheme2.png
instruct_bread.png

This is the scheme I made and used for this project. Fritzing schemes are valuable tools for planning, visualizing, and communicating electronic designs effectively.


*The barcode scanner did not work properly using the RX and TX pins. Instead of using connector wires and a logic shifter, I used a USB-micro cable that connects directly to my Raspberry Pi.

Making the Circuit

schakeling.jpg

Using the Fritzing scheme as a reference, we can easily create a correct circuit. Initially, while testing the different components, I used an external power supply to protect the Raspberry Pi. Once I confirmed that the circuit was working properly, I switched to using the Raspberry Pi as the power supply.

Writing an Image to the Raspberry Pi

Pi_imager.png

To write an Image to the Raspberry Pi, we first need to download the Official Raspberry Pi Imager to our computer. The Image I used was provided by my teachers.


Next, insert the SD card that will be used for the Raspberry Pi into a card reader connected to your computer. Open the Raspberry Pi Imager.

  1. Choose Device: Select "Raspberry Pi 4b" if that's the version of the Pi you are using.
  2. Choose Operating System: Select the image you have downloaded.
  3. Choose Storage: Select your SD card from the list of available storage devices.

Finally, click "Next" to begin writing the image to the SD card.

Connecting the Raspberry Pi to Your Wifi

putty.png
raspi-config.png
20191022-raspi-config-just-started-up.gif
oNps5.jpg

To connect your Raspberry Pi to your Wi-Fi, you first need to use an Ethernet cable to connect the Raspberry Pi to your computer. Then, follow these steps:

  1. Connect via PuTTY:
  • Open PuTTY on your computer.
  • Enter the IP address of your Raspberry Pi (in this case, 192.168.168.169).
  • Click 'Open' to initiate the connection.
  • When prompted, enter the login credentials. The default username is 'user' and the password is 'P@ssw0rd'.
  1. Configure Wi-Fi:
  • Once logged in, type the command sudo raspi-config and press Enter.
  • In the configuration menu, select 'System Options'.
  • Then, go to 'Network Options'.
  • Finally, select 'Wi-Fi'.
  • Enter the SSID (name) of your Wi-Fi network and the password when prompted.

Database

db_EER_ShelfTracker.png

In the picture above, you can see the EER diagram of the database I created for this project.

Setting Up Visual Studio Code

visual_studo.png
remote_connect.png
git-clone-button.png

First, we need to download the Remote SSH Extension for Visual Studio Code. Once downloaded, you should see two arrows pointing at each other at the bottom left of the screen. Click on that icon, and you will see a prompt at the top of the screen. There, select 'Connect to Host...'. Then, enter your username and IP address in the format username@your_ip_address. In this case, it’s user@192.168.168.169. When prompted, enter your password: P@ssw0rd.

Next, we need to clone the Git repository. You can find the link to my GitHub repository here. In Visual Studio Code, click on 'Clone Repository' and insert the link to the GitHub repository.

Virtual Environment

Next, we need to create a virtual environment and install all the necessary requirements. Here are the steps:

  • Create Virtual Environment:
  • Open a Terminal and enter the command: 'python -m venv venvp1'
  • When prompted to activate this virtual environment, confirm by typing 'yes'.
  • Deactivate Terminal:
  • Close the Terminal by clicking on the garbage bin icon or using the appropriate command to close it.
  • Install Requirements:
  • Start a new Terminal session.
  • Enter the command to install the requirements from the requirements.txt file: 'pip install -r requirement.txt'

Code

All the code can be accessed from the GitHub repository you've cloned. Please note that when running app.py, you'll need to use sudo. This is necessary because the Neopixel library requires access to specific memory areas.

Casing

p1_voorkant.jpg
p1_zijkant.jpg

The casing is crafted from wood that was spray-painted silver. I repurposed an old cigarette box for this purpose, which snugly accommodated the hardware, albeit with a tight fit. I created a large circular hole to house both the Neopixel light ring and the barcode scanner. Adjacent to it, I made a separate hole for the LCD screen, along with three smaller holes to accommodate the buttons and joystick.