• Skip to primary navigation
  • Skip to main content

Adduino

Addunio Covers Everything about arduino boards

  • Home
  • Arduino

Upload Hex file on Arduino using AVRDUDE (Programming AVR Boards)

January 10, 2021 by yasinzaii

In this tutorial, you will learn exactly what AVR DUDE is? How to install it? and how to upload a HEX file on any Arduino board or AVR Microcontroller using AVRDUDE.

First lets get into the details of AVRDUDE!

AVRDUDE:

AVRDUDE is an acronym for AVR downloader uploader. It is an open-source software used to program AVR microcontrollers. You can also use it to program EEPROM, Flash memories, and even fuse and lock bits.

AVRDUDE is available as a Command-line program and you will have to type in commands to perform read, write or verify operations.

AVRDUDE also has an interactive mode called terminal mode. This mode allows you to enter interactive commands to display and modify various device memories, perform a chip erase, and much more. We will discuss it with examples later in this tutorial.

There are also some 3rd party GUI packages that are handy if you are not comfortable with the command-line. however, the command-line program is more preferred and you can easily automate the build process using makefile which we will discuss in the upcoming tutorial.

AVRDUDE can be used effectively via the command-line to read or write the on-chip memories they include EEPROM, flash memory, fuse bits, lock bits, and signature bytes.

If you want to upload a hex file to the flash memory of your microcontroller you can easily do it using the command line. On the other hand, the Interactive terminal mode makes it easier if you are exploring memory contents, modifying individual bytes of EEPROM, or programming fuse/lock bits.

AVRDUDE Options:

Avrdude provides you many options and functionalities which can be listed in the command-line. Let’s discuss the most common options that are more commonly used. You should note that these options are case sensitive.

-C (Config-file)

– (capital)C is used to specify the config file for configuration data. The file contains all the programmer and microcontroller definitions that are supported by AVRDUDE. If you have a programmer or a microcontroller that Avrdude doesn’t know about you can add the details of its configuration in this file.

In Windows, it searches for the config file in the folder where AVRDUDE is installed. We will also see how to install AVRDUDE later in this tutorial.

-c (programmer-id)

-(small)c tells AVRDUDE about the type of programmer that is used to program the microcontroller. AVRDUDE knows about several common programmers so use this option to specify which one you are using. For each of the supported programmer, the programmer-id parameter is listed in the configuration file.

For a complete list of programmers type “avrdude -c help” in the command line. You will see a complete list of programmers that are supported by the AVRDUDE. Here help is just some nonsense parameter to get it to spit out the list of programmers.

-p (Part id)

-(small)p tells AVRDUDE about the type of microcontroller that is connected to the programmer. Its parameter must be the Part ID listed in the config file. Here are the part-id’s of the microcontrollers that are supported by the AVRDUDE.

PRT IDuC NAMEPRT IDuC Name
c128AT90CAN128m32ATmega32
pwm2AT90PWM2m324ATmega324
pwm3AT90PWM3m328ATmega328
1200AT90S1200m3290ATmega3290
2313AT90S2313m48ATmega48
2333AT90S2333m64ATmega64
2343AT90S2343 (*)m640ATmega640
4414AT90S4414m644ATmega644
4433AT90S4433m649ATmega649
4434AT90S4434m6490ATmega6490
8515AT90S8515m8ATmega8
8535AT90S8535m8515ATmega8515
m103ATmega103m8535ATmega8535
m128ATmega128m88ATmega88
m1280ATmega1280t12ATtiny12
m1281ATmega1281t13ATtiny13
m16ATmega16t15ATtiny15
m161ATmega161t2313ATtiny2313
m162ATmega162t25ATtiny25
m163ATmega163t26ATtiny26
m164ATmega164t45ATtiny45
m169ATmega169t85ATtiny85

For a full list of Supported Devices type “avrdude -c arduino -p help” in the command-line. Here help is just some nonsense parameter to get it to spit out the list of supported microcontrollers.

-b (Baud Rate)

– (small)b option overrides the serial communication baud rate, specified for that programmer in the configuration file.

-P (Port)

– (capital)P is used to identify the port to which the programmer is connected. I will tell you how to identify this port later in this tutorial.

-v (verbose Output)

– (small)v option enables verbose output. When you enable this command you will see extra information about the command that you have executed.

-U memtype:OP:filename:format

– (capital)U specifies the memory operation to be performed. Let’s discuss the different parameters that this option takes.

This option takes various parameters, “memtype” specifies the memory type to be programmed, “op” defines the operation to be performed, ”filename” is the source or destination file to be read or written to, and “format” parameter specifies the format of the file.

memtype:

