etc | ||
install | ||
addtoDB.py | ||
carousel.py | ||
epd4in2.py | ||
epdconfig.py | ||
iterparse.py | ||
LICENSE | ||
README.md | ||
refreshdb.py | ||
run-ssb.sh | ||
ssbpost.sh |
EBB
EBB is an e-paper bulletin board that syncs over Scuttlebutt (SSB). This program is in alpha so proceed at your own risk :)
Usage
EBB is a Slow Web device. As such it is not intended to be fast. Thus users must exercise great patience while operating EBB.
After you plug in the device, while the program is loading, the LED is purple, indicating you should wait before interacting with the device. Every couple hours the EBB db is synchronized with SSB and during this time the LED shines white (also wait to interact).
The device will automatically rotate through images in the database after a set period of time.
There are 5 buttons on the left side, they are numbered 1-5 from top to bottom:
button 1: takes a photo. The LED will go green while the photo is being taken. The photo will be taken when the red light on the camera itself goes out. A soon-to-be-written feature will allow the user to decide whether they want to keep the photo just taken and whether to store it locally or to post it to SSB.
button 2: advance to the next photo. LED will turn blue while this action is busy.
button 3: currently this button goes to the previous photo in the database (LED will turn blue while this action is busy) but soon the plan is for it to provide a menu with the options:
- power down
- add friend (via QR)
- show my QR (take pic/read the QR, txt to friend)
button 4: delete current photo. LED will go red and an alert with instructions is presented to the user on the e-paper screen. Press button 4 again to confirm delete or press any other button to cancel. The actual BMP wont be deleted, only the entry in the database (and of course it can't be deleted from SSB, so).
button 5: display the weather (currently doesn't work; a planned feature :)
Building one
There are a lot of steps here, this is not for the faint of heart. But if you're handy on the commandline it shouldn't be too bad. I intend to streamline setup greatly.
hardware
This would probably work with a variety of parts but here are the recommended hardware components:
part | cost | link |
---|---|---|
4.2 inch epaper screen | $21 | waveshare or aliexpress |
epaper hat | $10 | waveshare or aliexpress |
raspberry pi zero w with headers | $14 | adafruit (can only buy 1 at a time) or pihut (can buy more than 1) |
micro-sd card | variable, $5.8 on amazon | |
buttons | $7 | https://www.adafruit.com/product/3582 |
camera | $7 | aliexpres (confirmed works) or alt-aliexpress |
-------- | -------- | -------- |
total: | $65 plus shipping and tax, ~$75 total |
you'll also need a micro-usb cable, usb power supply and materials to build a case from.
assembly
-
There may be a better way to do this but for now I've been soldering the button shim directly to the Pi using this pinout. It can be challenging to solder but not impossible.
-
Then you just gotta plug in the camera and pop the e-paper hat on top of the headers.
-
build a case out of lego or something. Have fun with it :)
software
- download raspbian lite(or whatever basic raspbian image)
- write the image to your SD card
- follow these instructions to get into it over usb. AND OR, put in wifi credentials onto the card. This page says how to do it.
- put the card in the pi and boot it up
- ssh-in (or connect to monitor if you didn't do step 3, connect to monitor/keyboard...)
- use
sudo raspi-config
(howto) to change timezone, set a new hostname, enable ssh, change user password, enable SPI (for e-paper screen), enable I2C (for button shim), enable camera. - run all this stuff: (this should all be scripted but for now we're setting all these parts up manually...)
sudo apt update
sudo apt upgrade
sudo apt install unattended-upgrades
sudo apt install python-dev
sudo apt install python-pip
sudo apt install python-buttonshim
sudo apt install libjpeg-dev zlib1g-dev
sudo apt install git
pip install spidev
pip install tinydb
pip install pillow --no-cache-dir
need to install an ARMv6 compatible NPM. This should work:
curl -o node.tar.gz https://unofficial-builds.nodejs.org/download/release/v13.8.0/node-v13.8.0-linux-armv6l.tar.gz
tar -xzf node.tar.gz
sudo cp -r node-v13.8.0-linux-armv6l/* /usr/local
If that doesn't work you can read more about installing node on arm v6 architecture. Also the builds are here.
clone the repo
git clone https://git.laboratoryb.org/trav/ebb.git
ideally right in your home directory.
setup SSB
I can't remember how I got ssb-server to work, sudo npm install -g ssb-server
throws illegal instruction
. Something to do with a woknky version of Node. So my extremely hacky workaround is to unzip ssb-server.zip
from the install directory into /usr/local/lib/node_modules/
. This is v bad and needs to be fixed asap. SSB-server is made available via the MIT licese.
As long as the EBB repo is at /home/pi/ebb
the following service files should be configured fine. Otherwise you gotta edit ssb.service and ebb-carousel.service and update the WorkingDirectory
field.
Assuming that's good, from inside the repo run sudo cp install/ssb.service /etc/systemd/system/ssb.service
and then sudo systemctl enable ssb.service
to get SSB running (and now it will run at boot). Then run ssb-server whoami
. This should give you an output like @b4zcVEqkDe8whateverYntH9d/Qd7jUzpEQ044=.ed25519
. Copy that line (it's your SSB key), we'll need it for the next step...
configure config.txt
unless you want to store your images and db in an alternate location, run from inside the repo:
mkdir ~/images
cp install/images/starter.bmp ../images/starter.bmp
cp install/configDEFAULT.txt config.txt
cp install/posts.json ../posts.json
replace the values after = with:
- imagesPath = the absolute filepath of where you want to store your images. Ok to leave this as is.
- dbPath = the absolute filepath of where you want to store the database. Ok to leave this as is.
- ssbme = Replace with the key copied in the last step.
setup carousel to run at boot
Now we gotta install the service file for the carousel program.
sudo cp install/ebb-carousel.service /etc/systemd/system/ebb-carousel.service
sudo systemctl enable ebb-carousel.service
(this page describes what we're doing here.)
ssb follows
This part needs a lot of work. To actually sync with another device you're going to need to either run your own pub (I do) or get an invite to a pub. I worry the puny Pi 0 wouldn't be able to handle syncing a ton of people's posts so it seems ideal to run a pub just for syncing EBBs.
Anyway, to connect to other devices you need to run these commands on the command line:
To follow another device:
ssb-server publish --type contact --contact {@b4zcVEqkDe8-replace-with-your-friend's-key-YntH9d/Qd7jUzpEQ044=.ed25519} --following
to redeem a pub invite:
ssb-server invite.accept @b4zcVEqkDe8-replace-with-the-invite-code-YntH9d/Qd7jUzpEQ044=.ed25519
IN THE FUTURE what I'd like to do is have a button that opens a menu with an option to display a QR code of the SSB key of the device. You could take a picture of it, txt it to a friend, and then they could show the QR code to their device and start following you. This is on the roadmap...
Technically it would probably be very easy to tweak this program to be a general-purpose SSB client but for the time-being I like that it only shows photos from other devices. In the future I may enable it to read and write other kinds of posts (text) to/from SSB.
if you managed to get through all that
it should now it be running! If it works well and you're happy and you want to support the development my $ details are on my website. Or if it's not working feel free to send me an email or get in touch on Scuttlebutt, contact details are at that same link. Or you could register an account on git.laboratoryb.org and open an issue?!