Arduino: Difference between revisions

From Leo's Notes
This page was last edited on 27 November 2022, at 21:11.
arduino types
mNo edit summary
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Programming the Arduino Mini/Nano ==
Arduino is a opensource hardware and software company that design cheap single board microprocessor boards in various sizes. Most boards use Atmel based microprocessors but some newer models feature ARM and Intel processors. The Arduino ecosystem is vast and there are countless opensource libraries available to interface with different components.
You can use a regular Arduino Uno or Duemilanove to program an Arduino Mini. To do so:


# Connect GND and VCC from the Arduino Uno/Duemilanove to the Arduino Mini/Nano
The official boards from Arduino's website are more expensive than the Chinese clones that are found on eBay.
# Pull the Atmega 328 microprocessor from socket on the Arduino Uno/Duemilanove
 
# Connect RX (Pin 0), TX (Pin 1), Reset (RST) from the Arduino Uno/Duemilanove to RXI, TXO, RST pins on the Arduino Mini/Nano respectively.
==Programming the Arduino Pro Mini==
[[File:Arduino Settings for Pro Mini.png|alt=Arduino Settings for Pro Mini|thumb|318x318px|Arduino Settings for Pro Mini]]
 
=== With a USB UART adapter ===
The USB UART adapter should ideally have a DTR pin which is used by the Arduino to automatically reset the device for the bootloader to receive code and also for the device to reset after the upload is complete.
[[File:UART Wiring for Arduino Pro Mini.jpg|alt=UART Wiring for Arduino Pro Mini|left|thumb|140x140px|UART Wiring for Arduino Pro Mini]]
Connect the USB UART adapter to the Arduino Pro Mini board using the wiring in the table below. Ensure that the settings in the Arduino IDE is also set appropriately as pictured on the right.
 
I wasted a lot of time trying to diagnose why the uploads weren't working because I set the board to "Arduino Mini" rather than "Arduino Pro or Pro Mini". With the incorrect setting, the Arduino resets but code is never actually uploaded.
{| class="wikitable"
!Arduino Pro / Pro Mini
!UART
|-
|DTR (labeled on reverse side of PCB)
|DTR
|-
|TX
|RX
|-
|RX
|TX
|-
|GND
|GND
|-
|Vcc
|5V
|}
 
=== With another Arduino board ===
If you don't have a USB-UART adapter, you can use a regular Arduino Uno or Duemilanove to program an Arduino Mini with these steps.
 
#Connect GND and VCC from the Arduino Uno/Duemilanove to the Arduino Mini/Nano
#Pull the ATmega 328 microprocessor from DIP socket on the Arduino Uno/Duemilanove board
#Connect RX (Pin 0), TX (Pin 1), Reset (RST) from the Arduino Uno/Duemilanove to RXI, TXO, RST pins on the Arduino Mini/Nano respectively.


Then program the Arduino as you normally would while making sure that the board selected in the Arduino IDE is set to the Arduino Mini or Nano.
Then program the Arduino as you normally would while making sure that the board selected in the Arduino IDE is set to the Arduino Mini or Nano.
Line 10: Line 43:
If you're having issues uploading, make sure the settings look like the image below.
If you're having issues uploading, make sure the settings look like the image below.
<gallery>
<gallery>
Arduino_Uno_to_Mini_Connection.png|Arduino Uno/Duemilanove to Mini Connection
File:Arduino Uno to Mini Connection.png|Arduino Uno/Duemilanove to Mini Connection
Arduino_Mini.png|Arduino Settings
File:Arduino Mini.png|Arduino Settings
</gallery>
</gallery>


=== Types ===
==Types==
==== Arduino Nano ====
There are various types of Arduino boards. The ones I have are listed below.
[[File:Arduino-nano.jpg|thumb|right|200px|Arduino Nano with a MEGA328P]]
Nanos have the USB mini connector for power and serial. These are typically around $2.25 USD each.
 
==== Arduino Mini ====
Not all Arduino Minis from eBay have the same microprocessor. Some have the Atmel Atmega168 while others have the Atmega328. The differences are listed in the following table.
{| class="wikitable centered right"
{| class="wikitable centered right"
! Parametrics !! Atmega168 !! Atmega328
!Parametrics!!ATmega168!!ATmega328
!ATmega 32U4
!ATmega2560
|-
|-
! Memory Size (flash)  
!Memory Size (flash)
| 16 KB || 32 KB
|16 KB||32 KB
|32 KB
|256 KB
|-
|-
! CPU Speed      
!CPU Speed
|colspan="2"| 20 MIPS
| colspan="2" |20 MIPS
| colspan="2" |16 MIPS
|-
|-
! SRAM Size      
!SRAM Size
| 1024 bytes || 2048 bytes
|1024 bytes||2048 bytes
|2560 bytes
|8192 bytes
|-
|-
! EEPROM/HEF Size  
!EEPROM/HEF Size
| 512 bytes || 1024 bytes
|512 bytes|| colspan="2" |1024 bytes
|4096 bytes
|-
|-
! Operating Voltage 
!Pin Count
|colspan="2"| 1.8v - 5.5v
| colspan="2" |32
|44
|100
|-
|-
! Operating Temperatures  
!Operating Voltage
| -40C to 150C || -40C to 85C
| colspan="2" |1.8v - 5.5v
|2.7v - 5.5v
|1.8v - 5.5v
|-
!Operating Temperatures
| -40C to 150C|| colspan="3" |-40C to 85C
|}
|}


