SlideShare a Scribd company logo
1 of 131
Download to read offline
1
SKAD ELECTRONICS TRAINING
MANUAL
2
PREFACE
Electronics Overview of SKAD ADD-ONS
An Add-on can be defined as something that has been or can be added to an existing object or
arrangement, in other words, it is an accessory or device designed to maximize the capability of a
system. Therefore, Skill ’G’ Add-on also referred to as SKAD are those supplements, appendages,
adjunct, addendum, or extra and independent components/accessories added to Special Science,
Engineering and Technology (SET) Equipment supplied to 73 and 51 beneficiaries Universities
and Polytechnics respectively to improve the competence of the existing equipment.
Below is the list of Add-Ons as regards Electronics & Telecommunications SET Equipment:
SKAD-3371: Analog & Digital Electronic Hardware Technique includes:
• Arduino UNO (SKAD-3371A)
• Ultrasonic sensor (SKAD-3371B)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• Banana cables
SKAD-3351: Digital Electronics Logic includes:
• Arduino UNO (SKAD-3351A)
• SET equipment (TPS-3351)
• Neopixel matrix (SKAD-3351E)
• Digital Multimeter
• Jumper wires
• Banana cables
SKAD-3321: Electricity & Semiconductor Simulation includes:
• Arduino UNO (SKAD 3321A)
• Temperature Sensor (SKAD-3321D) DHT22,
• Brushless Fan 12V DC (SKAD-3321G)
• SET equipment (TPS 3321)
• Digital Multimeter
• Jumper wires
• Banana cables
SKAD-3717: Green House Control includes:
• Arduino UNO (SKAD-3717A)
• SET equipment (TPS-3717)
• LCD (SKAD-3717C)
• Temperature & Humidity sensor (SKAD-3717D): DHT22
• Relay (SKAD-3717F)
• Digital Multimeter
• Jumper wires
• BRUSHLESS FAN 12V DC: SKAD-3717G
3
SKAD-3719: Modern Technology & Electronic Systems includes:
• Arduino UNO (SKAD-3719A)
• SET equipment (TPS-3719)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• LEDS
TABLE OF CONTENT
PREFACE ………………………………………………………………………………………...3
CHAPTER 1 – ANALOG & DIGITAL ELECTRONIC HARDWARE TECHNIQUE ……….…5
EXPERIMENT 1.1 – DIGITAL READ WITH 8 BIT SWITCH ………………………………...14
EXPERIMENT 1.2 – DIGITAL WRITE WITH AN 8 BIT LED USING ARDUINO …………..20
EXPERIMENT 1.3 – DIGITAL WRITE OF 8 BITS LED WITH ARRAY …………………......24
EXPERIMENT 1.4 – PULSE WIDTH MODULATION (PWM) ………..…………………......28
EXPERIMENT 1.5 – INTRUDER DETECTION USING ULTRASONIC SENSOR (SKAD-
3371B) ON TPS-3371 ………………………….………………………..33
CHAPTER 2 – DIGITAL ELECTRONICS LOGIC …………………………………………… 38
EXPERIMENT 2.1 – ADC READ RESOLUTION ………………..………………………….. .47
EXPERIMENT 2.2 – ADC RESOLUTION CONVERTED TO VOLTAGE ………………….. 51
EXPERIMENT 2.3 – ADC READ WITH NEOPIXEL MATRIX ………………………………54
EXPERIMENT 2.4 – ADC RESOLUTION CONVERTED TO VOLTAGE WITH NEOPIXEL
MATRIX ………………………………………………….……………. 59
CHAPTER 3 – ELECTRICITY & SEMICONDUCTOR SIMULATION ……………………. 68
EXPERIMENT 3.1 – AUTOMATIC STREET LIGHT USING LDR ………………………….77
EXPERIMENT 3.2 – TEMPERATURE CONTROLLED FAN WITH INDICATOR ………… 81
CHAPTER 4 – GREEN HOUSE EFFECTS …………………………………………………... 85
EXPERIMENT 4.1 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING
SENSOR (DHT22) AND LCD……………………………...…………… 93
EXPERIMENT 4.2 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING
RELAY & FAN ………………………………………………………… 99
CHAPTER 5 – MODERN TECHNOLOGY & ELECTRONIC SYSTEMS.………………… 106
4
EXPERIMENT 5.1 – AUTOMATIC TRAFFIC LIGHT CONTROL ………..………………. 115
EXPERIMENT 5.2 – TRAIN ALARM SYSTEM ……………………………………………. 118
LIST OF ELECTRONICS ADD-ONs
S/N ADD-ON CODE ADD-ON DESCRIPTION PICTURE
1. SKAD 3300F 5V 4 channel relay
2. SKAD 3300H Resistor 10k Ohms (Thermistor)
3. SKAD 3300I 1K 10K 100K 220ohm 1M Resistors
4. SKAD 3300J Jumper wires Female -Female
5
5. SKAD 3300K Jumper wires Male -Male
6. SKAD 3300A Arduino Uno R3
7. SKAD 3300D Temperature & Humidity Sensor
(DHT22)
8. SKAD 3300C Display Screen
9. SKAD 3300L 5v Regulator
6
10. SKAD 3300M Light Sensor (LDR)
11. SKAD 3300N Servo motor
12. SKAD 3300P Photo Transistor
13. SKAD 3300E Flexible Pixel Led Module Panel
14. SKAD 3300B Ultrasonic Sensor
7
15. SKAD 3300Q Black Plastic AA Size Power Battery
SKAD 3300G Brushless Fan 12v
SKAD-3371
8
CHAPTER 1 – ANALOG & DIGITAL ELECTRONIC HARDWARE TECHNIQUE
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS 3371)
2. Write program to control 8bits LED
3. Write program to change the state of the LEDs
4. Write program to change the state of the LEDs using array
5. Write program to handle Pulse Width Modulation (PWM)
6. Write program to Turn on a Buzzer when an intruder blocks the Ultrasonic sensor
7. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• Ultrasonic sensor (SKAD-3371B)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• Banana cables
SUBJECT DISCUSSION:
Introduction to Arduino
Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It
consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready-
made software called Arduino IDE (Integrated Development Environment), which is used to write
and upload the computer code to the physical board.
Arduino Wiring-based Framework allows writing cross-platform software to control devices
attached to a wide range of Arduino boards to create all kinds of creative coding, interactive
objects, spaces or physical experiences.
Arduino is an open-source programmable circuit board that can be integrated into a wide variety
of makerspace projects both simple and complex. This board contains a microcontroller which is
able to be programmed to sense and control objects in the physical world. By responding to sensors
and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and
displays. Because of its flexibility and low cost, Arduino has become a very popular choice for
makers and makerspaces looking to create interactive hardware projects. Arduino was introduced
back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost,
simple tool for creating hardware projects. Since the board is open-source, it is released under a
Creative Commons license which allows anyone to produce their own board. If you search the
web, you will find there are hundreds of Arduino compatible clones and variations available but
the only official boards have Arduino in its name.
9
The key features:
Fig. Image of Arduino Pin-outs
• Arduino boards are able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connecting to the
cloud and many other actions.
• You can control your board functions by sending a set of instructions to the microcontroller
on the board via Arduino IDE (referred to as uploading software).
• Unlike most previous programmable circuit boards, Arduino does not need an extra piece
of hardware (called a programmer) in order to load a new code onto the board. You can
simply use a USB cable.
• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn
to program.
• Finally, Arduino provides a standard form factor that breaks the functions of the
microcontroller into a more accessible package.
10
TYPES OF ARDUINO BOARDS
Arduino is a great platform for prototyping projects and inventions but can be confusing when
having to choose the right board. If you’re brand new to this, you might have always thought that
there was just one “Arduino” board and that’s it. In reality, there are many variations of the official
Arduino boards and then there are hundreds more from competitors who offer clones. Below are
a few examples of the different types of Arduino boards out there. The boards with the name
Arduino on them are the official boards but there are also a lot of really great clones on the market
as well. One of the best reasons to buy a clone is the fact they are generally less expensive than
their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards
which cost less but still have the same quality of the originals. Another factor to consider when
choosing a board is the type of project you are looking to do. For example, if you want to create a
wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The
LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a
small form factor, you might want to use the Arduino Pro Mini which has a very small footprint
compared to other boards.
Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was
not actually the first board to be released, it remains to be the most actively used and most widely
documented on the market.
Fig. Image of Arduino Board
Board Breakdown Here are the components that make up an Arduino board and what each of their
functions are.
1. Reset Button – This will restart any code that is loaded to the Arduino board
2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
11
3. Ground Pin – There are a few ground pins on the Arduino and they all work the same
4. Digital Input/Output – Pins 0-13 can be used for digital input or output
5. PWM – The pins marked with the (~) symbol can simulate analog output
6. USB Connection – Used for powering up your Arduino and uploading sketches
7. TX/RX – Transmit and receive data indication LEDs
8. AT-mega Microcontroller – This is the brains and is where the programs are stored
9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source
10.Voltage Regulator – This controls the amount of voltage going into the Arduino board
11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino and they all work the same
15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital
ARDUINO POWER SUPPLY
The Arduino Uno needs a power source in order for it to operate and can be powered in a variety
of ways. You can do what most people do and connect the board directly to your computer via a
USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice.
The last method would be to use a 9V AC power supply.
Fig. Image of Arduino power supply
12
ARDUINO BREADBOARD
Another very important item when working with Arduino is a solderless breadboard. This device
allows you to prototype your Arduino project without having to permanently solder the circuit
together. Using a breadboard allows you to create temporary prototypes and experiment with
different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which
are connected to each other by strips of conductive material.
Fig. Image of a breadboard
On a side note, the breadboard is not powered on its own and needs power brought to it from the
Arduino board using jumper wires. These wires are also used to form the circuit by connecting
resistors, switches and other components together.
ARDUINO INSTALLATION
Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB
cable.
In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila,
you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB
printer as shown in the following image.
13
Fig. Image of SKAD-3300A USB cable
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the
following image.
Fig. Image of A to Mini-B cable
Step 2: Download Arduino IDE Software.
You can get different versions of Arduino IDE from the Download page on the Arduino Official
website. You must select your software, which is compatible with your operating system
(Windows, IOS, or Linux). After your file download is complete, unzip the file.
14
Fig. Image of Arduino installation file
Step 3: Power up your board.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either
the USB connection to the computer or an external power supply. If you are using an Arduino
Diecimila, you have to make sure that the board is configured to draw power from the USB
connection. The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins closest to the
USB port. Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
Step 4: Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder,
you can find the application icon with an infinity label (application.exe). Double-click the icon to
start the IDE.
15
Fig. Image of installation procedure
Step 5: Open your first project.
Once the software starts, you have two options:
∙ Create a new project.
∙ Open an existing project example
To create a new project, select File --> New
16
To open an existing project example, select File -> Example -> Basics -> Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off
with some time delay. You can select any other example from the list.
Step 6: Select your Arduino board.
To avoid any error while uploading your program to the board, you must select the correct Arduino
board name, which matches with the board connected to your computer. Go to Tools -> Board and
select your board.
17
EXPERIMENT 1.1 – DIGITAL READ WITH 8 BIT SWITCH
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371)
2. Write program to control 8bits LED
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR DIGITAL READ:
Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer.
Step 2: Connect Vin on the Arduino to the positive (+) terminal of the breadboard on TPS-3371
Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371
Step 4: Connect pin 2,3,4,5,6,7,8,9 on the Arduino to switch S7,S6,S5,S4,S3,S2,S1,S0 on the TPS
3371 respectively
Step 5: Write code for digital read and compile on the Arduino IDE
Step 6: Toggle the switches to obtain different values according to the table below.
Switch S7 S6 S5 S4 S3 S2 S1 S0
State (H/L)
Table: A table for the state of the LED (High or Low)
Step 7: Tabulate your result
18
Fig. Screenshot of result obtained from the experiment
Fig. Schematic Diagram of SKAD 3371A and TPS 3371 connection.
19
Fig. Physical image of SKAD 3371A and TPS 3371 connection.
PRECAUTIONS:
1. Ensure that the TPS 3371 equipment is turned off during connection to SKAD 3371.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
Fig. Screenshot of steps taken select Arduino UNO in the IDE interface
20
Fig. Screenshots of steps taken to allow communication between Arduino board and computer
CODE FOR DIGITAL READ
int S7 = 2; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D2
int S6 = 3; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D3
int S5 = 4; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D4
int S4 = 5; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D5
int S3 = 6; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D6
int S2 = 7; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D7
int S1 = 8; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D8
int S0 = 9; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D9
void setup() {
21
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(S7, INPUT); //Variable S7 connected to Digital Pin D2 is configured an INPUT
pinMode(S6, INPUT);
pinMode(S5, INPUT);
pinMode(S4, INPUT);
pinMode(S3, INPUT);
pinMode(S2, INPUT);
pinMode(S1, INPUT);
pinMode(S0, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int Switch7=digitalRead(S7); //The value of S7 is stored in container called Switch7
int Switch6=digitalRead(S6);
int Switch5=digitalRead(S5);
int Switch4=digitalRead(S4);
int Switch3=digitalRead(S3);
int Switch2=digitalRead(S2);
int Switch1=digitalRead(S1);
int Switch0=digitalRead(S0);
Serial.print("Switch7: "); //Print a String called Switch7:
Serial.println(Switch7); //Print the value of Switch7 on the next line
Serial.print("Switch6: ");
Serial.println(Switch6);
Serial.print("Switch5: ");
Serial.println(Switch5);
Serial.print("Switch4: ");
22
Serial.println(Switch4);
Serial.print("Switch3: ");
Serial.println(Switch3);
Serial.print("Switch2: ");
Serial.println(Switch2);
Serial.print("Switch1: ");
Serial.println(Switch1);
Serial.print("Switch0: ");
Serial.println(Switch0);
delay(1000); //delay the printout for an interval of 1000 millisecond(i.e, 1 second)
}
23
EXPERIMENT 1.2 – DIGITAL WRITE WITH AN 8 BIT LED USING ARDUINO
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371)
2. Write program to change the state of the LEDs
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR DIGITAL WRITE:
Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer.
Step 2: Connect Vin on the Arduino to the positive (+) terminal of the breadboard on TPS-3371
Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371
Step 4: Connect pin 2,3,4,5,6,7,8,9 on the Arduino to switch L7,L6,L5,L4,L3,L2,L1,L0 on the
TPS-3371 respectively
Step 5: Write code for digital read and compile on the Arduino IDE
Step 6: Toggle the switches to obtain different values according to the table below.
LEDs L7 L6 L5 L4 L3 L2 L1 L0
State (H/L)
Table: A table for the state of the LED (High or Low)
Step 7: Tabulate your result
24
Fig. Schematic diagram of SKAD-3371A and TPS-3371 connection.
25
Fig. Physical image of SKAD-3371A and TPS-3371 connection.
PRECAUTIONS:
1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
CODE FOR DIGITAL WRITE
int L7 = 2; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D2
int L6 = 3; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D3
int L5 = 4; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D4
int L4 = 5; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D5
26
int L3 = 6; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D6
int L2 = 7; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D7
int L1 = 8; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D8
int L0 = 9; // Variable initialization and definition. Variable is an Integer Data type connected to
digital pin D9
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(L7, OUTPUT); //Variable L7 connected to Digital Pin D2 is configured an OUTPUT
pinMode(L6, OUTPUT);
pinMode(L5, OUTPUT);
pinMode(L4, OUTPUT);
pinMode(L3, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(L1, OUTPUT);
pinMode(L0, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(L7, HIGH); //The value of S7 is stored in container called Switch7
digitalWrite(L6, LOW);
digitalWrite(L5, HIGH);
digitalWrite(L4, LOW);
digitalWrite(L3, HIGH);
digitalWrite(L2, LOW);
digitalWrite(L1, HIGH);
digitalWrite(L0, LOW);
}
27
EXPERIMENT 1.3 – DIGITAL WRITE OF 8 BITS LED WITH ARRAY
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371)
2. Write program to change the state of the LEDs using array
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• SET equipment (TPS 3371)
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR DIGITAL WRITE:
Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer.
Step 2: Connect Vin on the Arduino to the positive (+) terminal of the breadboard on TPS-3371
Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371
Step 4: Connect pin 2,3,4,5,6,7,8,9 on the Arduino to switch L7,L6,L5,L4,L3,L2,L1,L0 on the
TPS-
3371 respectively
Step 5: Write code for digital read and compile on the Arduino IDE
Step 6: Toggle the switches to obtain different values according to the table below.
LEDs L7 L6 L5 L4 L3 L2 L1 L0
State (H/L)
Table: A table for the state of the LED (High or Low)
Step 7: Tabulate your result
28
Fig. Schematic diagram of SKAD-3371A and TPS-3371 connection.
Fig. Physical image of SKAD-3371A and TPS-3371 connection.
29
PRECAUTIONS:
1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
CODE FOR DIGITAL WRITE OF 8 BITS LED WITH ARRAY
/*
Arrays
Demonstrates the use of an array to hold pin numbers in order to iterate over
the pins in a sequence. Lights multiple LEDs in sequence, then in reverse.
Unlike the For Loop tutorial, where the pins have to be contiguous, here the
pins can be in any random order.
https://www.arduino.cc/en/Tutorial/Array
*/
int timer = 100; // The higher the number, the slower the timing.
int ledPins[] = {
2, 3, 4, 5, 6, 7,8,9 //L7,L6,L5,L4,L5,L4,L3,L2,L1,L0
}; // an array of pin numbers to which LEDs are attached
int pinCount = 6; // the number of pins (i.e. the length of the array)
void setup() {
// the array elements are numbered from 0 to (pinCount - 1).
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
30
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
// loop from the highest pin to the lowest:
for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
}
31
EXPERIMENT 1.4 – PULSE WIDTH MODULATION (PWM)
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371)
2. Write program to handle PWM
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• Neopixel matrix (SKAD-3371E) RGB
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR PULSE WIDTH MODULATION (PWM):
Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer.
Step 2: Build the physical circuit according to the schematic diagram
Step 3: Tabulate your result
LEDs L7 L6 L5 L4 L3 L2 L1 L0
State (H/L)
Table: A table for the state of the LED (High or Low)
32
Fig. Schematic for pulse width modulation (PWM)
Fig. Physical image for pulse width modulation (PWM) connection
PRECAUTIONS:
1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
33
CODE FOR PULSE WIDTH MODULATION (PWM)
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
int S8 = 9; //S8 Debounce Circuit For Red. Connected to Arduino digital pin 9
int S9 = 10; //S9 Debounce Circuit For Green. Connected to Arduino digital pin 10
int S10 = 11; //S10 Debounce Circuit For Blue. Connected to Arduino digital pin 11
int RED;
int GREEN;
int BLUE;
int R;
int G;
int B;
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 8 // OConnected to Pin 8 of the Arduino UNO
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 175 // Popular NeoPixel ring size
// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 100 // Time (in milliseconds) to pause between pixels
void setup() {
Serial.begin(9600);
pinMode(S8, INPUT); //Set S8 as an INPUT
pinMode(S9, INPUT); //Set S9 as an INPUT
pinMode(S10, INPUT); //Set S10 as an INPUT
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
34
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.setBrightness(30);
pixels.show();
}
void loop() {
pixels.clear(); // Set all pixel colors to 'off'
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
// delay(1000);
for (int i = 0; i < NUMPIXELS; i++) { // For each pixel...
RED = digitalRead(S8);
GREEN = digitalRead(S9);
BLUE = digitalRead (S10);
if (RED == 1) {
R++;
}
if (R > 255) {
R = 0;
}
if (GREEN == 1) {
G++;
}
if (G > 255) {
G = 0;
}
35
if (BLUE == 1) {
B++;
}
if (B > 255) {
B = 0;
}
Serial.print("R:");
Serial.println(R);
Serial.print("G:");
Serial.println(G);
Serial.print("B:");
Serial.println(B);
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(R, G, B));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
}
36
EXPERIMENT 1.5 – INTRUDER DETECTION USING ULTRASONIC SENSOR (SKAD-
3371B) ON TPS-3371
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize SKAD-3371A with SET equipment (TPS-3371)
2. Write program to Turn on a Buzzer when an intruder blocks the Ultrasonic sensor (SKAD-
3371B)
3. Relate the experiment to real life scenarios (Speed of sound: Echo)
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• Ultrasonic sensor (SKAD-3371B)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• Banana cables
DISCUSSION
The Speed of Sound
A sound wave is a pressure disturbance that travels through a medium by means of particle-to-
particle interaction. As one particle becomes disturbed, it exerts a force on the next adjacent
particle, thus disturbing that particle from rest and transporting the energy through the medium.
Like any wave, the speed of a sound wave refers to how fast the disturbance is passed from
particle to particle. While frequency refers to the number of vibrations that an individual particle
makes per unit of time, speed refers to the distance that the disturbance travels per unit of time.
Always be cautious to distinguish between the two often-confused quantities of speed (how
fast...) and frequency (how often...).
Since the speed of a wave is defined as the distance that a point on a wave (such as a
compression or a rarefaction) travels per unit of time, it is often expressed in units of
meters/second (abbreviated m/s). In equation form, this is;
speed = distance/time
The Speed of Sound in Air
The speed of a sound wave in air depends upon the properties of the air, mostly the temperature,
and to a lesser degree, the humidity. Humidity is the result of water vapor being present in air.
Like any liquid, water has a tendency to evaporate. As it does, particles of gaseous water become
37
mixed in the air. This additional matter will affect the mass density of the air (an inertial
property). The temperature will affect the strength of the particle interactions (an elastic
property). At normal atmospheric pressure, the temperature dependence of the speed of a sound
wave through dry air is approximated by the following equation:
v = 331 m/s + (0.6 m/s/C)•T
where T is the temperature of the air in degrees Celsius. Using this equation to determine the
speed of a sound wave in air at a temperature of 20 degrees Celsius yields the following solution.
v = 331 m/s + (0.6 m/s/C)•T
v = 331 m/s + (0.6 m/s/C)•(20 C)
v = 331 m/s + 12 m/s
v = 343 m/s
Reflection of sound waves
Echoes
Sound waves can reflect off surfaces.
We hear reflected sound waves as echoes.
Hard, smooth surfaces are particularly good at reflecting sound.
This is why empty rooms produce lots of echoes.
Soft, rough surfaces are good at absorbing sound.
This is why rooms with carpets and curtains do not usually produce lots of echoes.
Sound travels at a constant speed in a medium.
If we know the speed of sound and the time it takes for the echo to be detected, we can use the
equation:
Speed =
2 𝑥 𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒
𝑡𝑖𝑚𝑒
to work out distances.
Or
Distance = speed x time.
38
Remember in the time taken to hear an echo the sound has travelled to the object and back again. To
calculate the distance to the object use half of the time (or calculate half the total distance there and
back)
Ultrasound
Ultrasound waves are sound waves which have a frequency higher than the upper limit for
human hearing - above 20,000 Hz.
Ultrasound waves are longitudinal because they are simply high frequency sound waves i.e.
above 20 kHz.
Different species of animal have different hearing ranges.
This explains why a dog can hear the ultrasound produced by a dog whistle, but humans cannot.
Question
A builder uses an ultrasonic device to measure the length of a room.
The device shows that the distance from one wall to the opposite wall is 8.25 m.
If the speed of ultrasound in air is 330 m/s, how long does it take for the ultrasound to
travel to the far wall and back again?
Speed = Time/Distance
Time = Distance/Speed
Distance to opposite wall = 8.25 m
39
Speed of sound = 330 m/s
Time taken from device to opposite wall = 8.25 m/330 m/s
Time taken from device to opposite wall = 0.025 s
Time taken from device to opposite wall and back again:
= 0.025 s x 2 = 0.050 s
The time taken for the ultrasound to travel to the far wall and back again is 0.050 s.
PROCEDURE FOR TURNING ON BUZZER USING ULTRASONIC SENSOR:
Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to
the computer.
Step 2: Connect 5V on the Arduino to the positive (+) terminal of the breadboard on TPS-3371
Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371
Step 4: Connect SKAD-3371B to SKAD-3371A and TPS-3371 as shown on the schematic
diagram.
Step 5: Connect Trigger Pin on SKAD-3371B to pin 7 of SKAD-3371A and
Echo Pin to pin 8
Step 6: Connect the 5v and GND on SKAD-3371B to TPS-3371 5V and GND respectively
Step 7: Connect the Buzzer on TPS-3371 to pin 13 of SKAD-3371A
Step 8: Write code for digital read and compile on the Arduino IDE
Step 9: Change the value of the variable “distance” in the code to obtain the table below
Distance (cm) 10 20 30 40 50 60 70 80 90 100
Time (s)
Table: A table of distance and time
40
Fig. Schematic Diagram of SKAD-3371A, SKAD-3371B and TPS-3371 connection.
41
Fig. Physical image of SKAD-3371A, SKAD-3371B and TPS-3371 connection.
PRECAUTIONS:
1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
4. Ensure that SKAD-3371B is not obstructed
42
CODE FOR TURNING ON BUZZER USING ULTRASONIC SENSOR:
int MotionPin = 13;
int TrigPin = 7;
int EchoPin = 8;
int distance = 30; //Change the value of distance here
int value;
long Time;
void setup() {
Serial.begin(9600); //Initiate serial monitor
pinMode (MotionPin, OUTPUT);
pinMode (TrigPin, OUTPUT); //Sending sound
pinMode (EchoPin, INPUT); //Receiving sound
}
void loop() {
digitalWrite (TrigPin, LOW); //Clears the TrigPin
delayMicroseconds (2);
digitalWrite (TrigPin, HIGH); //Sends the Sound
delayMicroseconds (10);
digitalWrite (TrigPin, LOW);
Time = pulseIn (EchoPin, HIGH); //Reads returning sound
value = Time * 0.034 / 2; //Speed of sound in 343 m/s
Serial.println(value);
if (value <= distance) // centimeters
{
digitalWrite (MotionPin, HIGH);
}
else{
digitalWrite (MotionPin, LOW);
}
}
43
SKAD-3351
44
CHAPTER 2 – DIGITAL ELECTRONICS LOGIC
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351)
2. Write program to read the resolution of analog output TPS-3351 equipment
3. Write program to change the resolution of analog output TPS-3351 equipment to voltage
4. Write program to read enable ADC to read with Neopixel Matrix
5. Write program to read the resolution of analog output TPS-3351 equipment
6. Compare the result with the values on the serial monitor of SKAD-3351A integrated
development environment
7. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3351A)
• SET equipment (TPS-3351)
• Neopixel matrix (SKAD-3351E)
• Digital Multimeter
• Jumper wires
• Banana cables
SUBJECT DISCUSSION:
Introduction to Arduino
Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It
consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready-
made software called Arduino IDE (Integrated Development Environment), which is used to write
and upload the computer code to the physical board.
Arduino Wiring-based Framework allows writing cross-platform software to control devices
attached to a wide range of Arduino boards to create all kinds of creative coding, interactive
objects, spaces or physical experiences.
Arduino is an open-source programmable circuit board that can be integrated into a wide variety
of makerspace projects both simple and complex. This board contains a microcontroller which is
able to be programmed to sense and control objects in the physical world. By responding to sensors
and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and
displays. Because of its flexibility and low cost, Arduino has become a very popular choice for
makers and makerspaces looking to create interactive hardware projects. Arduino was introduced
back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost,
simple tool for creating hardware projects. Since the board is open-source, it is released under a
Creative Commons license which allows anyone to produce their own board. If you search the
45
web, you will find there are hundreds of Arduino compatible clones and variations available but
the only official boards have Arduino in its name.
The key features:
Fig. Image of Arduino Pin-outs
• Arduino boards are able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connecting to the
cloud and many other actions.
• You can control your board functions by sending a set of instructions to the microcontroller
on the board via Arduino IDE (referred to as uploading software).
• Unlike most previous programmable circuit boards, Arduino does not need an extra piece
of hardware (called a programmer) in order to load a new code onto the board. You can
simply use a USB cable.
• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn
to program.
• Finally, Arduino provides a standard form factor that breaks the functions of the
microcontroller into a more accessible package.
46
TYPES OF ARDUINO BOARDS
Arduino is a great platform for prototyping projects and inventions but can be confusing when
having to choose the right board. If you’re brand new to this, you might have always thought that
there was just one “Arduino” board and that’s it. In reality, there are many variations of the official
Arduino boards and then there are hundreds more from competitors who offer clones. Below are
a few examples of the different types of Arduino boards out there. The boards with the name
Arduino on them are the official boards but there are also a lot of really great clones on the market
as well. One of the best reasons to buy a clone is the fact they are generally less expensive than
their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards
which cost less but still have the same quality of the originals. Another factor to consider when
choosing a board is the type of project you are looking to do. For example, if you want to create a
wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The
LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a
small form factor, you might want to use the Arduino Pro Mini which has a very small footprint
compared to other boards.
Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was
not actually the first board to be released, it remains to be the most actively used and most widely
documented on the market.
Fig. Image of Arduino Board
Board Breakdown Here are the components that make up an Arduino board and what each of their
functions are.
1. Reset Button – This will restart any code that is loaded to the Arduino board
2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
47
3. Ground Pin – There are a few ground pins on the Arduino and they all work the same
4. Digital Input/Output – Pins 0-13 can be used for digital input or output
5. PWM – The pins marked with the (~) symbol can simulate analog output
6. USB Connection – Used for powering up your Arduino and uploading sketches
7. TX/RX – Transmit and receive data indication LEDs
8. AT-mega Microcontroller – This is the brains and is where the programs are stored
9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source
10.Voltage Regulator – This controls the amount of voltage going into the Arduino board
11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino and they all work the same
15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital
ARDUINO POWER SUPPLY
The Arduino Uno needs a power source in order for it to operate and can be powered in a variety
of ways. You can do what most people do and connect the board directly to your computer via a
USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice.
The last method would be to use a 9V AC power supply.
Fig. Image of Arduino power supply
48
ARDUINO BREADBOARD
Another very important item when working with Arduino is a solderless breadboard. This device
allows you to prototype your Arduino project without having to permanently solder the circuit
together. Using a breadboard allows you to create temporary prototypes and experiment with
different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which
are connected to each other by strips of conductive material.
Fig. Image of a breadboard
On a side note, the breadboard is not powered on its own and needs power brought to it from the
Arduino board using jumper wires. These wires are also used to form the circuit by connecting
resistors, switches and other components together.
ARDUINO INSTALLATION
Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB
cable.
In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila,
you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB
printer as shown in the following image.
49
Fig. Image of SKAD-3300A USB cable
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the
following image.
Fig. Image of A to Mini-B cable
Step 2: Download Arduino IDE Software.
You can get different versions of Arduino IDE from the Download page on the Arduino Official
website. You must select your software, which is compatible with your operating system
(Windows, IOS, or Linux). After your file download is complete, unzip the file.
50
Fig. Image of Arduino installation file
Step 3: Power up your board.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either
the USB connection to the computer or an external power supply. If you are using an Arduino
Diecimila, you have to make sure that the board is configured to draw power from the USB
connection. The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins closest to the
USB port. Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
Step 4: Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder,
you can find the application icon with an infinity label (application.exe). Double-click the icon to
start the IDE.
51
Fig. Image of installation procedure
Step 5: Open your first project.
Once the software starts, you have two options:
∙ Create a new project.
∙ Open an existing project example
To create a new project, select File --> New
52
To open an existing project example, select File -> Example -> Basics -> Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off
with some time delay. You can select any other example from the list.
Step 6: Select your Arduino board.
To avoid any error while uploading your program to the board, you must select the correct Arduino
board name, which matches with the board connected to your computer. Go to Tools -> Board and
select your board.
53
EXPERIMENT 2.1 – ADC READ RESOLUTION
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351)
2. Write program to read the resolution of analog output TPS-3351 equipment
3. Compare the result with the values on the serial monitor of SKAD-3351A integrated
development environment
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3351A)
• Serial monitor
• SET equipment (TPS-3351)
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR ADC READ RESOLUTION
Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to
the computer.
Step 2: Connect the physical circuit according to the schematic diagram below
Step 3: Tabulate your result
54
Fig. schematic diagram for ADC read resolution
55
Fig. Physical connection for ADC read resolution
BINARY NUMBER RESOLUTION VALUE
00000000
10000000
11000000
11100000
11110000
11111000
11111100
11111110
11111111
Table: for ADC read resolution
56
PRECAUTIONS:
1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
CODE FOR ADC READ RESOLUTION
float adcRead;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(adcRead, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
adcRead = analogRead(A0);
Serial.println(ADC);
delay(2000);
}
57
EXPERIMENT 2.2 – ADC RESOLUTION CONVERTED TO VOLTAGE
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351)
2. Write program to change the resolution of analog output TPS-3351 equipment to voltage
3. Compare the result with the values on the serial monitor of SKAD-3351A integrated
development environment
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3351A)
• Serial monitor
• SET equipment (TPS-3351)
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR ADC RESOLUTION CONVERTED TO VOLTAGE
Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to
the computer.
Step 2: Connect the physical circuit according to the schematic diagram below
Step 3: Tabulate your result
58
Fig. schematic diagram for ADC resolution converted to voltage
Fig. Physical connection for ADC resolution converted to voltage
59
BINARY NUMBER RESOLUTION VALUE OUTPUT VOLTAGE
00000000
10000000
11000000
11100000
11110000
11111000
11111100
11111110
11111111
Table: A table of binary numbers, resolution, and voltage
PRECAUTIONS:
1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
CODE FOR ADC RESOLUTION CONVERTED TO VOLTAGE
float adcRead;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(adcRead, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
adcRead = analogRead(A0);
float voltageRead=(4.87*adcRead)/1023.00;
Serial.println(ADC);
Serial.println(voltageRead);
delay(2000);
}
60
EXPERIMENT 2.3 – ADC READ WITH NEOPIXEL MATRIX
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351)
2. Write program to read enable ADC to read with Neopixel Matrix
3. Compare the result with the values on the serial monitor of SKAD-3351A integrated
development environment
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3351A)
• SET equipment (TPS-3351)
• Neopixel matrix (SKAD-3351E) RGB
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR ADC READ WITH NEOPIXEL MATRIX
Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to
the computer.
Step 2: Connect the physical circuit according to the schematic diagram below
Step 3: Collect data from the serial monitor
Step 4 Compare your result with what you obtained in Experiment 1.1
61
Fig. schematic diagram for ADC read with neopixel matrix
Fig. Physical circuit connection for ADC read with neopixel matrix
62
PRECAUTIONS:
1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
4. Handle Neopixel matrix (SKAD-3351E) with care
CODE FOR ADC READ WITH NEOPIXEL MATRIX
int adcRead;
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif
#define PIN 8
// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
// NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT,
NEO_MATRIX_RIGHT:
// Position of the FIRST LED in the matrix; pick two, e.g.
// NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
// NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
// rows or in vertical columns, respectively; pick one or the other.
// NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
// in the same order, or alternate lines reverse direction; pick one.
// See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
63
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// Example for NeoPixel Shield. In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino. When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order. The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(25, 7, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255)
};
void setup() {
Serial.begin(9600); // Set the baud rate of the serial monitor
pinMode(adcRead, INPUT);
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(40);
matrix.setTextColor(colors[0]);
}
int x = matrix.width();
int pass = 0;
void loop() {
adcRead = analogRead(A0);
64
Serial.println(ADC);
delay(100);
matrix.fillScreen(0);
matrix.setCursor(x, 0);
matrix.print(F("ADC: "));
matrix.print(adcRead);
if (--x < -36) {
x = matrix.width();
if (++pass >= 3) pass = 0;
matrix.setTextColor(colors[pass]);
}
matrix.show();
delay(100);
}
65
EXPERIMENT 2.4 – ADC RESOLUTION CONVERTED TO VOLTAGE WITH
NEOPIXEL MATRIX
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351)
2. Write program to read the resolution of analog output TPS-3351 equipment
3. Compare the result with the values on the serial monitor of SKAD-3351A integrated
development environment
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3351A)
• SET equipment (TPS-3351)
• Neopixel matrix (SKAD-3351E) RGB
• Digital Multimeter
• Jumper wires
• Banana cables
PROCEDURE FOR ADC RESOLUTION CONVERTED TO VOLTAGE WITH
NEOPIXEL MATRIX
Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to
the computer.
Step 2: Connect the physical circuit according to the schematic diagram below
Step 3: Get reading from the serial monitor
Step 4: Compare your result with what you obtained in Experiment 2.0
66
Fig. schematic diagram for ADC resolution converted to voltage with neopixel matrix
Fig. Physical circuit connection for ADC resolution converted to voltage with neopixel matrix
67
PRECAUTIONS:
1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351.
2. Ensure secure connection of jumper wires
3. Ensure that the serial monitor is activated
CODE FOR ADC RESOLUTION CONVERTED TO VOLTAGE WITH NEOPIXEL
MATRIX
float adcRead;
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif
#define PIN 8
// MATRIX DECLARATION:
// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
// NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT,
NEO_MATRIX_RIGHT:
// Position of the FIRST LED in the matrix; pick two, e.g.
// NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
// NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
// rows or in vertical columns, respectively; pick one or the other.
// NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
// in the same order, or alternate lines reverse direction; pick one.
// See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
68
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// Example for NeoPixel Shield. In this application we'd like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino. When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order. The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(25, 7, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255)
};
void setup() {
Serial.begin(9600);
pinMode(adcRead, INPUT);
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(40);
matrix.setTextColor(colors[0]);
}
int x = matrix.width();
int pass = 0;
void loop() {
adcRead = analogRead(A0);
float voltageRead = (5 * adcRead) / 1023.00; //chage 5
Serial.println(ADC);
69
Serial.println(voltageRead);
delay(100);
matrix.fillScreen(0);
matrix.setCursor(x, 0);
matrix.print(F("ADC: "));
matrix.print(adcRead);
matrix.print(F(" Voltage: "));
matrix.print(voltageRead);
if (--x < -130) {
x = matrix.width();
if (++pass >= 3) pass = 0;
matrix.setTextColor(colors[pass]);
}
matrix.show();
delay(100);
}
CODE FOR PWM COLOR MIXING
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
int S8 = 9; //S8 Debounce Circuit For Red. Connected to Arduino digital pin 9
int S9 = 10; //S9 Debounce Circuit For Green. Connected to Arduino digital pin 10
int S10 = 11; //S10 Debounce Circuit For Blue. Connected to Arduino digital pin 11
int RED;
int GREEN;
int BLUE;
int R;
70
int G;
int B;
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 8 // OConnected to Pin 8 of the Arduino UNO
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 175 // Popular NeoPixel ring size
// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 100 // Time (in milliseconds) to pause between pixels
void setup() {
Serial.begin(9600);
pinMode(S8, INPUT); //Set S8 as an INPUT
pinMode(S9, INPUT); //Set S9 as an INPUT
pinMode(S10, INPUT); //Set S10 as an INPUT
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.setBrightness(30);
pixels.show();
}
void loop() {
71
pixels.clear(); // Set all pixel colors to 'off'
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
// delay(1000);
for (int i = 0; i < NUMPIXELS; i++) { // For each pixel...
RED = digitalRead(S8);
GREEN = digitalRead(S9);
BLUE = digitalRead (S10);
if (RED == 1) {
R++;
}
if (R > 255) {
R = 0;
}
if (GREEN == 1) {
G++;
}
if (G > 255) {
G = 0;
}
if (BLUE == 1) {
B++;
}
if (B > 255) {
B = 0;
}
Serial.print("R:");
Serial.println(R);
Serial.print("G:");
72
Serial.println(G);
Serial.print("B:");
Serial.println(B);
// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(R, G, B));
pixels.show(); // Send the updated pixel colors to the hardware.
delay(DELAYVAL); // Pause before next pass through loop
}
}
73
SKAD-3321
74
CHAPTER 3 – ELECTRICITY & SEMICONDUCTOR SIMULATION
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS 3321)
2. Write program to control lamp depending on the state of the LDR
3. Write program to use temperature to control fan with indicator
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD 3321A)
• Temperature Sensor (SKAD-3321D) DHT22,
• Brushless Fan 12V DC (SKAD-3321G)
• SET equipment (TPS 3321)
• Digital Multimeter
• Jumper wires
• Banana cables
SUBJECT DISCUSSION:
Introduction to Arduino
Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It
consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready-
made software called Arduino IDE (Integrated Development Environment), which is used to write
and upload the computer code to the physical board.
Arduino Wiring-based Framework allows writing cross-platform software to control devices
attached to a wide range of Arduino boards to create all kinds of creative coding, interactive
objects, spaces or physical experiences.
Arduino is an open-source programmable circuit board that can be integrated into a wide variety
of makerspace projects both simple and complex. This board contains a microcontroller which is
able to be programmed to sense and control objects in the physical world. By responding to sensors
and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and
displays. Because of its flexibility and low cost, Arduino has become a very popular choice for
makers and makerspaces looking to create interactive hardware projects. Arduino was introduced
back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost,
simple tool for creating hardware projects. Since the board is open-source, it is released under a
Creative Commons license which allows anyone to produce their own board. If you search the
web, you will find there are hundreds of Arduino compatible clones and variations available but
the only official boards have Arduino in its name.
75
The key features:
Fig. Image of Arduino Pin-outs
• Arduino boards are able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connecting to the
cloud and many other actions.
• You can control your board functions by sending a set of instructions to the microcontroller
on the board via Arduino IDE (referred to as uploading software).
• Unlike most previous programmable circuit boards, Arduino does not need an extra piece
of hardware (called a programmer) in order to load a new code onto the board. You can
simply use a USB cable.
• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn
to program.
• Finally, Arduino provides a standard form factor that breaks the functions of the
microcontroller into a more accessible package.
76
TYPES OF ARDUINO BOARDS
Arduino is a great platform for prototyping projects and inventions but can be confusing when
having to choose the right board. If you’re brand new to this, you might have always thought that
there was just one “Arduino” board and that’s it. In reality, there are many variations of the official
Arduino boards and then there are hundreds more from competitors who offer clones. Below are
a few examples of the different types of Arduino boards out there. The boards with the name
Arduino on them are the official boards but there are also a lot of really great clones on the market
as well. One of the best reasons to buy a clone is the fact they are generally less expensive than
their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards
which cost less but still have the same quality of the originals. Another factor to consider when
choosing a board is the type of project you are looking to do. For example, if you want to create a
wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The
LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a
small form factor, you might want to use the Arduino Pro Mini which has a very small footprint
compared to other boards.
Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was
not actually the first board to be released, it remains to be the most actively used and most widely
documented on the market.
Fig. Image of Arduino Board
Board Breakdown Here are the components that make up an Arduino board and what each of their
functions are.
1. Reset Button – This will restart any code that is loaded to the Arduino board
77
2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
3. Ground Pin – There are a few ground pins on the Arduino and they all work the same
4. Digital Input/Output – Pins 0-13 can be used for digital input or output
5. PWM – The pins marked with the (~) symbol can simulate analog output
6. USB Connection – Used for powering up your Arduino and uploading sketches
7. TX/RX – Transmit and receive data indication LEDs
8. AT-mega Microcontroller – This is the brains and is where the programs are stored
9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source
10.Voltage Regulator – This controls the amount of voltage going into the Arduino board
11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino and they all work the same
15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital
ARDUINO POWER SUPPLY
The Arduino Uno needs a power source in order for it to operate and can be powered in a variety
of ways. You can do what most people do and connect the board directly to your computer via a
USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice.
The last method would be to use a 9V AC power supply.
Fig. Image of Arduino power supply
78
ARDUINO BREADBOARD
Another very important item when working with Arduino is a solderless breadboard. This device
allows you to prototype your Arduino project without having to permanently solder the circuit
together. Using a breadboard allows you to create temporary prototypes and experiment with
different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which
are connected to each other by strips of conductive material.
Fig. Image of a breadboard
On a side note, the breadboard is not powered on its own and needs power brought to it from the
Arduino board using jumper wires. These wires are also used to form the circuit by connecting
resistors, switches and other components together.
ARDUINO INSTALLATION
Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB
cable.
In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila,
you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB
printer as shown in the following image.
79
Fig. Image of SKAD-3300A USB cable
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the
following image.
Fig. Image of A to Mini-B cable
Step 2: Download Arduino IDE Software.
You can get different versions of Arduino IDE from the Download page on the Arduino Official
website. You must select your software, which is compatible with your operating system
(Windows, IOS, or Linux). After your file download is complete, unzip the file.
80
Fig. Image of Arduino installation file
Step 3: Power up your board.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either
the USB connection to the computer or an external power supply. If you are using an Arduino
Diecimila, you have to make sure that the board is configured to draw power from the USB
connection. The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins closest to the
USB port. Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
Step 4: Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder,
you can find the application icon with an infinity label (application.exe). Double-click the icon to
start the IDE.
81
Fig. Image of installation procedure
Step 5: Open your first project.
Once the software starts, you have two options:
∙ Create a new project.
∙ Open an existing project example
To create a new project, select File --> New
82
To open an existing project example, select File -> Example -> Basics -> Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off
with some time delay. You can select any other example from the list.
Step 6: Select your Arduino board.
83
To avoid any error while uploading your program to the board, you must select the correct Arduino
board name, which matches with the board connected to your computer. Go to Tools -> Board and
select your board.
EXPERIMENT 3.1 – AUTOMATIC STREET LIGHT USING LDR
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS 3321)
2. Write program to control lamp depending on the state of the LDR
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• LDR (SKAD-3321D)
• SET equipment (TPS-3321)
• Digital Multimeter
• Jumper wires
• Banana cables
• LED
PROCEDURE FOR CONTROLLING DEMO AUTOMATIC STREET LIGHT USING
LDR
Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to
the computer.
Step 2: Implement the circuit shown on the schematic diagram below
84
Fig. Schematic diagram Automatic Street Light using LDR
Fig. Connection of SKAD-3321 to TPS 3321 at OFF state
85
Fig. Connection of SKAD-3321 to TPS-3321 at ON state
PRECAUTIONS:
1. Ensure that the TPS-3321 equipment is turned off during connection to SKAD-3321.
2. Ensure secure connection of jumper wires
CODE FOR CONTROLLING DEMO AUTOMATIC STREET LIGHT USING LDR
//Automatic Street Light with LDR//
int sensorPin=A5; //LDR Sensor Pin
#define light 2 //LED Pin
int sensorValue;
int led;
void setup()
{
86
Serial.begin(9600); //Initiate serial monitor
pinMode(led,OUTPUT);
pinMode(sensorPin,INPUT);
}
void loop()
{
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue); //Display values on Serial Monitor
//check if it is dark then switch on the light else let it remain off
if (sensorValue <100){
digitalWrite(light,HIGH);
}
else if (sensorValue >100){
digitalWrite(light,LOW);
}
}
87
EXPERIMENT 3.2 – TEMPERATURE CONTROLLED FAN WITH INDICATOR
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS 3321)
2. Write program to use temperature to control fan with indicator
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3371A)
• Temperature Sensor (SKAD-3321D) DHT22
• SET equipment (TPS-3321)
• Digital Multimeter
• Jumper wires
• Banana cables
• Brushless Fan 12V DC (SKAD-3321G)
PROCEDURE FOR TEMPERATURE CONTROLLED FAN WITH INDICATOR
Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to
the computer.
Step 2: Implement the circuit shown on the schematic diagram below
Fig. Schematic diagram for temperature-controlled fan with indicator
88
Fig. Physical image of temperature-controlled fan with indicator connection
PRECAUTIONS:
1. Ensure that the TPS-3321 equipment is turned off during connection to SKAD-3321.
2. Ensure secure connection of jumper wires
3. Do not allow any object to enter the fan blade
CODE FOR TEMPERATURE CONTROLLED FAN WITH INDICATOR
#include "DHT.h"
#define DHTPIN 2 // What pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
#define fan 4
int maxTemp = 27;
DHT dht(DHTPIN, DHTTYPE);
89
void setup() {
pinMode(fan, OUTPUT);
Serial.begin(9600);
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
// Read temperature as Celsius
float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
if(t > maxTemp) {
digitalWrite(fan, HIGH);
} else {
digitalWrite(fan, LOW);
}
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C ");
}
90
SKAD-3717
91
CHAPTER 4 – GREEN HOUSE EFFECTS
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3717)
2. Write program to control the temperature of greenhouse effect
3. Write program to measure temperature and humidity using sensor (DHT22) and LCD
4. Write program to measure temperature and humidity using relay and fan
5. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3717A)
• SET equipment (TPS-3717)
• LCD (SKAD-3717C)
• Temperature & Humidity sensor (SKAD-3717D): DHT22
• Relay (SKAD-3717F)
• Digital Multimeter
• Jumper wires
• BRUSHLESS FAN 12V DC: SKAD-3717G
SUBJECT DISCUSSION:
Introduction to Arduino
Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It
consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready-
made software called Arduino IDE (Integrated Development Environment), which is used to write
and upload the computer code to the physical board.
Arduino Wiring-based Framework allows writing cross-platform software to control devices
attached to a wide range of Arduino boards to create all kinds of creative coding, interactive
objects, spaces or physical experiences.
Arduino is an open-source programmable circuit board that can be integrated into a wide variety
of makerspace projects both simple and complex. This board contains a microcontroller which is
able to be programmed to sense and control objects in the physical world. By responding to sensors
and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and
displays. Because of its flexibility and low cost, Arduino has become a very popular choice for
makers and makerspaces looking to create interactive hardware projects. Arduino was introduced
back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost,
simple tool for creating hardware projects. Since the board is open-source, it is released under a
Creative Commons license which allows anyone to produce their own board. If you search the
web, you will find there are hundreds of Arduino compatible clones and variations available but
the only official boards have Arduino in its name.
92
The key features:
Fig. Image of Arduino Pin-outs
• Arduino boards are able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connecting to the
cloud and many other actions.
• You can control your board functions by sending a set of instructions to the microcontroller
on the board via Arduino IDE (referred to as uploading software).
• Unlike most previous programmable circuit boards, Arduino does not need an extra piece
of hardware (called a programmer) in order to load a new code onto the board. You can
simply use a USB cable.
• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn
to program.
• Finally, Arduino provides a standard form factor that breaks the functions of the
microcontroller into a more accessible package.
TYPES OF ARDUINO BOARDS
Arduino is a great platform for prototyping projects and inventions but can be confusing when
having to choose the right board. If you’re brand new to this, you might have always thought that
there was just one “Arduino” board and that’s it. In reality, there are many variations of the official
Arduino boards and then there are hundreds more from competitors who offer clones. Below are
a few examples of the different types of Arduino boards out there. The boards with the name
93
Arduino on them are the official boards but there are also a lot of really great clones on the market
as well. One of the best reasons to buy a clone is the fact they are generally less expensive than
their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards
which cost less but still have the same quality of the originals. Another factor to consider when
choosing a board is the type of project you are looking to do. For example, if you want to create a
wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The
LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a
small form factor, you might want to use the Arduino Pro Mini which has a very small footprint
compared to other boards.
Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was
not actually the first board to be released, it remains to be the most actively used and most widely
documented on the market.
Fig. Image of Arduino Board
Board Breakdown Here are the components that make up an Arduino board and what each of their
functions are.
1. Reset Button – This will restart any code that is loaded to the Arduino board
2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
3. Ground Pin – There are a few ground pins on the Arduino and they all work the same
4. Digital Input/Output – Pins 0-13 can be used for digital input or output
5. PWM – The pins marked with the (~) symbol can simulate analog output
6. USB Connection – Used for powering up your Arduino and uploading sketches
94
7. TX/RX – Transmit and receive data indication LEDs
8. AT-mega Microcontroller – This is the brains and is where the programs are stored
9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source
10.Voltage Regulator – This controls the amount of voltage going into the Arduino board
11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino and they all work the same
15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital
ARDUINO POWER SUPPLY
The Arduino Uno needs a power source in order for it to operate and can be powered in a variety
of ways. You can do what most people do and connect the board directly to your computer via a
USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice.
The last method would be to use a 9V AC power supply.
Fig. Image of Arduino power supply
ARDUINO BREADBOARD
Another very important item when working with Arduino is a solderless breadboard. This device
allows you to prototype your Arduino project without having to permanently solder the circuit
together. Using a breadboard allows you to create temporary prototypes and experiment with
different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which
are connected to each other by strips of conductive material.
95
Fig. Image of a breadboard
On a side note, the breadboard is not powered on its own and needs power brought to it from the
Arduino board using jumper wires. These wires are also used to form the circuit by connecting
resistors, switches and other components together.
ARDUINO INSTALLATION
Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB
cable.
In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila,
you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB
printer as shown in the following image.
Fig. Image of SKAD-3700A USB cable
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the
following image.
96
Fig. Image of A to Mini-B cable
Step 2: Download Arduino IDE Software.
You can get different versions of Arduino IDE from the Download page on the Arduino Official
website. You must select your software, which is compatible with your operating system
(Windows, IOS, or Linux). After your file download is complete, unzip the file.
Fig. Image of Arduino installation file
Step 3: Power up your board.
97
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either
the USB connection to the computer or an external power supply. If you are using an Arduino
Diecimila, you have to make sure that the board is configured to draw power from the USB
connection. The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins closest to the
USB port. Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
Step 4: Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder,
you can find the application icon with an infinity label (application.exe). Double-click the icon to
start the IDE.
Fig. Image of installation procedure
Step 5: Open your first project.
Once the software starts, you have two options:
∙ Create a new project.
∙ Open an existing project example
To create a new project, select File --> New
98
To open an existing project example, select File -> Example -> Basics -> Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off
with some time delay. You can select any other example from the list.
Step 6: Select your Arduino board.
99
To avoid any error while uploading your program to the board, you must select the correct Arduino
board name, which matches with the board connected to your computer. Go to Tools -> Board and
select your board.
EXPERIMENT 4.1 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING
SENSOR (DHT22) AND LCD
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS 3717)
2. Write program to control the temperature of greenhouse effect
3. Write program to measure temperature and humidity using sensor (DHT22) and LCD
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3717A)
• SET equipment (TPS 3717)
• LCD (SKAD-3717C)
• Temperature & Humidity sensor (SKAD-3717D): DHT22
• Digital Multimeter
• Jumper wires
PROCEDURE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING
SENSOR (DHT22) AND LCD
Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to
the computer.
Step 2: Implement the circuit shown on the schematic diagram below
100
Fig. Schematic diagram connecting DHT22, LCD and UNO in a Greenhouse
Fig. External view of TPS-3717
101
Fig. Internal view of TPS-3717
PRECAUTIONS:
3. Ensure that the TPS-3717 equipment is turned off during connection to SKAD-3717.
4. Ensure secure connection of jumper wires
5. Do not apply direct heat to DHT22 when performing the experiment
102
INTERFACE OF AN 12C LCD WITH ARDUINO
SOURCE:- https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/
CODE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR
(DHT22) AND LCD
//* How to use the DHT-22 sensor with Arduino
// Temperature and humidity sensor and
// I2C LCD1602
// SDA --> A4
// SCL --> A5
//DHT 22 out-->D7
//Libraries
#include <DHT.h>;
//I2C LCD:
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line
display,Pls check your lcd.
103
//Constants
#define DHTPIN 7 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
//Variables
//int chk;
int h; //Stores humidity value
int t; //Stores temperature value
void setup()
{
Serial.begin(9600);
Serial.println("Temperature and Humidity Sensor Test");
dht.begin();
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
lcd.begin(16,2);
}
void loop()
{
//Read data and store it to variables h (humidity) and t (temperature)
// Reading temperature or humidity takes about 250 milliseconds!
h = dht.readHumidity();
t = dht.readTemperature();
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
104
Serial.print(h);
Serial.print(" %, Temp: ");
Serial.print(t);
Serial.println(" ° Celsius");
// set the cursor to (0,0):
// print from 0 to 9:
lcd.setCursor(0, 0);
lcd.println(" Now Temperature ");
lcd.setCursor(0, 1);
lcd.print("T:");
lcd.print(t);
lcd.print("C");
lcd.setCursor(6, 1);
lcd.println("2021 ");
lcd.setCursor(11, 1);
lcd.print("H:");
lcd.print(h);
lcd.print("%");
delay(1000); //Delay 1 sec.
}
105
EXPERIMENT 4.2 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING
RELAY & FAN
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS 3717)
2. Write program to measure temperature and humidity using relay and fan
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3717A)
• SET equipment (TPS 3717)
• LCD (SKAD-3717C)
• Temperature & Humidity sensor (DHT22): SKAD-3717D
• Relay (SKAD-3717F)
• Digital Multimeter
• Jumper wires
• BRUSHLESS FAN 12V DC: SKAD-3717G
PROCEDURE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING
RELAY & FAN
Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to
the computer.
Step 2: Implement the circuit shown on the schematic diagram below
106
Fig. Schematic for Measurement of Temperature and Humidity using Sensor (DHT22) and LCD
Fig. external view of TPS-3717
107
Fig. internal view of TPS-3717
PRECAUTIONS:
1. Ensure that the TPS-3717 equipment is turned off during connection to SKAD-3717.
2. Ensure secure connection of jumper wires
3. Do not apply direct heat to DHT22 when performing the experiment
CODE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR
(DHT22) WITH RELAY & FAN
//* How to use the DHT-22 sensor with Arduino
// Temperature and humidity sensor and
// I2C LCD1602
// SDA --> A4
// SCL --> A5
// DHT 22 out-->D7
// FAN --> 4
//Libraries
#include <DHT.h>;
108
//I2C LCD:
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line
display,Pls check your lcd.
//Constants
#define DHTPIN 7 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
#define fan 4
//Variables
//int chk;
int h; //Stores humidity value
int t; //Stores temperature value
int maxHum = 100;
int maxTemp = 30;
void setup()
{
Serial.begin(9600);
Serial.println("Temperature and Humidity Sensor Test");
pinMode(fan, OUTPUT);
dht.begin();
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
lcd.begin(16,2);
}
void loop()
{
109
//Read data and store it to variables h (humidity) and t (temperature)
// Reading temperature or humidity takes about 250 milliseconds!
h = dht.readHumidity();
t = dht.readTemperature();
//Fan control
if(h > maxHum || t > maxTemp) {
digitalWrite(fan, HIGH);
} else {
digitalWrite(fan, LOW);
}
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %, Temp: ");
Serial.print(t);
Serial.println(" ° Celsius");
// set the cursor to (0,0):
// print from 0 to 9:
lcd.setCursor(0, 0);
lcd.println(" Now Temperature ");
lcd.setCursor(0, 1);
lcd.print("T:");
lcd.print(t);
lcd.print("C");
lcd.setCursor(6, 1);
110
lcd.println("2021 ");
lcd.setCursor(11, 1);
lcd.print("H:");
lcd.print(h);
lcd.print("%");
delay(1000); //Delay 1 sec.
}
111
SKAD-3719
112
CHAPTER 5 – MODERN TECHNOLOGY & ELECTRONIC SYSTEMS
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3719)
2. Write program to control traffic light automatically
3. Write program to control trigger alarm when a train is approaching
4. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3719A)
• SET equipment (TPS-3719)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• LEDS
SUBJECT DISCUSSION:
Introduction to Arduino
Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It
consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready-
made software called Arduino IDE (Integrated Development Environment), which is used to write
and upload the computer code to the physical board.
Arduino Wiring-based Framework allows writing cross-platform software to control devices
attached to a wide range of Arduino boards to create all kinds of creative coding, interactive
objects, spaces or physical experiences.
Arduino is an open-source programmable circuit board that can be integrated into a wide variety
of makerspace projects both simple and complex. This board contains a microcontroller which is
able to be programmed to sense and control objects in the physical world. By responding to sensors
and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and
displays. Because of its flexibility and low cost, Arduino has become a very popular choice for
makers and makerspaces looking to create interactive hardware projects. Arduino was introduced
back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost,
simple tool for creating hardware projects. Since the board is open-source, it is released under a
Creative Commons license which allows anyone to produce their own board. If you search the
web, you will find there are hundreds of Arduino compatible clones and variations available but
the only official boards have Arduino in its name.
113
The key features:
Fig. Image of Arduino Pin-outs
• Arduino boards are able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connecting to the
cloud and many other actions.
• You can control your board functions by sending a set of instructions to the microcontroller
on the board via Arduino IDE (referred to as uploading software).
• Unlike most previous programmable circuit boards, Arduino does not need an extra piece
of hardware (called a programmer) in order to load a new code onto the board. You can
simply use a USB cable.
• Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn
to program.
• Finally, Arduino provides a standard form factor that breaks the functions of the
microcontroller into a more accessible package.
114
TYPES OF ARDUINO BOARDS
Arduino is a great platform for prototyping projects and inventions but can be confusing when
having to choose the right board. If you’re brand new to this, you might have always thought that
there was just one “Arduino” board and that’s it. In reality, there are many variations of the official
Arduino boards and then there are hundreds more from competitors who offer clones. Below are
a few examples of the different types of Arduino boards out there. The boards with the name
Arduino on them are the official boards but there are also a lot of really great clones on the market
as well. One of the best reasons to buy a clone is the fact they are generally less expensive than
their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards
which cost less but still have the same quality of the originals. Another factor to consider when
choosing a board is the type of project you are looking to do. For example, if you want to create a
wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The
LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a
small form factor, you might want to use the Arduino Pro Mini which has a very small footprint
compared to other boards.
Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was
not actually the first board to be released, it remains to be the most actively used and most widely
documented on the market.
Fig. Image of Arduino Board
Board Breakdown Here are the components that make up an Arduino board and what each of their
functions are.
1. Reset Button – This will restart any code that is loaded to the Arduino board
2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
115
3. Ground Pin – There are a few ground pins on the Arduino and they all work the same
4. Digital Input/Output – Pins 0-13 can be used for digital input or output
5. PWM – The pins marked with the (~) symbol can simulate analog output
6. USB Connection – Used for powering up your Arduino and uploading sketches
7. TX/RX – Transmit and receive data indication LEDs
8. AT-mega Microcontroller – This is the brains and is where the programs are stored
9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source
10.Voltage Regulator – This controls the amount of voltage going into the Arduino board
11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply
12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects
13. 5V Pin – This pin supplies 5 volts of power to your projects
14. Ground Pins – There are a few ground pins on the Arduino and they all work the same
15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital
ARDUINO POWER SUPPLY
The Arduino Uno needs a power source in order for it to operate and can be powered in a variety
of ways. You can do what most people do and connect the board directly to your computer via a
USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice.
The last method would be to use a 9V AC power supply.
Fig. Image of Arduino power supply
116
ARDUINO BREADBOARD
Another very important item when working with Arduino is a solderless breadboard. This device
allows you to prototype your Arduino project without having to permanently solder the circuit
together. Using a breadboard allows you to create temporary prototypes and experiment with
different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which
are connected to each other by strips of conductive material.
Fig. Image of a breadboard
On a side note, the breadboard is not powered on its own and needs power brought to it from the
Arduino board using jumper wires. These wires are also used to form the circuit by connecting
resistors, switches and other components together.
ARDUINO INSTALLATION
Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB
cable.
In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila,
you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB
printer as shown in the following image.
117
Fig. Image of SKAD-3700A USB cable
In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the
following image.
Fig. Image of A to Mini-B cable
Step 2: Download Arduino IDE Software.
You can get different versions of Arduino IDE from the Download page on the Arduino Official
website. You must select your software, which is compatible with your operating system
(Windows, IOS, or Linux). After your file download is complete, unzip the file.
118
Fig. Image of Arduino installation file
Step 3: Power up your board.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either
the USB connection to the computer or an external power supply. If you are using an Arduino
Diecimila, you have to make sure that the board is configured to draw power from the USB
connection. The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins closest to the
USB port. Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
Step 4: Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder,
you can find the application icon with an infinity label (application.exe). Double-click the icon to
start the IDE.
119
Fig. Image of installation procedure
Step 5: Open your first project.
Once the software starts, you have two options:
∙ Create a new project.
∙ Open an existing project example
To create a new project, select File --> New
120
To open an existing project example, select File -> Example -> Basics -> Blink.
Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off
with some time delay. You can select any other example from the list.
Step 6: Select your Arduino board.
To avoid any error while uploading your program to the board, you must select the correct Arduino
board name, which matches with the board connected to your computer. Go to Tools -> Board and
select your board.
121
EXPERIMENT 5.1 – AUTOMATIC TRAFFIC LIGHT CONTROL
OBJECTIVES:
At the end of the experiment session, the learner will be able to;
1. Connect and synchronize Arduino UNO with SET equipment (TPS-3719)
2. Write program to control traffic light automatically
3. Relate the experiment to real life scenarios
EQUIPMENT REQUIRED:
• Arduino UNO (SKAD-3719A)
• SET equipment (TPS-3719)
• SET equipment (TPS-3371)
• Digital Multimeter
• Jumper wires
• LEDS
• DC MOTOR
PROCEDURE FOR AUTOMATIC TRAFFIC LIGHT CONTROL
Step 1: Connect Arduino UNO (SKAD-3719A) to one end of the USB cable and the other end to
the computer.
Step 2: Implement the circuit shown on the schematic diagram below
Fig. Schematic Diagram for Automatic Traffic Light Control
122
Fig. Physical circuit connection for Automatic Traffic Light Control
PRECAUTIONS:
1. Ensure that the TPS-3719 equipment is turned off during connection to SKAD-3719.
2. Ensure secure connection of jumper wires
CODE FOR AUTOMATIC TRAFFIC LIGHT CONTROL
// C++ code
//Traffic Light
void setup()
{
pinMode(2, OUTPUT); //Red Light
pinMode(3, OUTPUT); //Yellow Light
pinMode(4, OUTPUT); //Green Light
}
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf
SKAD Electronics Training Manual.pdf

