0% found this document useful (0 votes)
104 views23 pages

Embedded System1 - Lab

The document contains details of 4 experiments conducted using Arduino and MSP430 boards. Experiment 1 involves blinking an LED using Arduino. The circuit diagram and code to blink an LED is provided. Experiment 2 details using a buzzer with Arduino. The circuit and code to generate tones from the buzzer is given. Experiment 3 combines an LED and buzzer on Arduino with code provided. Experiment 4 measures temperature using a sensor on Arduino and displays the values. Experiments are also conducted using MSP430 and Raspberry Pi boards to blink LEDs, generate tones from buzzers and use RGB LEDs.

Uploaded by

sneha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views23 pages

Embedded System1 - Lab

The document contains details of 4 experiments conducted using Arduino and MSP430 boards. Experiment 1 involves blinking an LED using Arduino. The circuit diagram and code to blink an LED is provided. Experiment 2 details using a buzzer with Arduino. The circuit and code to generate tones from the buzzer is given. Experiment 3 combines an LED and buzzer on Arduino with code provided. Experiment 4 measures temperature using a sensor on Arduino and displays the values. Experiments are also conducted using MSP430 and Raspberry Pi boards to blink LEDs, generate tones from buzzers and use RGB LEDs.

Uploaded by

sneha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Embedded Systems (CS650)

Lab Record
Batch Name : B2 Batch Members:

1.Sahana.V

2.Sneha.M

Aurdino based Experiments

Using Arduino

1.LED blink

2.Buzzer sensor

3.Sensor with LED and buzzer

4.Demonstration of temperature and humidity sensor

Experiment No:1

Aim/Title of the Experiment: LED blink on aurdino

Purpose/Application(if any):Used as sensors using relatively low power

Hardware components used and the design (take the snap of the circuit design drawn in the book):

1.Bread board

2.Led

3.Aurdino board

4.Jumpers
List of Functionality and the final code:

int ledPin = 13;

void setup()

pinMode(ledPin, OUTPUT);

void loop()

digitalWrite(ledPin, HIGH);

delay(1000);

digitalWrite(ledPin, LOW);

delay(1000);

}
Video demonstration of the same(insert the video snippet):

Experiment No:2

Aim/Title of the Experiment:

2.Working of buzzer sensor on aurdino

Purpose/Application(if any):  alarm devices, timers etc

Hardware components used and the design (take the snap of the circuit design drawn in the book):

1.Active Buzzer

2.Bread board

3.Jumpers
List of Functionality and the final code:
const int buzzer = 9; //buzzer to arduino pin 9