Without looking too closely, these two boards look identical but with a different microprocessor.
 
===Arduino Duemilanove===
Duemilanove is Italian for 2009. This is the first Arduino I obtained and comes with an ATmega168 in a DIP package.
 
===Arduino Nano===
Nanos have the USB mini connector for power and serial. These are typically around $2.25 USD each.[[File:Arduino-nano.jpg|thumb|200px|Arduino Nano with a MEGA328P|alt=|none]]
===Arduino Pro Mini===
Not all Arduino Pro Minis from eBay have the same microprocessor. Some have the Atmel ATmega168 while others have the ATmega328. The differences are listed in the following table.
 
Without looking too closely, these following two boards look identical but actually has a different microprocessor.
<gallery>
<gallery>
Arduino-mini168.jpg|Mini Atmega168
File:Arduino-mini168.jpg|alt=Pro Mini ATmega168|Pro Mini ATmega168
Arduino-mini328.jpg|Mini Atmega328
File:Arduino-mini328.jpg|alt=Pro Mini ATmega328|Pro Mini ATmega328
</gallery>
</gallery>


While the differences are slight, the Atmega 168 does have half the memory capacity and EEPROM size.
While the differences are slight, the ATmega168 has half the memory capacity and EEPROM size.


== Arduino and Raspberry Pi Serial Integration ==
===Arduino Mega 2560===
Arduino Mega has an Atmel ATmega2560 as the main microprocessor as well as a secondary Atmel ATmega 16u2 driving the UART. These cost about $18 USD each.
 
The ATmega 16u2 microprocessor can be updated with a different firmware to make this Arduino appear as a USB HID device (such as making the Arduino appear as a USB keyboard). This is done by making the Arudino enter DFU mode and then uploading a new firmware with a utility called Flip. You can learn more at the [[Arduino Mega 2560|Arduino Mega]] page.
 