AVRDUDE supports various memory types present on the microcontroller. The memtype parameter is used to specify the type of on-chip memory to be programmed. These are the memtypes that can be accessed by the AVRDUDE.

  • eeprom: The EEPROM of the device.
  • efuse: The extended fuse byte.
  • flash: The flash ROM of the device.
  • fuse: The fuse byte in devices that have only a single fuse byte.
  • hfuse: The high fuse byte.
  • lfuse: The low fuse byte.
  • lock: The lock byte.

OP:

The OP parameter specifies the type of operation to be performed. This field takes a single character that can be “r”, “w” or “v” for read write or verify operations.

  • r: read the specified device memory and write to the specified file
  • w: read the specified file and write it to the specified device memory
  • v: read the specified device memory and the specified file and perform verify operation.

filename:

The filename parameter specifies the name of the file to read or write. You should also specify the extension of the file along with the file name.

format:

The format parameter is optional and contains the format of the file to read from or write to. Possible values of this parameter are “i, s, r, and a”. The details of each of these format are provided in this slide. The Intel HEX format is the most popular and is commonly used among them.

  • i: Intel Hex
  • s: Motorola S-record
  • r: raw binam
  • m: immediate mode
  • a: auto detect

This was an overview of AVRDUDE we will use all of these option in AVRDUDE examples tutorial given below. Let’s see how to install AVRDUDE first.

How to Install AVRDUDE ON Windows:

In the second part of this article, I will also tell you to install AVRDUDE on your windows computer.

If you have Arduino IDE installed on your Windows PC then for sure you have AVRDUDE already installed on your computer. You can verify it by opening the command prompt and typing “AVRDUDE” there.

Type “command prompt” in the search field on the taskbar and open it by pressing enter. Then type “avrdude” there.

If you see this message

“‘avrdude’ is not recognized as an internal or external command, operable program or batch file.“

Then AVRDUDE Is not installed on your machine and you should follow this tutorial to install AVRDUE on your machine.

On the other hand, if you see a list of available options for AVRDUDE when you type it in the command prompt. Then it means that AVRDUDE is already installed on your computer and you can just use it to upload programs onto your Arduino Boards.

Lets See how to install AVRDUDE:

Open this link and downlead the software from here AVRDUDE ZIP.

Go to C drive or any other drive you like. Make a new folder with the Name “AVRDUDE” and copy the zip file to this folder.

Extract the contents of the zip file to this folder. There should be two files “avrdude.exe” and “avrdude.conf“. The First file is the executable AVRDUDE program whereas the second is the configuration file for AVRDUDE. Which contains the definitions of all programmers and microcontrollers supported by the software.

Next, you have to add this folder to the path variable. To do this go to your desktop and right-click on “This PC“. Then click on properties.

Click on the advanced system settings on the right. A window will pop up showing you the “System Properties”.

Click on the environment variables button in the lower right corner. In the system variable section, you will see a variable named “path”. Select the variable and click on edit.

Click on the new button paste the path and click ok. Now, the program path is set in the environment variables and the installation is complete.

To very the successful installation of AVRDUDE, open the command prompt again and type “AVRDUDE”. if you see a list of all the options associated with AVRDUDE then your AVRDUDE program is all set and running.

Now you can use this program to flash Arduino boards and AVR microcontrollers.

There is also another method by which you can install AVRDUDE on your windows machine. AVRDUDE is also included in WINAVR Toolchain. This toolchain includes open source software development tools for AVR microcontrollers.

You can also download and install WinAVR toolchain. It has AVR-GCC compiler along with other tools that will help you compile and generate hex files from your code. We will have complete tutorials on how to use these tools in the upcoming posts.

AVRDUDE In Action:

In the third part of this tutorial, we will see how to use AVRDUDE for performing different operations.

How to use AVRDUDE in interactive Mode:

AVRDUDE interactive mode is very handy if you want to read and write to the fuse, lock bits, or chunk of memory. To go into the interactive mode type AVRDUDE in the command prompt. Then type the programmer-id that you are using. In my case, I am using Arduino Uno board as an ISP programmer so that’s why I have typed “avrisp“.

Next, you have to provide the name of the microntroller chip you are working with. I am programming Arduino Pro Mini and it has an “atmega328p” microcontroller chip so I have used “m328p” for this option.

You also have to provide the serial com port on which the Arduino is connected. You can easily find the comport from the device manager.

Go to the search field in the taskbar, type “device manager” and press enter. You will see the list of all the connected devise. Expand the “Ports” section you should see the COM port for your Arduino board. In my case, it’s COM8, so I have mentioned it using the -C (dash Captical C ) option.

Let’s talk about the baud rate now. Most of the programmers have baud rate specified in the “avrdude.config” file. In my case, I am using ARDUINO UNO as an ISP programmer with a baud rate of 19200. The baud rate is not set correctly for “avrisp” in the config file in my case and the default baud rate doesn’t work as demonstrated.

