0% found this document useful (0 votes)
35 views

Arduino Embedded Trainer Kit-2022 _programming_manual

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Arduino Embedded Trainer Kit-2022 _programming_manual

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

THE OFFICAIL ACENAAR TECHNOLOGIES

ARDUINO EMBEDDED trainer Kit -2022

ACENAAR TECHNOLOGIES
ARDUINO EMBEDDED trainer Kit -2022

Polytechnical ECE Lab Manual


Powered by ACENAAR TECHNOLOGIES PVT. LTD.

1
Get started with
ACENAAR TECHNOLOGIES
ARDUINO EMBEDDED trainer Kit -2022

2
Welcome
The developments in Embedded Systems technology played a pivotal role in
spurring innovation and growth. It is a technological revolution and it is bringing
tremendous changes in socioeconomics. And it is occupying omni fields like home
automation, transport, agriculture and whatnot. Embedded systems technology has
demand for very huge skillful manpower in near feature and apart from this, everyone
needs to know about this technology. As it is going to become the integral part of life. This
technology fascinates everyone to learn and use for self-empowerment and to utilize
prospects of modern life style of 21 st century.

In the mission to help you out to acquaint yourself to this technology, we are
introducing the best self-learning Do It Yourself (DIY) platform.

In the manual we are presenting programming procedure for resourceful


unequivocally designed Arduino embedded trainer kit. Special care is taken to keep
instruction simple and clear and yet cover utilization of all resources available in the kit.

In present manual we will focus on C++ programming for Arduino based on


Polytechnique colleges’ accordingly their syllabus, apart from this, here also given many
other programming for different sensors, Actuators and display units. And it gives
information about getting started with Kit. the exercise, one will acquaint with kit and have
confidence to develop other programs.

3
List of experiments
Basic Arduino (C++) programming
Get to know about your ARDUINO EMBEDDED trainer Kit -2022
know fully getting started about your Arduino Embedded Trainer Kit-2022.
Get to know your Arduino Embedded Trainer Kit-2022 about installations of IDEs and your first
LED blink program. At end of this lesson, you are set to do other programs.

Section-I:
Lesson 1: RGB LED
Write an Arduino C++ program to generate different colors using RGB LED.
Lesson 2: Servo motor
Write an Arduino C++ program for servo motor to rotate to different angles and
different speeds.
Lesson 3: PMDC
Write an Arduino C++ program for speed control using PMDC.
Lesson 4: LCD
Write an Arduino C++ program to display Alphanumerical characters on LCD.
Lesson 5: Water pump
Write an Arduino C++ program for control of water pump based on soil
moisture values using soil moisture sensor.

4
Section-II: Get started with C++ program for other peripherals in your
Arduino Embedded Trainer Kit-2022

Lesson 1: LEDs
Write an Arduino C++ program to blink LEDs on Arduino Embedded trainer kit-
2022.
Lesson 2: Seven segment
Write an Arduino C++ program to show Alphanumerical values on seven segment
Display.
Lesson 3: DHT11 sensor for Temperature and humidity measurement
Write an Arduino C++ program for measurement of real time temperature and
humidity and display on serial monitor.
Lesson 4: PIR sensor for object detection
Write an Arduino C++ program for motion detection using PIR sensor and display
on serial monitor
Lesson 5: Ultrasonic sensor for distance measurement
Write an Arduino C++ program for measurement of distance using Ultrasonic
sensor and display on serial monitor
Lesson 6: IR sensor for object detection
Write an Arduino C++ program for object detection using IR sensor
Lesson 7: LDR sensor for light detection
Write an Arduino C++ program for measurement of light intensity using LDR and
display on serial monitor.
Lesson 8: 4X3 key pad
Write an Arduino C++ program for key pad to read numbers/symbols from the key-
pad.
Lesson 9: Buzzer
Write an Arduino C++ program for sound production using Buzzer.
Appendices:
Appendix A: Arduino nano specifications

5
Basic Arduino (C++) programming
Section-I: Get to know about your Arduino Embedded Trainer Kit 2022
Know-how and getting started with your Acenaar Technology Arduino
Embedded Trainer Kit -2021. Learn to initialize and program.

