With the grow of technology and informatics, the push forward towards the digitalisation and simplification of jobs grows with it. In my project, I want to look how to simplify and digitalize the weighing of substances in a lab environment. In a normal classic lab setup, data is collected on paper, and has been so for as long as science has existed. This however comes with issues, such as being time consuming when one wants digitalize said data, readability is entirely dependant of the writer, absent-mindedness leading to wrongly noting down said data, etc.
My project seeks to simplify another thing closely related to the collection of data in a lab environment: lab management.
Some stored substances can run out quicker than others, and it's up to the person who last weighed said substance to report to the head of the department or those in charge, to order and restock. This can easily go awry, because of the fact that we tend to forget things when we have other pressing items on our minds.
So the solution is to monitor the substances and the events where they're being weighed. Here I will just work out some basics: keeping track of how much of a substance is taken out and who accesses the closet housing the substances.
For this project I used certain things:
- Raspberry Pi 3B+
- RFID scanner
- OLED display
- Barcode scanner module (2D)
- Electromagnetic lock
- Load cell, including a HX711 board
- Relay (0RZ-SH-205L)
- Enough batteries to make a 12V source
- Transistor (BC337)
- A button
- A few resistors
- A bunch of cables
Step 1: BOM: the Bill of Materials
Step 2: Setting Up Your Raspberry Pi 3B+
Make sure to acquire programs such as putty for easy access to the Pi via remote distance. Mount an image on the Pi that has Raspbarian and has a consistent APIPA a dress.
Make sure to install several programs on the Pi, such as MySQL, Python and pip.
Step 3: Connecting Your Components
All the components are coupled as represented as in the figures.
Following interfaces were used:
- Serial communication for the barcode scanner
- I2C for the OLED display and the RFID
- Digital line for the HX711
Step 4: Creating a Fitting Database
My project can be seen as 2 separate things: the closet and the balance. As such my database is made up of 2 entities as well: a database model for the balance and the closet.
These are nothing fancy, but they do both exist out of 2 tables. Both containing a table for history, one containing a table for substance info and the other having a table for personnel.
Step 5: Making a Functional Backend
All of the coding has been done in Python 3.5
It has the following dependencies:
flask, flask_cors and flask_socketio
gevent and geventwebsocket
- Built in:
The code can be found here.
Step 6: Designing the Front End
A simple website should suffice to not only display the collected data from the closet and weighing. But there should also be a page that presents us with real time data from both the scanner and the balance.
This all designed to be mobile first, keep it simple, keep it clean.
Said code can also be found here.
Step 7: Building the Site
The site was coded in HTML and CSS, keeping (for the most part) good practice, such as the BEM notation, in mind. The editor used was VS Code, for a quick and easy launching of servers (thanks to plug-ins), clean up and sorting of code and quickly suggesting what you might be typing with drop-down menus.
The site (code found here) is simplistic and nothing fancy, but it'll do, especially for the next step.
Step 8: Implenting the Functionality
With the foundation (the site) now in place, we can start implementing the functionality needed to represent the data on the site.
With this the site can communicate with the database on the raspberry pi and visualize the data to the user.
Again the same link can be used to find the JS code.
Step 9: Realizing a Casing
A small wooden chest is used to emulate a closet, placing the electromagnetic lock inside. It's crude, but one can use tape to bind the two components together. Furthermore, a hole is drilled for the cables.
The casing for the pi, where the balance will go, is another matter entirely different. Placed in an elongated plastic box, used for storage, the pi and its wires as safe from most physical manipulation. Hole have been made so the transport of data through cables.
The balance itself is tricky, i recommend buying a load cell prebuilt, because I trouble assembling the desired result to say the least. I, myself, used a combination of drilling wood, with the correct measurements, use of bolts, which were the same measurements as the drill head, and duck tape, the strongest of tapes. This resulted is a balance that is sturdy enough to weigh under the 500g (found that out the hard way).
With everything connected, the final product should be ready.