There are two solutions to this problem lets discuss both of them.

First, I can override the default baud rate by using the -b option and giving the program the correct baud rate of 19200. This will work and the program as demonstrated here.

Or I can add the baud rate information in the config file. It is also very easy to do so let’s do it. Open the config file and search for “avrisp” as this programmer does have the baud rate specified like some of the others. Let’s give it a baud rate of 19200 and save and close the file. It will work as well as shown.

Finally, type “-t” to take the Arduino into interactive mode. AVRDUDE will then verify the device signature to check if the right device is connected. You will see “avrdude>” which shows that AVRDUDE is now in terminal mode.

Yes! it works like a charm. You can now type help to see all the available commands in the interactive mode as shown below.

  • dump: dump memory : dump
  • read: alias for dump
  • write: write memory : write …
  • erase: perform a chip erase
  • sig: display device signature bytes
  • part: display the current part information
  • send: send a raw command : send
  • parms: display adjustable parameters (STK500 only)
  • vtarg: set (STK500 only)
  • varef: set (STK500 only)
  • fosc: set (STK500 only)
  • sck: set (STK500 only)
  • spi: enter direct SPI mode
  • pgm: return to programming mode
  • verbose: change the verbosity
  • help: help
  • ?: help
  • quit: quit

How to read the values of efuse, hfuse, lfuse, and lock byte in the interactive mode?

To read the values of the fuses type the read command followed by the fuse name. Let’s demonstrate it for efuse first. Type read and then type efuse and press enter. You can see that the value of efuse is set to 0xfd. Similarly, let’s demonstrate it for the other fuse and lock bytes.

  • read efuse : To read the extended fuse byte.
  • read hfuse: To read the high fuse byte.
  • read lfuse: To read the low fuse byte.
  • read lock: To read the lock byte.

How to write the values of efuse, hfuse, lfuse and lock byte in the interactive mode?

let’s see how can we write a new value to the efuse. I will write the same value on to the Atmel atmega328p because I don’t want to change the fuse settings of my Arduino Pro Mini. However, we will discuss in detail what each fuse and lock bits do and we will change them to change the settings of the AVR microcontroller.

To write to fuse byte, type “write” followed by the fuse name in my case it’s efuse, then type the address as it’s only a single byte so the address will be 0x0000, and finally type the 8-bit hex value, I have chosen 0xff.

You can then read the contents of the efuse again in order to very the changes. I don’t want to change the settings of my Arduino Pro Mini so I will change the efuse byte back to 0xfd. But I future tutorials we will learn about each fuse bits and we will change them.

  • write efuse 0x0000 0xfd
  • write hfuse 0x0000 0xda
  • write lfuse 0x0000 0xff
  • write lock 0x0000 0x3f

How read the flash memory in the interactive mode?

You can easily read chunks on memory in the interactive mode. Lets read 8 byte of flash memory from address 0x0000 to 0x0008. Simply in terminal type “read” then type “flash” and then type the start address followed by the number of bits you want to read, in my case its 8.

When you press enter you will see contents of the flash memory for those addresses on the terminal.

  • read flash 0x0000 8
  • read flash 0x0040 16

How read the EEPROM memory in the interactive mode?

Just like the flash memory, you can read the contents of EEPROM memory in the interactive mode by typing write and then EEPROM followed by the starting address and the number of bits. You will see the contents of EEPROM for those addresses on your terminal.

  • read eeprom 0x0000 8
  • read eeprom 0x0010 4

How to use AVRDUDE:

Now lets see how can we use AVRDUDE to read and write from Arduino.

How to Upload HEX file on Arduino using AVRDUDE?

You can easily upload any HEX file on Arduino any of your Arduino boards using AVRDUDE. To do this task write type AVRDUDE in the command prompt then specify the programmer-id (in my case its AVRISP), next type the microcontroller-id (I am using arduino pro mini so its m328p in my case). After than mention the port and baud rate for me the port is COM8 and the baud rate is 19200.

Then type -U to specify that you are doing a memory operation and then flash colon w to specify that it’s a write operation then colon file name (in my case file name is adduino.hex) and finally type a colon followed by “I” to specify that its an intel hex file.

  • avrdude -c avrisp -p m328p -P com8 -b 19200 -U flash:w:adduino.hex:i

This is a simple blink program where the yellow led is connected to Pin 8 of my Arduino Pro Mini board. Here is my setup, I am using Arduino Pro Mini board as ISP programmer and it is connected to Arduino Pro Mini using the SPI communication module. The yellow led is connected to PB0 or Pin 8 of Arduino Pro Mini.

How to Download the program from Arduino Flash Memory using AVRDUDE?