Lesson 1: Get to know your ACENAAR TECHNOLOGIES ARDUINO EMBEDDED trainer Kit -
2022 And also describes about installations of IDE and your first LED blink program.
In recent years Learning methods are shifting from conventional class room methods to more
independent methods like self-learning and particularly Do It Yourself (DIY) methods. ACENAAR
TECHNOLOGIES ARDUINO EMBEDDED trainer Kit -2022 is source for such an excellent opportunity
for leaning. This trainer Kit is well-organized for easy understanding and user friendly trainer Kit. The aim
of developing this kit is to reach maximum number of polytechnical students for easy understanding of
Embedded system concepts. This kit is populated with many sensors on board which eliminates purchase
of such sensors for practice.

This Embedded Trainer kit is consisting Arduino Microcontroller, sensors, activators, display units
in single board. It works with embedded C++ in open software Arduino IDE.

Technical specifications of the Arduino Embedded Trainer Kit 2022


S.No Name of unit Particulars of devices
HARDWARE SPECIFICATIONS
1 Ultrasonic sensor
2 PIR sensor
3 DHT temperature and Humidity sensor
1 SENSOR UNIT 4 IR sensor
5 LDR sensor
6 Key board
7 Soil Moisture sensor
8 Servo Motor
9 Relays
2 ACTUATORS UNIT 10 Buzzer
11 Small water pump
12 PMDC motor
13 LCD screen
3 DISPLAY UNIT 14 Seven segment display
15 LEDs
16 RGB led
5 CONTROL UNIT 17 Arduino Nano with extended
connectors
6 MISCELLANEOUS 18 400 Points Solderless Breadboard

6
Software Specifications
1 Programming 1 C++
2 Integrated Development 1 Arduino IDE (version - 1.8.19 )
Environment (IDE)
Electrical Specifications
1 Power ports 1 Micro USB
2 C – Type USB
2 Power supply 1 INPUT - DC : 5V---3Amp (max)

A guided view of Acenaar Technologies Arduino Embedded Trainer Kit


-2022
Acenaar Technologies Arduino Embedded Trainer Kit 2022is consisting of SIX important
blocks which are shown in figure-1 they are Control Unit, Sensor Unit, Actuator Unit, Display Unit,
and Miscellaneous. Figure-2 shows the control unit, GPIO connectors, micro-USB and C-type
power supply connectors. Japan Solderless Terminal (JST) Connectors 1 to 13 meant for different
components on the kit are cited along with signal names. Apart from these TWO male burg connectors
are provided for general purpose applications. Figure -3 shows the sensors unit. It consists of 7
SENSORS and each sensor Represented with alphabets for easy recognition while programing,
naming as IR sensor (F), PIR sensor(G), DHT11 sensor(I), Ultrasonic sensor(H), LDR sensor(L),
Keypad(M) and Soil moisture sensor(E). Figure-4 shows the ACTUATOR UNIT. It consists of four
ACTUATORS also represented with Alphabets, Servo motor(A), Relay(B), Buzzer(C), PMDC
motor(D) and Water Pump connected Externally. Figure-5 shows the DISPLAY UNIT consists of
FOUR DISPLAY Devises with Alphabets representation namely, 2x16 LCD (o), TM1637 seven
segment display(K), Eight LEDs(J) and RGB LED(N). Miscellaneous, two-400 Points Solderless
Breadboard is also provided on kit for General purpose programming applications which is shown
in figure-6.

NOTE: 1) Proper attention is needed While connecting wire connectors.


2) Refer appendix-B for Technical Specifications of sensors, actuator and display units used in
board.

7
PMDC

Figure -4: Activators Components present


in kit.

Figure-1: Acenaar Technologies Arduino


Embedded Trainer Kit -2022

Figure – 5: Display unit present in kit.

Figure-2: Microcontroller Arduino NANO


and its GPIO connectors .

SOIL
sensor

Figure-6: Bread board

Figure-3: sensor components present in kit.

8
Get to know about your ARDUINO EMBEDDED trainer Kit -2022
know fully getting started about your Arduino Embedded Trainer Kit-2022