[https://store.arduino.cc/usa/mega-2560-r3 https://store.Arduino.cc/usa/mega-2560-r3]
 
==Arduino and Raspberry Pi Serial Integration==
[[File:Pi-arduino-uart.png|350px|thumb|right|Arduino to Raspberry Pi Connection]]
[[File:Pi-arduino-uart.png|350px|thumb|right|Arduino to Raspberry Pi Connection]]
To make the arduino talk directly to the Pi via the UART pins, keep in mind that the arduino communicates at 5v while the Raspberry Pi can only work with 3.3v.
To make the Arduino talk directly to the Pi via the UART pins, keep in mind that the Arduino communicates at 5v while the Raspberry Pi can only work with 3.3v.


A possible hack is to run the arduino at 3.3v rather than 5v and then connect:
A possible hack is to run the Arduino at 3.3v rather than 5v and then connect:
* Arduino Pin 0 (RXI) to Raspberry Pi Pin 8 (UART0_TXD)
 
* Arduino Pin 1 (TXO) to Raspberry Pi Pin 10 (UART0_RXD)
*Arduino Pin 0 (RXI) to Raspberry Pi Pin 8 (UART0_TXD)
*Arduino Pin 1 (TXO) to Raspberry Pi Pin 10 (UART0_RXD)


This gets around needing to step up/down the voltages from 3.3v to 5v since everything will be at 3.3v.
This gets around needing to step up/down the voltages from 3.3v to 5v since everything will be at 3.3v.


If everything works, you should be able to talk with the arduino via the serial device. See [[Raspberry_Pi#UART_Serial|the Raspberry Pi Serial page]]
If everything works, you should be able to talk with the Arduino via the serial device. See [[Raspberry_Pi#UART_Serial|the Raspberry Pi Serial page]]
 
==Neat Projects==
Some neat projects using the Arduino
 
*Arduino MEGA Logic Analyzer - http://www.soasystem.com/eng/amla/
*328eForth - [https://playground.arduino.cc/CommonTopics/ForthOnArduino/ https://playground.Arduino.cc/CommonTopics/ForthOnArduino/], https://github.com/DRuffer/328eforth


[[Category:Arduino]]
[[Category:Arduino]]
[[Category:Tinkering]]{{Navbox Tinkering}}
{{Navbox Tinkering}}
[[Category:Tinkering]]

Latest revision as of 21:11, 27 November 2022

Arduino is a opensource hardware and software company that design cheap single board microprocessor boards in various sizes. Most boards use Atmel based microprocessors but some newer models feature ARM and Intel processors. The Arduino ecosystem is vast and there are countless opensource libraries available to interface with different components.

The official boards from Arduino's website are more expensive than the Chinese clones that are found on eBay.

Programming the Arduino Pro Mini

Arduino Settings for Pro Mini
Arduino Settings for Pro Mini

With a USB UART adapter

The USB UART adapter should ideally have a DTR pin which is used by the Arduino to automatically reset the device for the bootloader to receive code and also for the device to reset after the upload is complete.

UART Wiring for Arduino Pro Mini
UART Wiring for Arduino Pro Mini

Connect the USB UART adapter to the Arduino Pro Mini board using the wiring in the table below. Ensure that the settings in the Arduino IDE is also set appropriately as pictured on the right.

I wasted a lot of time trying to diagnose why the uploads weren't working because I set the board to "Arduino Mini" rather than "Arduino Pro or Pro Mini". With the incorrect setting, the Arduino resets but code is never actually uploaded.

Arduino Pro / Pro Mini UART
DTR (labeled on reverse side of PCB) DTR
TX RX
RX TX
GND GND
Vcc 5V

With another Arduino board

If you don't have a USB-UART adapter, you can use a regular Arduino Uno or Duemilanove to program an Arduino Mini with these steps.

  1. Connect GND and VCC from the Arduino Uno/Duemilanove to the Arduino Mini/Nano
  2. Pull the ATmega 328 microprocessor from DIP socket on the Arduino Uno/Duemilanove board
  3. Connect RX (Pin 0), TX (Pin 1), Reset (RST) from the Arduino Uno/Duemilanove to RXI, TXO, RST pins on the Arduino Mini/Nano respectively.

Then program the Arduino as you normally would while making sure that the board selected in the Arduino IDE is set to the Arduino Mini or Nano.

If you're having issues uploading, make sure the settings look like the image below.

Types

There are various types of Arduino boards. The ones I have are listed below.

Parametrics ATmega168 ATmega328 ATmega 32U4 ATmega2560
Memory Size (flash) 16 KB 32 KB 32 KB 256 KB
CPU Speed 20 MIPS 16 MIPS
SRAM Size 1024 bytes 2048 bytes 2560 bytes 8192 bytes
EEPROM/HEF Size 512 bytes 1024 bytes 4096 bytes
Pin Count 32 44 100
Operating Voltage 1.8v - 5.5v 2.7v - 5.5v 1.8v - 5.5v
Operating Temperatures -40C to 150C -40C to 85C


Arduino Duemilanove

Duemilanove is Italian for 2009. This is the first Arduino I obtained and comes with an ATmega168 in a DIP package.

Arduino Nano

Nanos have the USB mini connector for power and serial. These are typically around $2.25 USD each.

Arduino Nano with a MEGA328P

Arduino Pro Mini

Not all Arduino Pro Minis from eBay have the same microprocessor. Some have the Atmel ATmega168 while others have the ATmega328. The differences are listed in the following table.

Without looking too closely, these following two boards look identical but actually has a different microprocessor.

While the differences are slight, the ATmega168 has half the memory capacity and EEPROM size.

Arduino Mega 2560

Arduino Mega has an Atmel ATmega2560 as the main microprocessor as well as a secondary Atmel ATmega 16u2 driving the UART. These cost about $18 USD each.

The ATmega 16u2 microprocessor can be updated with a different firmware to make this Arduino appear as a USB HID device (such as making the Arduino appear as a USB keyboard). This is done by making the Arudino enter DFU mode and then uploading a new firmware with a utility called Flip. You can learn more at the Arduino Mega page.

https://store.Arduino.cc/usa/mega-2560-r3

Arduino and Raspberry Pi Serial Integration

Arduino to Raspberry Pi Connection

To make the Arduino talk directly to the Pi via the UART pins, keep in mind that the Arduino communicates at 5v while the Raspberry Pi can only work with 3.3v.

A possible hack is to run the Arduino at 3.3v rather than 5v and then connect:

  • Arduino Pin 0 (RXI) to Raspberry Pi Pin 8 (UART0_TXD)
  • Arduino Pin 1 (TXO) to Raspberry Pi Pin 10 (UART0_RXD)

This gets around needing to step up/down the voltages from 3.3v to 5v since everything will be at 3.3v.

If everything works, you should be able to talk with the Arduino via the serial device. See the Raspberry Pi Serial page

Neat Projects

Some neat projects using the Arduino