# EBB ![a photo of the device, made out of multi-colored legos, hanging on a wall](https://git.laboratoryb.org/trav/ebb/raw/branch/master/etc/welcomehome.jpg) EBB is an e-paper bulletin board that syncs over [Scuttlebutt](https://scuttlebutt.nz) (SSB). This program is in alpha so proceed at your own risk :) ## Usage EBB is a [Slow Web](https://www.are.na/morgan-sutherland/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](https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper.htm?SID=U) or [aliexpress](https://www.aliexpress.com/item/32827328059.html?spm=a2g0s.9042311.0.0.349f4c4dYCXYQ3) | | epaper hat | $10 | [waveshare](https://www.waveshare.com/product/modules/oleds-lcds/e-paper/e-paper-driver-hat.htm?__SID=U) or [aliexpress](https://www.aliexpress.com/item/33007613960.html?spm=a2g0s.9042311.0.0.349f4c4dYCXYQ3) | | raspberry pi zero w with headers | $14 | [adafruit](https://www.adafruit.com/product/3708) (can only buy 1 at a time) or [pihut](https://www.pishop.us/product/raspberry-pi-zero-wireless-wh-pre-soldered-header/) (can buy more than 1) | | micro-sd card | variable, $5.8 on amazon | | | buttons | $7 | https://www.adafruit.com/product/3582 | | camera | $7 | [aliexpres](https://www.aliexpress.com/item/32788881215.html?spm=a2g0s.12269583.0.0.55eb6619CDSuac) (confirmed works) or [alt-aliexpress](https://www.aliexpress.com/item/32293433078.html?spm=a2g0s.9042311.0.0.349f4c4dYCXYQ3)| | -------- | -------- | -------- | | 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 1. 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](https://pinout.xyz/pinout/button_shim). It can be challenging to solder but not impossible. 2. Then you just gotta plug in the camera and pop the e-paper hat on top of the headers. 3. build a case out of lego or something. Have fun with it :) ### software 1. download [raspbian lite](https://www.raspberrypi.org/downloads/raspbian/)(or whatever basic raspbian image) 2. [write the image to your SD card](https://www.raspberrypi.org/documentation/installation/installing-images/) 3. follow [these instructions](https://desertbot.io/blog/ssh-into-pi-zero-over-usb) to get into it over usb. AND OR, put in wifi credentials onto the card. [This page](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md) says how to do it. 4. put the card in the pi and boot it up 5. ssh-in (or connect to monitor if you didn't do step 3, connect to monitor/keyboard...) 6. use `sudo raspi-config`[(howto)](https://www.raspberrypi.org/documentation/configuration/raspi-config.md) 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. 7. 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](https://www.thepolyglotdeveloper.com/2018/03/install-nodejs-raspberry-pi-zero-w-nodesource/). Also [the builds are here](https://unofficial-builds.nodejs.org/). #### clone the repo `git clone https://git.laboratoryb.org/trav/ebb.git` ideally right in your home directory. #### setup SSB `sudo npm install -g ssb-server` doesn't seem to work to install SSB, says `illegal instruction` :/ I got it to work once but now I can't remember what I did! 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](https://github.com/ssbc/ssb-server) is made available via the MIT licese. As long as the repo is at `/home/pi/ebb` these 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](https://www.raspberrypi.org/documentation/linux/usage/systemd.md) 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](http://teafry.me/about/). 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?!