Skip to the content.

Version 2

How does a user log in?

Guests of mine connect differently depending on which kind of device they are using. Version 2 smartphones and tablets connect the same way they did in version 1; as long as they have line-of-sight to my QR code, they can point their camera at it and they’re in.

image_not_found

Version 2 does exist for a reason, and that reason is laptops and desktops which can’t read a QR code as easily. Instead, guests of mine can take the Digispark ATTINY85 that is plugged into my Raspberry Pi and plug it in to their device; in about 10 seconds the password will be typed in for them.

image_not_found

Parts list

One of the following to be the base that gets built off of:

A “brain” for the base:

A screen for the QR code. I used an e-ink screen because they look nice and are low-power, but any screen compatible with the Raspberry Pi should suffice:

A USB device that can be programmed to automatically type in passwords

Possibly cables and headers. I did need GPIO headers for the Raspberry Pi, but my screen came with jumper cables so I didn’t need those:

Raspberry Pi setup

Raspberry Pis, though awesome, require a bit of setup before use

Baseline setup

From a Windows machine, open a Command Prompt and type diskpart to use the diskpart tool.

diskpart

image_not_found

List the disks connected to the machine.

list disk

image_not_found

Choose the disk that you intend to write the Raspberry Pi Operating System (OS) to.

select disk 1

image_not_found

Clean the disk.

clean

image_not_found

Create a primary partition that can be formatted and written to.

create partition primary

image_not_found

Format the drive with a FAT32 filesystem.

format fs=fat32 quick

image_not_found

Download and use the Raspberry Pi Imager to burn the image on to the disk. The imager’s interface is pretty nice and allows for very easy SSH and wifi configuration (shown in a sec).

image_not_found

Within the “Advanced options” enable SSH and set the desired SSH username and password.

image_not_found

Configure the wifi settings so that the Raspberry Pi connects to the desired network. I had it connect to my IoT VLAN (not the guest network). My home network topology is beyond the scope of this guide, but it is important not to have the Raspberry Pi connect to the network whose password it will be changing.

image_not_found

Finally, burn the image to the disk.

image_not_found

NOTE: when you first boot the Raspberry Pi you may find that SSH is unstable. If that is the case it could be because of some flags set in the packets being sent and the way they interacted with your network; I was able to fix it by running the following command, substituting in the IP address of my Raspberry Pi.

ssh pi@pis.ip.add.res 'echo "IPQoS cs0 cs0" | sudo tee -a /etc/ssh/sshd_config && sudo reboot now'

Super shortcut

You can run the following command which will complete all the steps for the sections below, or you can follow along with the sections below.

NOTE: Plug in the Digispark device before running this command.

NOTE: You’ll need to fill out your config.ini file either way (the very last step at the bottom).

curl --proto "=https" --tlsv1.2 -sSf https://raw.githubusercontent.com/kmanc/be_my_guest/main/version_2_setup.sh | sh

Make it control the screen

To control the screen you will have to physically connect the screen to the Raspberry Pi. Mileage may vary depending on device, but Waveshare’s documentation gave a pretty good overview of the connections required.

image_not_found

Before installing any new packages, ensure that your Operating System is up-to-date. Connect to the Raspberry Pi and update it.

sudo apt update && sudo apt upgrade

image_not_found

Install required packages. If using a different screen you may have different dependencies.

sudo apt install git libopenjp2-7 libusb-dev python3-pip

image_not_found

Download and install any additional software. In the case of the Waveshare e-ink screen, a Broadcom library is required.

wget https://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz

image_not_found

Unzip the download.

tar zxvf bcm2835-1.71.tar.gz

image_not_found

Change your working directory to the unzipped folder.

cd bcm2835-1.71/

image_not_found

Run its configuration.

sudo ./configure

image_not_found

Run the “make” script.

sudo make

image_not_found

Check the “make” script’s completion.

sudo make check

image_not_found

Assuming the check passes, install the library.

sudo make install

image_not_found

Open the Raspberry Pi’s configuration menu to enable the SPI interface.

sudo raspi-config

Choose option 3.

image_not_found

Then option I4 for SPI.

image_not_found

Check the box to enable the SPI interface.

image_not_found

Close the option menu.

image_not_found

Arduino CLI Setup

Move back to the home directory.

cd ~

Download and run the arduino-cli installer.

curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh

image_not_found

Move the executable to a location within your PATH.

sudo mv bin/arduino-cli /usr/local/bin

image_not_found

Delete “leftover” files and directories.

rm -rf bin/

image_not_found

Create an arduino config file.

arduino-cli config init

image_not_found

Edit the config to include a specific package index for Digispark (https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json).

nano .arduino15/arduino-cli.yaml

image_not_found

Reload the config to take any actions needed based on the new config file.

arduino-cli core update-index

image_not_found

Install the proper platform for arduino-cli to compile for the Digispark board.

arduino-cli core install digistump:avr

image_not_found

Micronucleus Setup

Move back to the home directory.

cd ~

Cloned the repo to the Raspberry Pi.

git clone https://github.com/micronucleus/micronucleus.git

image_not_found

Move to the commandline directory within micronucleus.

cd micronucleus/commandline/

image_not_found

Build the executable.

make

image_not_found

Move the executable to a location within your PATH.

sudo cp micronucleus /usr/local/bin

image_not_found

Copy the micronucleus.rules file to the Raspberry Pi’s rules.d directory

sudo cp 49-micronucleus.rules /etc/udev/rules.d/

image_not_found

Move back to the home directory.

cd ~

Upgrade the bootloader on the board if it is an old version (which is very likely).

micronucleus --run micronucleus/firmware/upgrades/upgrade-t85_default.hex

image_not_found

Be My Guest Setup

Clone the “Be My Guest” repo to your Raspberry Pi.

git clone https://github.com/kmanc/be_my_guest.git

image_not_found

NOTE: my repo has two files from Waveshare’s Github repo that are specific to the board that I used. The epdconfig.py and epd4in2.py files are used to control my e-ink screen. You may need different files based on your screen.

Navigate to the be_my_guest directory.

cd be_my_guest

Set a cron schedule; I save my cron schedule in the crontab file within the project, so feel free to use that.

crontab -e

image_not_found

Install the project requirements (optionally in a virtual environment - not shown).

python3 -m pip install -r requirements.txt

image_not_found

Change the config.ini file such that it matches your network.

nano config.ini