Get to know your Arduino Embedded Trainer Kit-2022 about installations of IDEs and your
first LED blink program. At end of this lesson, you are set to do other programs.
To start the programming with Embedded trainer kit you need to follow step by step procedure
which is given below.
STEP-1: POWER ON the Main power switch by sliding right side on the kit after connecting
power supply to USB C-Type/Micro USB power connector. (Observe POWER LED ON)

Step-2: Connect one end of USB -B cable to Arduino NANO board and other end connect to
PERSONAL COMPUTER or LAPTOP port USB-2.0/3.0.

STEP-3: Install Arduino IDE in PC/Laptop from software folder provided in CD (windows OS is
taken as reference in this entire guide).

Step-4: Open, Arduino IDE

Search for Arduino IDE Icon on Desktop or in programs.

9
And go to tools -> Board-> Arduino Nano for Arduino Nano Board selection and also go to Tools-
>Port-> com port for port selection.

For Arduino board selection

For Arduino COM port selection

STEP-5: To test the Arduino Nano and IDE installed, go to FILE -> example-> Basic -> Blink
example., compile it and upload code by tap upload button. Observe Built-in LED Blinking on
Arduino Nano board. If you could see LED blinking on Arduino Nano Board, congratulations you
have Successfully installed IDE and configured your board for programming.
Note: tick mark ( √ ) is for compilation, and Arrow mark ( → ) for compile and upload.

10
For Blink example.
Result: add photo

Step-6: Install libraries (only once) as per the requirements of the experiment ( DHT-11 sensor,
LDC, 7segment, Wi-Fi, Keypad library.

11
Note-1: Arduino IDE and All libraries will be installed automatically by tab the setup file. This
is one time activity need not be repeated.

Note-2: Manually install USB-serial CH324 drivers for Arduino nano for Windows7 and 8.
Note-2: For further more information/ video content visit Acenaar Technology web site and
you tube channel.

12
Section-I:

Lesson 1: RGB
Aim: Write an Arduino C++ program to generate different colors using RGB LED.

Step-1: For Program development: Open Arduino IDE and open new file window
and Write C++ program given below in Arduino IDE and save it.
Step-2: For program compilation: to compile the program tap on verify button
Step-3: For Uploading to target board (Arduino nano): tap on Upload button.
Step-4: For circuit connection:
Connect 4-pin JST connector between 1st connector of
Controller unit RGB to the connector of RGB (N) in display unit.
Step-5: For result: After successful uploading, observe different colors RGB LEDs blinking on
Arduino Embedded trainer kit-2022.

Program:
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name: Open Arduino IDE and open new file window
and Write C++ program given below in
Arduino IDE and save it. *********
* Connector : 8-pins JST cable *********
* Connections : from control unit->RGB(1) to Connector -> RGB (N) *********
******************************************************************/
int red_light_pin= 9;
int green_light_pin = 10;
int blue_light_pin = 11;
void setup() {
pinMode(red_light_pin, OUTPUT);
pinMode(green_light_pin, OUTPUT);
pinMode(blue_light_pin, OUTPUT);
}
void loop() {
RGB_color(255, 0, 0); // Red
delay(1000);
RGB_color(0, 255, 0); // Green
delay(1000);

13
RGB_color(0, 0, 255); // Blue
delay(1000);
RGB_color(0, 255, 255); // Cyan
delay(1000);
RGB_color(255, 0, 255); // Magenta
delay(1000);
RGB_color(255, 255, 0); // Yellow
delay(1000);
RGB_color(255, 255, 255); // White
delay(1000);
}
void RGB_color(int red_light_value, int green_light_value, int blue_light_value)
{
analogWrite(red_light_pin, red_light_value);
analogWrite(green_light_pin, green_light_value);
analogWrite(blue_light_pin, blue_light_value);
}

RESULT:

14
Lesson 2: Servo Motor
Aim: Write an Arduino C++ program for servo motor to rotate to different angles and
different speeds.

Step-1: For Program development: Open Arduino IDE and open new file window
and Write C++ program given below in Arduino IDE and save it.
Step-2: For program compilation: to compile the program tap on verify button
Step-3: For Uploading to target board (Arduino nano): tap on Upload button.
Step-4: For circuit connection:
Connect 4-pin JST connector between 10th connector of
Controller unit SERVO to the connector of SERVO (A) in Actuator unit.
Step-5: For result: After successful uploading, observe rotation of servo motor on the
Embedded trainer kit-2022.

Program:
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name: Write an Arduino C++ program for servo
motor to rotate to different angles and
different speeds. *********
* Connector : 4-pins JST cable *********
* Connections : from control unit->SERVO(10) to Connector SERVO->(A) *****
******************************************************************/

#include <Servo.h>

Servo myservo; // create servo object to control a servo


// twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position

void setup() {
myservo.attach(3); // attaches the servo on pin 9 to the servo object
}

void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'

15
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}

