Time Cuboid
But I didn't want to go buying lots of unnecessary things, or wait until my usual suppliers were back in full swing. So I dug around in the piles of boxes that comprise my electronics stash. Back at GaelHack (seven years ago) I started on a clock, but it never left the breadboard. I dusted that off, and found most of what else I needed.
The first step is always the first part. I dug out an Arduino Duemilanove 328 (maybe ten years old). Not much to be said here, solid piece of equipment. I did remove the onboard pin 13 LED and resistor, but otherwise as found.
Arduino Duemilanove 328, pin 13 LED removed
Photo by chebe
The reason I needed to remove the LED was because of visible ghosting (... no, that is right, I think) on the LoLshield I soldered up (nine years ago). I can't link directly to the website on the silkscreen because it makes my browser sad. But, luckily, there is a repo of the library on github. I found I only used Charliplexing.h and Charliplexing.cpp, and just copied them into my Arduino project directly.
Topside of LoLshield with blue LEDs
Photo by chebe
The clever thing about this shield is that it uses charlieplexing to address the LEDs, so I get 14x9 = 126 LEDs with only 16 pins of the Arduino used, which is only one side of Arduino pins, digital pins 0-13, GND, AREF. Leaving all the analog side available.
Underside of LoLshield
Photo by chebe
The one thing I did need to buy was an Arduino Proto(typing) Shield (Pimoroni), and a bunch of stackable 6 and 8 pin headers (Pimoroni).
I added a potentiometer to control brightness (A3, grey), and a switch (A2/D16, white). At least it ended up being a switch. I somehow managed to mess up adding a button four different ways. But, it works now, and that's what matters. I use it to turn on and off the LoLshield completely.
Arduino Proto Shield, populated, topside
Photo by chebe
I added headers to the proto shield for the clock module, and split headers above and below the board for the 7-segment display. Both modules use 12C interfaces (using the Wire library), so they are both chained to A4/SDA (yellow) and A5/SCL (green).
Arduino Proto Shield, populated, underside
Photo by chebe
Turns out the new shields, and presumably the new Arduinos, come with more pins than my humble Duemilanove. I had to snip some of the extra header pins where they were hitting components. The rest I just ignored. (Also, the sides of the headers are labelled! Fancy.)
Populated Proto Shield seated on Duemilanove
Photo by chebe
For the clock face I dug out an Adafruit Perma Proto breadboard PCB, quarter size (Adafruit / Pimoroni), and the 0.56" 4-Digit 7-Segment Display w/I2C Backpack - Blue (Adafruit / Pimoroni) from seven years ago. Mostly I'm using the Proto board for getting the display at the correct height. I made my own 'jumper cables' with solid core wire, to minimise the space needed to fit it all in.
7-segment display soldered to Proto board
Photo by chebe
The SparkFun Real Time Clock Module (SparkFun) (from seven years ago) is seated in the header on the Proto Shield. This is so it's easy to replace the battery if needed. Its placement did mean some tetris-ing with the switch and potentiometer though. In the end I even had to snip the corner so the potentiometer knob could turn.
Duemilanove, Proto Sheild, clock module, 7-segment display
Photo by chebe
Then it's just a case of putting everything in place, adding headers so the LoLshield sits above the potentiometer and switch. I could add another layer of headers, but I like the current effect.
Duemilanove, Proto Sheild, clock module, 7-segment display, LoLshield
Photo by chebe
There is just enough room to be able to get at all the bits.
All components stacked, end-on view
Photo by chebe
Now, what about the enclosure? Well, enter a box, maybe twenty years old, that once upon a time was the packaging for a then-new watch. It's moulded plastic, with a metallic appearance base that holds itself together with a foam layer. I kept it all this time because I knew it would diffuse LEDs very nicely.
Plastic box
Photo by chebe
Drill, cut, shave, or otherwise make a hole in the box for the Arduino USB cable.
Plastic box opened, with opening for cable
Photo by chebe
Pack it all up nicely inside the box.
Plastic box, containing electronics, off
Photo by chebe
Finally we get to code it all up. Everything is standard and can be gotten from example code and tutorials. Except maybe the LoLshield. But it's quite straight-forward;
- Include the Charliplexing.h library (copied to same folder, with the .cpp, as your .ino)
- Init the shield in setup();
-- LedSign::Init() will initialise it in a binary state, where all the LEDs are either on or off. You turn them off with LedSign::Set(i, j, 0), and on with LedSign::Set(i, j, 1).
-- LedSign::Init(GRAYSCALE) will initialise it with 8 different possible brightness settings. You still turn them off with LedSign::Set(i, j, 0), but turn them on with LedSign::Set(i, j, n), where n is 1-7, giving brighter results.
#include "Charliplexing.h"
void setup ()
{
//Initializes the lolshield
//LedSign::Init();
LedSign::Init(GRAYSCALE);
}
void fillRandom()
{
for (uint8_t i = 0; i < 14; i++)
{
for (uint8_t j = 0; j < 9; j++)
{
//LedSign::Set(i, j, random(0, 2));
LedSign::Set(i, j, random(0, 8));
}
}
}
I just have it placing a random grayscale value in each LED, changing every second. Producing a relaxed ebb and flow, almost like digital water.
LoLshield with random grayscale pattern as seen through top of box
Photo by chebe
Given the purpose of the device, and age of most of the components, I had half a mind to refer to this as a Time Capsule, but Time Cuboid seems more self-explanatory.
Overall it looks something like this;
Time Cuboid, on
Photo by chebe
no subject
no subject