You can also easily download the contents of the flash memory using avrdude. To perform this task type -U to specify the memory operation and then type flash followed by colon then “r” then the output file name and then colon “i”.

  • avrdude -c avrisp -p m328p -P com8 -b 19200 -U flash:r:adduinoDownload.hex:i

You will then find a HEX file named “arduinoDownload” in the current folder. This is the hex code that we have downloaded from Arduino Pro Mini board.

How to Download the data from Arduino EEPROM using AVRDUDE?

You can also easily download the contents of the EEPROM using avrdude. To perform this task type -U to specify the memory operation and then type eeprom followed by colon then “r” then the output file name and then colon “i”.

  • avrdude -c avrisp -p m328p -P com8 -b 19200 -U flash:r:adduinoEEPROM.hex:i

You will then find a HEX file named “arduinoDownload” in the current folder. This is the EEPROM data in the intel hex format that we have downloaded from Arduino Pro Mini board.

I hope that you have learned a lot from this tutorial. Keep intouch because we will be discussing more interesting topics very soon.

Filed Under: Uncategorized

Arduino Pro Mini Board Schematics 100% Explained

January 3, 2021 by yasinzaii

Arduino Pro Mini board is widely used in embedded systems because this board only has the necessary onboard components with a small form factor and low power consumption. In this article, you will learn about Arduino Pro Mini board Schematics and the use of each and every component on this board.

Schematics of arduino pro mini fully explained

The schematic of the Arduino Pro Mini is shown in the Figure given below. It is a fairly simple board with minimal onboard components. Go through the figure thoroughly because we will be explaining the working of every onboard component.

Complete schematic diagram and circuit of arduino pro mini. atmega328p
Arduino Pro Mini Board Schematic Diagram

This is the schematic diagram of the Arduino Pro Mini board manufactured by Sparkfun. There are also other good manufacturers of Arduino Pro Mini boards and their schematics are almost the same. On the other hand, the schematics for low-cost Chinese clones are also very similar, with minor differences and I will discuss those differences at the end of this tutorial.

Now lets discuss each and every component on this board.

Voltage Regulator Circuit:

Arduino Pro Mini has an onboard 3.3 or 5 volts voltage regulator depending on the board type. The 3.3-volt regulator converts 4-12 volts input into 3.3 volts output and the 5-volt regulator converts 6-12 volts into 5 volts output. The voltage regulator circuit is handy if you want to drive your Arduino Pro Mini from an unregulated voltage source. The voltage regulator circuit is shown in the Figure given below.

The onboard components of Arduino Pro Mini for the voltage regulator circuit is shown on the left and the voltage Regulator circuit is shown on the right.

Raw Pin:

The input to the voltage regulator is labeled as Raw (as shown in the schematics on the right) and is accessible through the RAW Pin on the Arduino Pro Mini board (as shown in the top right corner in the Figure above). Here is the link to the complete pinout diagram of Arduino Pro Mini. This Pin is used to power Arduino Pro Mini with an unregulated voltage source. This input voltage is then converted into 3.3 or 5 volts depending on the board type.

C19 Capacitor:

C19 is the 10uF smoothing capacitor that is connected to the raw input of the voltage regulator. This capacitor removes small voltage ripples and fluctuations at the input of the voltage regulator and makes it more stable.

Therefore, if your voltage source has small high-frequency voltage variations then these fluctuations will be removed by the C19 capacitor.

Voltage Regulator:

Arduino Pro Mini boards use linear voltage regulators because these regulators very cheap but they are also very inefficient. A linear regulator regulates the output voltage by changing its resistance according to the input voltage and the applied load. To make it more simple consider a linear regulator as a voltage divider where the regulator internal resistance is continuously changed with respect to the load inorder to maintain a steady voltage of 5 V or 3.3 volts at the output.

For Example: if the voltage at the raw input is increased the resistance of the regulator increases accordingly to maintain 5 Volts at the output of the voltage regulator. Similarly, if the load resistance is decreased (in other words, the load drawn by the board is increased by maybe interfacing a sensor with Arduino), then the resistance of the regulator will decrease to maintain a constant voltage drop at the output.

You might be thinking how much power will be wasted by the regulator ?

Well, you can calculate the amount of power dissipated by the regulator if you know the output current from the regulator (Iout). You can calculate this power using the formlua.

Power Dissipated = (Vraw – Vout)*Iout

The atmega328p generally consumes around 20mA of current and if you are using a 9-volt battery to power the board then the voltage regulator is wasting 60mWatts of power in the form of heat.

Power Dissipated = (9 – 5)*20mA = 60 mWatts

