Maker.io main logo

How to Build a Connected RP2040-Based Clock - Part 1

2022-02-09 | By Maker.io Staff

License: General Public License Arduino

This article discusses a simple DIY project that’s perfect for beginners. It outlines how to use an Arduino RP2040 Connect board in a beautiful IoT clock build. To guarantee that the clock always displays the correct time, it connects to your home Wi-Fi network and periodically queries and updates the time. Besides that, this DIY clock fits on every bookshelf and nightstand thanks to its modern, simplistic design, and its small physical size.

How to Build a Connected RP2040-Based Clock

This picture shows the finished product next to a small succulent.

Required Components and Tools

You need the following parts to build this project at home:

Component/Pcs.

In addition to these components, you’ll also need access to a 3D printer, such as the Lulzbot TAZ Workhorse, to manufacture the case. You can also check out DigiKey’s new 3D-printing service if you don’t have access to a 3D printer and have the parts manufactured by a professional company.

The Schematic Diagram

The Arduino RP2040 Connect single-board computer includes a few advantages compared to the Raspberry Pi Pico, which uses the same MCU. One of those advantages is the built-in Wi-Fi module that allows the Arduino board to join a local wireless network. This project uses this ability by connecting the Arduino to an NTP server. Doing so allows the Arduino to query the current time when needed, which allows the Arduino to keep its internal time in sync with a very accurate clock source. Furthermore, the design can omit numerous external components that would otherwise be required to make it functional.

Many conventional clocks require manually setting the time whenever the device loses power. That’s typically accomplished with small tactile pushbuttons, and it can be a fiddly and annoying procedure to run through. This project completely omits the need for manually setting the time, as it automatically obtains the current time when it boots up. Furthermore, the connected nature of this project also means that the resulting schematic is simple to understand, and it only requires a few components:

 

 

The schematic diagram for this project.

As you can see in the schematic diagram, the Arduino interfaces the 14-segment display module via I2C. You can read more about the display and how you can include it in Arduino projects here. Other than that, I added a simple panel-mount DC jack to this project. Note that you must connect the positive rail of the DC jack to the VIN pin of the Arduino. This pin can take up to 21V, and a step-down circuit on the Arduino board converts the input voltage to the correct value for the MCU. I used an Arduino-compatible center-positive 12V DC power supply. The Arduino then supplies the display module with 3.3V. The software portion of this project does the heavy lifting, and I’ll discuss the firmware in great detail in the second article of this series.

How to Assemble the Project

Once I’ve decided which parts I wanted to use in this project, I created a two-part case design in Fusion 360. Next, I 3D-printed the enclosure.

The display snaps into the front face, and two flexible tabs clamp it down against the back of the front surface.

How to Build a Connected RP2040-Based Clock

The display snaps into place while the Arduino only loosely sits in a cutout.

Small standoffs above and below the display prevent it from moving around. Unfortunately, the Arduino’s mounting holes were too small to be of any use. Therefore, I created a small cutout for the Arduino to loosely sit in. It’s only held in place by the wires that connect the display to the development board. However, I’ve found that the cables are strong enough to keep the Arduino in its designated position, especially since there isn’t much space in the case.

As you can see, I connected the two positive power supply pins of the display module to the 3.3V pin of the Arduino. I cut two F-F jumper wires in half and created a Y-cable that supplies both of the display's power pins with voltage. While I had my soldering iron out, I also attached two wires to the DC power jack. Make sure you do this before you snap the connector into its place in the outer shell piece:

How to Build a Connected RP2040-Based Clock

Attach the red wire to the center pin of the DC jack and the black wire to the outer ring.

Note that the standard Arduino UNO power supply uses a center-positive setup. Therefore, I connected the red wire to the center pin of the DC jack and the black wire to the outer ring. I then snapped the DC jack into its place in the outer shell:

How to Build a Connected RP2040-Based Clock

This image shows the two halves of the case with all the components in their place.

Next, I connected all the remaining cables to the Arduino and the display. I recommend that you first run the wires between the Arduino and the display module and attach the DC jack wires last. Doing so prevents you from accidentally disconnecting any cables. The build should then look similar to this:

How to Build a Connected RP2040-Based Clock

Connect the power wires to the Arduino before sliding the inner piece into the outer shell.

Note that I deliberately left the DC power wires long enough so that you can pull out the entire inner portion of the case if you ever need to. I also shortened all the cables that connect the display to the Arduino. However, it’s not necessary to do this, and I only trimmed them to end up with a cleaner-looking product.

Slide the inner part into the outer shell next and be careful not to damage any wires in the process. The two large pins on the inner piece should mate with the two holes in the outer shell. It should be a relatively loose friction fit, but the two parts should fall apart on their own.

How to Build a Connected RP2040-Based Clock

Avoid damaging any wires when you slide the two case pieces together.

Make sure that you can separate the two pieces without too much trouble before sliding the outer piece all the way in, as you’ll still have to flash the firmware on the Arduino. If the fit is too tight, use a drill to enlarge the holes.

Summary

This article discussed the hardware aspect of the RP2040-based connected DIY clock project. The project features a two-part custom case design, and it uses an Arduino RP2040, an HT16K33-based 14-segment display module, and a simple panel-mount DC jack. The schematic is simple, as you only need to connect the display and the DC jack to the Arduino. The software does most of the heavy lifting, and I’ll discuss it in great detail in the next part of this beginner-friendly project.

制造商零件编号 ABX00052
ARDUINO NANO RP2040 CONNECT
Arduino
制造商零件编号 PJ-033A
CONN PWR JACK 2X5.5MM SOLDER
Same Sky (Formerly CUI Devices)
制造商零件编号 1912
ADDRESS LED 14 SEGMENT I2C BLUE
Adafruit Industries LLC
制造商零件编号 1950
JUMPER WIRE F TO F 6" 28AWG
Adafruit Industries LLC
制造商零件编号 VEL05US090-US-JA
AC/DC WALL MOUNT ADAPTER 9V 5W
XP Power
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum