Hi!
I’m still a bit of a noob when it comes to the Raspberry PI and since it took me a bit to figure out how to get the keybow software up and running on a normal Raspbian install I figured I’d share my method here :-) And perhaps collect some good pointers or suggestions from more experienced folks.
I wanted this setup so I can work on my keybow bindings over wifi instead of plugging the sdcard back and forth all the time. And in case I ever want the keybow to do something more fancy than just send keyboard events. And keep in mind this setup will take a lot longer to boot up than the minimal keybow OS image.
So here I’ll just quickly list how I did the following:
- autoconnect to wifi
- turn on ssh
- setup the Raspberry zero as a USB gadget
- install the keybow software and autorun it on boot
I downloaded and flashed ‘Raspbian Buster Lite’ from Raspberry Pi OS – Raspberry Pi
Once that is done you should see two partitions on the sdcard: rootfs and boot. We’ll add and edit files in both of these.
1: To autoconnect to your wifi add a file called ‘wpa_supplicant.conf’ in the boot partition and fill it with your settings. I used this template, ymmv.
country=US # Your 2-digit country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
ssid=“YOUR_NETWORK_NAME”
psk=“YOUR_PASSWORD”
key_mgmt=WPA-PSK
}
(I did notice that the raspberry wouldn’t connect to my 5ghz connection, there may be another setting for this or I’m doing something wrong)
2: To enable ssh just add an empty file called ‘SSH’ in the boot partition
3: In order for the Raspberry to act like a USB gadget we need to enable the proper modules. Inside the boot partition open the ‘config.txt’ file and add the line ‘dtoverlay=dwc2’ at the end. Then open ‘cmdline.txt’ and add the line ‘modules-load=dwc2,libcomposite’ just after where it says ‘rootwait’. Mine looks like this:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=17869b7d-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,libcomposite quiet init=/usr/lib/raspi-config/init_resize.sh
In the rootfs partition open the /etc/modules file and add these lines at the end (I needed to be root on my machine to do this):
dwc2
libcomposite
4: Download and unzip the keybow software (GitHub - pimoroni/keybow-firmware: Keybow Firmware for the Raspberry Pi Zero). What we need is in the sdcard folder. Copy over these folders+files: ‘layouts’, ‘patterns’, ‘snippets’, ‘default.png’, ‘keybow’, ‘keybow.lua’, ‘keys.lua’ to the root of the boot partition.
Finally open the /etc/rc.local file in the rootfs partition and add this line above the ‘exit 0’ line:
sudo /boot/keybow &
This will turn on the keybow software when the raspberry boots, so you may not want this on while you’re developing your own scripts for it.
That’s it! Put the sdcard into your keybow, plug it in and wait (for quite a while) for it to boot up, and you should be able to ssh into the machine over your wifi and edit the keybow scripts in the /boot/ folder as usual. Just remember to kill and restart the keybow software when you do.
I’m not entirely sure all of this is the best way to do things (especially point 3) so if you have any questions, suggestions or comments let me know!