Arduino UNO is the most popular Arduino board. It is a microcontroller based on the ATmega328p which can be programmed with open source software such as Arduino IDE (most commonly used). The Arduino UNO is easy to use and it has a very low barrier for anyone interested to learn about electronics. Most of the projects I have shown so far on my blog are based on Arduino UNO, so take a look at some of them to get some ideas!
Specifications and Features of an Arduino UNO
Number of pins and types of pins:
Digital I/O Pins: 14
*6 of these support PWM: 3, 5, 6, 9, 10, 11
Analog input pins: 6
PWM pins: 6
Number of ground pins: 4
Communication: capable via UART, I2C, SPI
Power can be provided to the Arduino UNO via barrel plug, input voltage pin, or USB. The I/O pins operate at 5 volts and support a maximum current of 20 mA per I/O pin. Input voltage through the input voltage pin is 7 volts – 12 volts.
Main Processor: ATmega328P 16 MHz
USB-Serial Processor: ATmega16U2 16 MHz
RAM size: 2048 bytes.
It’s key to know / remember that many pins could be use for multiple purposes. For example pin A1 can be used as an analog pins or a digital pin, and pin 6 can be used as a simple digital pin or a PWM pin.
Programming Arduino UNO
Step one to be able to programming your Arduino UNO is to download Arduino IDE. To do so, go to the Arduino website and download the software: https://www.arduino.cc/en/software.
You can also see reference materials on basic functions on the following link: https://www.arduino.cc/reference/en/, although sometimes it’s easier to see some examples, likes the ones I have in this channel, like the following:
- How to read RFID tags with RC522
- How to use the MPU6050 Accelerometer and Gyroscope
- How to use the A4988 Stepper Motor Driver
- Soil Moisture sensor with Arduino
Once you have downloaded and installed Arduino IDE (Integrated Development Environment), open the software. It should look as shown on the next image. This is where you will write your Arduino code. The main purposed of Arduino IDE is to write Arduino code, compile Arduino code, and upload Arduino code. Click on any of the examples above to see how Arduino IDE gets used on different projects. Once the code is ready to upload to your Arduino board, you can do so by connecting the Arduino board to your computer via USB cable and them uploading the code through Arduino IDE.
Examples on using the different types of pins in the Arduino UNO
Arduino Digital I/O Pins:
The typical Arduino UNO digital pins are pins 0 through 13. One of the ways then can be used are to read a digital input and write a digital output.
Reading a digital input:
Reading a digital input means reading the input voltage of the signal connected to the I/O pin and determining if such signal is “High” or “Low”. For the Arduino UNO, “High” means any voltage greater than 2 volts, and “Low” is any voltage lower than 0.8 volts.
A simple example on this is pushing a button to trigger an action. You can see this in my example on the use of a 2N2222 transistor, which basically powers a bright LED whenever a button is pushed. In this case the pushing of the button is read by the Arduino UNO either as “Low” when the button is not pushed, or as “High” when the button is pushed.
Writing a digital output:
Writing a digital output means using the digital I/O pins to set the voltage of the that pins and in turn cause a desired action to take place. The voltage of such I/O pins will either be 0 volts for “Low” or 5 volts for “High”. Using the same example above, I can use the Arduino UNO to set a specific pin to “High” (so to 5 volts) whenever the Arduino UNO detects that the push button was pushed. In the case of the example above, this 5 volts were going to the base of the transistor, which in turn caused it to power the LED, causing it to flash.
As mentioned before, some pins can be used as PWM pins. PWM stands for Pulse Width Modulation, which allows for controlling the length of a recurring pulse signal, with the objective of outputting a specific voltage between 0 volts and 5 volts. This can be super helpful when you need the Arduino to provide you with a specific voltage instead of a simple “Low” of 0 volts or “High” of 5 volts. As mentioned before, the pins that allow pulse width modulation are pins 3, 5, 6, 9, 10, 11, which, if you look at the Arduino UNO board, are the ones marked with a “~” sign.
The analog pins are used to read electric signal that can range from 0 volts to 5 volts. Once an analog signal (within the voltage range of 0-5 volts) is read by the Arduino, it will be converted to a digital scale that goes from 0 to 1,023. So, as you can see, this can be helpful whenever you want to read the value of a signal instead of the ‘Low” or “High” that the digital input pins provide. A basic example is when you want to measure the level of something with a sensor. This goes beyond low level or high level. You want to know the level, right? Two examples of this are measure the level of water in a container with a water level sensor or measuring the level of moisture in soil with a soil moisture sensor. Examples of both are listed below:
Communication with I2C Pins:
The Arduino UNO supports three main communication protocols: UART, I2C, and SPI. The UART pins are 0 and 1m for RX (reception pin) and TX (transmission pin), both used for serial communication. I2C pins are at the very top of the right side (SCL and SDA). A good example of a sensor using I2C is the MPU6050 Accelerometer and Gyroscope. Finally the SPI pins are 10 through 13 on the right side as shown on the image.
Getting started with Arduino
At first, it can seem daunting to get started with Arduino, but you don’t have to jump in with a mega project. Start with a simple example (there are many on this blog and all over the internet!). Once you start, increasing the difficulty of projects is simply one more step on the never ending learning process!