Arduinoare single-board microcontrollers that are easily programmable through a USB connection. They are used with electronics to design embedded system prototypes, the Internet-of-Things (IoT), and electronic gadgets.
Much like other microcontrollers, Arduino provides software-backed computing and embedded control to basic electronics applications. That means getting started with Arduino is no different than with other systems.
While working on Arduino, users can learn and work on electronics. To begin, an electronics workbench is recommended and a PC or laptop. For tips on setting up an electronics workbench, check out this tutorial:初学者指南建立电子实验室.
1.Breadboards, Micro or Mini Breadboards– to prototype circuits.
2.Breadboard Power Supply(Optional) – to supply power to breadboards through adaptor or USB.
3.Male-to-Male Jumper Wires– to make connection of Arduino pins with Breadboard and make connections between components on Breadboard.
4。Connecting Wires- 在面包板上建立组件之间的连接。
5.虫条连接器– to make connections of PCB modules on breadboard.
6. Wire Stripper- 剥离电线。
7.割绳– to cut wires and trim bug strip connectors.
8. Set of Tweezers– to hold components, and place or remove components on breadboard. It will be best to get a set of electrostatic tweezers.
9. Precision Screwdrivers– to calibrate pots, remove components on breadboards etc.
10. Protoboards or PCBs– to make permanent a breadboard circuit. Perf Boards or Strip boards can be used to quickly finalize a prototype design. For better finishing, a PCB can be designed for the prototype using a PCB design software and the entire circuit can be transferred to it.
11. Soldering Iron and Solder- 将焊料组件或PCB上的焊料组件，或PCB模块上的焊料虫条连接器。可以使用无铅或无铅焊料。尽管有铅焊料很容易使用，但无铅的焊料仍然可以安全。
12. Soldering Pump——修复焊接errors.
13. PCB Holder——持有多氯联苯在焊接的时候。
14. Tip Tinner– to keep soldering tip clean.
15. Copper Sponge– To clean soldering tip.
16. Assortment Kitof 1/4-Watt resistors,electrolyte and ceramic capacitors,potentiometer and variable resistors, andpush buttons
18. Multimeter– to measure voltage, current and resistance.
19.替补电源（可选） - 为面包板电路。可以从Arduino提供面包板电路3.3和5V电源。对于大于5V的电源，可以使用带有电压调节器IC的电池组。电源适配器或带面包板电源的USB电源也可以用于供电大于5V的动力面板电路。
In addition to the above tools, users will also need:
2.USB cable for programming Arduino boards
4。Arduino的电源 - 可以通过USB，电源适配器或电池组为Arduino板提供电源。这些板具有车载电压调节器，因此不需要外部电压调节器。
For advanced testing of circuits and signals, users may have oscilloscope and logic analyzer. However, these are unnecessary. It’s possible to get display devices, sensors, actuators, application-specific modules, and Arduino shields based on preferences.
Here are some commonly used display devices in embedded electronics and gadgets:
- RGB LED(s)
- LED Boards
- Graphic LCD/OLED
Here are the more popular sensors popular for electronics hobbyists:
- TMP36 Temperature Sensor
- LM35 Temperature Sensor
- Analog Microphone
- Digital Microphone
- Photoresistor (LDR)
- GUVA – S12SD Ultraviolet Light Sensor
- TCS34725 RGB Color Sensor
- Passive Infrared (PIR) Sensor
- BMP-080/BMP180/BMP280 Barometric Pressure Temperature and Altitude Sensor
- MCP9808 High Accuracy I2C Temperature Sensor
- ADXL335 Accelerometer Sensor
- IR Sensors
- Active/Passive Buzzers
- Soil Moisture Sensor
- MPU-6050 3轴加速度计和陀螺仪传感器
- MQ-9, MQ-8, MQ-7, MQ-6, MQ-5, MQ-4, MQ-3, MQ-2, MQ 135 Gas Sensors
- Proximity Sensors
- PH Sensors
- Load Cells
These actuators typically used for controlling mechanical systems:
- Brushed DC Motors
- Brushless DC Motors
- Servo Motors
- Stepper Motors
- Gear Motors
- AC Motors
- Linear Actuators
- Air Pumps
Some of the popular application-specific modules include the following –
- RFID Readers
- Camera Modules
- GSM-GPRS Modules
- QR Code Scanning Modules
- RTC DS1307
- Wi-Fi Modules
- 1Ethernet Shield
- Relay Shield
- GPS Shield
- Proto Shield
There are other thousands of sensors, sensor modules, actuators, application-specific modules, and custom-build shields. Engineers and hobbyists can choose based on the project requirement.
Most of the sensors or sensor modules operate on TTL voltages, which means they can easily interface with Arduino boards. The sophisticated modules, such as RFID or GPS, have serial communication interfaces that also communicate effortlessly with Arduino boards. Several actuators operate on higher voltages, however, which may lead to damaged control circuitry. So, they typically require additional external circuits or shields when controlled by the Arduino.
The Arduino shields are designed to fit in Arduino boards and may be providing a connectivity solution or ready-to-use embedded solution. Before beginning an Arduino journey, a few pre-requisite skills are necessary.
- Assembling and prototyping circuits on Breadboards.
- 熟悉使用万用表测量电压,咕咕叫ent, and resistance.
- Comfortable using Multimeter to test basic electronic components, such as testing continuity, diodes, and transistors.
- Soldering components and connectors on Protoboards and PCBs.
These skills are unnecessary but will provide an advantage:
- Etching and making PCBs
- Using Oscilloscopes and Logic Analyzer for testing circuits and signals
There are many Arduino and Arduino Pro boards. The most documented and used board is Arduino UNO. “Uno” means one in Italian and it is the first-ever Arduino board designed and supported by the company.
UNO uses AVR ATmega328P as the sitting microcontroller, which is clocked by a 16 MHz ceramic resonator. The major components on this microcontroller board are indicated in this image.
Arduino Uno在板载板上有两个微控制器，Atmega328p和Atmega16uc。ATMEL ATMEGA16UC是SMD微控制器，仅用于管理Atmega328p和计算机之间的USB通信。它不能用于控制嵌入式电子设备。
可以使用Arduino IDE轻松地通过USB电缆对Arduino进行编程。它还具有用于使用外部编程设备对两个控制器编程的ICSP标头引脚。如果损坏，可以更换Arduino Uno上的Atmega32p。但是，应该指出的是，替换微控制器可能不会带有引导加载程序。在这种情况下，可以将引导程序从Arduino IDE燃烧到控制器上。ATMEGA328P由16MHz晶体时钟。
The board can be powered by USB cable, AC-to-DC adaptor, or battery pack. The same USB cable that’s used to program the Arduino also supplies power to it. So, Arduino can be powered through a USB of a computer while programmed and the design is under testing.
Once programmed, it will need to be installed elsewhere. For instance, it can be powered through an AC-to-DC adapter or a battery pack. The adaptor or battery pack can be connected through a power connector of the board. The Arduino comes with an on-board voltage regulator, so it requires zero external voltage regulation circuit or device if it’s powered by a battery pack.
The Arduino UNO requires an operating voltage of 5V, although it can be input in a DC voltage ranging from 7 to 12V. It’s highly recommended to supply a voltage to the Arduino that’s close to its operating voltage, however, as any excess power supply will be wasted by the on-board voltage regulator.
In addition to the voltage regulator, Arduino has two capacitors to clean up any excess voltage.
1. Digital Input/Output– Arduino UNO has 14 digital I/O pins. Its analog input pins can also be used for digital I/O. So, there are 20 pins on UNO that can be used for digital input and output. All of these pins operate on TTL logic. The pins sense any input signal level between 2 and 5V as logical HIGH and any input signal level between 0 and 0.8V as logical LOW. Similarly, the pins output a voltage between 2.7 to 5V for logical HIGH and a voltage between 0 to 0.5V for logical LOW. Unconnected pins on the Arduino are in a hanging or floating state.
2. Analog Output– Arduino does not output any analog signal. Instead, it can output Pulse Width Modulated (PWM) signals that approximate to analog signals. Out of the 14 digital I/O pins, six pins (marked by tilde sign) can output PWM signals on the UNO. These pins are connections to six PWM channels of ATmega328P microcontroller.
3. Analog Input- Arduino Uno上有六个模拟输入引脚。这些引脚可用于感知传感器和传感器模块的模拟电压。ATMEGA328P具有8通道，10位ADC，因此销钉可以在10位分辨率下感知模拟电压。
4。Communication Interfaces– The ATmega328P microcontroller supports programmable serial USART (for peer-to-peer serial communication with a single device), two-wire serial interface (I2C/TWI for half-duplex serial communication with multiple devices) and master/slave SPI serial interface (for full-duplex serial communication with multiple devices). The digital I/O pins can also be used for peer-to-peer serial communication using a software serial that emulates the functioning of a hardware serial port.
5. ATmega328P Built-in Features– The ATmega328P microcontroller housed in Arduino UNO is a RISC (Reduced Instructions Set Computer) with an instruction set of 131 instructions, most of which have single-clock execution. It has 32, 8-bit registers and an On-chip, two-cycle multiplier. The microcontroller has 32 Kb in-system self-programmable flash memory that supports 10,000 write/erase cycles. It has 1Kb EEPROM that supports 100,000 write/erase cycles and 2Kb SRAM. The controller has two 8-bit Timer/Counters with separate prescaler and compare mode; one 16-bit Timer/Counter with separate prescaler, compare and capture mode; programmable watchdog timer with a separate On-chip oscillator, On-chip analog comparator and support for external interrupts at two pins.
Fritzing is an open-source hardware initiative that allows documenting prototypes. It can be used to design paper sketches, schematics, and PCB layouts of electronic circuits including circuits that involve Arduino. Once a design is final on Arduino, users can either document or make it permanent. It’s quite handy to design paper sketches and schematics using Fritzing.
Arduinobecame so popular, thanks to two of its aspects:
1.The ease of uploading programs to the microcontroller via a USB cable
This means even novice or non-engineers can productively use Arduino. Its programs can be written on any text editor or programming environment, provided they are saved as “.ino” files. The Arduino programs are called sketches as they’re meant as temporary firmware programs that can be replaced by others.
In fact, the Arduino can be loaded with sketches thousands of times. ATmega328P supports 10,000 write/erase cycles of flash memory. The ideal editor and programming environment for programming Arduino is the Arduino IDE.
The setup for Arduino IDE can be downloaded from the official website of Arduino (arduino.cc). The IDE is available for Microsoft Windows, Mac OS X, and Linux platforms. After installing the IDE, when it is launched, it looks like this…
At the top, it has main menus. Below the menus, there are function buttons, which serve to verify the sketch for syntax errors, upload a sketch to Arduino, create a new sketch, open or save a sketch, or open the serial monitor.
There’s also an editor area where users can write their Arduino sketches. At the bottom, there’s a debug console, where messages and errors are displayed when verifying or uploading the sketch.
In the preferences, users can:
- Choose a storage location for the sketches
- Set the editor language, font size, and interface scale
- Pick a theme for the IDE
- Select the output on compilation and upload via the debug console
- Use the checkboxes to display line numbers, enable code folding, verify code after upload, use the external editor, check for updates via the startup, save when verifying or uploading, or use the accessibility features.
If “display line numbers” is checked, line numbers will be visible in the editor area. It’s recommended this checkbox is selected as it will track programming errors by the line numbers. If “enable code folding” is checked, functions can be minimized in the editor area. This feature is useful to view the relevant parts of code. If “use external editor” is checked, sketches can be written using an external text editor, such as sublime text.
In the network tab of the preferences, users can also specify network settings so that Arduino IDE can connect with the Internet. By default, Arduino’s auto-detect proxy settings for Internet connectivity are on. Through the file menu, users can also access the sketchbook (this is the folder where the sketches are saved) and several sketch examples.
The tools menu has lots of useful features. Using “Auto Format,” users can automatically indent code. The “Archive Sketch” saves the sketch to an archive. If copying code from other sources, the “Fix Encoding & Reload” button will fix any encoding problems due to the code being written in a different programming environment.
From the tools menu, users can also open a serial monitor or serial plotter. It’s possible to select the target Arduino board. By default, the IDE automatically detects the board when it’s connected to the computer via a USB cable.
In the tools menu, it’s also possible to select the port that the Arduino board is connected to. By default, this is also automatically detected by the IDE when the Arduino board is connected to a computer. The tools menu also lets users select a programmer if uploading sketches through an external programming device.
To write a new sketch, it’s necessary to first create a new file. You can write the Arduino code and save it as “.ino file.” Any programming errors can be detected by pressing the “Verify” function button.
To upload the sketch to a target board, simply connect the board via a USB cable and click on the “Upload” function button. As the sketch will be uploaded on a target board, it will start executing. The boards can be reset to the start of the program execution by pressing the reset button on them.
While working on Arduino, you will be experimenting on a number of components and modules. To start with any electronic component or module, the first thing is to check out its datasheet. The datasheets are well-documented sources of information about a component.
It’s essential to look for the operating requirements, functioning, and applications of a component from its datasheet before using it in a circuit.
The Arduino UNO has ATmega328P as the sitting microcontroller. Start the habit of reading datasheets from the datasheet of ATmega328P microcontroller itself. Simply download the datasheet and check out the microcontroller specifications, operating conditions, and features. It’s interesting to inspect the built-in registers of the ATmega328P. And yes, there are 32 8-bit registers in ATmega328P.
In thenext tutorial,we will look at the basic structure of Arduino sketches and get through the basics of embedded C for the Arduino platform.