Arduino Day

Saturday was the 8th World Arduino day. Events were held all over the globe including one here in London. Unfortunately I had other commitments so could not attend.

But it seemed a good day to do some experiments with Arduino boards. I recently was given an Arduino Mega by Tariq Ahmad from Element14 and I thought I’d put it through it’s paces. I was under the impression that the Mega was more powerful than the Uno as I knew people were using it for 3D printer controllers.

My first thought for a challenging test for it was to run some Fast Fourier Transforms on some audio signals and use the output for controlling the mouth of a puppet. I did not have any convenient way of getting audio into the Arduino so abandoned idea and instea implemented a mathematical calculation. The day after I spotted that an electret would have worked for the input as Cabe Atwell had done a very impressive Birthday cake with blow out candles project for Arduino day.

Calculating big numbers

The early Arduinos are 8bit which is fine for most things but not so good for accurate calculators. I found the “BigNumbers” library which uses 256bit numbers.

I used it with the example code to calculate first 200 factorials.

On the Mega this complete in 3.14s and the Uno 3.13s.
I adjusted the code so it does not show the results and this brought the numbers to Mega 0.75s and Uno 0.75s

I was slightly puzzle as I was not getting faster results from the Mega so I moved onto their second example of calculating E to 50 decimal places.


The Mega completed this in 353mS and the Uno 349mS.
So I looked at the processors used by each of the boards, the Mega is a ATmega2560 and the Uno a ATmega328p. Looking at the data sheets the ATmega328p is fractionally faster than the ATmega2560 at 20 MIPS to 16 MIPS. This is consistent with my results.


I also tried the same code on the Trinket M0 and that performmed a lot better with E calculated in just 98mS.

Unfortunately in the process I needed to reflash the Trinket and seem to have changed the behaviour of the Trinket in that it’s no-longer talking to the LCD screen. I’m now getting an error 5 which is apparently due to the I2C device not responding correctly. The suggestion is to use a bus analyser to see what is going on. I believe I can use the PicoScope to do this and I’ve just bought myself an isolator and powered hub so that I can protect the PC from my rogue circuits.

Leave a Reply

Your email address will not be published. Required fields are marked *

 characters available