More Related Content

Similar to SKAD Electronics Training Manual.pdf

Proposal Report on Auto Meter Reading
Proposal Report on Auto Meter ReadingProposal Report on Auto Meter Reading
Proposal Report on Auto Meter ReadingRebekahSamuel2
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (Dhruwank Vankawala
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (Dhruwank Vankawala
 
1.Arduino Ecosystem.pptx
1.Arduino Ecosystem.pptx1.Arduino Ecosystem.pptx
1.Arduino Ecosystem.pptxMohamed Essam
 
Digital home automation with arduino bluetooth
Digital home automation with arduino bluetoothDigital home automation with arduino bluetooth
Digital home automation with arduino bluetoothShishupal03012015
 
Introduction to Arduino
Introduction to Arduino Introduction to Arduino
Introduction to Arduino Dennis Espiritu
 
Robotics and Embedded Systems
Robotics and Embedded SystemsRobotics and Embedded Systems
Robotics and Embedded SystemsAnkan Naskar
 
Embedded application development
Embedded application developmentEmbedded application development
Embedded application developmentAakash Raj
 
Industrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder LogicIndustrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder LogicRobocraze
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduinoavikdhupar
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshopmayur1432
 
IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...
IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...
IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...Jayanthi Kannan MK
 
Chapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptxChapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptxkhgh7
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptxAkshat Bijronia
 

Similar to SKAD Electronics Training Manual.pdf (20)

Proposal Report on Auto Meter Reading
Proposal Report on Auto Meter ReadingProposal Report on Auto Meter Reading
Proposal Report on Auto Meter Reading
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (
 
Neno Project.docx
Neno Project.docxNeno Project.docx
Neno Project.docx
 
1.Arduino Ecosystem.pptx
1.Arduino Ecosystem.pptx1.Arduino Ecosystem.pptx
1.Arduino Ecosystem.pptx
 
Ardunio
ArdunioArdunio
Ardunio
 
Digital home automation with arduino bluetooth
Digital home automation with arduino bluetoothDigital home automation with arduino bluetooth
Digital home automation with arduino bluetooth
 
Introduction to Arduino
Introduction to Arduino Introduction to Arduino
Introduction to Arduino
 
What is Arduino ?
What is Arduino ?What is Arduino ?
What is Arduino ?
 
Robotics and Embedded Systems
Robotics and Embedded SystemsRobotics and Embedded Systems
Robotics and Embedded Systems
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Embedded application development
Embedded application developmentEmbedded application development
Embedded application development
 
Industrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder LogicIndustrial Applications of Arduino using Ladder Logic
Industrial Applications of Arduino using Ladder Logic
 
B1_25Jan21.pptx
B1_25Jan21.pptxB1_25Jan21.pptx
B1_25Jan21.pptx
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...
IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...
IoT Arduino UNO, RaspberryPi with Python, RaspberryPi Programming using Pytho...
 
Chapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptxChapter 5 Arduino Microcontroller Systems .pptx
Chapter 5 Arduino Microcontroller Systems .pptx
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptx
 

More from KadiriIbrahim2

Lecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptxLecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptxKadiriIbrahim2
 
session 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptxsession 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptxKadiriIbrahim2
 
Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx
Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptxModelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx
Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptxKadiriIbrahim2
 
Introduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdfIntroduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdfKadiriIbrahim2
 
components_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdfcomponents_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdfKadiriIbrahim2
 
Closed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptxClosed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptxKadiriIbrahim2
 
Introduction to module and IE.ppt
Introduction to module and IE.pptIntroduction to module and IE.ppt
Introduction to module and IE.pptKadiriIbrahim2
 
ch6_digital_filters.pptx
ch6_digital_filters.pptxch6_digital_filters.pptx
ch6_digital_filters.pptxKadiriIbrahim2
 
Power_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptxPower_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptxKadiriIbrahim2
 
Fayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptxFayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptxKadiriIbrahim2
 

More from KadiriIbrahim2 (11)

Lecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptxLecture 1 Introduction to robotics (1).pptx
Lecture 1 Introduction to robotics (1).pptx
 
session 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptxsession 2 Process modelling and dynamics (5).pptx
session 2 Process modelling and dynamics (5).pptx
 
Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx
Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptxModelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx
Modelling using differnt metods in matlab2 (2) (2) (2) (4) (1) (1).pptx
 
Introduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdfIntroduction to MultisimCircuitSimulation.pdf
Introduction to MultisimCircuitSimulation.pdf
 
components_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdfcomponents_of_hydraulic_and_pneumatic_system_-_part_1.pdf
components_of_hydraulic_and_pneumatic_system_-_part_1.pdf
 
Closed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptxClosed-loop control system modelling_pid.pptx
Closed-loop control system modelling_pid.pptx
 
Introduction to module and IE.ppt
Introduction to module and IE.pptIntroduction to module and IE.ppt
Introduction to module and IE.ppt
 
ch6_digital_filters.pptx
ch6_digital_filters.pptxch6_digital_filters.pptx
ch6_digital_filters.pptx
 
Power_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptxPower_Point_PresentationTemplate_Mechanical_20.pptx
Power_Point_PresentationTemplate_Mechanical_20.pptx
 
Fayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptxFayomi Bassey Powerpoint seminar.pptx
Fayomi Bassey Powerpoint seminar.pptx
 
Project Format.pptx
Project Format.pptxProject Format.pptx
Project Format.pptx
 

Recently uploaded

HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 

Recently uploaded (20)

HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 

SKAD Electronics Training Manual.pdf

  • 2. 2 PREFACE Electronics Overview of SKAD ADD-ONS An Add-on can be defined as something that has been or can be added to an existing object or arrangement, in other words, it is an accessory or device designed to maximize the capability of a system. Therefore, Skill ’G’ Add-on also referred to as SKAD are those supplements, appendages, adjunct, addendum, or extra and independent components/accessories added to Special Science, Engineering and Technology (SET) Equipment supplied to 73 and 51 beneficiaries Universities and Polytechnics respectively to improve the competence of the existing equipment. Below is the list of Add-Ons as regards Electronics & Telecommunications SET Equipment: SKAD-3371: Analog & Digital Electronic Hardware Technique includes: • Arduino UNO (SKAD-3371A) • Ultrasonic sensor (SKAD-3371B) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • Banana cables SKAD-3351: Digital Electronics Logic includes: • Arduino UNO (SKAD-3351A) • SET equipment (TPS-3351) • Neopixel matrix (SKAD-3351E) • Digital Multimeter • Jumper wires • Banana cables SKAD-3321: Electricity & Semiconductor Simulation includes: • Arduino UNO (SKAD 3321A) • Temperature Sensor (SKAD-3321D) DHT22, • Brushless Fan 12V DC (SKAD-3321G) • SET equipment (TPS 3321) • Digital Multimeter • Jumper wires • Banana cables SKAD-3717: Green House Control includes: • Arduino UNO (SKAD-3717A) • SET equipment (TPS-3717) • LCD (SKAD-3717C) • Temperature & Humidity sensor (SKAD-3717D): DHT22 • Relay (SKAD-3717F) • Digital Multimeter • Jumper wires • BRUSHLESS FAN 12V DC: SKAD-3717G
  • 3. 3 SKAD-3719: Modern Technology & Electronic Systems includes: • Arduino UNO (SKAD-3719A) • SET equipment (TPS-3719) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • LEDS TABLE OF CONTENT PREFACE ………………………………………………………………………………………...3 CHAPTER 1 – ANALOG & DIGITAL ELECTRONIC HARDWARE TECHNIQUE ……….…5 EXPERIMENT 1.1 – DIGITAL READ WITH 8 BIT SWITCH ………………………………...14 EXPERIMENT 1.2 – DIGITAL WRITE WITH AN 8 BIT LED USING ARDUINO …………..20 EXPERIMENT 1.3 – DIGITAL WRITE OF 8 BITS LED WITH ARRAY …………………......24 EXPERIMENT 1.4 – PULSE WIDTH MODULATION (PWM) ………..…………………......28 EXPERIMENT 1.5 – INTRUDER DETECTION USING ULTRASONIC SENSOR (SKAD- 3371B) ON TPS-3371 ………………………….………………………..33 CHAPTER 2 – DIGITAL ELECTRONICS LOGIC …………………………………………… 38 EXPERIMENT 2.1 – ADC READ RESOLUTION ………………..………………………….. .47 EXPERIMENT 2.2 – ADC RESOLUTION CONVERTED TO VOLTAGE ………………….. 51 EXPERIMENT 2.3 – ADC READ WITH NEOPIXEL MATRIX ………………………………54 EXPERIMENT 2.4 – ADC RESOLUTION CONVERTED TO VOLTAGE WITH NEOPIXEL MATRIX ………………………………………………….……………. 59 CHAPTER 3 – ELECTRICITY & SEMICONDUCTOR SIMULATION ……………………. 68 EXPERIMENT 3.1 – AUTOMATIC STREET LIGHT USING LDR ………………………….77 EXPERIMENT 3.2 – TEMPERATURE CONTROLLED FAN WITH INDICATOR ………… 81 CHAPTER 4 – GREEN HOUSE EFFECTS …………………………………………………... 85 EXPERIMENT 4.1 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR (DHT22) AND LCD……………………………...…………… 93 EXPERIMENT 4.2 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING RELAY & FAN ………………………………………………………… 99 CHAPTER 5 – MODERN TECHNOLOGY & ELECTRONIC SYSTEMS.………………… 106
  • 4. 4 EXPERIMENT 5.1 – AUTOMATIC TRAFFIC LIGHT CONTROL ………..………………. 115 EXPERIMENT 5.2 – TRAIN ALARM SYSTEM ……………………………………………. 118 LIST OF ELECTRONICS ADD-ONs S/N ADD-ON CODE ADD-ON DESCRIPTION PICTURE 1. SKAD 3300F 5V 4 channel relay 2. SKAD 3300H Resistor 10k Ohms (Thermistor) 3. SKAD 3300I 1K 10K 100K 220ohm 1M Resistors 4. SKAD 3300J Jumper wires Female -Female
  • 5. 5 5. SKAD 3300K Jumper wires Male -Male 6. SKAD 3300A Arduino Uno R3 7. SKAD 3300D Temperature & Humidity Sensor (DHT22) 8. SKAD 3300C Display Screen 9. SKAD 3300L 5v Regulator
  • 6. 6 10. SKAD 3300M Light Sensor (LDR) 11. SKAD 3300N Servo motor 12. SKAD 3300P Photo Transistor 13. SKAD 3300E Flexible Pixel Led Module Panel 14. SKAD 3300B Ultrasonic Sensor
  • 7. 7 15. SKAD 3300Q Black Plastic AA Size Power Battery SKAD 3300G Brushless Fan 12v SKAD-3371
  • 8. 8 CHAPTER 1 – ANALOG & DIGITAL ELECTRONIC HARDWARE TECHNIQUE OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS 3371) 2. Write program to control 8bits LED 3. Write program to change the state of the LEDs 4. Write program to change the state of the LEDs using array 5. Write program to handle Pulse Width Modulation (PWM) 6. Write program to Turn on a Buzzer when an intruder blocks the Ultrasonic sensor 7. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • Ultrasonic sensor (SKAD-3371B) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • Banana cables SUBJECT DISCUSSION: Introduction to Arduino Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready- made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. Arduino is an open-source programmable circuit board that can be integrated into a wide variety of makerspace projects both simple and complex. This board contains a microcontroller which is able to be programmed to sense and control objects in the physical world. By responding to sensors and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and displays. Because of its flexibility and low cost, Arduino has become a very popular choice for makers and makerspaces looking to create interactive hardware projects. Arduino was introduced back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost, simple tool for creating hardware projects. Since the board is open-source, it is released under a Creative Commons license which allows anyone to produce their own board. If you search the web, you will find there are hundreds of Arduino compatible clones and variations available but the only official boards have Arduino in its name.
  • 9. 9 The key features: Fig. Image of Arduino Pin-outs • Arduino boards are able to read analog or digital input signals from different sensors and turn it into an output such as activating a motor, turning LED on/off, connecting to the cloud and many other actions. • You can control your board functions by sending a set of instructions to the microcontroller on the board via Arduino IDE (referred to as uploading software). • Unlike most previous programmable circuit boards, Arduino does not need an extra piece of hardware (called a programmer) in order to load a new code onto the board. You can simply use a USB cable. • Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program. • Finally, Arduino provides a standard form factor that breaks the functions of the microcontroller into a more accessible package.
  • 10. 10 TYPES OF ARDUINO BOARDS Arduino is a great platform for prototyping projects and inventions but can be confusing when having to choose the right board. If you’re brand new to this, you might have always thought that there was just one “Arduino” board and that’s it. In reality, there are many variations of the official Arduino boards and then there are hundreds more from competitors who offer clones. Below are a few examples of the different types of Arduino boards out there. The boards with the name Arduino on them are the official boards but there are also a lot of really great clones on the market as well. One of the best reasons to buy a clone is the fact they are generally less expensive than their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards which cost less but still have the same quality of the originals. Another factor to consider when choosing a board is the type of project you are looking to do. For example, if you want to create a wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a small form factor, you might want to use the Arduino Pro Mini which has a very small footprint compared to other boards. Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was not actually the first board to be released, it remains to be the most actively used and most widely documented on the market. Fig. Image of Arduino Board Board Breakdown Here are the components that make up an Arduino board and what each of their functions are. 1. Reset Button – This will restart any code that is loaded to the Arduino board 2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
  • 11. 11 3. Ground Pin – There are a few ground pins on the Arduino and they all work the same 4. Digital Input/Output – Pins 0-13 can be used for digital input or output 5. PWM – The pins marked with the (~) symbol can simulate analog output 6. USB Connection – Used for powering up your Arduino and uploading sketches 7. TX/RX – Transmit and receive data indication LEDs 8. AT-mega Microcontroller – This is the brains and is where the programs are stored 9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source 10.Voltage Regulator – This controls the amount of voltage going into the Arduino board 11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply 12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects 13. 5V Pin – This pin supplies 5 volts of power to your projects 14. Ground Pins – There are a few ground pins on the Arduino and they all work the same 15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital ARDUINO POWER SUPPLY The Arduino Uno needs a power source in order for it to operate and can be powered in a variety of ways. You can do what most people do and connect the board directly to your computer via a USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice. The last method would be to use a 9V AC power supply. Fig. Image of Arduino power supply
  • 12. 12 ARDUINO BREADBOARD Another very important item when working with Arduino is a solderless breadboard. This device allows you to prototype your Arduino project without having to permanently solder the circuit together. Using a breadboard allows you to create temporary prototypes and experiment with different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which are connected to each other by strips of conductive material. Fig. Image of a breadboard On a side note, the breadboard is not powered on its own and needs power brought to it from the Arduino board using jumper wires. These wires are also used to form the circuit by connecting resistors, switches and other components together. ARDUINO INSTALLATION Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image.
  • 13. 13 Fig. Image of SKAD-3300A USB cable In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the following image. Fig. Image of A to Mini-B cable Step 2: Download Arduino IDE Software. You can get different versions of Arduino IDE from the Download page on the Arduino Official website. You must select your software, which is compatible with your operating system (Windows, IOS, or Linux). After your file download is complete, unzip the file.
  • 14. 14 Fig. Image of Arduino installation file Step 3: Power up your board. The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either the USB connection to the computer or an external power supply. If you are using an Arduino Diecimila, you have to make sure that the board is configured to draw power from the USB connection. The power source is selected with a jumper, a small piece of plastic that fits onto two of the three pins between the USB and power jacks. Check that it is on the two pins closest to the USB port. Connect the Arduino board to your computer using the USB cable. The green power LED (labeled PWR) should glow. Step 4: Launch Arduino IDE. After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder, you can find the application icon with an infinity label (application.exe). Double-click the icon to start the IDE.
  • 15. 15 Fig. Image of installation procedure Step 5: Open your first project. Once the software starts, you have two options: ∙ Create a new project. ∙ Open an existing project example To create a new project, select File --> New
  • 16. 16 To open an existing project example, select File -> Example -> Basics -> Blink. Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off with some time delay. You can select any other example from the list. Step 6: Select your Arduino board. To avoid any error while uploading your program to the board, you must select the correct Arduino board name, which matches with the board connected to your computer. Go to Tools -> Board and select your board.
  • 17. 17 EXPERIMENT 1.1 – DIGITAL READ WITH 8 BIT SWITCH OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371) 2. Write program to control 8bits LED 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR DIGITAL READ: Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer. Step 2: Connect Vin on the Arduino to the positive (+) terminal of the breadboard on TPS-3371 Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371 Step 4: Connect pin 2,3,4,5,6,7,8,9 on the Arduino to switch S7,S6,S5,S4,S3,S2,S1,S0 on the TPS 3371 respectively Step 5: Write code for digital read and compile on the Arduino IDE Step 6: Toggle the switches to obtain different values according to the table below. Switch S7 S6 S5 S4 S3 S2 S1 S0 State (H/L) Table: A table for the state of the LED (High or Low) Step 7: Tabulate your result
  • 18. 18 Fig. Screenshot of result obtained from the experiment Fig. Schematic Diagram of SKAD 3371A and TPS 3371 connection.
  • 19. 19 Fig. Physical image of SKAD 3371A and TPS 3371 connection. PRECAUTIONS: 1. Ensure that the TPS 3371 equipment is turned off during connection to SKAD 3371. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated Fig. Screenshot of steps taken select Arduino UNO in the IDE interface
  • 20. 20 Fig. Screenshots of steps taken to allow communication between Arduino board and computer CODE FOR DIGITAL READ int S7 = 2; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D2 int S6 = 3; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D3 int S5 = 4; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D4 int S4 = 5; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D5 int S3 = 6; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D6 int S2 = 7; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D7 int S1 = 8; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D8 int S0 = 9; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D9 void setup() {
  • 21. 21 // put your setup code here, to run once: Serial.begin(9600); pinMode(S7, INPUT); //Variable S7 connected to Digital Pin D2 is configured an INPUT pinMode(S6, INPUT); pinMode(S5, INPUT); pinMode(S4, INPUT); pinMode(S3, INPUT); pinMode(S2, INPUT); pinMode(S1, INPUT); pinMode(S0, INPUT); } void loop() { // put your main code here, to run repeatedly: int Switch7=digitalRead(S7); //The value of S7 is stored in container called Switch7 int Switch6=digitalRead(S6); int Switch5=digitalRead(S5); int Switch4=digitalRead(S4); int Switch3=digitalRead(S3); int Switch2=digitalRead(S2); int Switch1=digitalRead(S1); int Switch0=digitalRead(S0); Serial.print("Switch7: "); //Print a String called Switch7: Serial.println(Switch7); //Print the value of Switch7 on the next line Serial.print("Switch6: "); Serial.println(Switch6); Serial.print("Switch5: "); Serial.println(Switch5); Serial.print("Switch4: ");
  • 22. 22 Serial.println(Switch4); Serial.print("Switch3: "); Serial.println(Switch3); Serial.print("Switch2: "); Serial.println(Switch2); Serial.print("Switch1: "); Serial.println(Switch1); Serial.print("Switch0: "); Serial.println(Switch0); delay(1000); //delay the printout for an interval of 1000 millisecond(i.e, 1 second) }
  • 23. 23 EXPERIMENT 1.2 – DIGITAL WRITE WITH AN 8 BIT LED USING ARDUINO OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371) 2. Write program to change the state of the LEDs 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR DIGITAL WRITE: Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer. Step 2: Connect Vin on the Arduino to the positive (+) terminal of the breadboard on TPS-3371 Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371 Step 4: Connect pin 2,3,4,5,6,7,8,9 on the Arduino to switch L7,L6,L5,L4,L3,L2,L1,L0 on the TPS-3371 respectively Step 5: Write code for digital read and compile on the Arduino IDE Step 6: Toggle the switches to obtain different values according to the table below. LEDs L7 L6 L5 L4 L3 L2 L1 L0 State (H/L) Table: A table for the state of the LED (High or Low) Step 7: Tabulate your result
  • 24. 24 Fig. Schematic diagram of SKAD-3371A and TPS-3371 connection.
  • 25. 25 Fig. Physical image of SKAD-3371A and TPS-3371 connection. PRECAUTIONS: 1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated CODE FOR DIGITAL WRITE int L7 = 2; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D2 int L6 = 3; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D3 int L5 = 4; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D4 int L4 = 5; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D5
  • 26. 26 int L3 = 6; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D6 int L2 = 7; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D7 int L1 = 8; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D8 int L0 = 9; // Variable initialization and definition. Variable is an Integer Data type connected to digital pin D9 void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(L7, OUTPUT); //Variable L7 connected to Digital Pin D2 is configured an OUTPUT pinMode(L6, OUTPUT); pinMode(L5, OUTPUT); pinMode(L4, OUTPUT); pinMode(L3, OUTPUT); pinMode(L2, OUTPUT); pinMode(L1, OUTPUT); pinMode(L0, OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(L7, HIGH); //The value of S7 is stored in container called Switch7 digitalWrite(L6, LOW); digitalWrite(L5, HIGH); digitalWrite(L4, LOW); digitalWrite(L3, HIGH); digitalWrite(L2, LOW); digitalWrite(L1, HIGH); digitalWrite(L0, LOW); }
  • 27. 27 EXPERIMENT 1.3 – DIGITAL WRITE OF 8 BITS LED WITH ARRAY OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371) 2. Write program to change the state of the LEDs using array 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • SET equipment (TPS 3371) • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR DIGITAL WRITE: Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer. Step 2: Connect Vin on the Arduino to the positive (+) terminal of the breadboard on TPS-3371 Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371 Step 4: Connect pin 2,3,4,5,6,7,8,9 on the Arduino to switch L7,L6,L5,L4,L3,L2,L1,L0 on the TPS- 3371 respectively Step 5: Write code for digital read and compile on the Arduino IDE Step 6: Toggle the switches to obtain different values according to the table below. LEDs L7 L6 L5 L4 L3 L2 L1 L0 State (H/L) Table: A table for the state of the LED (High or Low) Step 7: Tabulate your result
  • 28. 28 Fig. Schematic diagram of SKAD-3371A and TPS-3371 connection. Fig. Physical image of SKAD-3371A and TPS-3371 connection.
  • 29. 29 PRECAUTIONS: 1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated CODE FOR DIGITAL WRITE OF 8 BITS LED WITH ARRAY /* Arrays Demonstrates the use of an array to hold pin numbers in order to iterate over the pins in a sequence. Lights multiple LEDs in sequence, then in reverse. Unlike the For Loop tutorial, where the pins have to be contiguous, here the pins can be in any random order. https://www.arduino.cc/en/Tutorial/Array */ int timer = 100; // The higher the number, the slower the timing. int ledPins[] = { 2, 3, 4, 5, 6, 7,8,9 //L7,L6,L5,L4,L5,L4,L3,L2,L1,L0 }; // an array of pin numbers to which LEDs are attached int pinCount = 6; // the number of pins (i.e. the length of the array) void setup() { // the array elements are numbered from 0 to (pinCount - 1). // use a for loop to initialize each pin as an output: for (int thisPin = 0; thisPin < pinCount; thisPin++) { pinMode(ledPins[thisPin], OUTPUT); }
  • 30. 30 } void loop() { // loop from the lowest pin to the highest: for (int thisPin = 0; thisPin < pinCount; thisPin++) { // turn the pin on: digitalWrite(ledPins[thisPin], HIGH); delay(timer); // turn the pin off: digitalWrite(ledPins[thisPin], LOW); } // loop from the highest pin to the lowest: for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { // turn the pin on: digitalWrite(ledPins[thisPin], HIGH); delay(timer); // turn the pin off: digitalWrite(ledPins[thisPin], LOW); } }
  • 31. 31 EXPERIMENT 1.4 – PULSE WIDTH MODULATION (PWM) OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3371) 2. Write program to handle PWM 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • Neopixel matrix (SKAD-3371E) RGB • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR PULSE WIDTH MODULATION (PWM): Step 1: Connect Arduino UNO to one end of the USB cable and the other end to the computer. Step 2: Build the physical circuit according to the schematic diagram Step 3: Tabulate your result LEDs L7 L6 L5 L4 L3 L2 L1 L0 State (H/L) Table: A table for the state of the LED (High or Low)
  • 32. 32 Fig. Schematic for pulse width modulation (PWM) Fig. Physical image for pulse width modulation (PWM) connection PRECAUTIONS: 1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated
  • 33. 33 CODE FOR PULSE WIDTH MODULATION (PWM) #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> // Required for 16 MHz Adafruit Trinket #endif int S8 = 9; //S8 Debounce Circuit For Red. Connected to Arduino digital pin 9 int S9 = 10; //S9 Debounce Circuit For Green. Connected to Arduino digital pin 10 int S10 = 11; //S10 Debounce Circuit For Blue. Connected to Arduino digital pin 11 int RED; int GREEN; int BLUE; int R; int G; int B; // Which pin on the Arduino is connected to the NeoPixels? #define PIN 8 // OConnected to Pin 8 of the Arduino UNO // How many NeoPixels are attached to the Arduino? #define NUMPIXELS 175 // Popular NeoPixel ring size // When setting up the NeoPixel library, we tell it how many pixels, // and which pin to use to send signals. Note that for older NeoPixel // strips you might need to change the third parameter -- see the // strandtest example for more information on possible values. Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 100 // Time (in milliseconds) to pause between pixels void setup() { Serial.begin(9600); pinMode(S8, INPUT); //Set S8 as an INPUT pinMode(S9, INPUT); //Set S9 as an INPUT pinMode(S10, INPUT); //Set S10 as an INPUT // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  • 34. 34 // Any other board, you can remove this part (but no harm leaving it): #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif // END of Trinket-specific code. pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) pixels.setBrightness(30); pixels.show(); } void loop() { pixels.clear(); // Set all pixel colors to 'off' // The first NeoPixel in a strand is #0, second is 1, all the way up // to the count of pixels minus one. // delay(1000); for (int i = 0; i < NUMPIXELS; i++) { // For each pixel... RED = digitalRead(S8); GREEN = digitalRead(S9); BLUE = digitalRead (S10); if (RED == 1) { R++; } if (R > 255) { R = 0; } if (GREEN == 1) { G++; } if (G > 255) { G = 0; }
  • 35. 35 if (BLUE == 1) { B++; } if (B > 255) { B = 0; } Serial.print("R:"); Serial.println(R); Serial.print("G:"); Serial.println(G); Serial.print("B:"); Serial.println(B); // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255 // Here we're using a moderately bright green color: pixels.setPixelColor(i, pixels.Color(R, G, B)); pixels.show(); // Send the updated pixel colors to the hardware. delay(DELAYVAL); // Pause before next pass through loop } }
  • 36. 36 EXPERIMENT 1.5 – INTRUDER DETECTION USING ULTRASONIC SENSOR (SKAD- 3371B) ON TPS-3371 OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize SKAD-3371A with SET equipment (TPS-3371) 2. Write program to Turn on a Buzzer when an intruder blocks the Ultrasonic sensor (SKAD- 3371B) 3. Relate the experiment to real life scenarios (Speed of sound: Echo) EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • Ultrasonic sensor (SKAD-3371B) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • Banana cables DISCUSSION The Speed of Sound A sound wave is a pressure disturbance that travels through a medium by means of particle-to- particle interaction. As one particle becomes disturbed, it exerts a force on the next adjacent particle, thus disturbing that particle from rest and transporting the energy through the medium. Like any wave, the speed of a sound wave refers to how fast the disturbance is passed from particle to particle. While frequency refers to the number of vibrations that an individual particle makes per unit of time, speed refers to the distance that the disturbance travels per unit of time. Always be cautious to distinguish between the two often-confused quantities of speed (how fast...) and frequency (how often...). Since the speed of a wave is defined as the distance that a point on a wave (such as a compression or a rarefaction) travels per unit of time, it is often expressed in units of meters/second (abbreviated m/s). In equation form, this is; speed = distance/time The Speed of Sound in Air The speed of a sound wave in air depends upon the properties of the air, mostly the temperature, and to a lesser degree, the humidity. Humidity is the result of water vapor being present in air. Like any liquid, water has a tendency to evaporate. As it does, particles of gaseous water become
  • 37. 37 mixed in the air. This additional matter will affect the mass density of the air (an inertial property). The temperature will affect the strength of the particle interactions (an elastic property). At normal atmospheric pressure, the temperature dependence of the speed of a sound wave through dry air is approximated by the following equation: v = 331 m/s + (0.6 m/s/C)•T where T is the temperature of the air in degrees Celsius. Using this equation to determine the speed of a sound wave in air at a temperature of 20 degrees Celsius yields the following solution. v = 331 m/s + (0.6 m/s/C)•T v = 331 m/s + (0.6 m/s/C)•(20 C) v = 331 m/s + 12 m/s v = 343 m/s Reflection of sound waves Echoes Sound waves can reflect off surfaces. We hear reflected sound waves as echoes. Hard, smooth surfaces are particularly good at reflecting sound. This is why empty rooms produce lots of echoes. Soft, rough surfaces are good at absorbing sound. This is why rooms with carpets and curtains do not usually produce lots of echoes. Sound travels at a constant speed in a medium. If we know the speed of sound and the time it takes for the echo to be detected, we can use the equation: Speed = 2 𝑥 𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒 𝑡𝑖𝑚𝑒 to work out distances. Or Distance = speed x time.
  • 38. 38 Remember in the time taken to hear an echo the sound has travelled to the object and back again. To calculate the distance to the object use half of the time (or calculate half the total distance there and back) Ultrasound Ultrasound waves are sound waves which have a frequency higher than the upper limit for human hearing - above 20,000 Hz. Ultrasound waves are longitudinal because they are simply high frequency sound waves i.e. above 20 kHz. Different species of animal have different hearing ranges. This explains why a dog can hear the ultrasound produced by a dog whistle, but humans cannot. Question A builder uses an ultrasonic device to measure the length of a room. The device shows that the distance from one wall to the opposite wall is 8.25 m. If the speed of ultrasound in air is 330 m/s, how long does it take for the ultrasound to travel to the far wall and back again? Speed = Time/Distance Time = Distance/Speed Distance to opposite wall = 8.25 m
  • 39. 39 Speed of sound = 330 m/s Time taken from device to opposite wall = 8.25 m/330 m/s Time taken from device to opposite wall = 0.025 s Time taken from device to opposite wall and back again: = 0.025 s x 2 = 0.050 s The time taken for the ultrasound to travel to the far wall and back again is 0.050 s. PROCEDURE FOR TURNING ON BUZZER USING ULTRASONIC SENSOR: Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to the computer. Step 2: Connect 5V on the Arduino to the positive (+) terminal of the breadboard on TPS-3371 Step 3: Connect GND on the Arduino to the negative (-) terminal of the breadboard TPS-3371 Step 4: Connect SKAD-3371B to SKAD-3371A and TPS-3371 as shown on the schematic diagram. Step 5: Connect Trigger Pin on SKAD-3371B to pin 7 of SKAD-3371A and Echo Pin to pin 8 Step 6: Connect the 5v and GND on SKAD-3371B to TPS-3371 5V and GND respectively Step 7: Connect the Buzzer on TPS-3371 to pin 13 of SKAD-3371A Step 8: Write code for digital read and compile on the Arduino IDE Step 9: Change the value of the variable “distance” in the code to obtain the table below Distance (cm) 10 20 30 40 50 60 70 80 90 100 Time (s) Table: A table of distance and time
  • 40. 40 Fig. Schematic Diagram of SKAD-3371A, SKAD-3371B and TPS-3371 connection.
  • 41. 41 Fig. Physical image of SKAD-3371A, SKAD-3371B and TPS-3371 connection. PRECAUTIONS: 1. Ensure that the TPS-3371 equipment is turned off during connection to SKAD-3371. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated 4. Ensure that SKAD-3371B is not obstructed
  • 42. 42 CODE FOR TURNING ON BUZZER USING ULTRASONIC SENSOR: int MotionPin = 13; int TrigPin = 7; int EchoPin = 8; int distance = 30; //Change the value of distance here int value; long Time; void setup() { Serial.begin(9600); //Initiate serial monitor pinMode (MotionPin, OUTPUT); pinMode (TrigPin, OUTPUT); //Sending sound pinMode (EchoPin, INPUT); //Receiving sound } void loop() { digitalWrite (TrigPin, LOW); //Clears the TrigPin delayMicroseconds (2); digitalWrite (TrigPin, HIGH); //Sends the Sound delayMicroseconds (10); digitalWrite (TrigPin, LOW); Time = pulseIn (EchoPin, HIGH); //Reads returning sound value = Time * 0.034 / 2; //Speed of sound in 343 m/s Serial.println(value); if (value <= distance) // centimeters { digitalWrite (MotionPin, HIGH); } else{ digitalWrite (MotionPin, LOW); } }
  • 44. 44 CHAPTER 2 – DIGITAL ELECTRONICS LOGIC OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351) 2. Write program to read the resolution of analog output TPS-3351 equipment 3. Write program to change the resolution of analog output TPS-3351 equipment to voltage 4. Write program to read enable ADC to read with Neopixel Matrix 5. Write program to read the resolution of analog output TPS-3351 equipment 6. Compare the result with the values on the serial monitor of SKAD-3351A integrated development environment 7. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3351A) • SET equipment (TPS-3351) • Neopixel matrix (SKAD-3351E) • Digital Multimeter • Jumper wires • Banana cables SUBJECT DISCUSSION: Introduction to Arduino Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready- made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. Arduino is an open-source programmable circuit board that can be integrated into a wide variety of makerspace projects both simple and complex. This board contains a microcontroller which is able to be programmed to sense and control objects in the physical world. By responding to sensors and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and displays. Because of its flexibility and low cost, Arduino has become a very popular choice for makers and makerspaces looking to create interactive hardware projects. Arduino was introduced back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost, simple tool for creating hardware projects. Since the board is open-source, it is released under a Creative Commons license which allows anyone to produce their own board. If you search the
  • 45. 45 web, you will find there are hundreds of Arduino compatible clones and variations available but the only official boards have Arduino in its name. The key features: Fig. Image of Arduino Pin-outs • Arduino boards are able to read analog or digital input signals from different sensors and turn it into an output such as activating a motor, turning LED on/off, connecting to the cloud and many other actions. • You can control your board functions by sending a set of instructions to the microcontroller on the board via Arduino IDE (referred to as uploading software). • Unlike most previous programmable circuit boards, Arduino does not need an extra piece of hardware (called a programmer) in order to load a new code onto the board. You can simply use a USB cable. • Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program. • Finally, Arduino provides a standard form factor that breaks the functions of the microcontroller into a more accessible package.
  • 46. 46 TYPES OF ARDUINO BOARDS Arduino is a great platform for prototyping projects and inventions but can be confusing when having to choose the right board. If you’re brand new to this, you might have always thought that there was just one “Arduino” board and that’s it. In reality, there are many variations of the official Arduino boards and then there are hundreds more from competitors who offer clones. Below are a few examples of the different types of Arduino boards out there. The boards with the name Arduino on them are the official boards but there are also a lot of really great clones on the market as well. One of the best reasons to buy a clone is the fact they are generally less expensive than their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards which cost less but still have the same quality of the originals. Another factor to consider when choosing a board is the type of project you are looking to do. For example, if you want to create a wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a small form factor, you might want to use the Arduino Pro Mini which has a very small footprint compared to other boards. Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was not actually the first board to be released, it remains to be the most actively used and most widely documented on the market. Fig. Image of Arduino Board Board Breakdown Here are the components that make up an Arduino board and what each of their functions are. 1. Reset Button – This will restart any code that is loaded to the Arduino board 2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
  • 47. 47 3. Ground Pin – There are a few ground pins on the Arduino and they all work the same 4. Digital Input/Output – Pins 0-13 can be used for digital input or output 5. PWM – The pins marked with the (~) symbol can simulate analog output 6. USB Connection – Used for powering up your Arduino and uploading sketches 7. TX/RX – Transmit and receive data indication LEDs 8. AT-mega Microcontroller – This is the brains and is where the programs are stored 9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source 10.Voltage Regulator – This controls the amount of voltage going into the Arduino board 11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply 12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects 13. 5V Pin – This pin supplies 5 volts of power to your projects 14. Ground Pins – There are a few ground pins on the Arduino and they all work the same 15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital ARDUINO POWER SUPPLY The Arduino Uno needs a power source in order for it to operate and can be powered in a variety of ways. You can do what most people do and connect the board directly to your computer via a USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice. The last method would be to use a 9V AC power supply. Fig. Image of Arduino power supply
  • 48. 48 ARDUINO BREADBOARD Another very important item when working with Arduino is a solderless breadboard. This device allows you to prototype your Arduino project without having to permanently solder the circuit together. Using a breadboard allows you to create temporary prototypes and experiment with different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which are connected to each other by strips of conductive material. Fig. Image of a breadboard On a side note, the breadboard is not powered on its own and needs power brought to it from the Arduino board using jumper wires. These wires are also used to form the circuit by connecting resistors, switches and other components together. ARDUINO INSTALLATION Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image.
  • 49. 49 Fig. Image of SKAD-3300A USB cable In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the following image. Fig. Image of A to Mini-B cable Step 2: Download Arduino IDE Software. You can get different versions of Arduino IDE from the Download page on the Arduino Official website. You must select your software, which is compatible with your operating system (Windows, IOS, or Linux). After your file download is complete, unzip the file.
  • 50. 50 Fig. Image of Arduino installation file Step 3: Power up your board. The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either the USB connection to the computer or an external power supply. If you are using an Arduino Diecimila, you have to make sure that the board is configured to draw power from the USB connection. The power source is selected with a jumper, a small piece of plastic that fits onto two of the three pins between the USB and power jacks. Check that it is on the two pins closest to the USB port. Connect the Arduino board to your computer using the USB cable. The green power LED (labeled PWR) should glow. Step 4: Launch Arduino IDE. After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder, you can find the application icon with an infinity label (application.exe). Double-click the icon to start the IDE.
  • 51. 51 Fig. Image of installation procedure Step 5: Open your first project. Once the software starts, you have two options: ∙ Create a new project. ∙ Open an existing project example To create a new project, select File --> New
  • 52. 52 To open an existing project example, select File -> Example -> Basics -> Blink. Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off with some time delay. You can select any other example from the list. Step 6: Select your Arduino board. To avoid any error while uploading your program to the board, you must select the correct Arduino board name, which matches with the board connected to your computer. Go to Tools -> Board and select your board.
  • 53. 53 EXPERIMENT 2.1 – ADC READ RESOLUTION OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351) 2. Write program to read the resolution of analog output TPS-3351 equipment 3. Compare the result with the values on the serial monitor of SKAD-3351A integrated development environment 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3351A) • Serial monitor • SET equipment (TPS-3351) • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR ADC READ RESOLUTION Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to the computer. Step 2: Connect the physical circuit according to the schematic diagram below Step 3: Tabulate your result
  • 54. 54 Fig. schematic diagram for ADC read resolution
  • 55. 55 Fig. Physical connection for ADC read resolution BINARY NUMBER RESOLUTION VALUE 00000000 10000000 11000000 11100000 11110000 11111000 11111100 11111110 11111111 Table: for ADC read resolution
  • 56. 56 PRECAUTIONS: 1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated CODE FOR ADC READ RESOLUTION float adcRead; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(adcRead, INPUT); } void loop() { // put your main code here, to run repeatedly: adcRead = analogRead(A0); Serial.println(ADC); delay(2000); }
  • 57. 57 EXPERIMENT 2.2 – ADC RESOLUTION CONVERTED TO VOLTAGE OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351) 2. Write program to change the resolution of analog output TPS-3351 equipment to voltage 3. Compare the result with the values on the serial monitor of SKAD-3351A integrated development environment 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3351A) • Serial monitor • SET equipment (TPS-3351) • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR ADC RESOLUTION CONVERTED TO VOLTAGE Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to the computer. Step 2: Connect the physical circuit according to the schematic diagram below Step 3: Tabulate your result
  • 58. 58 Fig. schematic diagram for ADC resolution converted to voltage Fig. Physical connection for ADC resolution converted to voltage
  • 59. 59 BINARY NUMBER RESOLUTION VALUE OUTPUT VOLTAGE 00000000 10000000 11000000 11100000 11110000 11111000 11111100 11111110 11111111 Table: A table of binary numbers, resolution, and voltage PRECAUTIONS: 1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated CODE FOR ADC RESOLUTION CONVERTED TO VOLTAGE float adcRead; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(adcRead, INPUT); } void loop() { // put your main code here, to run repeatedly: adcRead = analogRead(A0); float voltageRead=(4.87*adcRead)/1023.00; Serial.println(ADC); Serial.println(voltageRead); delay(2000); }
  • 60. 60 EXPERIMENT 2.3 – ADC READ WITH NEOPIXEL MATRIX OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351) 2. Write program to read enable ADC to read with Neopixel Matrix 3. Compare the result with the values on the serial monitor of SKAD-3351A integrated development environment 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3351A) • SET equipment (TPS-3351) • Neopixel matrix (SKAD-3351E) RGB • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR ADC READ WITH NEOPIXEL MATRIX Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to the computer. Step 2: Connect the physical circuit according to the schematic diagram below Step 3: Collect data from the serial monitor Step 4 Compare your result with what you obtained in Experiment 1.1
  • 61. 61 Fig. schematic diagram for ADC read with neopixel matrix Fig. Physical circuit connection for ADC read with neopixel matrix
  • 62. 62 PRECAUTIONS: 1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated 4. Handle Neopixel matrix (SKAD-3351E) with care CODE FOR ADC READ WITH NEOPIXEL MATRIX int adcRead; #include <Adafruit_GFX.h> #include <Adafruit_NeoMatrix.h> #include <Adafruit_NeoPixel.h> #ifndef PSTR #define PSTR // Make Arduino Due happy #endif #define PIN 8 // MATRIX DECLARATION: // Parameter 1 = width of NeoPixel matrix // Parameter 2 = height of matrix // Parameter 3 = pin number (most are valid) // Parameter 4 = matrix layout flags, add together as needed: // NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT: // Position of the FIRST LED in the matrix; pick two, e.g. // NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner. // NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal // rows or in vertical columns, respectively; pick one or the other. // NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed // in the same order, or alternate lines reverse direction; pick one. // See example below for these values in action. // Parameter 5 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
  • 63. 63 // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // Example for NeoPixel Shield. In this application we'd like to use it // as a 5x8 tall matrix, with the USB port positioned at the top of the // Arduino. When held that way, the first pixel is at the top right, and // lines are arranged in columns, progressive order. The shield uses // 800 KHz (v2) pixels that expect GRB color data. Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(25, 7, PIN, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800); const uint16_t colors[] = { matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) }; void setup() { Serial.begin(9600); // Set the baud rate of the serial monitor pinMode(adcRead, INPUT); matrix.begin(); matrix.setTextWrap(false); matrix.setBrightness(40); matrix.setTextColor(colors[0]); } int x = matrix.width(); int pass = 0; void loop() { adcRead = analogRead(A0);
  • 64. 64 Serial.println(ADC); delay(100); matrix.fillScreen(0); matrix.setCursor(x, 0); matrix.print(F("ADC: ")); matrix.print(adcRead); if (--x < -36) { x = matrix.width(); if (++pass >= 3) pass = 0; matrix.setTextColor(colors[pass]); } matrix.show(); delay(100); }
  • 65. 65 EXPERIMENT 2.4 – ADC RESOLUTION CONVERTED TO VOLTAGE WITH NEOPIXEL MATRIX OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3351) 2. Write program to read the resolution of analog output TPS-3351 equipment 3. Compare the result with the values on the serial monitor of SKAD-3351A integrated development environment 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3351A) • SET equipment (TPS-3351) • Neopixel matrix (SKAD-3351E) RGB • Digital Multimeter • Jumper wires • Banana cables PROCEDURE FOR ADC RESOLUTION CONVERTED TO VOLTAGE WITH NEOPIXEL MATRIX Step 1: Connect Arduino UNO (SKAD-3351A) to one end of the USB cable and the other end to the computer. Step 2: Connect the physical circuit according to the schematic diagram below Step 3: Get reading from the serial monitor Step 4: Compare your result with what you obtained in Experiment 2.0
  • 66. 66 Fig. schematic diagram for ADC resolution converted to voltage with neopixel matrix Fig. Physical circuit connection for ADC resolution converted to voltage with neopixel matrix
  • 67. 67 PRECAUTIONS: 1. Ensure that the TPS-3351 equipment is turned off during connection to SKAD-3351. 2. Ensure secure connection of jumper wires 3. Ensure that the serial monitor is activated CODE FOR ADC RESOLUTION CONVERTED TO VOLTAGE WITH NEOPIXEL MATRIX float adcRead; #include <Adafruit_GFX.h> #include <Adafruit_NeoMatrix.h> #include <Adafruit_NeoPixel.h> #ifndef PSTR #define PSTR // Make Arduino Due happy #endif #define PIN 8 // MATRIX DECLARATION: // Parameter 1 = width of NeoPixel matrix // Parameter 2 = height of matrix // Parameter 3 = pin number (most are valid) // Parameter 4 = matrix layout flags, add together as needed: // NEO_MATRIX_TOP, NEO_MATRIX_BOTTOM, NEO_MATRIX_LEFT, NEO_MATRIX_RIGHT: // Position of the FIRST LED in the matrix; pick two, e.g. // NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner. // NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal // rows or in vertical columns, respectively; pick one or the other. // NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed // in the same order, or alternate lines reverse direction; pick one. // See example below for these values in action. // Parameter 5 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
  • 68. 68 // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_GRBW Pixels are wired for GRBW bitstream (RGB+W NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // Example for NeoPixel Shield. In this application we'd like to use it // as a 5x8 tall matrix, with the USB port positioned at the top of the // Arduino. When held that way, the first pixel is at the top right, and // lines are arranged in columns, progressive order. The shield uses // 800 KHz (v2) pixels that expect GRB color data. Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(25, 7, PIN, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG, NEO_GRB + NEO_KHZ800); const uint16_t colors[] = { matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) }; void setup() { Serial.begin(9600); pinMode(adcRead, INPUT); matrix.begin(); matrix.setTextWrap(false); matrix.setBrightness(40); matrix.setTextColor(colors[0]); } int x = matrix.width(); int pass = 0; void loop() { adcRead = analogRead(A0); float voltageRead = (5 * adcRead) / 1023.00; //chage 5 Serial.println(ADC);
  • 69. 69 Serial.println(voltageRead); delay(100); matrix.fillScreen(0); matrix.setCursor(x, 0); matrix.print(F("ADC: ")); matrix.print(adcRead); matrix.print(F(" Voltage: ")); matrix.print(voltageRead); if (--x < -130) { x = matrix.width(); if (++pass >= 3) pass = 0; matrix.setTextColor(colors[pass]); } matrix.show(); delay(100); } CODE FOR PWM COLOR MIXING #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> // Required for 16 MHz Adafruit Trinket #endif int S8 = 9; //S8 Debounce Circuit For Red. Connected to Arduino digital pin 9 int S9 = 10; //S9 Debounce Circuit For Green. Connected to Arduino digital pin 10 int S10 = 11; //S10 Debounce Circuit For Blue. Connected to Arduino digital pin 11 int RED; int GREEN; int BLUE; int R;
  • 70. 70 int G; int B; // Which pin on the Arduino is connected to the NeoPixels? #define PIN 8 // OConnected to Pin 8 of the Arduino UNO // How many NeoPixels are attached to the Arduino? #define NUMPIXELS 175 // Popular NeoPixel ring size // When setting up the NeoPixel library, we tell it how many pixels, // and which pin to use to send signals. Note that for older NeoPixel // strips you might need to change the third parameter -- see the // strandtest example for more information on possible values. Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 100 // Time (in milliseconds) to pause between pixels void setup() { Serial.begin(9600); pinMode(S8, INPUT); //Set S8 as an INPUT pinMode(S9, INPUT); //Set S9 as an INPUT pinMode(S10, INPUT); //Set S10 as an INPUT // These lines are specifically to support the Adafruit Trinket 5V 16 MHz. // Any other board, you can remove this part (but no harm leaving it): #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif // END of Trinket-specific code. pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) pixels.setBrightness(30); pixels.show(); } void loop() {
  • 71. 71 pixels.clear(); // Set all pixel colors to 'off' // The first NeoPixel in a strand is #0, second is 1, all the way up // to the count of pixels minus one. // delay(1000); for (int i = 0; i < NUMPIXELS; i++) { // For each pixel... RED = digitalRead(S8); GREEN = digitalRead(S9); BLUE = digitalRead (S10); if (RED == 1) { R++; } if (R > 255) { R = 0; } if (GREEN == 1) { G++; } if (G > 255) { G = 0; } if (BLUE == 1) { B++; } if (B > 255) { B = 0; } Serial.print("R:"); Serial.println(R); Serial.print("G:");
  • 72. 72 Serial.println(G); Serial.print("B:"); Serial.println(B); // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255 // Here we're using a moderately bright green color: pixels.setPixelColor(i, pixels.Color(R, G, B)); pixels.show(); // Send the updated pixel colors to the hardware. delay(DELAYVAL); // Pause before next pass through loop } }
  • 74. 74 CHAPTER 3 – ELECTRICITY & SEMICONDUCTOR SIMULATION OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS 3321) 2. Write program to control lamp depending on the state of the LDR 3. Write program to use temperature to control fan with indicator 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD 3321A) • Temperature Sensor (SKAD-3321D) DHT22, • Brushless Fan 12V DC (SKAD-3321G) • SET equipment (TPS 3321) • Digital Multimeter • Jumper wires • Banana cables SUBJECT DISCUSSION: Introduction to Arduino Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready- made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. Arduino is an open-source programmable circuit board that can be integrated into a wide variety of makerspace projects both simple and complex. This board contains a microcontroller which is able to be programmed to sense and control objects in the physical world. By responding to sensors and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and displays. Because of its flexibility and low cost, Arduino has become a very popular choice for makers and makerspaces looking to create interactive hardware projects. Arduino was introduced back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost, simple tool for creating hardware projects. Since the board is open-source, it is released under a Creative Commons license which allows anyone to produce their own board. If you search the web, you will find there are hundreds of Arduino compatible clones and variations available but the only official boards have Arduino in its name.
  • 75. 75 The key features: Fig. Image of Arduino Pin-outs • Arduino boards are able to read analog or digital input signals from different sensors and turn it into an output such as activating a motor, turning LED on/off, connecting to the cloud and many other actions. • You can control your board functions by sending a set of instructions to the microcontroller on the board via Arduino IDE (referred to as uploading software). • Unlike most previous programmable circuit boards, Arduino does not need an extra piece of hardware (called a programmer) in order to load a new code onto the board. You can simply use a USB cable. • Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program. • Finally, Arduino provides a standard form factor that breaks the functions of the microcontroller into a more accessible package.
  • 76. 76 TYPES OF ARDUINO BOARDS Arduino is a great platform for prototyping projects and inventions but can be confusing when having to choose the right board. If you’re brand new to this, you might have always thought that there was just one “Arduino” board and that’s it. In reality, there are many variations of the official Arduino boards and then there are hundreds more from competitors who offer clones. Below are a few examples of the different types of Arduino boards out there. The boards with the name Arduino on them are the official boards but there are also a lot of really great clones on the market as well. One of the best reasons to buy a clone is the fact they are generally less expensive than their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards which cost less but still have the same quality of the originals. Another factor to consider when choosing a board is the type of project you are looking to do. For example, if you want to create a wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a small form factor, you might want to use the Arduino Pro Mini which has a very small footprint compared to other boards. Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was not actually the first board to be released, it remains to be the most actively used and most widely documented on the market. Fig. Image of Arduino Board Board Breakdown Here are the components that make up an Arduino board and what each of their functions are. 1. Reset Button – This will restart any code that is loaded to the Arduino board
  • 77. 77 2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage 3. Ground Pin – There are a few ground pins on the Arduino and they all work the same 4. Digital Input/Output – Pins 0-13 can be used for digital input or output 5. PWM – The pins marked with the (~) symbol can simulate analog output 6. USB Connection – Used for powering up your Arduino and uploading sketches 7. TX/RX – Transmit and receive data indication LEDs 8. AT-mega Microcontroller – This is the brains and is where the programs are stored 9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source 10.Voltage Regulator – This controls the amount of voltage going into the Arduino board 11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply 12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects 13. 5V Pin – This pin supplies 5 volts of power to your projects 14. Ground Pins – There are a few ground pins on the Arduino and they all work the same 15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital ARDUINO POWER SUPPLY The Arduino Uno needs a power source in order for it to operate and can be powered in a variety of ways. You can do what most people do and connect the board directly to your computer via a USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice. The last method would be to use a 9V AC power supply. Fig. Image of Arduino power supply
  • 78. 78 ARDUINO BREADBOARD Another very important item when working with Arduino is a solderless breadboard. This device allows you to prototype your Arduino project without having to permanently solder the circuit together. Using a breadboard allows you to create temporary prototypes and experiment with different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which are connected to each other by strips of conductive material. Fig. Image of a breadboard On a side note, the breadboard is not powered on its own and needs power brought to it from the Arduino board using jumper wires. These wires are also used to form the circuit by connecting resistors, switches and other components together. ARDUINO INSTALLATION Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image.
  • 79. 79 Fig. Image of SKAD-3300A USB cable In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the following image. Fig. Image of A to Mini-B cable Step 2: Download Arduino IDE Software. You can get different versions of Arduino IDE from the Download page on the Arduino Official website. You must select your software, which is compatible with your operating system (Windows, IOS, or Linux). After your file download is complete, unzip the file.
  • 80. 80 Fig. Image of Arduino installation file Step 3: Power up your board. The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either the USB connection to the computer or an external power supply. If you are using an Arduino Diecimila, you have to make sure that the board is configured to draw power from the USB connection. The power source is selected with a jumper, a small piece of plastic that fits onto two of the three pins between the USB and power jacks. Check that it is on the two pins closest to the USB port. Connect the Arduino board to your computer using the USB cable. The green power LED (labeled PWR) should glow. Step 4: Launch Arduino IDE. After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder, you can find the application icon with an infinity label (application.exe). Double-click the icon to start the IDE.
  • 81. 81 Fig. Image of installation procedure Step 5: Open your first project. Once the software starts, you have two options: ∙ Create a new project. ∙ Open an existing project example To create a new project, select File --> New
  • 82. 82 To open an existing project example, select File -> Example -> Basics -> Blink. Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off with some time delay. You can select any other example from the list. Step 6: Select your Arduino board.
  • 83. 83 To avoid any error while uploading your program to the board, you must select the correct Arduino board name, which matches with the board connected to your computer. Go to Tools -> Board and select your board. EXPERIMENT 3.1 – AUTOMATIC STREET LIGHT USING LDR OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS 3321) 2. Write program to control lamp depending on the state of the LDR 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • LDR (SKAD-3321D) • SET equipment (TPS-3321) • Digital Multimeter • Jumper wires • Banana cables • LED PROCEDURE FOR CONTROLLING DEMO AUTOMATIC STREET LIGHT USING LDR Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to the computer. Step 2: Implement the circuit shown on the schematic diagram below
  • 84. 84 Fig. Schematic diagram Automatic Street Light using LDR Fig. Connection of SKAD-3321 to TPS 3321 at OFF state
  • 85. 85 Fig. Connection of SKAD-3321 to TPS-3321 at ON state PRECAUTIONS: 1. Ensure that the TPS-3321 equipment is turned off during connection to SKAD-3321. 2. Ensure secure connection of jumper wires CODE FOR CONTROLLING DEMO AUTOMATIC STREET LIGHT USING LDR //Automatic Street Light with LDR// int sensorPin=A5; //LDR Sensor Pin #define light 2 //LED Pin int sensorValue; int led; void setup() {
  • 86. 86 Serial.begin(9600); //Initiate serial monitor pinMode(led,OUTPUT); pinMode(sensorPin,INPUT); } void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); //Display values on Serial Monitor //check if it is dark then switch on the light else let it remain off if (sensorValue <100){ digitalWrite(light,HIGH); } else if (sensorValue >100){ digitalWrite(light,LOW); } }
  • 87. 87 EXPERIMENT 3.2 – TEMPERATURE CONTROLLED FAN WITH INDICATOR OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS 3321) 2. Write program to use temperature to control fan with indicator 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3371A) • Temperature Sensor (SKAD-3321D) DHT22 • SET equipment (TPS-3321) • Digital Multimeter • Jumper wires • Banana cables • Brushless Fan 12V DC (SKAD-3321G) PROCEDURE FOR TEMPERATURE CONTROLLED FAN WITH INDICATOR Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to the computer. Step 2: Implement the circuit shown on the schematic diagram below Fig. Schematic diagram for temperature-controlled fan with indicator
  • 88. 88 Fig. Physical image of temperature-controlled fan with indicator connection PRECAUTIONS: 1. Ensure that the TPS-3321 equipment is turned off during connection to SKAD-3321. 2. Ensure secure connection of jumper wires 3. Do not allow any object to enter the fan blade CODE FOR TEMPERATURE CONTROLLED FAN WITH INDICATOR #include "DHT.h" #define DHTPIN 2 // What pin we're connected to #define DHTTYPE DHT22 // DHT 22 (AM2302) #define fan 4 int maxTemp = 27; DHT dht(DHTPIN, DHTTYPE);
  • 89. 89 void setup() { pinMode(fan, OUTPUT); Serial.begin(9600); dht.begin(); } void loop() { // Wait a few seconds between measurements. delay(2000); // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) // Read temperature as Celsius float t = dht.readTemperature(); // Check if any reads failed and exit early (to try again). if (isnan(t)) { Serial.println("Failed to read from DHT sensor!"); return; } if(t > maxTemp) { digitalWrite(fan, HIGH); } else { digitalWrite(fan, LOW); } Serial.print("Temperature: "); Serial.print(t); Serial.println(" *C "); }
  • 91. 91 CHAPTER 4 – GREEN HOUSE EFFECTS OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3717) 2. Write program to control the temperature of greenhouse effect 3. Write program to measure temperature and humidity using sensor (DHT22) and LCD 4. Write program to measure temperature and humidity using relay and fan 5. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3717A) • SET equipment (TPS-3717) • LCD (SKAD-3717C) • Temperature & Humidity sensor (SKAD-3717D): DHT22 • Relay (SKAD-3717F) • Digital Multimeter • Jumper wires • BRUSHLESS FAN 12V DC: SKAD-3717G SUBJECT DISCUSSION: Introduction to Arduino Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready- made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. Arduino is an open-source programmable circuit board that can be integrated into a wide variety of makerspace projects both simple and complex. This board contains a microcontroller which is able to be programmed to sense and control objects in the physical world. By responding to sensors and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and displays. Because of its flexibility and low cost, Arduino has become a very popular choice for makers and makerspaces looking to create interactive hardware projects. Arduino was introduced back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost, simple tool for creating hardware projects. Since the board is open-source, it is released under a Creative Commons license which allows anyone to produce their own board. If you search the web, you will find there are hundreds of Arduino compatible clones and variations available but the only official boards have Arduino in its name.
  • 92. 92 The key features: Fig. Image of Arduino Pin-outs • Arduino boards are able to read analog or digital input signals from different sensors and turn it into an output such as activating a motor, turning LED on/off, connecting to the cloud and many other actions. • You can control your board functions by sending a set of instructions to the microcontroller on the board via Arduino IDE (referred to as uploading software). • Unlike most previous programmable circuit boards, Arduino does not need an extra piece of hardware (called a programmer) in order to load a new code onto the board. You can simply use a USB cable. • Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program. • Finally, Arduino provides a standard form factor that breaks the functions of the microcontroller into a more accessible package. TYPES OF ARDUINO BOARDS Arduino is a great platform for prototyping projects and inventions but can be confusing when having to choose the right board. If you’re brand new to this, you might have always thought that there was just one “Arduino” board and that’s it. In reality, there are many variations of the official Arduino boards and then there are hundreds more from competitors who offer clones. Below are a few examples of the different types of Arduino boards out there. The boards with the name
  • 93. 93 Arduino on them are the official boards but there are also a lot of really great clones on the market as well. One of the best reasons to buy a clone is the fact they are generally less expensive than their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards which cost less but still have the same quality of the originals. Another factor to consider when choosing a board is the type of project you are looking to do. For example, if you want to create a wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a small form factor, you might want to use the Arduino Pro Mini which has a very small footprint compared to other boards. Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was not actually the first board to be released, it remains to be the most actively used and most widely documented on the market. Fig. Image of Arduino Board Board Breakdown Here are the components that make up an Arduino board and what each of their functions are. 1. Reset Button – This will restart any code that is loaded to the Arduino board 2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage 3. Ground Pin – There are a few ground pins on the Arduino and they all work the same 4. Digital Input/Output – Pins 0-13 can be used for digital input or output 5. PWM – The pins marked with the (~) symbol can simulate analog output 6. USB Connection – Used for powering up your Arduino and uploading sketches
  • 94. 94 7. TX/RX – Transmit and receive data indication LEDs 8. AT-mega Microcontroller – This is the brains and is where the programs are stored 9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source 10.Voltage Regulator – This controls the amount of voltage going into the Arduino board 11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply 12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects 13. 5V Pin – This pin supplies 5 volts of power to your projects 14. Ground Pins – There are a few ground pins on the Arduino and they all work the same 15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital ARDUINO POWER SUPPLY The Arduino Uno needs a power source in order for it to operate and can be powered in a variety of ways. You can do what most people do and connect the board directly to your computer via a USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice. The last method would be to use a 9V AC power supply. Fig. Image of Arduino power supply ARDUINO BREADBOARD Another very important item when working with Arduino is a solderless breadboard. This device allows you to prototype your Arduino project without having to permanently solder the circuit together. Using a breadboard allows you to create temporary prototypes and experiment with different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which are connected to each other by strips of conductive material.
  • 95. 95 Fig. Image of a breadboard On a side note, the breadboard is not powered on its own and needs power brought to it from the Arduino board using jumper wires. These wires are also used to form the circuit by connecting resistors, switches and other components together. ARDUINO INSTALLATION Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image. Fig. Image of SKAD-3700A USB cable In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the following image.
  • 96. 96 Fig. Image of A to Mini-B cable Step 2: Download Arduino IDE Software. You can get different versions of Arduino IDE from the Download page on the Arduino Official website. You must select your software, which is compatible with your operating system (Windows, IOS, or Linux). After your file download is complete, unzip the file. Fig. Image of Arduino installation file Step 3: Power up your board.
  • 97. 97 The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either the USB connection to the computer or an external power supply. If you are using an Arduino Diecimila, you have to make sure that the board is configured to draw power from the USB connection. The power source is selected with a jumper, a small piece of plastic that fits onto two of the three pins between the USB and power jacks. Check that it is on the two pins closest to the USB port. Connect the Arduino board to your computer using the USB cable. The green power LED (labeled PWR) should glow. Step 4: Launch Arduino IDE. After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder, you can find the application icon with an infinity label (application.exe). Double-click the icon to start the IDE. Fig. Image of installation procedure Step 5: Open your first project. Once the software starts, you have two options: ∙ Create a new project. ∙ Open an existing project example To create a new project, select File --> New
  • 98. 98 To open an existing project example, select File -> Example -> Basics -> Blink. Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off with some time delay. You can select any other example from the list. Step 6: Select your Arduino board.
  • 99. 99 To avoid any error while uploading your program to the board, you must select the correct Arduino board name, which matches with the board connected to your computer. Go to Tools -> Board and select your board. EXPERIMENT 4.1 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR (DHT22) AND LCD OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS 3717) 2. Write program to control the temperature of greenhouse effect 3. Write program to measure temperature and humidity using sensor (DHT22) and LCD 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3717A) • SET equipment (TPS 3717) • LCD (SKAD-3717C) • Temperature & Humidity sensor (SKAD-3717D): DHT22 • Digital Multimeter • Jumper wires PROCEDURE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR (DHT22) AND LCD Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to the computer. Step 2: Implement the circuit shown on the schematic diagram below
  • 100. 100 Fig. Schematic diagram connecting DHT22, LCD and UNO in a Greenhouse Fig. External view of TPS-3717
  • 101. 101 Fig. Internal view of TPS-3717 PRECAUTIONS: 3. Ensure that the TPS-3717 equipment is turned off during connection to SKAD-3717. 4. Ensure secure connection of jumper wires 5. Do not apply direct heat to DHT22 when performing the experiment
  • 102. 102 INTERFACE OF AN 12C LCD WITH ARDUINO SOURCE:- https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/ CODE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR (DHT22) AND LCD //* How to use the DHT-22 sensor with Arduino // Temperature and humidity sensor and // I2C LCD1602 // SDA --> A4 // SCL --> A5 //DHT 22 out-->D7 //Libraries #include <DHT.h>; //I2C LCD: #include <LiquidCrystal_I2C.h> #include <Wire.h> LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display,Pls check your lcd.
  • 103. 103 //Constants #define DHTPIN 7 // what pin we're connected to #define DHTTYPE DHT22 // DHT 22 DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino //Variables //int chk; int h; //Stores humidity value int t; //Stores temperature value void setup() { Serial.begin(9600); Serial.println("Temperature and Humidity Sensor Test"); dht.begin(); lcd.init(); //initialize the lcd lcd.backlight(); //open the backlight lcd.begin(16,2); } void loop() { //Read data and store it to variables h (humidity) and t (temperature) // Reading temperature or humidity takes about 250 milliseconds! h = dht.readHumidity(); t = dht.readTemperature(); //Print temp and humidity values to serial monitor Serial.print("Humidity: ");
  • 104. 104 Serial.print(h); Serial.print(" %, Temp: "); Serial.print(t); Serial.println(" ° Celsius"); // set the cursor to (0,0): // print from 0 to 9: lcd.setCursor(0, 0); lcd.println(" Now Temperature "); lcd.setCursor(0, 1); lcd.print("T:"); lcd.print(t); lcd.print("C"); lcd.setCursor(6, 1); lcd.println("2021 "); lcd.setCursor(11, 1); lcd.print("H:"); lcd.print(h); lcd.print("%"); delay(1000); //Delay 1 sec. }
  • 105. 105 EXPERIMENT 4.2 – MEASUREMENT OF TEMPERATURE AND HUMIDITY USING RELAY & FAN OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS 3717) 2. Write program to measure temperature and humidity using relay and fan 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3717A) • SET equipment (TPS 3717) • LCD (SKAD-3717C) • Temperature & Humidity sensor (DHT22): SKAD-3717D • Relay (SKAD-3717F) • Digital Multimeter • Jumper wires • BRUSHLESS FAN 12V DC: SKAD-3717G PROCEDURE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING RELAY & FAN Step 1: Connect Arduino UNO (SKAD-3371A) to one end of the USB cable and the other end to the computer. Step 2: Implement the circuit shown on the schematic diagram below
  • 106. 106 Fig. Schematic for Measurement of Temperature and Humidity using Sensor (DHT22) and LCD Fig. external view of TPS-3717
  • 107. 107 Fig. internal view of TPS-3717 PRECAUTIONS: 1. Ensure that the TPS-3717 equipment is turned off during connection to SKAD-3717. 2. Ensure secure connection of jumper wires 3. Do not apply direct heat to DHT22 when performing the experiment CODE FOR MEASUREMENT OF TEMPERATURE AND HUMIDITY USING SENSOR (DHT22) WITH RELAY & FAN //* How to use the DHT-22 sensor with Arduino // Temperature and humidity sensor and // I2C LCD1602 // SDA --> A4 // SCL --> A5 // DHT 22 out-->D7 // FAN --> 4 //Libraries #include <DHT.h>;
  • 108. 108 //I2C LCD: #include <LiquidCrystal_I2C.h> #include <Wire.h> LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display,Pls check your lcd. //Constants #define DHTPIN 7 // what pin we're connected to #define DHTTYPE DHT22 // DHT 22 DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino #define fan 4 //Variables //int chk; int h; //Stores humidity value int t; //Stores temperature value int maxHum = 100; int maxTemp = 30; void setup() { Serial.begin(9600); Serial.println("Temperature and Humidity Sensor Test"); pinMode(fan, OUTPUT); dht.begin(); lcd.init(); //initialize the lcd lcd.backlight(); //open the backlight lcd.begin(16,2); } void loop() {
  • 109. 109 //Read data and store it to variables h (humidity) and t (temperature) // Reading temperature or humidity takes about 250 milliseconds! h = dht.readHumidity(); t = dht.readTemperature(); //Fan control if(h > maxHum || t > maxTemp) { digitalWrite(fan, HIGH); } else { digitalWrite(fan, LOW); } //Print temp and humidity values to serial monitor Serial.print("Humidity: "); Serial.print(h); Serial.print(" %, Temp: "); Serial.print(t); Serial.println(" ° Celsius"); // set the cursor to (0,0): // print from 0 to 9: lcd.setCursor(0, 0); lcd.println(" Now Temperature "); lcd.setCursor(0, 1); lcd.print("T:"); lcd.print(t); lcd.print("C"); lcd.setCursor(6, 1);
  • 112. 112 CHAPTER 5 – MODERN TECHNOLOGY & ELECTRONIC SYSTEMS OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3719) 2. Write program to control traffic light automatically 3. Write program to control trigger alarm when a train is approaching 4. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3719A) • SET equipment (TPS-3719) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • LEDS SUBJECT DISCUSSION: Introduction to Arduino Arduino is a prototype platform (open-source) based on easy-to-use hardware and software. It consists of a circuit board, which can be programmed (referred to as a microcontroller) and a ready- made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. Arduino is an open-source programmable circuit board that can be integrated into a wide variety of makerspace projects both simple and complex. This board contains a microcontroller which is able to be programmed to sense and control objects in the physical world. By responding to sensors and inputs, the Arduino is able to interact with a large array of outputs such as LEDs, motors and displays. Because of its flexibility and low cost, Arduino has become a very popular choice for makers and makerspaces looking to create interactive hardware projects. Arduino was introduced back in 2005 in Italy by Massimo Banzi as a way for non-engineers to have access to a low cost, simple tool for creating hardware projects. Since the board is open-source, it is released under a Creative Commons license which allows anyone to produce their own board. If you search the web, you will find there are hundreds of Arduino compatible clones and variations available but the only official boards have Arduino in its name.
  • 113. 113 The key features: Fig. Image of Arduino Pin-outs • Arduino boards are able to read analog or digital input signals from different sensors and turn it into an output such as activating a motor, turning LED on/off, connecting to the cloud and many other actions. • You can control your board functions by sending a set of instructions to the microcontroller on the board via Arduino IDE (referred to as uploading software). • Unlike most previous programmable circuit boards, Arduino does not need an extra piece of hardware (called a programmer) in order to load a new code onto the board. You can simply use a USB cable. • Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn to program. • Finally, Arduino provides a standard form factor that breaks the functions of the microcontroller into a more accessible package.
  • 114. 114 TYPES OF ARDUINO BOARDS Arduino is a great platform for prototyping projects and inventions but can be confusing when having to choose the right board. If you’re brand new to this, you might have always thought that there was just one “Arduino” board and that’s it. In reality, there are many variations of the official Arduino boards and then there are hundreds more from competitors who offer clones. Below are a few examples of the different types of Arduino boards out there. The boards with the name Arduino on them are the official boards but there are also a lot of really great clones on the market as well. One of the best reasons to buy a clone is the fact they are generally less expensive than their official counterpart. Adafruit and Sparkfun, for example, sell variations of the Arduino boards which cost less but still have the same quality of the originals. Another factor to consider when choosing a board is the type of project you are looking to do. For example, if you want to create a wearable electronic project, you might want to consider the LilyPad board from Sparkfun. The LilyPad is designed to be easily sewn into e-textiles and wearable projects. If your project has a small form factor, you might want to use the Arduino Pro Mini which has a very small footprint compared to other boards. Arduino Uno One of the most popular Arduino boards out there is the Arduino Uno. While it was not actually the first board to be released, it remains to be the most actively used and most widely documented on the market. Fig. Image of Arduino Board Board Breakdown Here are the components that make up an Arduino board and what each of their functions are. 1. Reset Button – This will restart any code that is loaded to the Arduino board 2. AREF – Stands for “Analog Reference” and is used to set an external reference voltage
  • 115. 115 3. Ground Pin – There are a few ground pins on the Arduino and they all work the same 4. Digital Input/Output – Pins 0-13 can be used for digital input or output 5. PWM – The pins marked with the (~) symbol can simulate analog output 6. USB Connection – Used for powering up your Arduino and uploading sketches 7. TX/RX – Transmit and receive data indication LEDs 8. AT-mega Microcontroller – This is the brains and is where the programs are stored 9. Power LED Indicator – This LED lights up anytime the board is plugged in a power source 10.Voltage Regulator – This controls the amount of voltage going into the Arduino board 11.DC Power Barrel Jack – This is used for powering your Arduino with a power supply 12. 3.3V Pin – This pin supplies 3.3 volts of power to your projects 13. 5V Pin – This pin supplies 5 volts of power to your projects 14. Ground Pins – There are a few ground pins on the Arduino and they all work the same 15. Analog Pins – These pins can read the signal from an analog sensor and convert it to digital ARDUINO POWER SUPPLY The Arduino Uno needs a power source in order for it to operate and can be powered in a variety of ways. You can do what most people do and connect the board directly to your computer via a USB cable. If you want your project to be mobile, consider using a 9V battery pack to give it juice. The last method would be to use a 9V AC power supply. Fig. Image of Arduino power supply
  • 116. 116 ARDUINO BREADBOARD Another very important item when working with Arduino is a solderless breadboard. This device allows you to prototype your Arduino project without having to permanently solder the circuit together. Using a breadboard allows you to create temporary prototypes and experiment with different circuit designs. Inside the holes (tie points) of the plastic housing, are metal clips which are connected to each other by strips of conductive material. Fig. Image of a breadboard On a side note, the breadboard is not powered on its own and needs power brought to it from the Arduino board using jumper wires. These wires are also used to form the circuit by connecting resistors, switches and other components together. ARDUINO INSTALLATION Step 1: First you must have your Arduino board (you can choose your favorite board) and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you would connect to a USB printer as shown in the following image.
  • 117. 117 Fig. Image of SKAD-3700A USB cable In case you use Arduino Nano, you will need an A to Mini-B cable instead as shown in the following image. Fig. Image of A to Mini-B cable Step 2: Download Arduino IDE Software. You can get different versions of Arduino IDE from the Download page on the Arduino Official website. You must select your software, which is compatible with your operating system (Windows, IOS, or Linux). After your file download is complete, unzip the file.
  • 118. 118 Fig. Image of Arduino installation file Step 3: Power up your board. The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power from either the USB connection to the computer or an external power supply. If you are using an Arduino Diecimila, you have to make sure that the board is configured to draw power from the USB connection. The power source is selected with a jumper, a small piece of plastic that fits onto two of the three pins between the USB and power jacks. Check that it is on the two pins closest to the USB port. Connect the Arduino board to your computer using the USB cable. The green power LED (labeled PWR) should glow. Step 4: Launch Arduino IDE. After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the folder, you can find the application icon with an infinity label (application.exe). Double-click the icon to start the IDE.
  • 119. 119 Fig. Image of installation procedure Step 5: Open your first project. Once the software starts, you have two options: ∙ Create a new project. ∙ Open an existing project example To create a new project, select File --> New
  • 120. 120 To open an existing project example, select File -> Example -> Basics -> Blink. Here, we are selecting just one of the examples with the name Blink. It turns the LED on and off with some time delay. You can select any other example from the list. Step 6: Select your Arduino board. To avoid any error while uploading your program to the board, you must select the correct Arduino board name, which matches with the board connected to your computer. Go to Tools -> Board and select your board.
  • 121. 121 EXPERIMENT 5.1 – AUTOMATIC TRAFFIC LIGHT CONTROL OBJECTIVES: At the end of the experiment session, the learner will be able to; 1. Connect and synchronize Arduino UNO with SET equipment (TPS-3719) 2. Write program to control traffic light automatically 3. Relate the experiment to real life scenarios EQUIPMENT REQUIRED: • Arduino UNO (SKAD-3719A) • SET equipment (TPS-3719) • SET equipment (TPS-3371) • Digital Multimeter • Jumper wires • LEDS • DC MOTOR PROCEDURE FOR AUTOMATIC TRAFFIC LIGHT CONTROL Step 1: Connect Arduino UNO (SKAD-3719A) to one end of the USB cable and the other end to the computer. Step 2: Implement the circuit shown on the schematic diagram below Fig. Schematic Diagram for Automatic Traffic Light Control
  • 122. 122 Fig. Physical circuit connection for Automatic Traffic Light Control PRECAUTIONS: 1. Ensure that the TPS-3719 equipment is turned off during connection to SKAD-3719. 2. Ensure secure connection of jumper wires CODE FOR AUTOMATIC TRAFFIC LIGHT CONTROL // C++ code //Traffic Light void setup() { pinMode(2, OUTPUT); //Red Light pinMode(3, OUTPUT); //Yellow Light pinMode(4, OUTPUT); //Green Light }