On the iPhone Gonzo Divination

In the past few weeks, partly out of silliness and partly out of artistic creativity, I’ve been posting a #GonzoDivination image to The Socials each morning. Pre-hashtag, it started with taking a semi-traditional tarot spread, but using a combination of divination and inspirational cards, instead of using all cards from a single deck.

Over time, I incorporated playing cards, board game cards, runes, dice, Scrabble tiles. Notable ones were a Solitaire layout and a Celtic cross with nothing but blank cards,

On Friday, I fished out a bunch of old phones and laid them out in a traditional tarot spread.

It occurred to me over the weekend that this would be a more powerful image if the devices were powered on with each displaying a card. I mean, how hard could that be? It turns out I’d learn…

I had to immediately rule out the Handspring phones. Maybe some other time? I had the cables, but these were pre-Wifi and I decided that trying to get an image on each was going to be a hassle of USB/Serial dongles and compiling Open Source sync software — more than I was willing to do for this particular stunt. I swapped one out for an iPad Mini and the other for a little eInk prototyping board. In retrospect, I maybe should have dropped this one from the spread and only had 9 “cards.” I imagine most folks wouldn’t notice the missing card.

I started by charging the phones. I have a drawer full of lightning cables, but only one 30-pin cable, which three of the phones took. I had to charge those ones in sequence, and they took hours upon hours before they even got to the point of turning on, not to mention that they can barely keep a charge anymore. One of those phones had an unlock code from when I loaned it out, so I had to track that down. I’d previously used the iPad Mini for work, so it was using an old work password. I had to go back through my list of old passwords, each failed one triggering an increasing retry timeout. It took about an hour of waiting to arrive at the correct one.

Next, I had to scan the cards. I’ve had this deck, The Londa Tarot, since my teens. It’s getting a little ragged around the edges, so I decided to scan in all 78 cards instead of only ten random ones required for this stunt. I figured it would be nice to have them for posterity. That took some time. Of course, the flatbed scanner doesn’t do any automatic cropping, so I had to write a small shell script to wrap ImageMagick to trim them down. I’m still less-than-satisfied with the rounded corners and may write some more ImageMagic directives later to clean those up.

Next, I wrote a thin HTML/CSS wrapper to maximize the card image to whatever screen was showing the card, plus tint the background image to match the border. Within this, I put in about a dozen lines of PHP to select a card at random.

I put this up on my web hosting and started to set up the photo shoot — EXCEPT… all of my websites use secure HTTPS, with certificates through Let’s Encrypt. The sites are configured to not only push you to HTTPS, but uses a HSTS header to say “don’t ever talk to me on regular HTTP.” Let’s Encrypt’s root certificates are new enough to not be in the list of trusted certs on these old versions of iOS. Risk reconfiguring and un-reconfiguring my Apache server for a stunt photo? Nope! I also had some Amazon hosting I could have put it on, but it had similar root-cert problems. I finally found some S3 bucket space I could put it on that didn’t have HTTPS.

Except — problem: S3 doesn’t support PHP. I had to rewrite that piece in JavaScript so it would run client-side. I then pushed that to my bucket.

I then took one static image at random — well, maybe not so random, but one that I figured would look good in monochrome — and resized+dithered it to load onto that eInk device. It was previously running bare-metal Arduino code, so I had to go through all the gyrations to install a Python bootloader and run the sample slideshow app because I figured that’d be easier/quicker than xxd’ing the image into C code and poking that into the screen driver.

But FINALLY I was able to take a revised picture with cards displayed on the devices! And no, none of them are inverted because I’m being optimistic. We need that optimism as we slowly start to emerge from the pandemic.

Posted in: Gadgets Projects

Published by

Brian Enigma

Brian Enigma is a Portlander, manipulator of atoms & bits, minor-league blogger, and all-around great guy. He typically writes about the interesting “maker” projects he's working on, but sometimes veers off into puzzles, software, games, local news, and current events.

Leave a Reply

Your email address will not be published.