Assembling the PyPortal Star Trek Clock

Recently my alarm clock broke. Instead of seeing this as a bad situation, I decided to use this opportunity to make my alarm clock. I was going to do something with an Arduino, LCD, wifi module, and various other hardware. But then I remember this Star Trek-inspired clock I had seen on Thingiverse. That day I ordered a PyPortal and various other parts from Adafruit.

3D printing the case.

The case was relatively easy to print out. I used the STL files from Thingiverse provided by Adafruit. The white parts were printed using Ivory White PLA2 from FilaCube. The black parts of the case were printed using Black PLA2 from FilaCube.

I printed the parts with a .1 mm layer height. I don’t think it was necessary to print with such high quality. But I had just ordered this filament from Filacube and wanted to see how well it did. I’ve gotta say, I really like this filament and will probably order more from them in the future.

Getting the software going

I actually happen to have another PyPortal that I had bought for another project involving OctoPrint. Since I hadn’t yet used the PyPortal for that, I tested the Learn guide’s code. I wanted to get the clock going as soon as the hardware got here.

I did upgrade the PyPortal UFT bootloader from v1.23.1-adafruit.1-89-gcfdd5ba to v3.10.0. I then updated to CircuitPython 5.3.1. The libraries were all updated at the same time. I believe that was the latest when I did this. I might also have been wary of CircuitPython 6 at the time. I’m not sure.

I had to set my secrets.py as follows. XXXX is my private info taken out. The Adafruit IO username and key are required for this to grab time. The openweather API needs a free account setup at OpenWeather. Also, if you search for your town on that site, you can find your CITY ID.

secrets = {
    'ssid' : 'XXXXXX',             # Keep the two '' quotes around the name
    'password' : 'XXXXXX',         # Keep the two '' quotes around password
    'timezone' : "America/Chicago",  # http://worldtimeapi.org/timezones
    'aio_username' : 'XXXXXX',
    'aio_key' : 'XXXXXX',
    'openweather_token': 'XXXXXX',
    'city_id': '5225857',
    'celcius': False,
    }

The code.py I ran as-is. Once I got everything in the secrets.py set correctly, the clock program booted right up on the PyPortal.

I did spend some time removing the Mugsy Icon and creating a Star Trek quote function instead. But I never did finish that code. So I put it back to the original state and waited for my hardware.

Assembling the hardware

Adafruit’s Learn guide has a list of all the hardware required. I ordered most of the hardware through them. I also opted for the optional PowerBoost module and LIon battery to power the clock and keep it going during a power outage.

This hardware sat for a few weeks once I got it. Shortly after ordering all the hardware for this clock, I had fixed my current clock. Having a currently working alarm clock slowed down my urgency to finish this project.

I won’t post a step-by-step of the hardware assembly. The Learn guide from Adafruit does that. But here are a few pics of the build process.

PyPortal attached to the front panel.

For the most part, I followed the guide to connect the SPDT slide switch, USB A jack, DC barrel jack, arcade button, and STEMMA cable to the PowerBoost module. The most significant change here is that I have a slightly different arcade button.

All wired up to the PowerBoost module.

I then mounted the PowerBoost module into the clock. The USB A jack was inserted into its place. On the rear panel, I mounted the SPDT slide switch and DC barrel jack. The STEMMA connector was connected to the PyPortal. Finally, the speaker was inserted into its place on top of the clock and connected to the PyPortal.

Everything assembled inside the clock.

I then closed the back cover… and noticed a LIon battery sitting on my desk. So, I reopened the case and stuck the battery in. It is secured with a piece of thick double-sided tape. As soon as I connected the battery, the clock came to life.

It’s alive!

Then I could once again close the back.

Rear view of the clock. There is a cool glow showing through the filament.

The last step was to add the cap to the arcade button. I had to slightly modify how this was installed due to using a different arcade button from the original plans. But with some double-sided tape and hot glue, it fit just right. The snooze button works fine.

Yes, it was 34 degrees Fahrenheit when I did this step. That’s actually a pretty warm evening for December.

I set the alarm to go off at 9 pm.

Alarm set for 21:00.

The alarm went off as it should. The sound worked fine.

Alarm going off!

Now to take it apart.

As I mentioned earlier in this post, I fixed my old alarm clock while waiting for the hardware. So now I had to decide what to do with this clock. After assembling it, I was quite sure this would never work as an alarm clock for me. I tend to bash my alarm clock. This clock would have to be redesigned to utilize thick ABS to work as an alarm clock for me. I don’t regret making this clock. It is a cool project, and I learned a lot by playing with the code.

Now I’ll just run this as a cool ST clock at my desk for a while. I have a lot of other ideas about what to do with this PyPortal. The main problem I have is settling on one idea. So until I repurpose it, I’ll use this PyPortal to test CircuitPython code and run the Star Trek clock software when I’m not testing.

Song of the Day: Star Trekkin

I can’t do a Star Trek post without playing this classic song from The Firm.

Bonus Song: Highly Illogical

Sometimes you just need a Nimoy song to make it through the day.

One comment

Leave a Reply