Tag Archives: real time clock

Keeping time with a modded Etch-a-Sketch

Dodgey99 had never used stepper motors or real-time clocks before, but that didn’t stop this Maker from creating a really cool Etch-A-Sketch clock.

According to HackADay’s Kristina Panos, Dodgey99 originally employed two 5V stepper motors with ULN2003 drivers, but ultimately decided to upgrade to faster Nema17 motors driven by an ATmega328 powered kit.

“These [original] motors are mounted on the back and rotate the knobs via pulleys,” Panos explained.

“They are kind of slow; it takes about 2 1/2 minutes to draw the time, but the point of the hack is to watch the Etch-A-Sketch.”

Dodgey99 has already written three sketches for the clock: one to configure the RTC, a test hardware run to sample the look of the digits and the main code to replace the very first test sketch.

“The icing on this timekeeping cake is the acrylic base and mounting he’s fashioned,” said Panos.

“During his mounting trials, he learned a valuable lesson about drilling holes into an Etch-A-Sketch. You can’t shake an Etch-A-Sketch programmatically, so he rotates it with a Nema 17.”

Interested in learning more? You can check out the project’s official Instructables page here.

ATmega328 tick-tocks this binary clock

A Maker named Aaron has built a rather impressive binary clock using the shell of an old, discarded hard drive. The unit is powered by a DS1307 Real Time Clock (RTC) module paired with an Atmel ATmega328 microcontroller (MCU).

”As I have an abundant supply of old hard drives, I went the upcycling route and used one for the enclosure. Should add to the clocks nerd cred as well, which can’t hurt,” Aaron explained in a recent blog post.

“You typically need a torx screwdriver bit to crack open most hard drive cases. However, you can bust out some dodgyness and use a flat head if need be.The only parts to be re-used were the body and cover of the hard drive, [although] there’s also some handy rare-earth magnets that can be salvaged.”

Aaron kicked off the binary clock project by marking a grid, then punching and drilling the holes, which he describes as a common LED arrangement for DIY binary clocks. Simply put, the left two columns represent the hours, while the right side displays the minutes.

“Each LED is installed and secured into place with a bit of hot glue. All the LEDs negative legs are soldered together creating a common ground connection. A color coded wire was soldered to each positive connection then insulated with another healthy dob of hot glue,” he continued.

“I had a couple of ATmega328 microcontrollers with Arduino bootloaders (can be programmed by an Arduino) so I breadboarded out a functional Arduino (hackduino) and tested it with the standard blink sketch.”

Aaron then adopted a more permanent model using a protoboard with the RTC – adding outputs for each LED with a resistor in series, 7805 5V regulator and other supporting passive components.

”Once everything was connected up, I let it run naked for a couple of days to make sure everything was sweet. A spare 9v wall wort provides enough power for the unit,” he added.

According to Aaron, the RTC “remembers” the time for approximately 10 years on its own battery, although it is capable of drawing power from an external source when available.

Last, but certainly not least, the Arduino sketch uses Adafruit’s RTC library to interact with the RTC module and ask for the current time/ The sketch then takes those values and calculates which LEDs should be lit to display the current time in binary format.

Interested in learning more? You can download the code here and check out the project’s official page here.

Atmel-based ChronosMEGA measures time

A Maker by the name of N.fletch has debuted the ChronosMEGA, a beautifully designed wristwatch powered by Atmel’s versatile ATmega328P microcontroller (MCU).

“I’ve always loved watches; not only are they aesthetic and beautiful, but they are functional, precise and useful. An elegant fusion between engineering and art; two normally opposed perspectives, now joined in harmonic unison,” N.fletch explained in a recent Instructables post.

“However, all technologies like the dial-up internet, the CVT monitor and the abacus, inevitably will become relics of our past with the advent of advancing technology and have since become less pragmatic for the typical person to own. Unlike these archaic technologies, the wrist watch still thrives on the wrists of many, standing forever as a testament to one of mankind’s greatest inventions: the measurement of time.”

Aside from Atmel’s ATmega328P, key ChronosMEGA specs include binary time encoding (via 10 Blue 1206 LEDs), a slew of buttons to control time, sleep mode and display, a 32.768kHz external crystal and an 8MHz internal clock source.

Additional key features?

  • Micro-USB and charge management controller (for 400mAh Li-ion battery)
  • Draws 4uA in its Deep Sleep mode to last up to 11 years on a single charge
  • Battery indicator 0603 LED
  • Boost TI switching regulator for power regulation
  • Low loss PowerPath controller IC for power source selection
  • Total form factor of 10mm x 40mm x 53mm
  • Custom 3D designed case cast in pure polished silver
  • Genuine crocodile leather watch band

As you can see in the videos above, the layout of the watch configured in a circular array of 10 LEDs. Four of the LEDs account for hours, while six of the LEDs account for minutes.

“The LEDs count in binary to display the time on the watch face. By utilizing a combination of the 10 LEDs, the watch can display any possible time accurate to the minute,” N.fletch continued.

