BarcodeRattler - A Raspberry Pi Powered Barcode Reader to load a game on the Mister FPGA using MBC

Overview

Barcode Rattler

A Raspberry Pi Powered Barcode Reader to load a game on the Mister FPGA using MBC

This is a work in progress and a bit hackery 😅

There are limitations on the MBC side. Some of the computer cores don't work in loading games up. Such as the commodore computers as the cores have changed the menu layout is slightly different.

Currently i have only implemented getting games from out of zip files. You can do direct loading of a rom, just not implemented in my python script to do this.

The CSV file, spaces and other special characters need backslash \ or sometimes double backslash \\ not got around to sorting this out.


Versions

Version Date Description Released
0.2 04/01/2022 Initial commit Yes link
0.2.1 07/01/2022 NFC Support added by Symm No

Raspberry Pi OS

I used the Raspberry Pi OS Lite Release date: October 30th 2021

Installation of files

Files need to be installed in to a folder called /opt/barcoderattler

sudo mkdir /opt/barcoderattler

sudo chown pi /opt/barcoderattler

cd /opt/barcoderattler

You can either get the zip file

wget https://github.com/chris-jh/BarcodeRattler/archive/refs/tags/barcoderattler_v0.2.zip

unzip -j ./barcoderattler_v0.2.zip

or the tar.tgz file

wget https://github.com/chris-jh/BarcodeRattler/archive/refs/tags/barcoderattler_v0.2.tar.gz

tar -zxf ./barcoderattler_v0.2.tar.gz --strip-components=1

or if you have git installed, you can clone the latest

git clone https://github.com/chris-jh/BarcodeRattler.git ./

all the above methods assume you are inside the /opt/barcoderattler folder before running

Installing MBC on Mister

Get the Mister IP Address

Enable SSH on the Mister

Copy the mmsmbc.sh file to Mister in the Fat folder

default password is 1

scp /opt/barcoderattler/mmsmbc.sh root@IP:/media/fat

ssh into Mister and run the mmsmbc.sh file to install mbc

ssh root@IP

cd /media/fat

./mmsmbc.sh

Running this file will download the latest release of MBC from https://github.com/pocomane/MiSTer_Batch_Control

It will be installed on your SD Card at /media/fat/Scripts/.barcoderattler

Configuring the PI Camera

Make sure to enable the Camera and SSH on the Pi

You may need to tweak the focus on the Camera, so it can read close up objects, like a barcode.

I had to adjust mine anticlockwise about 1 full turn

Intalling PYTHON LIBS

make sure to

sudo apt-get update

and then run the file barcodesetup.sh (do not sudo, it will ask for password) on the pi, this should install the python libraries that is required

KEYBOARD USB Permissions

A udev rule is required so that the pi user can have access to the USB events for the keyboard

create a file called (you will have to sudo nano)

/etc/udev/rules.d/99-hidraw-permissions.rules

and this should be inside it

KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"

The barcode scanner will need to be in USB Keyboard mode, it also needs to be the first usb keyboard device to be plugged in, or the only usb keyboard device plugged.

The barcode device i bought was this one from amazon.

https://www.amazon.co.uk/gp/product/B00Y83TXOE

NFC Support

NFC Support has been added by Symm.

Devices that are supported can be seen here Supported Devices

Set NFC_ID to the one you have from the list inside the barcoderattler_nfc.py file

There is no service or start file for it yet, but you can modify the startrattler bash script and change to run the barcoderattler_nfc.py

CSV File

The file is made up of the following headers

BARCODE,CORE,ZIP,FILE,TMP

Field Description Example
BARCODE The Barcode 123456789
Core Name of the core to run GENESIS
ZIP Location of the Zip File. Currently this version expects the games to be inside a zip file /media/fat/Games/Genesis/GenesisGames.zip
FILE Location of the game inside the zip file US\Q-Z\Street\ Fighter\ II\ CE.md
TMP A temporary location to unzip the game to /tmp/game.md

any special characters in the file path including spaces needs the backslash
some need double backslash such as the [ ]

To see what the core names are on mbc, you need to ssh into the MisterFGPA and run

/media/fat/Scripts/.barcoderattler/mbc list_core

The core name is the first field

Running

There are two python script files

  1. barcoderattler.py

This one uses the Barcode Hand Scanner, make sure to scan factory reset code in the book and then scan the USB Keyboard.

  1. barcoderattler_camera.py

This is for using the Pi Camera on a Pi 3

In each of the python scripts there is an area at the top to Specify your Mister IP Address and to change the password is different from the default 1. You can also change the location of the CSV file to read and also if you put the mbc in a different directory also.


If you are going to use the Hand Scanner, this needs to be the first keyboard device. Remove any keyboards, and then plug in the barcode hand scanner.

You should do any interaction with the Pi via SSH


To run each version, only one should be run, from the command line type either

  1. /opt/barcoderattler/startrattler

    To start the Barcode Hand Scanner version

  2. /opt/barcoderattler/startrattler_camera

    To start the Barcode scanning via the Pi Camera


If you want to enable the barcode rattler on start up, run either of the following

  1. /opt/barcoderattler/enable_barcode_scanner

    To enable the Barcode Hand Scanner on boot up

  2. /opt/barcoderattler/enable_camera_barcode_scanner

    To enable the Barcode Scanning via the Pi Camer on boot up


To start and stop the service

  1. sudo service start barcoderattler

    To Start the Barcode Hand Scanner

  2. sudo service stop barcoderattler

    To Stop the Barcode Hand Scanner

  3. sudo service start barcoderattler

    To Start the Barcode Camera Scanner

  4. sudo service stop barcoderattler

    To Stop the Barcode Camera Scanner


To Stop the services for starting at boot up

Run

sudo systemctl disable barcoderattler_camera.service

sudo systemctl disable barcoderattler.service

You might also like...
Cl datasets - PyTorch image dataloaders and utility functions to load datasets for supervised continual learning

Continual learning datasets Introduction This repository contains PyTorch image

A Python library that enables ML teams to share, load, and transform data in a collaborative, flexible, and efficient way :chestnut:
A Python library that enables ML teams to share, load, and transform data in a collaborative, flexible, and efficient way :chestnut:

Squirrel Core Share, load, and transform data in a collaborative, flexible, and efficient way What is Squirrel? Squirrel is a Python library that enab

A facial recognition doorbell system using a Raspberry Pi

Facial Recognition Doorbell This project expands on the person-detecting doorbell system to allow it to identify faces, and announce names accordingly

Control-Robot-Arm-using-PS4-Controller - A Robotic Arm based on Raspberry Pi and Arduino that controlled by PS4 Controller

Control-Robot-Arm-using-PS4-Controller You can see all details about this Robot

Game Agent Framework. Helping you create AIs / Bots that learn to play any game you own!
Game Agent Framework. Helping you create AIs / Bots that learn to play any game you own!

Serpent.AI - Game Agent Framework (Python) Update: Revival (May 2020) Development work has resumed on the framework with the aim of bringing it into 2

Gesture-controlled Video Game. Just swing your finger and play the game without touching your PC
Gesture-controlled Video Game. Just swing your finger and play the game without touching your PC

Gesture Controlled Video Game Detailed Blog : https://www.analyticsvidhya.com/blog/2021/06/gesture-controlled-video-game/ Introduction This project is

Hand-distance-measurement-game - Hand Distance Measurement Game
Hand-distance-measurement-game - Hand Distance Measurement Game

Hand Distance Measurement Game This is program is made to calculate the distance

Dcf-game-infrastructure-public - Contains all the components necessary to run a DC finals (attack-defense CTF) game from OOO

dcf-game-infrastructure All the components necessary to run a game of the OOO DC

Torchlight2 lan game server tool - A message forwarding tool for Torchlight 2 lan game

Torchlight 2 Lan Game Server Tool A message forwarding tool for Torchlight 2 lan