RESULT

16
Lesson 3: PDMC Motor
Aim: Write an Arduino C++ program for speed control using PMDC.

Step-1: For Program development: Open Arduino IDE and open new file window
and Write C++ program given below in Arduino IDE and save it.
Step-2: For program compilation: to compile the program tap on verify button
Step-3: For Uploading to target board (Arduino nano): tap on Upload button.
Step-4: For circuit connection:
Connect 4-pin JST connector between 1st connector of
Controller unit RGB to the connector of PDMC (D) in Actuator unit.
Step-5: For result: After successful uploading, observe PDMC motor on Arduino Embedded
trainer kit-2022.

Program:
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name: Write an Arduino C++ program for speed
control using PMDC. *********
* Connector : 4-pins JST cable *********
* Connections : from control unit->RGB(1) to Connector->(D) *****
******************************************************************/

const int enable = 9;


const int m_1 = 10;
const int m_2 = 11;

void setup() {
pinMode(enable, OUTPUT);
pinMode(m_1, OUTPUT);
pinMode(m_2, OUTPUT); //analogWrite(enable, 50);
analogWrite(enable, 255);
delay(1000);
}

void loop() {
digitalWrite(m_1, 1);
digitalWrite(m_2, 0);
delay(1000);
digitalWrite(m_1, 0);

17
digitalWrite(m_2, 1);
delay(1000);
}

Result

18
Lesson 4: LCD
Aim: Write an Arduino C++ program to display Alphanumerical characters on LCD.

Step-1: For Program development: Open Arduino IDE and open new file window
and Write C++ program given below in Arduino IDE and save it.
Step-2: For program compilation: to compile the program tap on verify button
Step-3: For Uploading to target board (Arduino nano): tap on Upload button.
Step-4: For circuit connection:
Connect 4-pin JST connector between 2nd connector of
Controller unit LCD to the connector of LCD (0) in Display unit.
Step-5: For result: After successful uploading, observe LCD display on Arduino Embedded
trainer kit-2022.

Program:
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name: Write an Arduino C++ program to display
Alphanumerical characters on LCD. *********
* Connector : 4-pins JST cable *********
* Connections : from control unit->LCD(2) to Connector->(0) *****
******************************************************************/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
}
void loop()
{
lcd.backlight();
lcd.setCursor(5,0);
lcd.print("AcenAAr");
lcd.setCursor(2,1);
lcd.print("Technologies");
delay(500);
lcd.noBacklight();
delay(500);

19
}

RESULT

20
Lesson 5: Water PUMP
Aim: Write an Arduino C++ program for control of water pump based on soil
moisture values using soil moisture sensor.

Step-1: For Program development: Open Arduino IDE and open new file window
and Write C++ program given below in Arduino IDE and save it.
Step-2: For program compilation: to compile the program tap on verify button
Step-3: For Uploading to target board (Arduino nano): tap on Upload button.
Step-4: For circuit connection:
1. Connect 4-pin JST connector between 9th connector of
Controller unit to the connector of Relay (B) in Actuator UNIT.
2. Connect 4-pin JST connector between 6th connector of
Controller unit to the connector of Soil Sensor (E) in Sensor unit.
(Place soil sensor in soil pot).

3. Place Water pump in water tank and connect male DC power jack of the PUMP to
female DC power jack on the Board (bottom left corner).

Step-5: For result: After successful uploading, observe the pump on Arduino Embedded trainer
kit-2022.