Following are the common voltage regulator that can be found on Arduino Pro Mini

  • 3.3V:
    • Voltage regulators: KB33 , S20K , F34V , L0RA , L0RB
  • 5V:
    • Voltage regulators:  KB50 , L05 , L0UA , L0UB

The Sparkfun board uses a MIC5205 regulator which should accept input voltage up to 16 volts. However, I will not recommend applying more than 12 volts at the RAW pin or Arduino Pro Mini, because incase of cheap Chinese boards the smoothing capacitors at the input are usually rated up to 12 volts, and applying voltage above 12 volts will burn and short the capacitor.

For powering 3.3 volts Arduino pro mini 4.5 – 6 volts is a sweet spot and for 5 volts Arduino 6 – 7.5 volts is a nice choice. This is because the voltage drop across the regulator will be small and less power will be dissipated by the regulator.

R11 and Led1:

LED1 is just used to indicate that the Arduino is being powered and the 10KOhm resistor R11 (O1C) is used to limit the current through the Led. Generally, SMD LEDs have a 1.8-3.3 voltage drop which means it will typically consume 0.17mA-0.32mA current for a 5-volt board.

(5-1.8)/10000 – (5-3.3)/10000 = 0.32mA – 0.17mA

I have a Chinese clone and the Power Led has a 1KOhm resistor so the current should be 3.2mA-1.7mA in my case.

Soldering Jumper (SJ1):

Arduino Pro Mini from Sparkfun provides this solder jumper to provide you the flexibility to connect or disconnect the onboard voltage regulator and the power LED from the Vcc line.

This is very handy because if you want to power Arduino Pro Mini directly from a 3.3-volt or 5-volt external source you can easily do it by desoldering the jumper connection. This will cut off the supply to the onboard voltage regulator and power led and it helps to save power from dissipating in the regulator and the power led.

The SJ1 is on the top of the board next to the GND and RST pins. To isolate the regulator from VCC, remove the solder blob on the top of the board with a sucker or solder wick.

The cheap Chinese Arduino Pro Mini boards doest provide this jumper. So, you will have to desolder the onboard voltage regulator if you want to save power.

You can still power the Arduino directly from Vcc with the voltage regulator output still connected to the Vcc line. It will not impact the performance of your microcontroller but you will waste a few milliamps of current.

Decoupling Capacitors (C13 , C10, C3):

Decoupling capacitors are used to suppress high-frequency noise from the voltage signal. They suppress tiny voltage variations, which could otherwise be harmful to delicate ICs.

It acts as a very small, local power supply for IC’s to replenish the temporary voltage spike at the Vcc input of the IC. This is actually pretty common, especially when the circuit it’s powering is constantly switching its load requirements. Decoupling capacitors can briefly supply power at the correct voltage and should be connected very close to the IC. This is why these capacitors are also called bypass caps because they can temporarily act as a power source, bypassing the power supply.

Decoupling capacitor’s main purpose is not to get rid of the power supply’s ripple, but to catch glitches. An IC may need much extra current for a short time, for instance when thousands of transistors switch at the same time. The inductance of the PCB’s traces may prevent fast delivery of current to the IC. So decoupling capacitors are used as local energy buffers to overcome this.

You can use two or more different-valued, even different types of capacitors to bypass the power supply because some capacitor values will be better than others at filtering out certain frequencies of noise.

Arduino Pro Mini Decoupling Capacitors

Now, Let’s discuss the decoupling capacitors used in Arduino Pro Mini. The capacitor C13 is a 10uF tantalum electrolyte capacitor whereas the Capacitor C10 and C3 is a 0.1uF ceramic capacitor. The ceramic capacitor is mounted very close to the Vcc pin whereas the tantalum electrolytic capacitor is a bit far from the atmega328p chip.

This is because the 0.1uF ceramic capacitor is very effective in bypassing high-frequency spikes that arise due to the fast switching of the atmega328p. Therefore it should be as close to the IC as possible for the availability of steady voltage. On the other hand, the 10uF tantalum electrolytic capacitor is effective in removing the comparatively big dips and variations.

Auto Reset Circuit:

If a logic low voltage is applied at the reset pin of atmega328 for a minimum pulse width the microcontroller will reset. The voltage on this pin should be converted back to Vcc (5V or 3.3V depending on the board type) so that the atmega328 can start executing the bootloader program.

The Minimum pulse width on RESET Pin is mentioned to be 2.5us on the datasheet. So the reset pin should be turned low for at least 2.5us in order to confirm that the microcontroller goes into the reset state.

The reset Circuit is shown in the Figure given below.

Auto Reset Circuit Arduino Pro Mini

The bootloader program will detect if we are trying to upload a new program onto the atmega328p and it will upload a new sketch onto the microcontroller. Otherwise, it will start executing the program that is stored in the flash memory.

