Interfacing Lab
MCTE 3104| Sec. No. 1
SEMESTER 2 2021/2022
Instructor
Dr. AHMAD IMRAN BIN IBRAHIM
LAB REPORT 1
INTRO TO ARDUINO
GROUP 11
• AL-SAIAARI OMAR YASER 1733863
• AL-DUAIS GHASSAN ABDULSALAM 1815065
• AL-SAIAARI MOHAMMED NASSER 1734429
• MUHAMED RAMIC 1915869
• KHALED SYED ASHQUE MD 1716275
First activity
Observation
1. In our coding, we used an infinite loop in order to get the desired results, also some
math, there is an accumulation code and a condition if else to be met, the 0.5 sec led
blink 2 times then the 1 sec led will blink and when it blinks 6 times the 3 sec led will
blink.
2. We need to connect the negative and positive pins correctly, the anode (long leg) is
connected to Arduino, the cathode (short leg) is connected to the ground. We need to
connect our port to the computer to power supply the Arduino and
3. upload the code through the right port to the Arduino.
The led are connected to different pins and are blinking individually.
Photo of your working setup
VIDEO LINK :
https://drive.google.com/file/d/1Tql3Y6vbHovljwCCuNSC6QtuERaZ
dB2N/view?usp=sharing
CODE :
int led1=7,led2=8,led3=9; //pin initialization
void setup() { // put your setup code here, to run once:
Serial.begin(9600);
pinMode(led1,OUTPUT); //pin function determination input or output
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT); }
void loop() {
int o=0;
int i=0;
while(i==0){
o++;
digitalWrite(led1,1); //turning on the led every 0.5 sec
if(o%2==0){
digitalWrite(led2,1);//turning on the led every 1 sec }
if(o%6==0){
digitalWrite(led3,1);//turning on the led every 3 sec }
delay(500);//delay for 0.5
digitalWrite(led1,0);//turning off all every
digitalWrite(led2,0);
digitalWrite(led3,0); }
}
Second Activity
observation
1. We need an external power supply like AC to DC transformer to activate the mini
strobe siren and linear actuator through a double relay, because the Arduino can’t
supply enough power to the devices.
2. The linear actuator and mini strobe siren depend on the push button to functional
when pressed continuously.
3. The linear actuator can only work one direction only if it is needed to switch direction
we need to change the direction of the current through wire inversion.
4. We have one input pin for the push button and two output pins on the Arduino for the
linear actuator and mini strobe siren.
Photo of your working setup
VIDEO LINK
https://drive.google.com/file/d/1EvlENPboQkduW8xYCNdk-
tjNk1oTKtgE/view?usp=sharing
CODE
Third Activity
Observation:
1. firstly, we need to connect the led correctly.
2. For the potentiometer, the red terminal is connected to the +5V, the white terminal
is connected to the signal, and the black terminal is connected to the ground.
3. potentiometer is used to modify the resistance, so here we used ohm’s law.
Photo of your working setup
VIDEO LINK
https://drive.google.com/file/d/1EvlENPboQkduW8xYCNdk-
tjNk1oTKtgE/view?usp=sharing
Code:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const
int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
void setup() { // initialize serial communications at 9600 bps:
Serial.begin(9600); }
void loop() { // read the analog in value:
sensorValue = analogRead(analogInPin);// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255); // change the analog out value:
analogWrite(analogOutPin, outputValue); // print the results to the Serial Monitor:
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(2); }
Fourth Activity
Observation
1. firstly, we need to connect the servo correctly.
2. For the potentiometer, the red terminal is connected to the +5V, the white terminal is
connected to the signal, and the black terminal is connected to the ground.
3. potentiometer is used to modify the resistance to rotate the servo according mapping ,
so here we used ohm’s law.
CODE :
Photo of your working setup
CONCLOUSIN
In the end of the session the learning out came was incredible for us, we learn how to use
Arduino and get basic knowledge about the power supply and how to use it and the benefit of
servo motor and the important of design the appropriate circuit and appropriate coding.
END OF FIRST SESSION