21
Program:
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name: Write an Arduino C++ program for control
of water pump based on soil moisture values
using soil moisture sensor. ********
* Connector : 4-pins JST cable *********
* Connections : from control unit->(9) to Connector->(B)
from control unit->(6) to Connector->(E) *****
******************************************************************/
const int mois_pin = 10;
const int pump_pin = 4;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(mois_pin, INPUT);
pinMode(pump_pin, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
int val = digitalRead(mois_pin);
if(val == 1)
{
Serial.println("Wet Condition");
digitalWrite(pump_pin, LOW);
}
else if(val == 0)
{
Serial.println("Dry Condition");
digitalWrite(pump_pin, HIGH);
}
}

22
RESULT
Note: based on the Moisture content in the soil the pump will turn ON and OFF.
( for wet soil --- pump turn OFF, for Dry soil Pump will turn ON).

Place soil sensor in SOIL


Place PUMP in
Water tank

23
Section-II
Get started with C++ program for other peripherals in your Arduino
Embedded Trainer Kit -2022
Lesson 1: LEDs
Aim: Write an Arduino C++ program to blink LEDs on Arduino Embedded Trainer Kit 2022 with
1 second
delay.
Step-1: For Program development: Open Arduino IDE and open new file window
and Write C++ program given below in Arduino IDE and save it.
Step-2: For program compilation: to compile the program tap on verify button
Step-3: For Uploading to target board (Arduino nano): tap on Upload button.
Step-4: For circuit connection: Connect 10-pin JST connector between 13th connector of
Control unit to “L” connector of display unit.
Step-5: For result: After successful uploading, observe 8 LEDs blinking on Embedded trainer kt-
2012.
Program :
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : Flashing of Led's *********
* Connector : 8-pins JST cable *********
* Connections : Connector->(13) to Connector->(L) *********
******************************************************************/

const int pins[12] = {2,3,4,5,6,7,8,9};


void setup() {
Serial.begin(9600);
for(int ii = 0; ii < 8; ii++)
pinMode(pins[ii], OUTPUT);
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
for(int ii = 0; ii < 8; ii++)
digitalWrite(pins[ii], LOW);
delay(500);
for(int ii = 0; ii < 8; ii++)

24
digitalWrite(pins[ii], HIGH);
delay(500);
}

Results:

25
Lesson 2: Seven segment

Aim: Write an Arduino C++ program to show Alphanumerical values on seven segments
Display.
Repeat Step-1: To step-3 as explained in Lesson -1.
Step-4: For circuit connection: Connect 4-pin JST connector between 10th connector of Control
unit to “K” connector of display unit.
Step-5: For result: After successful uploading, observe displaying as “AcenAAr” on seven
segment display on Arduino Embedded Trainer Kit 2022.

Program:
/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : Seven Segment Display *********
* Connector : 4-pins JST cable ********
* Lesson : 02 ********
* Connections : Connector->(10) to Connector->(K) ********
****************************************************************/

#define CLK 3
#define DIO 2

#include "GyverTM1637.h"
GyverTM1637 disp(CLK, DIO);

uint32_t Now, clocktimer;


boolean flag;

void setup() {
Serial.begin(9600);
disp.clear();
disp.brightness(7);
}

void loop() {
runningText();
}
void runningText() {
byte welcome_banner[] = {_A, _C, _E, _N, _A, _A, _r};

26
disp.runningString(welcome_banner, sizeof(welcome_banner), 350); //
}

Results :

27
Lesson 3: DHT11 sensor
AIM: Write an Arduino C++ program for measurement of real time temperature and
humidity and display on serial monitor.
Repeat Step-1: To step-3 as explained in Lesson -1

Step-1: For circuit connection: Connect 4-pin JST connector between 05th connector of
Control unit to S3 connector of Sensor unit.

Step-5: For result: After successful uploading, observe Arduino serial monitor displaying
temperature and Humidity.

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : DHT 11 Sensor(Temperature & Humidity) *********
* Connector : 4-pins JST cable ********
* Lesson : 03 ********
* Connections : Connector->(05) to Connector->(I) ********
****************************************************************/

#include "DHT.h"

#define DHTPIN 12 // Digital pin connected to the DHT sensor