Now let’s discuss, How this auto-reset circuit works.

The DTR pin is used by the FTDI programmer for programming atmega328p using the UART module. This pin is turned low by the FTDI programmer to upload a new program and keeps this pin In low state while the program is uplaoding.

The pullup resistor R2 keeps the RESET pin at a logic high level and there is no charge stored in the capacitor so the voltage drop across the capacitor is 0. When the FTDI programmer applies logic low at the DTR pin the voltage a the RESET pin becomes 0 which resets atmega328p. The voltage gradually starts increasing at the RESET pin as the capacitor charge and the microcontroller goes into bootloader mode to upload a new sketch on the board.

Oscillator Circuit:

The Arduino Pro Mini board comes with an onboard oscillator which can be an 8MHz or 16MHz oscillator depending on the Arduino Pro mini-board voltage. The majority of the pro mini board has an onboard ceramic oscillator and there are few Arduino pro mini boards with a crystal oscillator.

Ceramic resonators are constructed from high stability piezoelectric ceramics. Featuring built-in load capacitance, these SMD ceramic resonators eliminate the need for external load capacitors. With a low profile and small package size, these ceramic resonators offer an economic use of space and the opportunity for high-density mounting.

In the case of a ceramic capacitor, you will just have to connect the oscillator directly with the pins without worrying about external capacitors as we do in the case of crystal oscillators. The following figure is helpful in illustrating this idea.

schematic diagram of arduino pro mini ceramic ossilator
The Onboard Ceramic Oscillator On Arduino Pro Mini Board

Following are the oscillators that can be found on Arduino Pro Mini

  • 3.3V Board:
    • Oscillators: 80e. , 80'0
  • 5V Board:
    • Oscillators: R160JAC6s , 16.000-30 , A1 , A'N , A'a

I2C Pullup Resistors:

This schematic diagram shown below is of the Arduino Pro Mini board from Sparkfun and they provide optional pullup resistor pads for the I2C module that are provided at the back of the Arduino Pro Mini board.

schematic diagram of I2C pullup resistor
I2C Pullup Resistor Pads for Arduino Pro Mini

You will have to solder SMD resistors by yourself if you wish to have the pullup resistors onboard. The cheap Chinese Arduino Pro Mini board doesn’t have any onboard pull-up resistors or pads for the I2C communication module. In that case, you will have to connect the pullup resistor externally.

Led at SCK:

There is a built-in led connected to pin 13 (SCK) of the Arduino Pro Mini board. This is the SCLK pin (Atmega328 pin 17) for the SPI module. It will blink when your Arduino pro mini is communicating using the SPI protocol. I will also blink when you are uploading a sketch onto the Arduino pro mini when it is connected to an SPI programmer.

Led Connected to Pin 13 of Arduino Pro Mini

It is Pin13 of the Arduino Pro Mini board and the famous and basic led blink sketch (Program) uses this pin and it blinks this onboard Led.

C1 at AREF Pin:

AREF is the analog reference pin and we will discuss it in the upcoming tutorials. The capacitor C1 is there to reduce noise on the AREF pin.

Arduino Pro Mini Clones:

I have a Chinese clone of Arduino Pro Mini and it has an onboard diode. The input of the diode is connected to the RAW pin and the output is connected to the input of the voltage regulator.

the reverse protection diode that i found of my arduino pr mini

This is for reverse protection and it is used to protect your Arduino board from reverse voltage. In absence of this diode, the input tantalum capacitor will become short if a reverse voltage is applied and It will probably short the voltage source.

Almost all of the clones have similar schematics and they are equally capable and it use them all the time.

I hope you learned a lot from this tutorial. Keep in touch because I will share more interesting and informative tutorials.

Filed Under: Arduino

Introduction to Arduino Pro Mini (AVR Atmel Atmega328p)

December 23, 2020 by yasinzaii

Arduino Pro Mini is a small microcontroller board that uses the popular AVR Atmel Atmega328p microcontroller chip just like its other variants popular variants like Arduino UNO and Arduino Nano.

The capability of this microcontroller board is equal to Arduino Uno because it contains the same Atmega328p microcontroller chip. The small size and low prices for this borad are the main factors making it more attractive when compare to the bulky and costly Arduino Uno board.

introduction to arduino pro mini atmega328p

Arduino Pro Mini Board Variants

There are two very popular versions of arduino pro mini boards they include

  • 3.3 board with 8MHz onboard crystal oscillator
  • 5V board with 16MHz onboard crystal oscillator

The 5V version of Arduino Pro mini has 5 Volts regulator and 16MHz crystal oscillator clock on the board whereas the 3.3 Volts version of Arduino pro mini has 3.3 volts voltage regulator with an 8MHz onboard crystal oscillator.

