Today I am gonna start a series of Arduino tutorials on all the parts in the Arduino Starter Kit from Marginally Clever Robots
Arduino is a popular open-source electronics platform for hobbyists and students to easily build their own electronics project. You can hook up a lot of electronic modules ranging from all kinds of sensors to actuators, and program software (we call it firmware here) for it.
We assume you have already know some basic electronics knowledge (including current, voltage, resistor, capacitor and something like that, if you don't know, don't worry too much, just take 10 minutes googling that) before you read this tutorial. In this tutorial, you will learn about the basic concepts of Arduino and how to program with it to control LED lights using Arduino IDE.
Step 1: Arduino Uno Board Hardware
The figure shows a typical Arduino board for beginners, it's called Uno. Here are a list of basic things you need to know before we start experiment with it (I skipped some not-usually used parts which I may introduce in the tutorials later.)
0. ATmega328p Micro-controller
It's a widely used 8-bit micro-controller made by one the largest chip company Atmel
An 8-bit micro-controller like this can do a lot things such as sensor data reading, drive some motors to move or show some text on a LCD screen. But it is much less powerful than your desktop computer or your smart phone. It cannot do face-recognition or some heavy-computation tasks like that on it (you can use a Raspberry pi if you wanna do something like that).
The micro-controller will only function with certain circuit and components connected to it. And the Arduino has already got that on the board. You can see those tiny capacitors and resistors on it which I won't introduce too much about in this tutorial.
1. Digital pins
These 14 pins can be used as digital I/O (input / output) port. By 'digital', it basically means that it can produce 0/1 signals. 0 is low level voltage, usually 0 volts, and 1 is high level voltage, usually 5 volts. By using the 0/1 signal properly, we can do a lot things which will be introduced later. And some of the digital pins have 'extra' functionalities such as producing PWM signal, serial communication and etc. which will be introduced in details in later tutorials.
These pins can both output digital signals and input (read) digital signals. It can also produce (output) 'analog' signal in a PWM way which will be introduced in later tutorials.
2. Analog read pins
These 6 pins can be used as analog reading ports. It can read voltage level from 0 to 5V 'continuously' (actually it's roughly 4.9 mV per unit and it has 1023 units in total).
3. Power jack
You can use a 2.1 mm plug DC adapter with 7~12 volts voltage. You don't need that if your Arduino has already been plugged in with the USB cable to your computer.
4. Power pins
Vin: If you don't use 2.1 mm power jack or USB, you can power the board with a power source which has 7~12 volts voltage. And don't forget to connect the GND port (ground, 0 volt) to your power source as well.
You can get 3.3V and 5V output from the 3.3V and 5V port respectively with a maximum current of 50 mA.
You can use a USB A-to-B cable, one side plugged into this port and the other to your computer. The computer can 'talk' to the Arduino and power it through this USB port. You can write program on your computer and upload that to the Arduino, which we will talk about later.
6. Reset button
Every time you push the reset button, the Arduino will run the program in it from the beginning.
Step 2: Arduino Software: Program With Arduino IDE
Arduino IDE is a software environment which allows you to write program for your Arduino board and upload the program to it. It is open-source and free, you can use it with Windows, Mac OS X or Linuxe and you can download it from the official website: https://www.arduino.cc/en/Main/Software
1. Plug the USB cable as shown in the picture.
2. Open the IDE software, and select tools, make sure choose Arduino Uno for both the 'port' and 'board'. The selection for port might vary for different operation system, it usually contains 'Arduino' or 'usb' something like that in the choice you need to select.
3. Let's try an example, select File > examples > 01 Basics > Blink
4. Click the 'tick' button on the left up corner to verify the correctness of the program. Then click the 'up arrow 'which is the upload button. (Or you can click upload button directly without click verify button, it will automatically do the verify before uploading.)
5. After one or two seconds you can see the yellow LED light blinking. Yay! It's working!
If you unplug the USB, and then plug in either USB or any other power supply (2.1 mm power jack or Vin and GND on board), the blinking is still working. Since the firmware (the program example you just uploaded) is already in it and it won't go away unless you upload new firmware to it.