Project: Clock Four – Scrolling text clock
Introduction
Time for another instalment in my highly-irregular series of irregular clock projects. In this we have “Clock Four” – a scrolling text clock. After examining some Freetronics Dot Matrix Displays in the stock, it occurred to me that it would be neat to display the time as it was spoken (or close to it) – and thus this the clock was born. It is a quick project – we give you enough to get going with the hardware and sketch, and then you can take it further to suit your needs.
Hardware
You’ll need three major items – An Arduino Uno-compatible board, a real-time clock circuit or module using either a DS1307 or DS3232 IC, and a Freetronics DMD. You might want an external power supply, but we’ll get to that later on.
The first stage is to fit your real-time clock. If you are unfamiliar with the operation of real-time clock circuits, check out the last section of this tutorial. You can build a RTC circuit onto a protoshield or if you have a Freetronics Eleven, it can all fit in the prototyping space as such:
If you have an RTC module, it will also fit in the same space, then you simply run some wires to the 5V, GND, A4 (for SDA) and A5 (for SCL):
By now I hope you’re thinking “how do you set the time?”. There’s two answers to that question. If you’re using the DS3232 just set it in the sketch (see below) as the accuracy is very good, you only need to upload the sketch with the new time twice a year to cover daylight savings (unless you live in Queensland). Otherwise add a simple user-interface – a couple of buttons could do it, just as we did with Clock Two. Finally you just need to put the hardware on the back of the DMD. There’s plenty of scope to meet your own needs, a simple solution might be to align the control board so you can access the USB socket with ease – and then stick it down with some Sugru:
With regards to powering the clock – you can run ONE DMD from the Arduino, and it runs at a good brightness for indoor use. If you want the DMD to run at full, retina-burning brightness you need to use a separate 5 V 4 A power supply. If you’re using two DMDs – that goes to 8 A, and so on. Simply connect the external power to one DMD’s terminals (connect the second or more DMDs to these terminals):

The Arduino Sketch
You can download the sketch from here. It was written only for Arduino v1.0.1. The sketch has the usual functions to set and retrieve the time from DS1307/3232 real-time clock ICs, and as usual with all our clocks you can enter the time information into the variables in void setup(), then uncomment setDateDs1307(), upload the sketch, re-comment setDateDs1307, then upload the sketch once more. Repeat that process to re-set the time if you didn’t add any hardware-based user interface.
Once the time is retrieved in void loop(), it is passed to the function createTextTime(). This function creates the text string to display by starting with “It’s “, and then determines which words to follow depending on the current time. Finally the function drawText() converts the string holding the text to display into a character variable which can be passed to the DMD.
And here it is in action:
Conclusion
This was a quick project, however I hope you found it either entertaining or useful – and another random type of clock that’s easy to reproduce or modify yourself. We’re already working on another one which is completely different, so stay tuned.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Results – February 2012 Competition
Now that February is over it’s time to announce the lucky winners of our February competition…
Prize One is a brand new Freetronics EtherMega board – the mother of all Arduino-compatible boards. As reviewed recently, the EtherMega combines the power and versatility of the Arduino Mega2560, a microSD card shield, a full Ethernet shield and power over Ethernet support:

Winner of the first prize is Rosemary H from the United Kingdom.
Prize Two is awesome – and a mystery no more. It is the new Freetronics LeoStick:
From the Freetronics website:
The LeoStick is just like the upcoming Arduino Leonardo, but given the “honey, I shrunk the kids” treatment!
Just pop it into your USB port (no cable required!) and upload straight from the Arduino IDE. We’ve even included on-board RGB LED lights and a speaker in this handy sized board. All the usual Arduino pins are present and each LeoStick comes with low profile header sockets for plugging in modules, shields and wires.
Winner of the second prize is Andrian from Moldova. Congratulations to the winners and thanks to everyone for entering.
For the curious, the questions and answers were:
- What frequency crystal would you use with the DS1307 RTC? – 32.768kHz
- How many LEDs are on an EtherMega board? Now I have two answers as the question should have been more specific. There are ten LEDs on the actual PCB, plus two more on the ethernet socket. So we accepted ten or twelve for the answer
- What are the dimensions (length x width) of an 0805 SMT component in mm? – 2.0 x 1.3 mm
- In what year was Ikea founded? – 1943
- What nationality is the Hakko company? Japanese
- Who came up with the name for the device known as the ‘transistor‘? - John R. Pierce
Once again, thanks to Freetronics for the EtherMega and LeoStick prizes!
In the meanwhile, follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Project: Clock Two – Single digit clock
Let’s hack an Ikea lamp into a single-digit clock! How? Read on…
Updated 18/03/2013
Time for another instalment in my irregular series of clock projects. (Or should that be “Time for another instalment in the series of irregular clock projects”?) In contrast with the extreme “blinkiness” of Clock One, in this article we describe how to build this single-digit digital clock:
Once again the electronics of the clock will be based from an Arduino-compatible board with a DS1307 real-time clock IC added to the board. On top of this we add a shield with some extra circuitry and two buttons – but more on this later. The inspiration for this clock came from a product that was recently acquired at Ikea – the “Kvart” work lamp, for example:
If you are shopping for one, here are the Ikea stock details:
The goal is to place the electronics of the clock in the base, and have one single-digit LED display at the top of the neck which will blink out the digits. There will be two buttons under the base that are used to set the time. It will be powered by a 9V battery or an AC adaptor which is suitable for a typical Arduino board.
Construction
This article is a diary of my construction, and you can always use your own knowledge and initiative. It is assumed that you have a solid knowledge of the basics of the Arduino system. If not, review my series of tutorials available from here. Furthermore, feel free to modify the design to work with what you have available – I hope this article can be of some inspiration to you.
Software
It is much easier to prototype the clock and get the Arduino sketch working how you like it before breaking down the lamp and building up the clock. To do this involves some jumper wires and a solderless breadboard, for example:
Although there are four buttons on the board we only use two. They are connected to digital pins eight and nine (with 10k pull-down resistors). The LED display segments a~g are connected to Arduino digital pins 0~6 respectively. The decimal point is connected to the pulse output pin of the DS1307 – which will be set to a 1Hz output to have a nice constant blinking to show the clock is alive and well.
If you are unfamiliar with operating the DS1307 real-time clock IC please review this tutorial. Operation of the clock has been made as simple for the user as possible. To set the time, they press button A (on digital eight) while the current time is being displayed, after which point the user can select the first digit (0~2) of the time by pressing button A. Then they press button B (on digital nine) to lock it in and move to the second digit (0~9) which is again chosen with button A and selected with button B. Then they move onto the digits in the same manner.
After this process the new time is checked for validity (so the user cannot enter invalid times such as 2534h) – and is ok, the clock will blink the hyphen twice and then carry on with the new time. If the entered time is invalid, the clock reverts back to the current time. This process is demonstrated in the following video clip:
You can download the Arduino sketch from here.
Hardware
The parts required to replicate the Clock Two in this article are:
- One Arduino-compatible board with DS1307 real-time clock IC as described in this article
- One Arduino protoshield and header pins
- One common-cathode 7-segment LED display of your choosing
- Seven current-limiting resistors to reduce the output current from Arduino digital outputs going to the LED segments. In our example we use a 560 ohm resistor network to save time
- Two buttons and two 10k ohm pull-down resistors
- One meter of nine-core wire that will fit inside the neck and stand of the Kvart lamp – an external diameter of less than 6mm will be fine
- And of course – the lamp
The protoshield is used to hold the buttons, resistor network and the terminus for the wires between the LED display and the Arduino digital outputs, for example:
At this stage you will need to do some heavy deconstruction on the lamp. Cut off the mains lead at the base and remove the plastic grommet from the stand that surrounded the AC lead. Next, with some elbow grease you can twist off the lamp-shade unit from the end of the flexible neck. You could always reuse the lamp head and AC lead if wired by a licensed electrician.
Now you need to feed the multicore wire through the neck and down to the base of the lamp. You can pull it through the hole near the base, and then will need to drill a hole in the base to feed it through to the electronics as such:
Take care when feeding the cable though so you don’t nick the insulation as shown above. Leave yourself a fair bit of slack at the top which will make life easier when soldering on the LED display, for example:
The next step is to solder the wires at the top to the LED display. Make notes to help recall which wires are soldered to the pins of the display. If your soldering skills (like mine) aren’t so good, use heatshrink to cover the soldering:
Most displays will have two GND pins, so bridge them so you only need to use one wire in the multicore back to base:
At this point use the continuity function of a multimeter or a low-voltage power source to test each LED segment using the other end of the cable protruding from the base. Once you are satisfied the segments have been soldered correctly, carefully draw the cable back through the neck and base in order to reduce the slack between the display and the top of the lamp neck. Then solder the individual LED segment wires to the protoshield.
Now if you have not already done so, upload the sketch into the Arduino board – especially if you are going to permanently mount the circuitry into the base. A simple method of mounting would be using a hot glue gun, but for the purpose of demonstration we have just used blu-tac:
Although this does look a little rough, we are using existing stock which kept the cost down. If you are going to power the clock with an AC adaptor, you will also need to cut out small opening to allow the lead to protrude from the side of the base. And now for the resulting clock – our Clock Two:
So there you have it, the second of many clocks we plan to describe in the future.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
February 2012 Competition
Update – The competition has now finished, and the winners will be announced shortly…
It’s that time of the month again so we are running another competition. This month we have two prizes. Let’s check those out then follow up with the rules of entry.
Prize One is a brand new Freetronics EtherMega board – the mother of all Arduino-compatible boards. As reviewed recently, the EtherMega combines the power and versatility of the Arduino Mega2560, a microSD card shield, a full Ethernet shield and power over Ethernet support:

From the Freetronics website:
The EtherMega is a 100% Arduino Mega 2560 compatible board that can talk to the world. Do Twitter updates automatically, serve web pages, connect to web services, display sensor data online, and control devices using a web browser. The Freetronics EtherMega uses the same ATmega2560 as the Arduino Mega 2560 so it has masses of RAM, flash memory, and I/O pins, and also includes the same Wiznet W5100 chip used by the official Arduino Ethernet Shield, so it’s 100% compatible with the Ethernet library and sketches.
Any project you would previously have built with an Arduino Mega 2560 and an Ethernet shield stacked together, you can now do all in a single, integrated board. We’ve even added a micro SD card slot so you can store web content on the card, or log data to it. But it gets even better: we found space to squeeze in a small prototyping area, so now it’s possible to build a complete, Internet-enabled Arduino device including your own custom parts all on a single board! You don’t even need to use a prototyping shield for many projects.
Prize Two is awesome – and a mystery no more. It is the new Freetronics LeoStick:
From the Freetronics website:
The LeoStick is just like the upcoming Arduino Leonardo, but given the “honey, I shrunk the kids” treatment!
Just pop it into your USB port (no cable required!) and upload straight from the Arduino IDE. We’ve even included on-board RGB LED lights and a speaker in this handy sized board. All the usual Arduino pins are present and each LeoStick comes with low profile header sockets for plugging in modules, shields and wires.Features of the LeoStick include:
- Native USB port built-in, no need for any USB or FTDI cables
- Two Full Color RGB LEDs on-board! Drive different colored outputs and fun feedback from your sketch right away. One RGB LED is completely programmable, the other does Power, USB RX and TX indication, the RX and TX LEDs can also be controlled.
- On-board Piezo speaker element, play sounds, tunes and beeps. Can also be used as a knock/vibration sensor
- Same I/O pins. The LeoStick provides all the same header connections as larger boards, you can connect all the same sensors, actuators, and other inputs and outputs as typical Arduino models.
- Breadboard compatible, has 0.1″ pitch pads and header pins can be fitted underneath
- 500mA polyfuse and protection on the USB port
- ATmega32U4 microcontroller, Arduino compatible with on-board USB, 32K Flash, 2.5K RAM, 1K EEPROM at 16MHz
- ISP 6-pin connector for advanced programming of the ATmega32U4 MCU
Please note: The LeoStick currently uses a modified beta version of the upcoming Arduino Leonardo bootloader. There are some known issues with Windows 7 64-bit drivers and some library functions don’t work perfectly yet. Any firmware or Arduino Leonardo compatible support should not be considered to be final release firmware or in any way an official Arduino. Don’t hassle the Arduino team with support or requests related to this board: they’re solely our responsibility. The LeoStick is also a very complete ATmega32U4 breakout and USB board by itself and the LeoStick can be programmed directly from the supplied standard ISP header by AVR Studio, Mac OSX-AVR, avrdude, WinAVR etc.
How to enter!
There will be six questions for you to answer spread across articles published between the 1st and 29th of February. So you will need to review older posts. At the end of February and once you have answers to all six questions, email the answers along with your full name, email address and postal address to competition at tronixstuff dot com with the subject heading February.
During the second week of March, all the correct entries will be collated and two randomly chosen. The first correct entry drawn will win first prize, and the second entry the second prize. Entries will be accepted until 03/03/2012 0005h GMT.
As with any other competition, there needs to be some rules:
- Incomplete entries will be rejected, so follow the instructions!
- The winners’ first name and country will be announced publicly;
- The winners’ name and mailing address will be passed to the prize supplier only for the purpose of prize delivery and not for any form of marketing.
- Entries that contain text not suitable for minors or insulting to the competition will be rejected (seriously – it happens);
- Prizes will be delivered via Australia Post domestic or regular international air mail. We take absolutely no responsibility for packages that go missing or do not arrive. If you live in an area with a “less than reliable” domestic postage system, you can pay for registered mail or other delivery service at your expense.
- Winners outside of Australia will be responsible for any taxes, fees or levies imposed by your local Governments (such as import levies, excise, VAT, etc.) upon importation of purchased goods;
- Prizes may take up to 45 days to be received;
- No disputes will be entered in to;
- Prizes carry no warranty nor guarantee – and are to be used or abused at entirely your own risk;
- Entries will be accepted until 03/03/2012 0005h GMT.
Thanks to Freetronics for the EtherMega and LeoStick prizes!
So have fun and keep an eye out for the four competition questions spread through the February posts… In the meanwhile, follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Results – January 2012 Competition
Hello Readers
The January 2012 competition has now closed. For the curious, the questions and answers were:
Q – What does the acronym PWM mean?
A – Pulse-width modulation
Q – How many LEDs are contained in the Freetronics DMD?
A – 512
Q – How many digital I/O pins on an Arduino Mega2560?
A – 54
Q – What type of processor core does the PIC32 (from the Uno32 review) use?
A – MIPS (or to be more precise, 32-bit MIPS M4K Core)
Congratulations to Jack M. from the interesting state of South Australia! Jack has won the following prizes:
One v1.0 Akafugu Akafuino-X board as reviewed recently:

Jack’s Akafuino-X will have a companion on its journey which will be the Mayhew Labs “Go Between” Shield, as reviewed recently:

Thanks to Akafugu for offering the Akafuino-X prize!
The February 2012 competition will be announced soon, so in the meanwhile have fun and follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Project: Clock One
Let‘s make a huge analogue and digital clock using a dot-matrix display.
Updated 18/03/2013
For some strange reason I have a fascination with various types of electronic clocks (which explains this article). Therefore this project will be the start of an irregular series of clock projects whose goal will be easy to follow and produce interesting results. Our “Clock One” will use a Freetronics Dot Matrix Display board as reviewed previously. Here is an example of an operating Clock One:
As you can see, on the left half of the board we have a representation of an analogue clock. Considering we only have sixteen rows of sixteen LEDs, it isn’t too bad at all. The seconds are illuminated by sixty pixels that circumnavigate the square clock throughout the minute. On the right we display the first two letters of the day of the week, and below this the date. In the example image above, the time is 6:08. We omitted the month – if you don’t know what month it is you have larger problems.
Hardware
To make this happen you will need:
- A Freetronics Dot Matrix Display board;
- If you want the run the display at full brightness (ouch!) you will need a 5V 2.8A power supply – however our example is running without the external supply and is pretty strong
- An Arduino board of some sort, an Uno or Eleven is a good start
- A Maxim DS1307 real-time clock IC circuit. How to build this is explained here. If you have a Freetronics board, you can add this circuit directly onto the board!
Software
Planning the clock was quite simple. As we can only draw lines, individual pixels, and strings of text or individual characters, some planning was required in order to control the display board. A simple method is to use some graph paper and note down where you want things and the coordinates for each pixel of interest, for example:
Using the plan you can determine where you want things to go, and then the coordinates for pixels, positions of lines and so on. The operation for this clock is as follows:
- display the day of week
- display the date
- draw the hour hand
- draw the minute hand
- then turn on each pixel representing the seconds
- after the 59th second, turn off the pixels on the left-hand side of the display (to wipe the clock face)
There isn’t a need to wipe the right hand side of the display, as the characters have a ‘clear’ background which takes care of this when updated. At this point you can download the Arduino sketch from here. Note that the sketch was written to get the job done and ease of reading and therefore not what some people would call efficient. Some assumed knowledge is required – to catch up on the use of the display, see here; and for DS1307 real-time clock ICs, see here.
The sketch uses the popular method of reading and writing time data to the DS1307 using functions setDateDs1307 and getDateDs1307. You can initally set the time within void setup() – after uploading the sketch, comment out the setDateDs1307 line and upload the sketch again, otherwise every time the board resets or has a power outage the time will revert to the originally-set point.
Each display function is individual and uses many switch…case statements to determine which line or pixel to draw. This was done again to draw the characters on the right due to function limitations with the display library. But again it works, so I’m satisfied with it. You are always free to download and modify the code yourself. Moving forward, here is a short video clip of the Clock One in action:
For more information about the display used, please visit the Freetronics product page. Disclaimer – The display module used in this article is a promotional consideration made available by Freetronics.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
January 2012 Competition
Hello Readers
The competition has now ended and the winning entry will be announced shortly. Thank you to all those who entered, and of course to Akafugu for their prize this month.
It’s that time of the month again so we are running another competition. Our prize for this month consists of two items:
One v1.0 Akafugu Akafuino-X board as reviewed recently:

The winner’s Akafuino-X will have a companion on its journey which will be the Mayhew Labs “Go Between” Shield, as reviewed recently:

— *** How to Enter *** —
There will be four questions for you to answer spread across articles published between the 1st and 31st of January. So you will need to review older posts. At the end of January and once you have answers to all four questions, email the answers along with your full name, email address and postal address to competition at tronixstuff dot com with the subject heading January.
During the second week of February, all the correct entries will be collated and one randomly chosen. The first correct entry drawn will win the prize. Entries will be accepted until 03/02/2012 0005h GMT.
As with any other competition, there needs to be some rules:
- Incomplete entries will be rejected, so follow the instructions!
- The winners’ first name and country will be announced publicly;
- Entries that contain text not suitable for minors or insulting to the competition will be rejected (seriously – it happens);
- Prizes will be delivered via Australia Post domestic or regular international air mail. We take absolutely no responsibility for packages that go missing or do not arrive. If you live in an area with a “less than reliable” domestic postage system, you can pay for registered mail or other delivery service at your expense.
- Winners outside of Australia will be responsible for any taxes, fees or levies imposed by your local Governments (such as import levies, excise, VAT, etc.) upon importation of purchased goods;
- Prizes may take up to 45 days to be received;
- No disputes will be entered in to;
- Prizes carry no warranty nor guarantee – and are to be used or abused at entirely your own risk;
- Entries will be accepted until 03/02/2012 0005h GMT.
So have fun and keep an eye out for the four competition questions spread through the January posts… In the meanwhile, follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Initial Review: Akafuino-X Microcontroller Board
Hello Readers
Time to get back to work for 2012 and in doing so we review another interesting product from a new company based in Japan – akafugu. From their website:
Akafugu Corporation is a small electronics company that operates out of Tokyo, Japan. We specialize in fun and easy to use electronic gadgets. Our goal is to provide products that not only make prototyping faster and easier, but are also perfect for incorporation in finalized products.
And with this in mind we examine the Akafuino-X microcontroller board:
The observant among you will notice the similarity to our usual Arduino Uno and compatible boards. However there are some differences which bring changes and improvements over the original Arduino design. The biggest point of difference is the microcontroller, the Akafuino uses an Atmel XMega32A4. The benefit of this over the normal ATmega328 is:
- Speed! 32 MHz – twice as fast as the ATmega328;
- Two-channel DAC (digital to analogue) converter – output analogue signals between 0V and Vcc straight from the board. A library is included with the new IDE to control them. The DAC uses digital pins seven and eight;
- Not one, two or even four, but five UARTs;
- Two I2C buses;
- Sixteen PWM pins – great for LED effects…
Thankfully the designers have detailed the extra I/O pins and other useful information on the rear of the board:
Other changes include:
- It’s a 3.3V board – so no 5V supply for you. However the inputs are tolerant to 5V;
- On-board real time clock. You can also add an optional 32.768 kHz crystal to increase accuracy – see the space on the board near the reset pin;
- A very refreshing red colour (note that ‘aka(i)’ ** is red in Japanese) and a happy puffer fish (‘fugu’) on the silk-screening
- And libraries for other Akafugu products such as the TWI Display module are available.
Getting started is easy, however due to the difference in hardware the Arduino IDE needs modification. But don’t panic – instead of modifying your existing v1.0 Arduino IDE – download and install the Akafuino-X version from here and run your usual and the Akauino-X IDE on the same machine (it’s ok to do this). You should also review the usage instructions here and note that this is a derivative of the v1.0 IDE. Furthermore at the time of writing the software side of things is still in beta, and can be monitored via Github - however don’t let this put you off, as the Akafuino-X has a lot of potential.
If you find any bugs in use the issue tracker in Github to let the team know.
In the meanwhile we’ve conducted a quick speed test – by running the same sketch on an Arduino Uno and also the Akafuino-X. The test is a whole lot of multiplication, nothing too scientific. At the end the duration of the exercise is shown in milliseconds. Here’s the code:
// Arduino Uno test
//
void setup()
{
Serial.begin(9600);
}
unsigned long a,b,c,d,e;
void loop()
{
a=millis();
for (c=1; c<1000000; c++)
{
d=sq(c);
}
b=millis();
e=b-a;
Serial.print("Duration: ");
Serial.print(e);
Serial.println("ms");
do {} while (1>0);
}
And here are the results of running the sketch four times on each board (click image to enlarge):
Our Akafuino-X beta only took 2704ms versus the Arduino Uno taking 4212ms. Very good so far.
Update! The team at akafugu have been experimenting with overclocking the Akafuino-X. And also check out the errata page.
So there you have it, another contender in the Arduino-compatible board stakes. Considering the extra I/O, PWM and bus connectivity the Akafuino-X is a very capable board. I look forward to the evolution of the IDE and will return with the Akafuino-X in an upcoming project. And we also have one to give away. So stay tuned! In the meanwhile the Akafuino-X and other goodies are available directly from akafugu.jp.
Disclaimer – The parts reviewed in this article are a promotional consideration made available by akafugu.
Have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Discovering Arduino’s internal EEPROM lifespan
How long does the internal EEPROM of an Atmel ATmega328 last for? Let’s find out…
Updated 18/03/2013
Some time ago I published a short tutorial concerning the use of the internal EEPROM belonging to the Atmel ATmega328 (etc.) microcontroller in our various Arduino boards. Although making use of the EEPROM is certainly useful, it has a theoretical finite lifespan – according to the Atmel data sheet (download .pdf) it is 100,000 write/erase cycles.
One of my twitter followers asked me “is that 100,000 uses per address, or the entire EEPROM?” – a very good question. So in the name of wanton destruction I have devised a simple way to answer the question of EEPROM lifespan. Inspired by the Dangerous Prototypes’ Flash Destroyer, we will write the number 170 (10101010 in binary) to each EEPROM address, then read each EEPROM address to check the stored number. The process is then repeated by writing the number 85 (01010101 in binary) to each address and then checking it again. The two binary numbers were chosen to ensure each bit in an address has an equal number of state changes.
After both of the processes listed above has completed, then the whole lot repeats. The process is halted when an incorrectly stored number is read from the EEPROM – the first failure. At this point the number of cycles, start and end time data are shown on the LCD.
In this example one cycle is 1024 sequential writes then reads. One would consider the entire EEPROM to be unusable after one false read, as it would be almost impossible to keep track of individual damaged EEPROM addresses. (Then again, a sketch could run a write/read check before attempting to allocate data to the EEPROM…)
If for some reason you would like to run this process yourself, please do not do so using an Arduino Mega, or another board that has a fixed microcontroller. (Unless for some reason you are the paranoid type and need to delete some data permanently). Once again, please note that the purpose of this sketch is to basically destroy your Arduino’s EEPROM. Here is the sketch to download.
If you are unfamiliar with the time-keeping section, please see part one of my Arduino+I2C tutorial. The LCD used was my quickie LCD shield – more information about that here. Or you could always just send the data to the serial monitor box – however you would need to leave the PC on for a loooooong time… So instead the example sat on top of an AC adaptor (wall wart) behind a couch (sofa) for a couple of months:
The only catch with running it from AC was the risk of possible power outages. We had one planned outage when our house PV system was installed, so I took a count reading before the mains was turned off, and corrected the sketch before starting it up again after the power cut. Nevertheless, here is a short video – showing the start and the final results of the test:
So there we have it, 1230163 cycles with each cycle writing and reading each individual EEPROM address. If repeating this odd experiment, your result will vary.
Well I hope someone out there found this interesting. Please refrain from sending emails or comments criticising the waste of a microcontroller – this was a one off.
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.


