#define DHTTYPE DHT11 // DHT 11


DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
}

void loop() {
// Wait a few seconds between measurements.
delay(2000);

float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);

28
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}

Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.println(F("°C "));
}

Result:

29
Lesson 4: PIR sensor
AIM: Write an Arduino C++ program for motion detection using PIR sensor and display
on serial monitor
Repeat Step-1: To step-3 as explained in Lesson -1

Step-4: For circuit connection: Connect 4-pin JST connector between 03rd connector of Control
unit to “G” connector of Sensor unit.

Step-5: For result: After successful uploading, observe Arduino serial monitor displaying as
Motion detected and Motion stopped

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : PIR Sensor Module *********
* Connector : 4-pins JST cable ********
* Lesson : 04 ********
* Connections : Connector->(03) to Connector->(G) ********
****************************************************************/

int led = 8; // the pin that the LED is atteched to


int sensor = A2; // the pin that the sensor is atteched to
int state = LOW; // by default, no motion detected
int val = 0; // variable to store the sensor status (value)

void setup() {
pinMode(led, OUTPUT); // initalize LED as an output
pinMode(sensor, INPUT); // initialize sensor as an input
Serial.begin(9600); // initialize serial
}

void loop(){
val = digitalRead(sensor); // read sensor value
//Serial.println(val);
if (val == HIGH) { // check if the sensor is HIGH
digitalWrite(led, HIGH); // turn LED ON
delay(1000); // delay 100 milliseconds

if (state == LOW) {
Serial.println("Motion detected!");
state = HIGH; // update variable state to HIGH
}
}
else {

30
digitalWrite(led, LOW); // turn LED OFF
delay(1000); // delay 200 milliseconds

if (state == HIGH){
Serial.println("Motion stopped!");
state = LOW; // update variable state to LOW
}
}
}

Result:

31
Lesson 5: Ultrasonic sensor
AIM: Write an Arduino C++ program for measurement of distance using Ultrasonic
sensor and display on serial monitor
Repeat Step-1: To step-3 as explained in Lesson -1
Step-4: For circuit connection: Connect 4-pin JST connector between 08th connector of
Control unit to “H” connector of Sensor unit.
Step-5: For result: After successful uploading, observe Arduino serial monitor displaying as
Distance XXXX cm

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : Ultrasonic Distance Measurement *********
* Connector : 4-pins JST cable ********
* Lesson : 05 ********
* Connections : Connector->(08) to Connector->(H) ********
****************************************************************/

#define echoPin 6 // attach pin D2 Arduino to pin Echo of HC-SR04


#define trigPin 7 //attach pin D3 Arduino to pin Trig of HC-SR04

// defines variables
long duration; // variable for the duration of sound wave travel
int distance; // variable for the distance measurement
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT
Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed
Serial.println("Ultrasonic Sensor HC-SR04 Test"); // print some text in Serial Monitor
Serial.println("with Acenaar Board");
}
void loop() {
// Clears the trigPin condition
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin HIGH (ACTIVE) for 10 microseconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

32
// Calculating the distance
distance = duration * 0.034 / 2; // Speed of sound wave divided by 2 (go and back)
// Displays the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(1000);
}

Result: Result displayed on serial monitor, When object is maintained at different distance
from the Ultrasonic sensor.

33
Lesson 6: IR sensor
AIM: Write an Arduino C++ program for object detection using IR sensor
Repeat Step-1: To step-3 as explained in Lesson -1

Step-4: For circuit connection: Connect 4-pin JST connector between 06th connector of Control
unit to “F” connector of Sensor unit.
Step-5: For result: After successful uploading, observe Arduino serial monitor displaying as
Obstacle not Detected and Obstacle Detected

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : IR Sensor Module *********
* Connector : 4-pins JST cable ********
* Lesson : 06 ********
* Connections : Connector->(06) to Connector->(F) ******* *
****************************************************************/

int IRSensor = 10; // connect ir sensor to arduino pin 2


int BUZZER = 8; // conect Led to arduino pin 13
void setup()
{
pinMode (IRSensor, INPUT); // sensor pin INPUT
pinMode (BUZZER, OUTPUT); // Led pin OUTPUT
Serial.begin(9600);
}

