Introduction: Arduino Getting Started With Hardware and Software & Arduino Tutorials
Nowadays, Makers, Developers are preferring Arduino for rapid development of the prototyping of projects.
Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino has very good user community. Arduino board design uses variety of controllers which includes(AVR Family, nRF5x Family and fewer STM32 controllers and ESP8266/ESP32). Board has multiple Analog and Digital Input/Output pins. Board contains USB to Serial Converter as well which helps to program the controller.
In this post we will see How to use Arduino IDE and Arduino boards. Arduino is easy to use and very good option for prototyping projects. You will get plenty of libraries and number of hardware build for arduino board which gets fit pin to pin to the module board and Arduino board.
If you are using Arduino board then you won't require any programmer or any tool to program to Arduino boards. Because those board are already flashed with serial bootloader and ready to flash over usb to serial interface.
Step 1: Points to Be Covered
Following points are covered in this tutorial Attached in Step #4.
1. Schematic Explained
2. Bootloader Explained
3. How to use Web Editor
4. How to Use Arduino IDE
5. Example on LED Blink
6. Example on Serial Interface
7. Example on Switch interface using polling method
8. Example on Switch interface using interrupt method
9. Example on ADC.
Step 2: What Is a Bootloader?
In Simple Language, Bootloader is piece of code which accept the code and write it to our own flash.
Bootloader is piece of code which execute first whenever you controller gets power ON or get reset then starts the application.
When bootloader get execute, it will check for command or Data on Interface like UART, SPI, CAN or USB. Bootloader can be implement on UART, SPI, CAN or USB.
In case of bootloader, we don't need to use programmer every time. But if there no bootloader on controller then in that case we have to use programmer/Flasher.
And we have to use programmer/Flasherto flash bootloader. Once bootloader gets flashed then no need of programmer/Flasher.
Ardiuno comes with bootloader flashed on board.
Step 3: LED, Key and ADC Interfacing
Following type of interfaces are covered in this tutorial.
1. Led interface
2. Key Interface
3. Pot interface
1. Led Interface:
Led is connected to PC13 pin of the Arduino.
Most of the arduino has one USER led present on Board. So, Developer has just to use blinking example from example library.
2. Switch interface:
Switch can be read in two ways, one is polling method and another one is interrupt based. In polling method, switch will be read continuously and action can be taken.
And in Interrupt method, Action can be taken once Key is pressed.
3. Pot Interface:
Analog POT is connected to the Analog Pin of the Arduino.
Step 4: Required Components
Arduino Uno in India- https://amzn.to/2WmcLHU
Arduino Uno in UK - https://amzn.to/2WmcLHU
Arduino Uno in USA - https://amzn.to/2WmcLHU
Arduino Nano in India- https://amzn.to/2Jy1gYJ
Arduino Nano in UK - https://amzn.to/2Jy1gYJ
Arduino Nano in USA - https://amzn.to/2Jy1gYJ
HC-SR04 in UK - https://amzn.to/2JusLCu
HC-SR04 in USA - https://amzn.to/2JusLCu
MLX90614 in India- https://amzn.to/2C4E5Br
MLX90614 in UK - https://amzn.to/2C4E5Br
MLX90614 in USA - https://amzn.to/2C4E5Br
BreadBoard in India- https://amzn.to/2MW0Opb
BreadBoard in USA- https://amzn.to/2MW0Opb
BreadBoard in UK- https://amzn.to/2MW0Opb
16X2 LCD in India- https://amzn.to/34nsdGF
16X2 LCD in UK - https://amzn.to/34nsdGF
16X2 LCD in USA - https://amzn.to/34nsdGF
Step 5: Tutorial
Step 6: LCD Interface
16x2 LCD is 16 character and 2 row lcd which has 16 pins of connection. This LCD requires data or text in ASCII format to display.
First row Starts with 0x80 and 2nd row starts with 0xC0 address.
LCD can work in 4-bit or 8-bit mode. In 4 bit mode, Data/Command is Sent in Nibble Format First Higher nibble and then lower Nibble.
For Example, to send 0x45 First 4 will be sent Then 5 will be sent.
Please refer the schematic.
There are 3 controlling pins that is RS, RW, E.
How to Use RS:
When Command is sent, then
RS = 0 When Data is sent, then RS = 1
How to use RW:
RW pin is Read/Write.
where, RW=0 means Write Data on LCD
RW=1 means Read Data from LCD
When we are writing to LCD command/Data, we are setting pin as LOW.
When we are reading from LCD, we are setting pin as HIGH.
In our case, we have hardwired it to LOW level, because we will be writing to LCD always.
How to use E (Enable):
When we send data to LCD, we are giving pulse to lcd with the help of E pin.
This is high level flow we have to follow while sending COMMAND/DATA to LCD.
Proper RS value, Based on COMMAND/DATA
Proper RS value, Based on COMMAND/DATA
Step 7: Tutorial
Step 8: Ultrasonic Sensor Interface
In ultrasonic module HCSR04, we have to give trigger pulse on trigger pin, so that it will generate ultrasound of frequency 40 kHz. After generating ultrasound i.e. 8 pulses of 40 kHz, it makes echo pin high. Echo pin remains high until it does not get the echo sound back.
So the width of echo pin will be the time for sound to travel to the object and return back. Once we get the time we can calculate distance, as we know the speed of sound.
HC-SR04 can measure up to range from 2 cm - 400 cm.
Ultrasonic Module will generate the ultrasonic waves which are above the human-detectable frequency range, usually above 20,000 Hz. In our case we will be transmitting the frequency of 40Khz.
Step 9: MLX90614 Temperature Sensor Interface
MLX90614 is i2c based IR temperature sensor works on thermal radiation detection.
Internally, the MLX90614 is a pairing of two devices: an infrared thermopile detector and a signal-conditioning application processor. Per the Stefan-Boltzman law, any object that isn't below absolute zero (0°K) emits (non-human-eye-visible) light in the infrared spectrum that is directly proportional to its temperature. The special infrared thermopile inside the MLX90614 senses how much infrared energy is being emitted by materials in its field of view, and produces an electrical signal proportional to that. That voltage produced by the thermopile is picked up by the application processor's 17-bit ADC, then conditioned before being passed over to a microcontroller.