Comments
  • Initial script for reading NFC tags

    Initial script for reading NFC tags

    I hacked together support for reading NFC tags 😄

    Set NFC_ID to the one you have from the list of Supported devices and run ./barcoderattler_nfc.py

    I've not created any service startup scripts etc but can add if there is interest

    opened by symm 1
  • Idea: Machine Vision to identify cart based on box art/cartridge label

    Idea: Machine Vision to identify cart based on box art/cartridge label

    Could be a way to take it even further in a future project if you wanted to learn more. You could train the model on the libretro/retroarch cover art images available online. Just a thought.

    opened by birdybro 0
  • Ideas for additional barcode support

    Ideas for additional barcode support

    Hi,

    The zxing barcode scanner on Android can be launched with a custom URL protocol which would allow you to use an Android phone as the scanner: https://stackoverflow.com/questions/13347145/android-barcode-scanner-integration-with-web-page

    Another possibility is to print QR codes with a custom URL that goes to a .local hostname, allowing any phone to talk to a local Pi on the network.

    Both require some network level access, either through Zeroconf .local domains or perhaps via a publicly accessible hostname.

    The .local method would be useful if you have a "public wifi" that people can use, or just setup the Pi as an AP and allow people to connect to it for this purpose. That's probably the most robust solution for passers by. If this is used in-home then the .local solution on your home network is sufficient.

    opened by drwonky 1
  • A simple fix for slow CSV searching

    A simple fix for slow CSV searching

    I noticed in Neil's demo on YT that the time between scanning seemed to be pretty slow and highly variable. After he mentioned the barcodes were being stored in CSV, I rightly assumed that the CSV was being parsed and searched through every time a code is scanned. This is super inefficient, and only provides one small advantage in that simply uploading a new csv will immediately make new titles available to scan.

    This PR switches things around to only load the CSV once when the script loads, and then does a list comprehension on it to build an index by barcode. I haven't tested it (I don't have a barcode scanner), but it should allow for lightning fast lookups. There are only three caveats to this approach:

    1. All of the barcodes and other data in the CSV will be stored in memory. As long as the number of columns in the CSV doesn't get ridiculous, I can't see this being an actual problem on a RPi.

    2. Each row in the CSV will need a unique barcode. Really, this was already the case as the current script will only ever return the data for the first barcode it finds. After this change, if there are duplicates I believe you'd only get the data for the LAST duplicate in the file.

    3. The script will need to be restarted whenever the CSV is updated.

    EDIT: I didn't notice a script had also been added for NFCs. The same change could easily be made to that script as well.

    opened by raelik 4
Releases(barcoderattler_v0.2)
Owner
Chrissy
Chrissy
Tool for installing and updating MiSTer cores and other files

MiSTer Downloader This tool installs and updates all the cores and other extra files for your MiSTer. It also updates the menu core, the MiSTer firmwa

null 72 Dec 24, 2022
MohammadReza Sharifi 27 Dec 13, 2022
FPGA: Fast Patch-Free Global Learning Framework for Fully End-to-End Hyperspectral Image Classification

FPGA & FreeNet Fast Patch-Free Global Learning Framework for Fully End-to-End Hyperspectral Image Classification by Zhuo Zheng, Yanfei Zhong, Ailong M

Zhuo Zheng 92 Jan 3, 2023
E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

MagInkCal This repo contains the code needed to drive an E-Ink Magic Calendar that uses a battery powered (PiSugar2) Raspberry Pi Zero WH to retrieve

null 2.8k Dec 28, 2022
Using machine learning to predict and analyze high and low reader engagement for New York Times articles posted to Facebook.

How The New York Times can increase Engagement on Facebook Using machine learning to understand characteristics of news content that garners "high" Fa

Jessica Miles 0 Sep 16, 2021
An NVDA add-on to split screen reader and audio from other programs to different sound channels

An NVDA add-on to split screen reader and audio from other programs to different sound channels (add-on idea credit: Tony Malykh)

Joseph Lee 7 Dec 25, 2022
Load What You Need: Smaller Multilingual Transformers for Pytorch and TensorFlow 2.0.

Smaller Multilingual Transformers This repository shares smaller versions of multilingual transformers that keep the same representations offered by t

Geotrend 79 Dec 28, 2022
load .txt to train YOLOX, same as Yolo others

YOLOX train your data you need generate data.txt like follow format (per line-> one image). prepare one data.txt like this: img_path1 x1,y1,x2,y2,clas

LiMingf 18 Aug 18, 2022
A python comtrade load library accelerated by go

Comtrade-GRPC Code for python used is mainly from dparrini/python-comtrade. Just patch the code in BinaryDatReader.parse for parsing a little more eff

Bo 1 Dec 27, 2021
Additional code for Stable-baselines3 to load and upload models from the Hub.

Hugging Face x Stable-baselines3 A library to load and upload Stable-baselines3 models from the Hub. Installation With pip Examples [Todo: add colab t

Hugging Face 34 Dec 10, 2022