I saw flip dots (also called flip discs) last year for the first time and instantly knew I needed some in my life. If you’re not familiar with them, check out how they work!
The particular model I have is the ALFAZETA XY5, which may be the easiest way to get up and running, but certainly not the least expensive.
After getting the board, all you need is:
- 24V power supply
- Something that talks over RS485 (in my case I used an ESP8266 connected to a MAX3485 board)
- Their documentation that defines the controller data protocol
I plan to write in more detail how it all works, but for this demo the stack is:
For even easier prototyping, I’ve added Swift Playground support to my SwiftGFXWrapper project!
It felt good to complete this project that’s been on my list for quite some time. The main goal was to scrape the values from my modem’s status page and pipe them into InfluxDB, which feeds Grafana. Not only could I look at data trends, but I could receive alerts if certain values exceeded an acceptable threshold.
Overall this is a straightforward process:
- Pull in the HTML from the status page (which happens to not need any authentication, making it even easier)
- Parse the tables we care about (Downstream and Upstream) using XPaths
- Munge the data into something suitable for InfluxDB
- Insert the data into InfluxDB
- Query the InfluxDB data from Grafana
I knew I wanted to use Python for the project, so I first looked into Scrapy. After wrapping my mind around it (somewhat) I gave it a go and actually had a working solution… but it felt way over engineered and at times inflexible for what I wanted. I threw 90% of that solution away and went with a simpler script.
What I landed on was something that’s custom and lightweight, but extendable in case someone has a different status page or wants to use an alternative to InfluxDB.
Another fun project from a few weekends ago: Wrapping the Adafruit GFX in Objective C and bridging to Swift for some neat 8-bit effects!
The most interesting component of this project so far has been building a Swift closure that is executed in C as a
const void *. This was new territory for me and a lot of fun to figure out!
Currently a work in progress, I’ve nerd sniped myself to get TCP/IP working over SLIP with a pair of Arduinos equipped with nRF24L01+ radios.
SwiftUI is turning into my go-to for rapid prototyping. Here’s an example of a light / dark mode switcher that I think would work well on web…
It’s been possible to boot a Raspberry Pi from an SSD for a while now, but the process didn’t seem to have the full blessing from the Raspberry Pi Foundation. This changed recently when they announced their beta firmware to officially support it.
It was pretty painless to get it working, so here’s how I did it. Some notes up front:
- Based on research of past success stories, I went with this adapter – the ELUTENG SATA to USB 3.
- I used a Raspberry Pi 4 4GB
- The SSD I used was a spare Samsung EVO 250GB I had from a retired machine
- I connected the SSD directly to the USB 3 port
- I went with the headless version of Raspberry Pi OS (formerly known as Raspbian), but this should work with any of them
- Since my RPi was already running off an SD card I wanted to be able to plug in the USB drive and do this all from my couch. I only had to get up once, and that was to take out the SD card on the final reboot!
Don’t blindly follow these instructions unless this post is only a few days old! Things are bound to change – this is beta software. Do it at your own risk. If a step has something in [brackets], you need to figure out your particular value.
sudo apt update
sudo apt full-upgrade
sudo vim /etc/default/rpi-eeprom-update
- Change to:
- Change to:
sudo rpi-eeprom-update -d -f /lib/firmware/raspberrypi/bootloader/beta/pieeprom-2020-05-15.bin
- On the RPi, download the Raspberry Pi OS image and copy it to the SSD. Make sure the SSD isn’t mounted!
shasum -a 256 raspios_lite_armhf_latest(verify the SHA)
sudo dd bs=4M if=2020-05-27-raspios-buster-lite-armhf.img of=/dev/[SSD DEV NAME] conv=fsync
- Reboot, and hopefully the SSD will automount. The RPi isn’t expected to boot from it yet, but should treat it like an external drive.
sudo cp /boot/*.elf /media/[SSD mount]/boot
sudo cp /boot/*.dat /media/[SSD mount]/boot
- Because I went with the headless install, I wanted to be able to SSH into it
sudo touch /media/[SSD mount]/boot/ssh
- Power off the RPi
- Remove the SD card
- Power up
- Hopefully you’re booting off the SSD!
SD Reads: 42MB/sec
SD Writes: 22 MB/sec
SSD Reads: 314 MB/sec (7.4x)
SSD Writes: 212 MB/sec (9.6x)
Note: I use InfluxDB as my Telegraf output.
The Telegraf part
To get values for my Mac’s CPU temperature, GPU temperature, and fan speed, here’s what I did:
- Install iStats: https://github.com/Chris911/iStats
- Add the following executable inputs to Telegraf’s config in
# CPU temperature from iStats - https://github.com/Chris911/iStats # Note - this would need to be adjusted for multiple CPUs # Key was discovered as TC0P [[inputs.exec]] commands = ["/usr/local/bin/istats cpu --value-only"] timeout = "5s" name_override = "cpu_temperature_mac" data_format = "value" data_type = "float" # GPU temperature from iStats - https://github.com/Chris911/iStats # Note - this would need to be adjusted for multiple GPUs # Key was discovered as TCGc [[inputs.exec]] commands = ["/usr/local/bin/istats scan TCGc --value-only"] timeout = "5s" name_override = "gpu_temperature_mac" data_format = "value" data_type = "float" # Fan speed from iStats - https://github.com/Chris911/iStats # Note - this would need to be adjusted for multiple fans [[inputs.exec]] commands = ["/usr/local/bin/istats fan speed --value-only"] timeout = "5s" name_override = "fan_speed" data_format = "value" data_type = "integer"
The Grafana part
Some caveats to this approach:
- This was on a 2019 i9 iMac with a single processor, GPU, and fan and won’t automatically work for all machines. You’d need to run iStats to see what all keys and values appear for your particular Mac.
- It would be better if the CPU and GPU stats all played nice with the same measurement names Linux uses so we wouldn’t have to have multiple Grafana queries. I may do this in the future, but right now this was easy to implement with my RPi, PC, Mac, and Linux boxes.