Guide
Build a GeniCan with a Raspberry Pi.
By the end you will scan a real barcode with a USB scanner and watch it appear on a GeniCan shopping list. Plan about one class period.
Get your parts
You need a Raspberry Pi with Wi-Fi, a USB barcode scanner, a power supply and a microSD card. The Pi should run the standard Raspberry Pi OS with Python 3 and the requests library (pip install requests).
Make a GeniCan account and a list
Sign in at genican.com, make a household and create a list called something like "Class build". For a class, use one shared teacher account so students never need their own.
Open the list and copy its ID from the page address. That is your list ID.
Get a setup token
Your account needs a setup token to pair a device. In the GeniCan app, open the GeniCans page and add a device to create one. Developers can also request one from the account API with a signed-in session: POST /api/v1/devices/tokens with {} as the body.
Pair your Pi
Pairing gives your Pi its own device token. Run this once from any computer:
curl -X POST https://genican.com/genican/connect \
-H "token: YOUR_SETUP_TOKEN" \
-H "apikey: companion-mobile" \
-H "Content-Type: application/json" \
-d '{"list_id": "YOUR_LIST_ID", "device_name": "Room 12 GeniCan"}'In the reply, copy the identifierToken value. That token is your Pi's password, so keep it private and never post it online.
Scan a barcode
Plug the scanner into the Pi, open a terminal, and run this script. Scan any grocery barcode and it lands on your list.
import requests
BASE = "https://genican.com"
DEVICE_TOKEN = "PASTE_YOUR_identifierToken_HERE"
def scan(upc):
r = requests.post(
f"{BASE}/genican/add",
headers={"token": DEVICE_TOKEN},
json={"upc_code": upc},
timeout=10,
)
data = r.json()
if data.get("status") != 1:
return "error"
if data["success"]["data"].get("isAvailable") is True:
return "added"
return "unknown"
while True:
upc = input("Scan a barcode: ").strip() # the scanner types the number, then Enter
if upc:
print(scan(upc))It prints added when GeniCan knows the product, unknown when it has never seen the barcode, and error for a bad token or a network problem.
Make it yours
Now the project is open. Students can light an LED green when a scan is added and red when it is unknown, show the result on a display, or report how often the can is used. The status light colours the real GeniCan uses are green for ready, blue for power, purple for a question, white for sending and red for listening.
Ground rules
- Use a separate class account and list, never a family's real list.
- Keep tokens private. If one leaks, delete the device in the GeniCan app and pair again.
- Be gentle: scan at human speed. Heavy automated traffic may be limited.
- Free for schools, classrooms, clubs and personal hobby builds. Any commercial use of the Maker API or GeniCan designs needs our written permission.