void setup(){

pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output

void loop(){

tone(buzzer, 1000); // Send 1KHz sound signal...


delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec

}
Video demonstration of the same(insert the video snippet:
Experiment No:3.

Aim/Title of the Experiment: Buzzer and Led sensor on aurdino

Purpose/Application(if any):Distance Detector

Hardware components used and the design (take the snap of the circuit design drawn in the book):

1.Active Buzzer

2.Bread board

3.Jumpers

4.Led
List of Functionality and the final code:

int led = 13;                                    // LED connected to pin 13


int sound = 8;                                // piezo buzzer connected to pin 8

void setup()
{
   pinMode(led, OUTPUT);               // sets the LED as output
   pinMode(sound, OUTPUT);         // sets the buzzer alarm as output
}

void loop()                                         // run the program continuously


{
   digitalWrite(led, HIGH);                // turn the LED on
   tone(sound, 1000, 250);              // play a tone with 1000 Hz for 250 ms
   delay(2000);                                  // wait for 2 seconds
   digitalWrite(led, LOW);               // turn the LED off
   tone(sound, 6000, 250);             // play a tone with 6000 Hz for 250 ms
   delay(2000);

}                

Video demonstration of the same(insert the video snippet):


Experiment No:4

Aim/Title of the Experiment:Temperature sensor using aurdino

Purpose/Application(if any): These are used in electric motors for measuring the motor
winding temperature, internal housing temperature, bearing temperature, brushes
temperate and external body temperature.

Hardware components used and the design (take the snap of the circuit design drawn in the book):

1.Temperature sensor

2.Bread board

3.Jumpers
List of Functionality and the final code:

//Libraries
#include <DHT.h>;

//Constants
#define DHTPIN 7 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz
Arduino

//Variables
int chk;
float hum; //Stores humidity value
float temp; //Stores temperature value

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

void loop()
{
delay(2000);
//Read data and store it to variables hum and temp
hum = dht.readHumidity();
temp= dht.readTemperature();
//Print temp and humidity values to serial monitor
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" %, Temp: ");
Serial.print(temp);
Serial.println(" Celsius");
delay(10000); //Delay 2 sec.
}
Video demonstration of the same(insert the video snippet):

Using Msp4:

Experiment No 1: BUZZER

Aim/Title of the Experiment:


To generate sound from buzzer.

Purpose/Application:
Can be used for the purpose of signalling.

Hardware components:

 MSP430 Launchpad
 Buzzer
 Jumper wires

 Design:
List of functionality with final code:

Code:

void setup( )

pinMode(buzzerPin,OUTPUT);

void loop( )

tone(buzzerpin,699,500);

delay(500);

Video demonstration:
Experiment No 2: LED BLINK

Aim/Title of the Experiment:


To use led to obtain the output of MSP430 which can be expressed by the blink of led based on the
delay.

Purpose/Application:
They are mainly used for visual indication in any electronic devices, measuring and interacting with the
process and can also be used for signalling.

Hardware components:
 MSP430 Launch pad
 LED
 Jumper Wires

Design:
List of functionality with final code:

1. The MSP430 LaunchPad kit includes everything you need out of the box. To
start programming your MSP430 LaunchPad, you'll first have to install Code
Composer Studio onto your computer. This will install all of the required
drivers for your new MSP430 LaunchPad kit.
2. Next, simply plug in your LaunchPad with the included USB cable to your
Windows PC. The green power (PWR) LED should glow.
3. If prompted, let Windows automatically install the software.

CODE:

#include <msp430g2553.h>
 
int main(void) {
  volatile int i;
 
  // stop watchdog timer
  WDTCTL = WDTPW | WDTHOLD;
  // set up bit 0 of P1 as output
  P1DIR = 0x01;
  // intialize bit 0 of P1 to 0
  P1OUT = 0x00;
  // loop forever
  for (;;) {
    // toggle bit 0 of P1
    P1OUT ^= 0x01;
    // delay for a while
    for (i = 0; i < 0x6000; i++);
  }
}
Video demonstration:
Experiment No 3: RGB

Aim/Title of the Experiment:


Use of RGB LED to emit multiple colors i.e. Red, Green and Blue .

Purpose/Application:
 The main purpose of the RGB color model is for the sensing, representation, and display of images in
electronic systems, such as televisions and computers, though it has also been used in conventional
photography.

Hardware components:
 MSP430G2 LaunchPad
 RGB LED
 Breadboard
 Jumper wires

Design:
List of functionality with final code:

Make the connection according to this circuit diagram. I am using a


RGB module which has on board three resistors connected with all
three pins red, green and blue. But you can make the circuit according
to these connection by connecting 330 ohm resistor before red, green
and blue pins and connect pin number 2 to ground.
 RED PIN –  PIN NUMBER 13
 GREEN PIN –  PIN NUMBER 14
 BLUE PIN –  PIN NUMBER 15

CODE:

int redPin= 13;

int greenPin =14;

int bluePin = 15;

void setup() {

  pinMode(redPin, OUTPUT);

  pinMode(greenPin, OUTPUT);

  pinMode(bluePin, OUTPUT);

}
void loop() {

  setColor(1, 0, 0); // Red Color

  delay(1000);

  setColor(0, 1, 0); // Green Color

  delay(1000);

  setColor(0, 0, 1); // Blue Color

  delay(1000);

void setColor(int redValue, int greenValue, int blueValue) {

  digitalWrite(redPin, redValue);

  digitalWrite(greenPin, greenValue);

  digitalWrite(bluePin, blueValue);

}
Video demonstration:

USING raspberry pi:

Experiment No 1: LED
Aim/Title of the Experiment:
Use of LED to obtain the output of Raspberry pi which can be expressed by the blink of led based
on the delay.

Purpose/Application:

In this project, we have seen how to blink an LED using Raspberry Pi and Python Program.
This project will help you in understanding some basics of the GPIO Pins of Raspberry Pi.

With this project as reference, we can develop many other projects like driving motors,
connecting LCDs, etc.
Hardware components:

 Raspberry pi
 Bread board
 LED
 Jumper Wires
Design:

List of functionality with final code:

The circuit consists of a power supply (the Raspberry Pi), an LED that lights


when the power is applied, and a resistor to limit the current that can flow
through the circuit.
You will be using one of the ‘ground’ (GND) pins to act like the ‘negative’ or 0
volt ends of a battery. The ‘positive’ end of the battery will be provided by
a GPIO pin. Here we will be using pin 18.  When they are ‘taken high’, which
means it outputs 3.3 volts, the LED will light.
The principle of operation is very simple. The GPIO pin (GPIO25) is made HIGH for a second
and is made LOW for the next second. This process is kept on loop so that we get effect of
Blinking LED.

In order to control the GPIO Pin i.e. making it HIGH and LOW, I’ll be using Python programming
and few Python Packages.

 The first important function of the RPi.GPIO Module is the setmode(). Using
GPIO.setmode(), we can select either GPIO Numbering of the Pins or Physical
Numbering. By using GPIO.setmode(GPIO.BOARD), we are selecting the Physical
Numbering Scheme.

CODE:

import RPi.GPIO as GPIO


import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
print "LED on"
GPIO.output(18,GPIO.HIGH)
time.sleep(1)
print "LED off"
GPIO.output(18,GPIO.LOW)

Video demonstration:

RASPBERRY PI

Experiment No:2
Aim/Title of the Experiment:Demonstration of active buzzer on raspberry pi

Purpose/Application(if any):

Hardware components used and the design (take the snap of the circuit design drawn in the book):

1.Jumpers
2.Breadboard
3.Buzzer/piezo speaker
List of Functionality and the final code:

1. #Libraries

2. import RPi.GPIO as GPIO

3. from time import sleep

4. #Disable warnings (optional)

5. GPIO.setwarnings(False)

6. #Select GPIO mode

7. GPIO.setmode(GPIO.BCM)

8. #Set buzzer - pin 23 as output

9. buzzer=23

10. GPIO.setup(buzzer,GPIO.OUT)

11. #Run forever loop

12. while True:

13. ......GPIO.output(buzzer,GPIO.HIGH)

14. ......print ("Beep")

15. ......sleep(0.5) # Delay in seconds

16. ......GPIO.output(buzzer,GPIO.LOW)

17. ......print ("No Beep")

18. ......sleep(0.5)

Video demonstration of the same(insert the video snippet):

You might also like