Arduino Leonardo: everything you need to know about the development board

Arduino has various boards, various flavors with which to satisfy different needs. One of the most popular development boards, along with the Arduino UNO, Is the Arduino Leonardo. This board with a programmable microcontroller hides one of the most powerful features of the board line when compared to one of its sisters.

Of course, this official board from the Arduino Foundation is compatible with all electronic components let's go showing in other posts. This will give you the freedom to combine the Leonardo plate with a multitude of components to create the most varied projects you can imagine.

What is Arduino Leonardo?

This Arduino Leonardo board it bears great similarities to the Uno, even in appearance. But you should not confuse them, since there are notable differences between the two ...

Technical characteristics, scheme and pinout

Arduino Leonardo Pinout

One of the main features that you should knowing about Arduino Leonardo is your pinout, that is, the pins or connections that you have. As you can see in the image above, it is not the same as the UNO Rev3 board. There are some differences between the quantity, limits, and buses.

On the other hand, you should also know their technical characteristics, which are summarized in:

  • Microcontroller: Atmel ATmega32u4 at 16 Mhz.
  • RAM memories: 2.5 KB
  • EEPROM: 1 KB
  • Flash: 32 KB, but you have to subtract 4 KB used for the bootloader.
  • Operating voltage: 5v
  • Input voltage (recommended): 7-12v
  • Input voltage (maximum limit): 6-20v
  • Digital I / O pins: 20, of which 7 are PWM.
  • Analog input pins: 12 channels.
  • Current intensity per I / O pin: 40mA
  • Current intensity for pin 3.3v: 50mA
  • Weight and measurements: 68.6 × 53.3mm and 20 grams.
  • Price: € 18 - € 20 approximately. You can buy it on Amazon.

Datasheets

As is often the case with official Arduino boards, there are a large number of schematics, data and documentation in this regard, even to be able to create a board derived from it as it is open-source. From the official website of the project, you can find a lot of information to download about Arduino Leonardo and thus know better how it works. For example:

Differences with other Arduino boards

Arduino boards

The ideal is to compare it with the most similar plate, and that is Arduino UNO Rev3. Yes you compare Arduino Leonardo to UNO, you can see many similarities, but also differences that are vital if you have doubts between buying one or the other.

Physically it seems to have the same dimensions and same number of pins. In addition, they are arranged in the same way. The power supply is also the same, and even the frequency provided by the frequency generator. Also the A0-A5 could be configured as digital with the function pinMode (pin number, mode). Where is the difference then?

Well, one of the main differences between both development boards is in the microcontroller. While UNO is based on ATmega328, Arduino Leonardo is based on ATmega32u4 in their most recent revisions. In the case of the ATmega328, it does not have built-in USB communication, so a converter is required for that serial port. Function that the integrated circuit ATmega16u2 does.

In the case of the ATmega32u4, it does have that USB communication already implemented, so that second chip is not necessary. That, at a practical user level it makes a difference. When you connect the board Arduino UNO, a virtual COM port is assigned for communication. While in Leonardo the plate is recognized by the computer as if it were a USB device such as a mouse or keyboard. This gives the possibility of using mouse and keyboard functions.

Of course, having another MCU also varies some memory data. Of the 32 KB flash of Arduino UNO with 0.5 KB reserved for the bootloader it goes to 32 KB and 4KB used by the bootleader in Leonardo. For SRAM it goes from 2 KB to 2.5 KB and for EPROM it remains the same in both.

Another difference lies in the channels of the analog inputs. While in Arduino UNO It only has 6 channels, in the Arduino Leonardo it has with 12 channels. That's for A0-A5, and for pins 4, 6, 8, 9, 10, and 12 that would correspond to channels A6-A11.

Regarding PWM, Leonardo has one more than ONE. In addition to the same ones for ONE, another is added to pin 13. The rest will be the same for both cards, that is, it will be on pins 3, 5, 6, 9, 10 and 11.

You will find more differences in the I2C communication. Both can use TWI, but the difference is where the pins intended for the serial data line or SDA and clock line or SCL. In UNO they are on pins A4 and A5. But in Leonardo you have them in 2 and 3 respectively. Slight difference, but enough that UNO's hats or shields are not fully compatible with Leonardo.

With regards to SPI communication, In the Arduino UNO you have pins 10, 11, 12, and 13, for the SS, MOSI, MISO and SCK signals respectively. This is not the case on the Leonardo, as it has a specific ICSP connector, a 6-pin male connector near one end of the card. Another reason that could make UNO shields not worth it ...

For external interruptions there are also some changes. In UNO you have two pins for it, pin 2 (interrupt 0) and pin 3 (interrupt 1). In the case of Arduino Leoanrdo they extend to 5 pins. They are pins 3, 2, 0, 1, and 7 for interrupt 0, 1, 2, 3, and 4 respectively.

There is also another change between the two plates that many tend to forget, and it is the type of USB cable required to connect both boards to the PC. While in UNO an AB cable is used, in Leonardo an A-microB is needed.

In short, in the following difference table you can see more details:

 SUMMARY OF THE DIFFERENCES ARDUINO UNO vs. ARDUINO LEONARDO

A

Leonardo

MCU

ATmega328

ATmega32u4

Analog inputs

A0, A1, A2, A3, A4, A5

A0, A1, A2, A3, A4, A5, 4, 6, 8, 9, 10, 12

PWM outputs

3, 5, 6, 9, 10, 11

3, 5, 6, 9, 10, 11, 13

I2C communication

A4, A5

2, 3

SPI communication

10, 11, 12, 13

ICSP connector

External interruptions

2, 3

3, 2, 0, 1, 7
Flash Memory

32 KB

(0.5 KB for the bootloader)

32 KB

(4 KB for the bootloader)

SRAM

2 KB

2.5 KB

EEPROM

1 KB

1 KB

Arduino IDE and programming for Leonardo

Screenshot of Arduino IDE

To program Arduino Leonardo, as with the rest of Arduino boards, you can do it from different platforms such as macOS, Windows and Linux. That's thanks to the fact that your development environment Arduino IDE it is available for those platforms.

For more information about the programming to start with this board, I advise you to download our free PDF course for Arduino IDE. The truth is that Leonardo has no greater mystery to start creating sketches. You just have to take into account the differences for the connections and select the correct board in the Arduino IDE menu to load the program.

That is, open Arduino IDE, go to Tools> Boards> Select Leonardo… And start enjoying the projects that you create on your own or those that we have been publishing on Hwlibre.com. I repeat, the language and codes will be the same, the only thing you should pay attention to is those variations that I have mentioned in the I / O pins and their functions ...


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.