Recently the Arduino Leonardo was released, and I’ve finally got my hands on one. Some have claimed that the Leonardo as the successor to the Arduino Uno board, however that is somewhat subjective. In this article we have a look for ourselves and examine the differences between the Uno boards that we’re used to and the new Leonardo.
Here it is unwrapped from the cardboard packet:
It uses the same physical footprint as the Uno, so no surprises there:
Now to travel around the board and see what’s new. First is the microcontroller – we have the Atmel ATmega32U4:
There are several pros and cons to using the 32U4. The pros include:
- More analogue inputs. As well as the usual A0~A5, digital pins 4,6,8,9,10 and 12 can be configured as A6~A11
- It handles USB. So no more external USB controller MCU or the old FTDI chip. Supposedly this saves money, however the retail price in some markets don’t reflect this
- More PWM pins – well one more. They’re now on D3, 5, 6, 9, 10, 11 and 13
- There is a little more SRAM than the Uno, it is now 2.5 kB
- SPI has moved – they’re now wired to the ICSP pins. So you now have D10~D13 seperate to SPI
- SPI has moved – they’re now wired to the ICSP pins. So if you have any shields that use SPI – too bad, they’re out. The most common example of this will be Ethernet shields – you’ll need to modify them with some jumper leads to contact the ICSP pins
- I2C has moved over to D2+3. So if you have any shields using I2C – they’ll need to be modified
- Less flash memory – the bootloader uses 4 kB of the 32 kB flash (the Uno used 0.5 kB)
However you can get an adaptor shield to use older Arduino shields with the Leonardo.
Since the Leonardo does not have a dedicated chip to handle serial communication, it means that the serial port is virtual– it’s a software routine, both on your operating system, and on the Leonardo itself. Just as your computer creates an instance of the serial port driver when you plug in any Arduino, the Leonardo creates a serial instance whenever it runs its bootloader. The Leonardo is an instance of USB’s Connected Device Class (CDC) driver.
This means that every time you reset the board, the Leonardo’s USB serial connection will be broken and re-established. The Leonardo will disappear from the list of serial ports, and the list will re-enumerate. Any program that has an open serial connection to the Leonardo will lose its connection. This is in contrast to the Arduino Uno, with which you can reset the main processor (the ATmega328P) without closing the USB connection (which is maintained by the secondaryATmega8U2 or ATmega16U2 processor).
There are some other changes to the board. Moving on, the next change is the USB socket. Do you recognise this socket?
Yes – micro USB. Thankfully (!) a growing number of mobile phones use this type for charging and USB connection, so you may already have a matching cable. Note that the Leonardo doesn’t include a cable, so if you’re an iPhone user – order yourself a cable with your Leonardo.
Next, the LEDs have been moved to the edge of the board. You can see them in the above image to the right of the USB socket. No more squinting through shields at strange angles to check the TX/RX lights. However this isn’t a new invention, our friends at Freetronics have been doing this for some time. Furthermore, the reset button has been moved to the corner for easier access.
There are also seperate connectors for the I2C bus – next to AREF, which should make modifying existing shields a little easier:
Finally, due to the reduction in components and shift to SMD – there is what could almost be called a large waste of space on the board:
A few extra user LEDs wouldn’t have been a bad idea, or perhaps circuitry to support Li-Po rechargeable batteries. However the argument will be “that’s what a protoshield is for”. Just saying… As for the rest of the hardware, the specifications can be found here.
Finally, the Leonardo is available in two versions – with and without headers. This makes it easier to embed the Leonardo into fixed applications as you can directly solder to the various I/O pins. An alternative to this would instead be the Freetronics LeoStick, as it is much smaller yet fully compatible.
First – you need to drag yourself into Arduino IDE v1.0.1. Note you can run more than one version of the IDE on the same machine if you don’t mind sharing the same preferences file. Next, the Leonardo doesn’t reset when you open the serial monitor window (from arduino.cc) -
That means you won’t see serial data that’s already been sent to the computer by the board, including, for example, most data sent in the setup() function. This change means that if you’re using any Serial print(), println() or write() statments in your setup, they won’t show up when you open the serial monitor. To work around this, you can check to see if the serial port is open like so:Arduino
12 // while the serial stream is not open, do nothing:while (!Serial) ;
Using the 32U4, you also have two serial ports. The first is the emulated one via the USB, and the second is the hardware UART on digital pins 0 and 1. Furthermore, the Leonardo can emulate a USB keyboard and mouse – however with a few caveats. There is a section on the Leonardo homepage that you should really read and take note of. But this emulation does sound interesting, and we look forward to developing some interesting tools to take use of them, so stay tuned.
There is nothing wrong with the Leonardo board, it works as described. However you could consider this a virtual “line in the sand”, or a new beginning. Due to the changes in the pinouts shields will need to be redesigned, and for those of you still programming in Arduino v23 – it’s time to get up to speed with v1.0.1. If you need the special USB functions, keyboard and/or mouse emulation, or are happy with the changes and can get one for less than the cost of a Uno – great.
Here’s a video from the main man Massimo Banzi:
However if you’re looking for your first Arduino board – this isn’t the board for you right now. There are too many incompatible shields out there, and the inability to cheaply replace the microcontroller will see some beginners burn out their first couple of boards rendering them useless. Get yourself an Arduino Uno or compatible board such as the Freetronics Eleven.
In conclusion, classifying the Leonardo board as good or bad is not a simple decision. It may or may not be an improvement – depending on your needs. Right now – for beginners, this is not the board for you. For those who understand the differences between a Uno and Leonardo, sure – no problem. Frankly, I would get a LeoStick instead. At the end – it’s up to you to make an informed decision.
Latest posts by John Boxall (see all)
- Kit Review – JYE Tech DSO138 Digital Storage Oscilloscope - April 2, 2015
- Tutorial – Using DS1307 and DS3231 Real-time Clock Modules with Arduino - December 1, 2014
- Tutorial – L298N Dual Motor Controller Modules and Arduino - November 25, 2014