void loop()
{
int statusSensor = digitalRead (IRSensor);
if (statusSensor == 1){

digitalWrite(BUZZER, LOW); // LED LOW


Serial.println("Obstacle not Detected");
}
else
{
digitalWrite(BUZZER, HIGH); // LED High
Serial.println("Obstacle Detected");

}
delay(100);
}

34
Result:

35
Lesson 7: LDR sensor
AIM: Write an Arduino C++ program for measurement of light intensity using LDR and
display on serial monitor.
Repeat Step-1: To step-3 as explained in Lesson -1

Step-4: For circuit connection: Connect 4-pin JST connector between 04th connector of Control
unit to “L” connector of Sensor unit.

Step-5: For result: After successful uploading, observe Arduino serial monitor displaying as Good
night!!!!!, and Have a Good Day!!!!!,

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : LDR Sensor *********
* Connector : 4-pins JST cable ********
* Lesson :7 ********
* Connections : Connector->(04) to Connector->(L) ********
****************************************************************/

const int ledPin = 13;


const int ldrPin = A0;
void setup() {
Serial.begin(9600);
pinMode(ldrPin, INPUT);
}

void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <= 50) {
Serial.print("Good night!!!!!, ");
Serial.print("LDR Value :");
Serial.println(ldrStatus);
} else {
digitalWrite(ledPin, LOW);
Serial.print("Have a Good Day!!!!!, ");
Serial.print("LDR Value :");
Serial.println(ldrStatus);
}
delay(300);
}

Result:

36
37
Lesson 8: 4X3 key pad
AIM: Write an Arduino C++ program for key pad to read numbers/symbols from
the key- pad.
Repeat Step-1: To step-3 as explained in Lesson -1

Step-4: For circuit connection: Connect 4-pin JST connector between 13th connector of Control
unit to “M” connector of Sensor unit.

Step-5: For result: After successful uploading, observe Arduino serial monitor displaying as
1,2,3,4,5,6,7,8,9,0, * and # symbols.

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : Keypad *********
* Connector : 10-pins JST cable ********
* Lesson :8 ********
* Connections : Connector->(12) to Connector->(M) ********
****************************************************************/
#include <Keypad.h>

const byte ROWS = 4; //four rows


const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6, 7, 8}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
Serial.begin(9600);
}

void loop(){
char key = keypad.getKey();

if (key){
Serial.println(key);
}

38
}

Result:

39
Lesson 9: Buzzer
AIM: Write an Arduino C++ program for sound production using Buzzer.
Repeat Step-1: To step-3 as explained in Lesson -1
Step-4: For circuit connection: Connect 4-pin JST connector between 07th connector of Control
unit to “C” connector of Actuator unit.
Step-5: For result: After successful uploading, observe ON and OFF sound on Arduino Embedded
Trainer Kit 2022.

/*****************************************************************
* AcenAAr Arduino Embedded Trainer Kit 2022 *********
* Program Name : Buzzer *********
* Connector : 4-pins JST cable ********
* Lesson :9 ********
* Connections : Connector->(07) to Connector->(C) ********
****************************************************************/
const int buzzer = 8;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}

// the loop function runs over and over again forever


void loop() {
digitalWrite(buzzer, HIGH); //
Serial.println("Buzzer On");
delay(2000); // wait for a second
digitalWrite(buzzer, LOW); //
Serial.println("Buzzer OFF");
delay(2000); // wait for a second
}

Result:

40
Appendix A: Arduino nano specifications
The Arduino Nano is a small Arduino board based on ATmega328P or ATmega628
Microcontroller. The connectivity is the same as the Arduino Uno Board.

The Nano board is defined as a sustainable, small, consistent, and flexible Microcontroller board.
It is small in size compared to the UNO board. The Arduino Nano is organized using the Arduino
(IDE), which can run on various platforms. Here, IDE stands for Integrated Development
Environment.

The devices required to start our projects using the Arduino Nano board are Arduino IDE and
mini-USB. The Arduino IDE software must be installed on our respected laptop or desktop. The
mini-USB transfers the code from the computer to the Arduino Nano board.