You can checkout the following topics for more information on arduino voltage Regulator.

  • Difference between 5 Volts and 3.3 Volts Arduino Pro Mini boards.
  • How to identify if my Arduino boards support 5 volts or 3.3 volts.
  • Can I apply 5Volts on a 3.3 volt Arduino Pro Mini board?

Pin diagram of Arduino Pro Mini Board

The complete, detailed, and cross-verified Pin Diagram of Arduino Pro Mini Board is given in the Figure below. Note the light green represents the associated pin number on the chip. The complete description for each color is provided in the table on the right.

complete pinout, pins and pin diagram of Arduino pro mini board with avr atmel atmega328p microcontroller
Complete Pinout (Pin diagram of Arduino Pro Mini Board) Atmega328p

Features of Arduino Pro Mini Board

Following are the features of Arduino pro mini board:

14 digital I/O pins:

There are 14 digital I/O on this board and out of these 14 Pins 6 can be used for PWM output. These pins are clearly marked in the Pin Description Figure that we checked above. You can also find it in the table given below. Pin 0 and 1 can also be used for serial communication using the UART protocol. Two timers T0 and T1 are associated with digital I/O Pin 4 and Pin 5 of the board. Furthermore, Pin 2 and Pin 3 have hardware dedicated interrupt capability however you can use any of the 14 digital I/) pins as interrupts that we will discuss in the future tutorials.

Function associated with 14 digital I/O Pins of Arduino Pro Mini.
Functions associated with Digital Pins of Arduino Pro Mini

8 Analog Pins:

The SMD Atmel328p chip on this board has 8 channel ADC which can be used for interfacing 8 different analog sensors at the same time. Furthermore, the Analog input Pin A4 and A5 can also be utilized for the I2C communication protocol. Additionally, the first 6 Analog pins can be used as interrupts.

8 Analog Pins Description Arduino Pro Mini

On board Voltage Regulator:

Arduino Pro Mini has either 3.3 volts voltage regulator or 5 volts voltage regulator. Voltage Regulator provides you the flexibility to power your Arduino Pro Mini boards using 5 to 12 volts unregulated voltage source.

Clock Frequency:

The 3.3 volts version of the Arduino pro mini board has an 8MHz onboard oscillator whereas, the 5-volt version has a 16MHz oscillator. Majority of the Arduino Pro Mini boards uses ceramic oscillator however, I have also seen Arduino Pro mini boards with a crystal oscillator. More info on oscillators will be discussed in the upcoming tutorials.

No USB Port:

Arduino Pro Mini Doesn’t come with a USB port and there no onboard programmer on this chip. Therefore you will have to program it using an external USB to TTL programmer.

No Soldered Connectors:

When you buy this board there will be no connectors soldered to the board. This actually provides you the flexibility to solder only those pins that are required for your project making your circuit more compact.

Built in Led:

There is a built-in LED connected to the SPI serial clock (SCLK, Pin 13) of Arduino pro mini. This LED will blink when Arduino Uno is connected to an SPI programmer (Like UBSASP). However, you can also use it as a digital input or output Pin.

Features of Atmega328p Microcontroller:

32KB Flash Memory:

Atmega328 has 32KB of flash memory and it is used to store the program on the board. This is nonvolatile memory which means when power is lost the code (program) that we have flashed remains there and the program will again start executing when the power is restored.

1KB of EEPROM:

The Atmega328p Chip comes with 1KB of Electrically Erasable read-only memory. This memory can be utilized for storing data over time by the microcontroller. It is a nonvolatile memory which means the data stored in the EEPROM will stay there even if the power is lost.

1KB of RAM:

The Atmega328p Microcontroller has 2KB of SRAM. This memory is used by the program while it is executing. The information on is memory is lost when the power is turned off. When the power is restored the program starts executing from the beginning and the contents of RAM are repopulated again.

32 8-bit Register

This Chip has 32 8-bit general-purpose registers. More information about the atmega328 architecture and program execution will be covered in the upcoming tutorials.

arduino pro mini project

Software Required to program Arduino Pro Mini:

There are 2 methods by which you can program arduino pro mini.

The Easy Way:

The easiest way to program Arduino pro mini is by using the opensource Arduino IDE (integrated development environment). This software includes a compiler to convert your C code in binary and an uploader (avrdude) to upload the hex binary file onto the board.

My Favorite Way:

You have to compile the code separately using Avr-Gcc compiler to generate the executable file and then using Avr-ObjCopy to convert it into HEX file. Finally, Avrdude is used to upload the Hex file onto the board. Furthermore, Arduino IDE itself uses Avr-Gcc and Avrdude to compile and upload program onto the board.

How to connect Arduino Pro Mini to Computer:

