nubiScan is a general purpose bar-code scanner application. It reads in a bar-code and pulls out three pieces of information:
- A prefix 'NUBI-': This is used to ensure that the nubi bar-codes don't get mixed up with other bar-codes.
- A process ID: This tells nubiScan which process should handle this particular bar-code.
- A asset ID: The exact identifier for the thing the bar-code is attached to. Its format looks like this: 'NUBI--' for example 'NUBI-ET1-0000' will trigger the ET1 process on the 0000 asset.
As of right now there are two process IDs.
This is a special process ID used to track the name of the person using the bar-code scanner. It passes this information on to other process IDs. The user can then scan as many other bar-codes as they like. After each bar-code scanned the user has three minutes to scan in another bar-code before they need to scan in their name again. This allows a user to scan in as many things as they have on hand with out needing to scan their name each time. A new name can be scanned at any time.
The ET1 process is used for inventory control. It allows a user to check out and return equipment. The first step is for the user to scan their name off of a sheet, then the user can check out any equipment they like. Then when they wish to return it all they have to do is to scan the bar-code again. A name is not required to return equipment its only required to check it out. This process updates the Google sheet used to track all the equipment. The bar-code needs to be listed in the 'Asset ID' column. When something is checked out the 'Checked out to (Name)' column is updated with the user's name.
This software should run on any Linux box. It assumes these things:
- Input devices are mounted in /dev/input
- Systemd is manageing the deamons
- Network connectivity
- Audio out device
So long as these requirements are met you should not have a problem running nubiScan. Though it is assumed you will want to run this on a Raspberry Pi.
Any bar-code scanner that enumerates as a keyboard will work so long as it can read both 1d and 2d bar-codes. There are many to choose from. Both wired and wireless scanners are available. Here is a link to the first bar-code scanner we've used: Eyoyo Handheld USB 2D Barcode Scanner
Skip this section if you already have a system set up.
Do these steps from your Windows, Mac or Chromebook.
-
Pick and download an OS: The official Raspberry Pi OS Linux images can be found here: Raspberry Pi operating systems Pick whichever one you like. I prefer the 'Raspberry Pi OS Lite' image because it is smaller. But you might prefer one that has desktop support, with a more traditional GUI.
-
Next you need to download an installer from here: Raspberry Pi Imager This allows you to write the OS image to an SD card.
-
Or for Chromebooks follow These instructions
-
Install the imager and follow it's instructions for installing the OS you downloaded in step one.
Also do these steps from your Windows, Mac or Chromebook. Setup the network:
- Setup wifi for nubiNet: Setting up a Raspberry Pi headless
- Enable ssh: Follow instructions in section three 'Enable SSH on a headless Raspberry Pi' SSH (Secure Shell)
- Remove the SD card from your computer and put in into the Raspberry Pi.
- Plug the Pi into the USB-C power supply.
- Wait a minute or so for the system to boot and configure itself.
- ssh into the system (see section 'ssh')
- Change the default password:
passwd <new password> - Change the hostname to nubiscanX where X is the count of installed scanners.
- Run this command
sudo hostnamectl set-hostname nubiscanX - Edit /etc/hosts and change the last line of the file from
127.0.1.1 raspberrypito127.0.1.1 nubiscanXwith this commandsudo nano /etc/hosts - Update the system:
sudo apt update && sudo apt full-upgrade - Install pip3:
sudo apt-get install python3-pip - Install git:
sudo apt install git - Install the nubiScan software:
git clone https://github.com/Nubanusit/nubiScan.git - Setup the nubiScan software:
~/nubiScan/setup.sh - Copy the service account credentials to the ~/nubiScan directory. (also see the Service Account section)
- Reboot:
sudo reboot - Plug in the bar-code scanner and you are ready to go.
On a headless system (a system with out a monitor) it can be difficult to find the system's IP address. But there are several ways to do this.
- Temporarily plug in a monitor and use the
ifconfigcommand to see what the IP address is. - Use a network scanner to list all the devices on a network. Like this for Android: fing
- Use mDNS (Multicast DNS): This is the easiest to use and my preferred method.
- Apple's Bonjour service supports this and is naively installed. (I think...is this really true?)
- This is supported out of the box in Win10.
- If this is not working on your Mac or Windows box or you have a linux or Chrombook install avahi discovery or Bonjour. (Google can help you with this.) At this point you can always refer to your scanner with its mDNS .local. For example: nubiscan1.local
Now that you can address the raspberry by either its IP address or its mDNS name, you can use this command to ssh into the system: ssh pi@<address> Use the default 'pi' username.
A service account is a special type of Google account that isn't for people, its for robots. Once you have a service account setup, you will have a Google identity (an email address). You can then share any Google doc with this new identity. To do that you would do it the same way you would share a document with a person. Find the 'share' settings and add the service accounts email address.
More than you will ever need to know about Google service accounts
I've already created a service account for this purpose, nubiBot2000. But there is nothing special about it. You can also create a new one. It's safe to use several accounts so long as you are also sharing the appropriate Google docs with it. But because its quite tedious to create one and because there is no advantage of using several accounts, I can give you a copy of nubiBot2000's credentials file. The credentials work as the password to the service account it should be protected and handled with care. This is why it's not checked in to this repo. This is also why its important to change the default password.
See More than you will ever need to know about Google service accounts
The setup.sh script sets this up for you with these two commands:
sudo systemctl enable nubiScan
sudo systemctl start nubiScan
The first command tells it to automaticaly start on boot. The second one starts it right now. You can check the status of a running process with this command:
sudo systemctl status nubiScan
You can stop it like this:
sudo systemctl stop nubiScan
The Raspberry pi's preinstalled file editor is called nano. Use this if you ever need to edit files.
Once a system is setup its easy to update to newer versions. It can be done with two easy steps:
- From the nubiScan directory run
git pull - Restart the systemd service:
sudo systemctl restart nubiScan.service