41
Specifications
MICROCONTROLLER ATmega328
ARCHITECTURE AVR
OPERATING VOLTAGE 5V
FLASH MEMORY 32 KB of which 2 KB used by bootloader
SRAM 2 KB
CLOCK SPEED 16 MHz
ANALOG IN PINS 8
EEPROM 1 KB
DC CURRENT PER I/O PINS 40 mA (I/O Pins)
INPUT VOLTAGE 7-12V
DIGITAL I/O PINS 22 (6 of which are PWM)
PWM OUTPUT 6
POWER CONSUMPTION 19 mA
PCB SIZE 18 x 45 mm
WEIGHT 7g
PRODUCT CODE A000005

Power
The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power supply
(pin 30), or 5V regulated external power supply (pin 27). The power source is automatically selected to the
highest voltage source.

Memory
The ATmega328 has 32 KB, (also with 2 KB used for the bootloader. The ATmega328 has 2 KB of SRAM and 1
KB of EEPROM.

Input and Output


Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(), digitalWrite(), and
digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has
an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized
functions:

42
• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are
connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.
• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a
rising or falling edge, or a change in value. See the attachInterrupt() function for details.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although
provided by the underlying hardware, is not currently included in the Arduino language.
• LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on,
when the pin is LOW, it's off.

The Nano has 8 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values). By default
they measure from ground to 5 volts, though is it possible to change the upper end of their range using the
analogReference() function. Analog pins 6 and 7 cannot be used as digital pins. Additionally, some pins have
specialized functionality:

• I2C: A4 (SDA) and A5 (SCL). Support I2C (TWI) communication using the Wire library (documentation
on the Wiring website).

There are a couple of other pins on the board:

• AREF. Reference voltage for the analog inputs. Used with analogReference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields
which block the one on the board.

Communication
The Arduino Nano has a number of facilities for communicating with a computer, another Arduino, or other
microcontrollers. The ATmega328 provide UART TTL (5V) serial communication, which is available on digital
pins 0 (RX) and 1 (TX). An FTDI FT232RL on the board channels this serial communication over USB and the FTDI
drivers (included with the Arduino software) provide a virtual com port to software on the computer. The
Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino
board. The RX and TX LEDs on the board will flash when data is being transmitted via the FTDI chip and USB
connection to the computer (but not for serial communication on pins 0 and 1). A SoftwareSerial library allows
for serial communication on any of the Nano's digital pins. The ATmega328 also support I2C (TWI) and SPI
communication. The Arduino software includes a Wire library to simplify use of the I2C bus. To use the SPI
communication, please see ATmega328 datasheet.

Programming
The Arduino Nano can be programmed with the Arduino software (download). Select "Arduino Duemilanove
or Nano w/ ATmega328" from the Tools > Board menu (according to the microcontroller on your board). The
ATmega328 on the Arduino Nano comes preburned with a bootloader that allows you to upload new code to
it without the use of an external hardware programmer. It communicates using the original STK500
protocol. You can also bypass the bootloader and program the microcontroller through the ICSP (In -Circuit
Serial Programming) header using Arduino ISP or similar.

43
Automatic (Software) Reset
Rather then requiring a physical press of the reset button before an upload, the Arduino Nano is designed in a
way that allows it to be reset by software running on a connected computer. One of the hardware flow control
lines (DTR) of the FT232RL is connected to the reset line of the ATmega328 via a 100 nanofarad capacitor.
When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino software
uses this capability to allow you to upload code by simply pressing the upload button in the Arduino
environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-
coordinated with the start of the upload. This setup has other implications. When the Nano is connected to
either a computer running Mac OS X or Linux, it resets each time a connection is made to it from software (via
USB). For the following half-second or so, the bootloader is running on the Nano. While it is programmed to
ignore malformed data (i.e. anything besides an upload of new code), it will intercept the first few bytes of
data sent to the board after a connection is opened. If a sketch running on the board receives one-time
configuration or other data when it first starts, make sure that the software with which it communicates waits
a second after opening the connection and before sending this data.

For Further information Follow our YouTube channel and Webpage.

Thanking you :

44

You might also like