Modul 1 Introduction To Arduino
Modul 1 Introduction To Arduino
What is Arduino?
Arduino is an open-source hardware and software company, project, and user
community that designs and manufactures single-board microcontrollers and
microcontroller kits for building digital devices. With this microcontroller, you can make
various digital device with various function you want.
1
Preparation
Before start to practice, you should prepare some things to get our IDE ready.
You need to install some drivers and libraries for our practice.
2
Act. 1: Arduino to LCD Screen
LCD (Liquid Crystal Display) is a type of flat panel display which uses liquid
crystals in its primary form of operation. LEDs have a large and varying set of use
cases for consumers and businesses, as they can be commonly found in
smartphones, televisions, computer monitors and instrument panels.
Practice
In this activity, you will practice how to print some text into the LCD module and
run it with some code. You can set your Arduino and LCD according to the scheme in
Figure 4.
3
Write the code below to your Arduino IDE to run your Arduino device.
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27, 16 column
and 2 row display
void setup()
{
lcd.init(); // initialize the LCD
To connect your Arduino Board, plug-in to the USB port the in the menu bar
select Tools > Port and select the port available in your PC. After the board
connected, verify and upload you code to the board. Now you can see your
LCD working.
Try to change the value of lcd.setCursor() function, and see what will
happen.
void loop()
{
delay(500);
lcd.scrollDisplayLeft();
}
The LiquidCrystal_I2C library have various function you can use. If you want to
explore the function, visit liquidcrystal Documentation.
4
Write the result of your practice here!
5
Act. 2: Arduino with Ultrasonic Sensor
Ultrasonic sensors use high frequency sound waves, and calculate the time
interval between generating and receiving the echo. They are used to detect the
presence of a target, or measure the distance to the target.
Sonar stands for SOund Navigation And Ranging. The acoustic frequency used
does not have to be ultrasonic, and can include all sound frequencies, including
infrasonic. Sonar systems may involve multiple sound transmitters, and sensors, and
may involve more complex data processing.
Ultrasonic sensors work by sending out a sound wave at a frequency above the
range of human hearing. The transducer of the sensor acts as a microphone to receive
and send the ultrasonic sound.
Practice
This time, we will learn to run an ultrasonic sensor with Arduino. Try to
connect the sensor to Arduino with the jumpers following the scheme below.
6
After you connect the sensor, write the code below and upload it to your
Arduino board. See what’s happened.
#include <NewPing.h>
void setup()
{
Serial.begin(9600); //Set data rates in bit per second (bps)
}
void loop()
{
long int distance = ultSonic.ping_cm(); //get sensor output in cm
Serial.println(distance); // Print result
delay(200); //delay 200ms
}
To see how the sensor work, go to menu bar Tools > Serial Plotter, then
a plot graph will appear. Put your hand in front of the sensor, and move your hand far
and close. how does the graph change? What happened?
You can get another type of output from the ultrasonic sensor with the NewPing
library. You can visit NewPing Arduino Library for Arduino for further information.
7
Write the result of your practice here
8
Act. 3: Arduino with Buzzer
Piezo buzzer is a type of electronic device that’s used to produce a tone, alarm,
or sound. This device changes the electronic pulse to make a sound. It’s lightweight
with simple construction, and it’s typically a low-cost product. Piezo buzzers are often
used in alarms, warning devices, computer devices, telephones, and toys or games.
Practice
In this practice, we will try a quite simple project. We will use the buzzer module
to make a sound by using Arduino. Try to connect your buzzer to the Arduino board
following this scheme.
With the code below you can run the buzzer with Arduino. Can you explain how
this code working?
9
#define BUZZER_PIN 7
void setup() {}
void loop()
{
digitalWrite(BUZZER_PIN, HIGH);
delay(1000);
digitalWrite(BUZZER_PIN, LOW);
delay(1000);
}
The buzzer also can use the tone() function to make a sound. If you want to
know how to use it, visit the documentation.
10
Challenge
The inability of the message system in that time to give him news faster, he
started devising a plan to create a new way of fast long-distance communication. And
finally morse was born.
11
Figure 9. Chart of the Morse code 26 letters and 10 numerals
There is a challenge for you. Try to make a morse code using the buzzer. Try
to make out a word within 5 and 7 letters with the morse code. You can modify the
code you write before, to run the buzzer. You should follow the rules below to make
your morse code.
Rules
12
Mission Impossible
13
Write you code or put a photo of you code here!
14
Sources
Figure 1. https://dev.to/anou1234/arduino-and-its-types-1lik
Figure 2. Personal documentation
Figure 3. Personal documentation
Figure 4. Personal documentation. https://wokwi.com/projects/326902301745742419
Figure 5. Personal documentation. https://wokwi.com/projects/326902301745742419
Figure 6. Personal documentation
Figure 7. Personal documentation. https://wokwi.com/projects/326902301745742419
Figure 8. https://en.wikipedia.org/wiki/Morse_code#/media/File:Morsetaste.jpg
Figure 9.
https://en.wikipedia.org/wiki/Morse_code#/media/File:International_Morse_C
ode.svg
15
References
16