In order to program the board, you will have to connect Arduino pro mini with the computer via a USB. However, this board doesn’t have any USB port and onboard programmer. So you need a USB to serial converter or another Arduino board serving as a programmer.

You can program Arduino pro mini using the following three methods.

  1. Programming Arduino Pro Mini via SPI port using a USBASP programmer.
  2. Programming Arduino Pro Mini via SPI port using another Arduino Uno or Mega board.
  3. Programming Arduino Pro Mini via USART using an FTDI, USB to TTL serial module.
arduino pro mini intro. project atmega328p

Pin Description:

Lets talk about the different pins on the Arduino Pro mini board.

GND Pins:

GND Pins provide ground connections to the different sensors interfaced with the Arduino Pro Mini board and All of these pins are shorted together. To power Arduino Pro Mini with an external power source, connect the negative terminal of the battery to any of the ground pin.

Raw Pin:

This pin is used to power the Arduino pro mini and you can connect this pin to an unregulated power supply between 5 to 12 volts.

Vcc Pin:

These pins are connected to the output of the onboard voltage regulator. You can use them to power sensor or actuator modules. These pins can also be used to power your Arduino Pro Mini board however the voltage to the power source should be fixed 5V or 3.3V depending on the type of Arduino Pro Mini board.

PWM Pins:

The pins labeled as 3,5,6,9,10 and 11 provide PWM output functionality. This will comes in handy for controlling the speed of a motor or for producing analog outputs using this board.

Analog Pins:

Arduino Pro Mini has 8 analog pins labeled as A0 to A7. These pins are used to input analog signals to the microcontroller. The analog input applied on these pins is converted into a 10-bit digital value using its internal ADC.

Reset Pin:

This reset pin is connected to the reset button on the board. This pin will reset the microcontroller if a logic low voltage is applied for a short time. The program will start executing from the beginning after the microcontroller resets.

TXO & RXI Pins:

TXO & RXI pins are used by the internal USART module on the atmega328p chip and these pins can be used to interface Arduino pro mini with other devices using the UART protocol.

FTDI Header:

This header is used for programming the atmega328p using the USART module. These pins include TXO, RXI, DTR, Vcc, Gnd, and Gnd. The TXO and RXI are the same USART pins as discussed above. The Vcc and Ground Pins of the FTDI Header are used to power the Arduino pro mini using the FTDI programmer while uploading the code.

DTR Pin:

The Data-Terminal-Ready pin is used by the FTDI programmer to auto-reset the Arduino Pro Mini for uploading a new program on the board.

More discussion about the DTR pin will be discussed in Arduino Schematic post.

SPI Pins:

The SPI (Serial Peripheral Interface) Pins allows the microcontroller to communicate with sensors and other devices using the SPI protocol. They include Pin 10 (SS), Pin 11 (MOSI), Pin 12 (MISO), and Pin 13 (SCK) as shown in the pin diagram above

I2C Pins:

The analog Pins A4 and A5 are also connected to the I2C communication module. A4 is the serial data line (SDA) whereas A5 is the serial clock line (SCL). Using this protocol the data is sent on the SDA whereas SCL is used for clock synchronization.

More information about the I2C protocol will be discussed in the upcoming tutorials.

Schematic of Arduino Pro Mini:

The schematic of the Arduino Pro Mini is shown in the Figure given below. It is a fairly simple board with simple schematics. On the top right corner, you can see the schematics for the voltage regulator. This voltage regulator takes unregulated input voltage Vraw at the input and generates Vcc at the output.

Complete schematic diagram and circuit of arduino pro mini. atmega328p

The DTR pin is connected to the reset pin of the microcontroller through the auto-reset circuit which we will discuss in the upcoming tutorial. You can also see the crystal oscillator interfaced with the microcontroller.

Furthermore, an led is connected to pin 13 of the microcontroller. The schematic of Arduino pro mini will be fully explained in our upcoming tutorials.

Comparison of Arduino Pro Mini with Other Arduino boards:

Most of the Arduino boards come with a USB interface and onboard programmer making it easy to flash code onto the microcontroller program memory. But in case of Arduino Pro Mini, you will have to flash the Atmel atmega328p microcontroller chip using an external programmer.

The compact size of this board makes this device unique and more practical for using it in embedded systems and this also makes it incompatible with Arduino shields. Inorder to interface such shield you will have to hardwire them with the board.

What are the Applications in which we can use this board?

You can use this board in a wide variety of applications. The small form factor and ease of use make it stand out when compared to the other boards. You can use this board in the following applications.

  • Embedded Systems
  • IoT applications
  • Home Automation
  • Display Systems
  • Robotics

Filed Under: Arduino

Copyright © 2023 · Aspire Pro on Genesis Framework · WordPress · Log in