💾 Archived View for bulletpr00f.host › gemlog › posts › 2021-12-29.gmi captured on 2023-06-14 at 13:54:59. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

Epoch Clock / Motivation

I don't really understand how motivation works for people in general and for me in particular. I have a seemingly endless supply of projects I have started and then abandoned. Often I cannot bring myself to do any of the things I need/want to do.

And yet, sometimes I cannot rest until I do a thing even if that thing is pointless, stupid, and more difficult than I had originally imagined. This is a post about one of those times.

It starts like many of my life stories. I was drunk, talking to someone.

This particular time I was explaining unix epoch time, and it suddenly occured to me. I could build a digital clock to show the current time in unix epoch time. (note: unix epoch time is a count of seconds since midnight jan 1st 1970)

It was over, I had to do it. I pulled up my phone and made a shopping cart with a handfull 4-digit 7-segment displays, a real time clock module, and a couple pieces of breadboard style prototyping board. I then realized, how the fuck do you set this clock? NTP obviously so i threw a couple ESP8266s in there for good measure since I didn't have any wifi enabled microcontrollers laying around. I decided that 3 4 digit displays with a blank digit on each end would look better than say 5 2 digit displays or 10 single digit ones. Also it's the most cost effective way.

This will be easy I assume 7 segment displays are I2C or something

Embarassingly I had no idea how 7 segment displays work. If you don't know, apparently only one digit of the display is on at any given time. They flash on and off rapidly in succession. This gives the appearance of a stable display, because it happens so fast that your eyes don't see the LEDs as ever being off. It's kinda cool, you should google it and read about it if you want. Persistence of vision is kinda a trip.

video where I slowed my code down a bit so you can see it happening

So that means my code needs need to turn them all on and off while also keeping track of the time and connecting to wifi.

Thats kinda more than I bargained for in my drunk "Lol hook some stuff together and its done" idea. But oh well, the parts are being shipped.

Next problem is that each segment of my 10 digit display will require 8 wires. Thats 80 wires... ouch. Thats a lot of soldering in a tiny space. I have nerve damage and I'm shaky... too bad. I already decided I'm doing this.

So I built a prototype

The code... originally was written in micropython, cause I'd never used micropython so now seemed like a good chance.

It's as annoying and complicated as can be. The cheap ESP8266 doesn't have enough pins to drive the whole display and talk to a real time clock module. Plus I have no idea who to make i use NTP to keep the whole thing working without the display suddenly not working while its doing it's whole networking thing.

So a raspberry pi pico is doing the whole display driving thing, and the ESP8266 is getting on the internet and setting up an RTC to tell the correct time. Since the pi pico has 2 cores I am able to get the current time from the ESP8266 via serial in a background thread. This all worked surprisingly well. It was more complicated than I imagined and involved a lot of soldering a bunch of wires together and keeping track of what wire went were but it worked. I only had to desolder one 4 segment display that I accidentally damaged.

But eventually after a few weeks of having a pile of random shit on the table in my living room. It was done.

heres the first completed one

But as you probably guessed... it didn't go well. It worked briefly before being shorted out during handling. In my haste to turn the damn thing on and see it work I didn't properly trim all the wires sticking out of their little blobs of solder, and there a lot of those. One thing touched another thing, and *P O O F* blue smoke.

Well... fuck...

Do I call it a victory that it briefly worked? Do I pretend that conversation never happend? What if my buddy I was texting with while I was building it asks me how it's coming along?

A quick diagnosis revealed that it was the powersupply to the ESP2866 that had fried, but I could still power it via the pins (I tested using the 5 volt pins on a spare arduino as my 5 volt supply) and the clock would still work.

I dug through my horde of electronic bits and found a USB to 5v supply thats actually designed for breadboards and since this was built using breadboard style protoboard it should work fine. I soldered it up, and nervously plugged it in.

One by one segments of the display blipped on very bright before turning off forever...

I looked at reviews of the power supply (it came as part of some kit or something I didn't buy it specifically so I hadn't looked at the reviews before now)

DO NOT USE IT DOESN'T ACTUALLY OUTPUT 5 VOLTS WISH I COULD GIVE 0 STARS
FRIED MY PROJECT DON'T USE THIS
Quality control issues, i bought 3 of these and only 1 actually properly outputs five volts, you get what you pay for. use a multimeter to test first :)

FUCK

I was pissed. Like seriously just mad for days. This all started cause I was drinking beer and thought it'd be fun to make a little digital clock that shows the time in seconds since Jan 1st 1970. And I was too dumb to not short the damn thing out. Then I was too dumb to test that the powersupply I was using wouldn't also short the damn thing out. Clearly I'm a moron and I have no value as a person.

You think I'm just gonna not totally redo this stupid thing that I don't even want to do anymore???

THINK AGAIN

I really didn't want to this again. It took so much wiring to get the damn thing setup and you have to basically lay the wires first and then install the screens over them. I could actually make a custom PCB but that would cost money to do, or I'd have to buy stuff I don't own. And while my GF is a lovely person who puts up with a lot of my weirdness and hoarding of strange tools and components I don't think she'd be cool with me putting one of those little CNC style board makers in the living room and I'm not sure I have the skills to hand draw and etch a board in my apartment, and then what do I do with the left over metal eating liquid? Where do I get a drill press for drilling all the tiny holes?

No this was clearly going to be a "solderable breadboards and brass standoffs" type thing. Not only is that easy to do, it means I don't need to build a case, and frankly I think it looks cool.

So this time I actually googled and made sure I had a design that would work rather than drunkenly buying a pile of 7 segment displays and microcontrollers. Adafruit has a board that uses a chip to make 7 segment displays I2C. They call it a backpack. That means they will work how I think via I2C. They're way more expensive than just getting the display but at this point I didn't care. I just wanted a clock that showed the time in Unix Epoch Time and I wanted it to work well and this seemed like the way to go.

That also mean I needed less pins so I could make the entire project run just on the little ESP8266 board, and since it isn't constantly turning pins on and off (only sending updates via IC2) I don't have to worry about the whole single threaded thing.

So I bought 3 more displays (green this time) and 3 of their "backpacks" luckily cheap ESP8266s come in like packs of at least 3 so I still had a couple that weren't fried.

This time it was easy. I decided that I wanted the microcontroller to be replaceable so instead of soldering it directly to the board I soldered male pins to the controller and female ones to my breadboard that way it can be replaced.

Once again I wanted two solderable breadboards held together with brass standoffs so I made the top a screen and the bottom where the RTC and microcontroller live and they both have pins sticking up, connected with female jumper wires should I ever need to fix this damn thing for some reason.

It all came together, and it works great, it connects to WiFi and gets the time via NTP. If it can't connect to wifi it makes it's own little access point and runs a web server so you can give it valid credentials. Then it just periodically gets the time and resets the RTC, which takes less than a second, and the I2C chips handle the display so theres no noticeable lag during that process.

I had to troubleshoot a few errors and write a few dumb hacks, but it works. It's been sitting on my desk at work for months now. I even used it once to time when my ramen would be done.

My only gripe is that the inside is boring now that it's not a mess of wires.

/pics/clock-front.jpg

/pics/clock-back.jpg

/pics/clock-inside.jpg

Why did I spend all this time drinking beer and soldering? I don't know. Why does this inability to not do something come from the same person who is frequently unable to complete basic tasks I need to do? I don't know. Will I do laundry soon? Probably not at this rate.

It's a mystery I don't know how my brain works, I just live here.

CODE

CONTACT: b0b(at)bulletpr00f.host