“This is a very clean and elegant way to display time. I also really like this technique because of its esoteric and mysterious nature.”

In terms of the MCU, the ATmega328P is wired in a straight-forward manner, connected to power and ground, with a pull up resistor on the RESET pin. Essentially, the AVR is tasked with driving all the LEDs from its GPIO, although one of the MCU’s AVR’s ADC pin is connected to the battery to detect the voltage level. As such, the watch is equipped with a small red status LED to indicate when battery power is low.

“The AVR has a 32.768 kHz crystal wired to its XTAL pins. It uses the 32.768 kHz crystal to drive its Timer2 module asynchronously for counting the seconds, [while] its internal 1MHz RC clock drives the SW,” N.fletch added.

“32.768 kHz is a very common frequency to drive Real Time Clock (RTC) systems because 32,768 in decimal is equal to 8000 in hex. Therefore, 32,768 can be evenly divided by multiple powers of 2 including 1024. Dividing 32,768 by 1024 yields 32, so configuring the timer to count to 32 with a 1024 pre-scaler will equal an exact second.”

Interested in learning more about the Atmel-based ChronosMEGA? You can check out the project’s official Instructables page here.

Designing a gateway with Atmel’s SAMA5D35 eMPU

A gateway can best be described as a device that enables communication between various classes of networks using multiple communication protocols and technologies. A concentrator performs an identical function as a gateway, although it is also capable of acting as an aggregation point for data in smart energy networks.

Key design considerations when building a gateway or concentrator include connectivity (both wired and wireless) to communicate between the different protocols and networks concurrently, as well as integration, high performance and security.


Both concentrator and gateway can be designed using a number of Atmel components, including the SAMA5D35 Cortex-A5 (ARM) eMPU, AT86RF212 900MHz RF transceiver, AT86RF231/233 2.4GHz RF transceivers, ATPL220A Prime PLC controller, ATPL100A FSK PLC controller, ATSHA204 authentication IC and AT30TS temperature sensor.

“Atmel’s SAMA5D35-powered platform offers a highly integrated device with optimized performance and extensive connectivity peripherals to simplify product design and BOM. Connectivity is ensured via a number of integrated comm peripherals including SDIO, CAN, 10/100 Ethernet MAC Controller and a 10/100/1000 Gigabyte Ethernet MAC Controller with IEEE1588 support,” an Atmel engineer told Bits and Pieces.

“There is also an integrated External Bus Interface (EBI) for DDR2 support, a MLC/SLC NAND Controller (including ECC) for NAND Flash, a low-power Real Time Clock (RTC) that can be battery operated during outages and a Floating Point Unit (FPU) for energy calculations and data statistics. Last, but certainly not least, the above-mentioned Atmel platform – which is equipped with 160-Bits of OTP Fuses for secret storage and secure boot – supports a number hardware security functions, including TRNG, AES-256, TDES and SHA256.”

As expected, Atmel also provides Linux support for the ATSAMA5D35 eMPU, along with a full range of development tools, such as RTOS, middleware and support services, as well as free software packages like TCP/IP stacks and Wi-Fi drivers. Meanwhile, an Evaluation Kit facilitates code development of applications running on a ATSAMA5D35-based device.

Additional information about Atmel’s ATSAMA5D35 Cortex-A5 eMPU can be found here.

SleepWalking Helps Conserve Energy

Imagine you are the sole care-provider for a household full of babies all under the age of 3.  Each and every single one of them requires you to tend their needs and desires.  From feeding to going to the bathroom, from burping to changing their diapers, from bathing to putting them to nap/sleep to keeping them entertained, you are needed every single step of the way.  Isn’t that just exhausting?  Fast forward by a decade when they are grow to become teenagers – autonomy and self-sufficiency – in which they can all satisfy their own basic needs without your help, unless it’s an urgent matter.  Now you have much more free time to read a book, surf the net, get a job, or take a nap.

In essence, this is what SleepWalking is all about in the realm of an Atmel MCU.  Traditionally a technology found in the AVR architecture only, it is now incorporated into the ARM architecture as well.  It is a feature that extends the concept of autonomous peripherals (babies) that operate independently of the CPU core (a parent or care-provider) during active mode, to actually keeping the peripherals functional when the system clock has been stopped. This is achieved by clocking the peripherals using the real‐time clock (RTC), instead of the system clock.

sleepwalking explained

In the SAM4L, SleepWalking has been integrated into many of the peripherals, including the analog comparator, the ADC, the I2C, UART and the capacitive touch interface. It is then the peripheral that decides whether to wake the system, instead of the CPU waking periodically to carry out an interrupt service routine.  With this feature, the need to wake the CPU reduces significantly thus allowing it to stay inactive for longer and more frequent and thereby conserving more energy.

For more information, check out this video for a more detailed explanation on SleepWalking.  Please note: despite the AVR UC3 being used as an example in the video, the underlying fundamentals of how SleepWalking works and its benefits are the same as in the ARM SAM4L.