Embedded Systems Design Lab
Embedded Systems Design Lab
Embedded Systems Design Lab
AIM :
TM4C123GXL LanchPad :
SOFTWARE:
Energia is the open source software to program for TM4C123GXL. This is IDE (Integrated
Development Environment) for programming, compiling and debugging. Software has facility
to compile the program, upload the program into the target board.
Serial monitor is useful to debug the code in real time response of hardware and composed
circuit.
1
TM4C123GXL – INTERNAL STRUCTURE DIAGRAM
2
ENERGIA SOFTWARE SCREEN:
RESULT :
3
ADC INTERFACING WITH ARM PROCESSOR
AIM
To interface convert Analog signal in digital form using ADC in ARM processor.
APPARATUS REQUIED
1. ARM processor,
2. 1kΩ Resistor – 5 nos
3. Bread Board.
4. Connecting wires
THEORY
Five 1kΩ resistors are connected in series. 5V is supplied and the circuit is closed by the
ground. 5V is applied across 5 1kΩ resistors, so each resistor drops 1v, totally 5v. Test point in
ground, it produces 0 analog voltage, From ground after the first resistor produces 1 analog volt,
after the second resistor produces 2 analog volt, after the third resistor produces 3 analog volt, after
the fourth resistor produces 4 analog volt, all these test point voltage nodes are connected with the
analog IN pin of ARM processor one by one. Program is written to read analog value in analog pin
using analog read syntax and this received scale value in program is converted by multiplication
factor and can be displayed as 1,2,3,4 volt as digital numbers. Finally analog voltage across the
resistors is displayed as digital voltage value numbers in ARM processor serial monitor.
PROCEDURE
1. Connections are given as per the circuit diagram.
2. ADC energia program is loaded in ARM processor.
3. Open the serial monitor in energia
4. In circuit connect analog pin to test point - gnd, 1, 2, 3, 4.
5. Observe the respective digital voltage values in serial monitor as 0,1,2,3,4
PROGRAM
int analogPin = PE_2;
int volt;
int val = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(analogPin);
Serial.print("scale value = ");
Serial.println(val);
volt =(5*val) /5000;
Serial.print(volt);
Serial.println(" volts");
delay(1000);
}
4
CIRCUIT DIAGRAM
INPUT OUTPUT
GND 0
1 1
2 2
3 3
4 4
RESULT
Thus the Conversion of Analog to Digital is performed and verified with ARM processor
successfully
5
DAC INTERFACING WITH ARM PROCESSOR
AIM
To interface and convert Digital to Analog using DAC in ARM processor.
APPARATUS REQUIED
1. ARM processor,
2. Computer
3. Voltmeter (0-20)v or Multimeter
4. Connecting wires
THEORY
Digital scale value in program is uploaded to ARM processor. This value is passed to digital
to analog converting pin using analog write program line, so equivalent digital value is obtained at
the output of that pin. This is monitored by Voltmeter connected across the same pin with ground.
PROCEDURE
1. Connections are given as per the circuit diagram.
2. DAC energia program is loaded in ARM processor.
3. In circuit connect digital to analog pin to + terminal of voltmeter
4. Another end of voltmeter to be connected with ground.
5. Observe the respective analog voltage in voltmeter.
{Serial.begin(9600);
pinMode(analogpin, OUTPUT);
void loop()
analogWrite(analogpin, digitalscalevalue);
Serial.println( digitalscalevalue);
6
PROGRAM - VARIABLE VALUE INPUT OUTPUT
int digitalscalevalue =0; 5 0.1 volt
int addvalue = 5;
int analogpin=PB_2; 10 0.2 volt
void setup()
15 0.3 volt
{
pinMode(analogpin, OUTPUT); . .
}
void loop() . .
{
analogWrite(analogpin,digitalscalevalue); 255 3.3 volt
delay(30);
digitalscalevalue = digitalscalevalue +
addvalue;
if (digitalscalevalue ==255 )
{
digitalscalevalue =0;
}
}
CIRCUIT DIAGRAM
RESULT
Thus the Conversion of Digital to Analog is performed and verified with ARM processor
successfully.
7
LED INTERFACING
AIM
To interface LED with ARM processor.
APPARTUS REQUIRED
1. ARM Processor
2. Computer
3. LED.
4. Resister 1K.
THEORY
ARM processor is used for LED ON and OFF. Digital out of processor is connected to the LED.
When digital out is HIGH, LED gets ON, When digital out is LOW, LED gets OFF. Delay is used in
the program in between LED on and off to view the led change of state from ON to OFF.
PROCEDURE
1. Connections are given as per the circuit diagram.
2. Upload energia program into the ARM processor.
3. Observe the LED ON and OFF like blinking led.
PROGRAM
void setup()
{
pinMode(PA_4, OUTPUT);
}
void loop()
{
digitalWrite(PA_4,HIGH);
delay(100);
digitalWrite(PA_4,LOW);
delay(100);
}
INPUT OUTPUT
PORT PA_4, HIGH LED ON
PORT PA_4, LOW LED OFF
8
CIRCUIT DIAGRAM
RESULT
Thus the interfacing of LED with ARM processor is done successfully.
9
DC MOTOR SPEED CONTROL (PWM)
AIM
To interface the DC motor with ARM processor and perform the speed control.
APPARTUS REQUIRED
1. ARM Processor
2. BC547.
3. 12 V DC Motor.
4. 12 V Power supply.
5. LED.
6. Resister 1K.
THEORY
Pulse width modulation is digital signal changing high and low with respect to time. The time
is varying for high state and low state. The low state is less time dc motor is low speed. The high is
higher then low state dc motor run high speed.
PROCEDURE
1. Connections are given as per the Diagram.
2. For LOW speed : Set ON time 100ms and OFF time 10ms.
3. Upload energia programe to ARM processor.
4. Observe motor speed.
5. For HIGH speed : Set ON time 10ms and OFF time 100ms.
4. Upload energia programe to ARM processor.
4. Observe motor speed.
PROGRAM
void setup()
{
// put your setup code here, to run once:
pinMode(PA_4, OUTPUT);
}
void loop()
{
digitalWrite(PA_4,HIGH);
delay(10);
digitalWrite(PA_4,LOW);
delay(100);
}
INPUT: OUTPUT:
For LOW speed: For HIGH speed:
HIGH time = 10ms HIGH time = 100 ms
LOW time = 100ms LOW time = 10ms
10
CIRCUIT DIAGRAM
RESULT
Thus the interfacing of DC motor with ARM processor is done successfully and speed control
of DC motor is performed.
11
RTC INTERFACING WITH ARM
AIM:
To interface RTC (Real Time Clock – DS1307) with ARM processor.
Apparatus required:
1. ARM processor
2. RTC – DS1307 with 3v battery
3. 1k resistor – 2 nos
RTC DS1307:
Real-time clock (RTC) counts seconds, minutes, hours, day of the week, date of the month, month,
and year with leap-year. Full binary-coded decimal (BCD) clock/calendar and 56-byte, battery-backed,
nonvolatile (NV) RAM for data storage. Two-wire serial interface are SDA, SCL. The clock operates in either
the 24-hour or 12-hour format with AM/PM indicator. DS1307 has a built-in power sense circuit that detects
power failures and automatically switches to the battery supply.
PROCEDURE:
1. ARM processor USB is plugged with computer.
2. SDA(5), SCL(6) pin of DS1307 is connected with the SDA(PD_1), SCL(PD_0) pin of ARM processor.
3. Pull up resistors each 1k ohms to be connected in SDA, SCL and ended with common 5v.
4. Load the program into ARM processor, open the serial monitor in energia.
5. Setup part of program has settime function, this sets the seconds, minutes, hours, day, date, month and
year. This to be done only once when new RTC is used, then settime to be comments because every time of
program upload should not set time.
6. Loop part of the program reads the seconds, minutes, hours, day, date, month and year from RTC memory
from 0 to 7 address again and again.
7. Reading calendar values can be viewed in serial monitor of energia.
PROGRAM:
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68
void setup()
{
Wire.begin();
Serial.begin(9600);
// set the initial time here:
// DS1307 seconds, minutes, hours, day, date, month, year
//setDS1307time(40,07,11,6,20,8,16);
}
void loop()
{
displayTime(); // display the real-time clock data on the Serial Monitor,
delay(1000); // every second
}
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
return( (val/10*16) + (val%10) );
}
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
return( (val/16*10) + (val%16) );
}
void setDS1307time(byte second, byte minute, byte hour, byte dayOfWeek, byte dayOfMonth, byte month,
byte year)
12
{
13
Serial.print(" Day of week: ");
switch(dayOfWeek)
case 1:
Serial.println("Sunday");
break;
case 2:
Serial.println("Monday");
break;
case 3:
Serial.println("Tuesday");
break;
case 4:
Serial.println("Wednesday");
break;
case 5:
Serial.println("Thursday");
break;
case 6:
Serial.println("Friday");
break;
case 7:
Serial.println("Saturday");
break;
}
}
CIRCUIT DIAGRAM:
14
INPUT: OUTPUT:
setDS1307time(40,07,11,6,20,8,16); 11:07:40 20/8/16 Day of week: Friday
feed parameters in program line as 11:07:41 20/8/16 Day of week: Friday
seconds, minutes, hours, day, date, month, year 11:07:42 20/8/16 Day of week: Friday
(this is sample values, current time value to be set) 11:07:43 20/8/16 Day of week: Friday
40 – seconds 11:07:44 20/8/16 Day of week: Friday
07 – minutes 11:07:45 20/8/16 Day of week: Friday
11 – hours .
6 – day (FRIDAY) .
20 – date .
8 – month .
16 - year
15
DS1307 BLOCK DIAGRAM
RESULT:
Thus the interfacing of Real Time Clock with ARM processor is performed and calendar value is displayed.
16
KEYBOARD INTERFACING WITH ARM PROCESSOR
AIM
To interface keyboard with ARM processor
APPARTUS REQUIRED
1. ARM Processor.
2. Computer.
3. 3x3 matrix keyboard.
THEORY
Keyboard is scanned and the pressed key is detected then it is printed. When the columns
pins of ARM processor is set in output mode, 5v is supplied by default to this pins. 10k resistor is
connected in each column and another end of all this resistor is connected to ground. To start
scanning, Column1 is set as high, remaining columns set as low, so 5v is available in column1
alone. When scanning all the rows, if any key is pressed in row1 will received 5v in row1, so column1
row1 key is the pressed key, it is assumed as value of this position is 1, so 1 is printed. If row2 key is
pressed, 5v in column1 is received in row2, so the pressed key is column1 row2, it is assumed as 4
as it is the 3x3 matrix, this process is continued to row3. Next step column2 is enabled by setting it
as high and all the rows are scanned and it key values are assumed like 2,5,8 if it is pressed.
PROCEDURE
1. Connect 3 digital lines from ARM processor to row lines of keyboard
2. Connect another 3 digital lines from ARM processor to Columns line of keyboard
3. Upload energia program to processor.
4. Open serial monitor in computer.
5. Press any key in keyboard and observe that the same key is displayed in serial monitor.
PROGRAM
void setup()
{
pinMode(C1, OUTPUT); // c1
pinMode(C2, OUTPUT); // c2
pinMode(C3, OUTPUT); // c3
pinMode(R1, INPUT); // r1
pinMode(R2, INPUT); //r2
pinMode(R3, INPUT); //r3
Serial.begin(9600);
}
17
void loop()
{
delay(150);
// C1- column 1 scanning
digitalWrite(C1, HIGH);
digitalWrite(C2, LOW);
digitalWrite(C3, LOW);
if(digitalRead(R1)==HIGH)
{
Serial.println("1");
}
if(digitalRead(R2)==HIGH)
{
Serial.println("2");
}
if(digitalRead(R3)==HIGH)
{
Serial.println("3");
}
// C2 - column 2 scanning
digitalWrite(C1, LOW);
digitalWrite(C2, HIGH);
digitalWrite(C3, LOW);
if(digitalRead(R1)==HIGH)
{
Serial.println("4");
}
if(digitalRead(R2)==HIGH)
{
Serial.println("5");
}
if(digitalRead(R3)==HIGH)
{
Serial.println("6");
}
// C3 - column 3 scanning
digitalWrite(C1, LOW);
digitalWrite(C2, LOW);
digitalWrite(C3, HIGH);
if(digitalRead(R1)==HIGH)
{
Serial.println("7");
}
18
if(digitalRead(R2)==HIGH)
{
Serial.println("8");
}
if(digitalRead(R3)==HIGH)
{
Serial.println("9");
}
}
INPUT OUTPUT
Key to be pressed in Keyboard 2 – is displayed in serial monitor
If 2 is pressed
CIRCUIT DIAGRAM
RESULT
Thus the keyboard interfacing with ARM processor is done and pressed key is verified
successfully.
19
LCD INTERFACING WITH ARM PROCESSOR
AIM
To interface LCD with ARM processor and display the text.
APPARATUS REQUIRED
1. ARM processor
2. Computer
3. LCD 16x2
4. 10kΩ variable resistor – 1.
5. Separate 5V supply.
THEORY
VSS – GND
VDD – 5V (separate supply not from ARM processor)
V0 –3 wires 10kΩ pot, top wire to 5v, bottom wire to ground, middle wire to V0
RS – to arm processor digital pin
RW – to GND
E – to arm processor digital pin
D4,D5,D6,D7 – to arm processor digital pin
PROCEDURE
1. Connection are given as per the circuit diagram.
2. Separate 5V supply to be used in LCD display, ARM processor GND to connected to
GND of separate 5v power supply.
3. Varying 10kΩ pot in V0 brightness of LCD is tuned.
4. LCD display program in energia is loaded to the ARM processor.
5. Observe the text displayed in LCD display
PROGRAM
#include <LiquidCrystal.h>
Int RS = PA7;
Int EN = PA6;
Int D4 = PA5;
Int D5 = PB4;
Int D6 = PE5;
Int D7 = PE4;
LiquidCrystal lcd(RS,EN,D4,D5,D6,D7);
20
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("LCD TEST");
lcd.setCursor(0, 1);
lcd.print("EMBEDED LAB");
}
CIRCUIT DIAGRAM
INPUT OUTPUT
“LCD TEST” in row0 LCD TEST
“EMBEDED LAB” in row1 EMBEDED LAB
RESULT
Thus the interfacing LCD display with ARM processor is done and text is displayed in
LCD
21
EPROM INTERFACING
AIM:
To write and read data from EEPROM interfaced with ARM processor.
Apparatus required:
1. ARM processor
2. 24C02 - EPROM
3. 1k resistor – 2 nos
EPROM:
24C02C is a 2K bit Serial Electrically Erasable PROM with a voltage range of 4.5V to 5.5V. It has a
single block of 256 x 8-bit memory, It means 256 address location each has the capacity to store 8 bit, 256x8 =
2048 bit.
PROCEDURE:
ARM processor USB is plugged with computer.
SDA(5), SCL(6) pin of EPROM is connected with the SDA(PD_1), SCL(PD_0) pin of ARM processor.
Pull up resistors each 1k ohms to be connected in SDA, SCL and ended with common 5v.
WP of EPROM to be connected in GND to enable both write and read operation in EPROM.
Load the program into ARM processor, open the serial monitor.
Setup part of program writes the data in EPROM memory from 0 to 256 address.
Loop part of the program reads the data from EPROM memory from 0 to 256 address again and
again.
Writing data and reading data output can be viewed in serial monitor of energia.
PROGRAM:
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("Writen to memory!");
for(int i = 0; i < 100; i++)
{
eeprom_i2c_write(B01010000, i, 'A'+i);
Serial.print(i);
Serial.print(" - ");
Serial.print('A'+i);
Serial.print("\n");
delay(100);
}
}
void loop()
{
Serial.println("Reading from memory!");
for(int i = 0; i < 7; i++)
{
byte r = eeprom_i2c_read(B01010000, i);
Serial.print(i);
Serial.print(" - ");
Serial.print(r);
22
Serial.print("\n");
delay(500);
}
}
Wire.requestFrom(deviceaddress, 1);
if(Wire.available())
return Wire.read();
else
return 0xFF;
}
CIRCUIT DIAGRAM:
23
INPUT:
MEMORY DATA
(WRITING)
ADDRESS
0 65
1 66
2 67
3 68
. .
. .
. .
256
OUTPUT:
MEMORY DATA
(READING)
ADDRESS
0 65
1 66
2 67
3 68
. .
. .
. .
256
24
SDA (Serial Data)
This is a bidirectional pin used to transfer addresses and data into and data out of the device. It is an open drain terminal ;
therefore, the SDA bus requires a pullup resistor to VCC (typical 10 k for 100 kHz, 2 k for 400 kHz).
A0, A1, A2
The levels on these inputs are compared with the corresponding bits in the slave address. The chip is selected if the
compare is true. Up to eight 24C02C devices may be connected to the same bus by using different Chip Select bit
combinations. If A0, A1, A1 are 0,0,0, it is the first device, so combination of three line upto 1,1,1 eight devices can be
connected.
WP
This is the hardware write-protect pin. It must be tied to VCC or GND. If tied to Vcc, the hardware write protection is
enabled. If the WP pin is tied to GND the hardware write protection is disabled.
DEVICE ADDRESSING:
RESULT:
Thus the writing and reading the data from EEPROM with ARM processor is performed.
25
IMPLEMENTING INTERRUPT IN ARM PROCESSOR
AIM
To implement interrupt in ARM processor.
APPARATUS REQUIRED
1. ARM processor,
2. Computer
3. LED – 3 nos
4. Bread Board.
5. Connecting wires
THEORY
Two interrupt ports are available in ARM processor. Two interrupt ports are PUSH1,
PUSH2. PUSH1 is linked with PF4 and PUSH2 is linked with PF0, so external switch is to
be connected with PF4 to trigger the PUSH1 interrupt, and PF0 for PUSH2.
SW1 and SW2 switch are present in the ARM target board, SW1 can be used instead
of connecting external switch to PF4 to trigger PUSH1 interrupt. SW2 can be used instead
of connecting external switch to PF0 to trigger PUSH2 interrupt.
These interrupts are initiated on RISING or FALLING of signal which is to provided
through switches and as mentioned in program in “attachInterrupt” function.
PROCEDURE
1. Connections are given as per the circuit diagram.
2. Program is uploaded to ARM processor.
3. Output is verified in LEDs.
4. The main program execution is observed in Red and Green Leds continuously
blinking.
5. When pressing External interrupt switch Yellow Led is glowing for some time due to
interrupt is initiated.
PROGRAM
int ledRed=PE_1;
int ledGreen=PE_2;
int ledYellow=PE_3;
int interrCount=0;
void setup()
{
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledYellow, OUTPUT);
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, LOW);
digitalWrite(ledYellow, LOW);
26
pinMode(PUSH2, INPUT_PULLUP);
attachInterrupt(PUSH2, interruptBlink, RISING);
}
void loop()
{
interrCount++;
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, LOW);
delay(300);
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, HIGH);
delay(300);
if ( interrCount == 10 )
{
interrCount = 0;
digitalWrite(ledYellow, LOW);
}
}
void interruptBlink()
{
digitalWrite(ledYellow, HIGH);
}
27
CIRCUIT DIAGRAM
28
INPUT
OUTPUT
RESULT
Thus the implementation of interrupt is performed in ARM processor.
29
FLASHING OF LEDS WITH ARM PROCESSOR
AIM
To perform the flashing of LEDs with ARM processor
APPARATUS REQUIRED
1. ARM processor –
2. Separate 5V power supply
3. LEDs – 5 nos
4. Bread Board
5. Connecting wires.
THEORY
5 LEDs are connected with ARM processor by individual digital pin. Program is written
to ON LEDs one by one then off all the LEDs at a time, then ON the LEDs one by one, the
same loop is operated. So the flashing of LEDs is done.
PROCEDURE
1. Connections are given as per the circuit diagram.
2. energia program is loaded into the ARM processor.
3. Output is observed in LEDs.
4. LEDs are gets ON one by one, then at a time all the LEDs are turned OFF, then LEDs are
gets ON one by one, loop is contined.
PROGRAM
int tonDelay=1000;
int toffDelay=500;
int LED1= PA_2;
int LED2= PA_3;
int LED3= PA_4;
int LED4= PE_0;
void setup()
{
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
}
void loop()
{
digitalWrite(LED1,
HIGH);delay(tonDelay);
digitalWrite(LED2,HIGH);
delay(tonDelay);
30
digitalWrite(LED3,
HIGH);delay(tonDelay);
digitalWrite(LED4,HIGH);
delay(tonDelay);
digitalWrite(LED1, LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3, LOW);
digitalWrite(LED4,LOW);
delay(toffDelay);
}
CIRCUIT DIAGRAM
31
INPUT
ON led1, ON led2, ON led3, ON led4, ON led5
OFF all LED, again same thing to be repeated
OUTPUT
LED1 gets ON, LED2 gets ON, LED3 gets ON, LED4 gets ON, LED5 gets ON
All LED is turned OFF, same thing is repeated
RESULT
Thus the flashing of LEDs by ARM processor is performed and verified.
32
STEPPER MOTOR INTERFACING
Aim:
To perform a speed control of stepper motor using ARM processor.
Apparatus required:
1. ARM processor
2. Stepper motor with driver module
3. Separate 5V power supply
Theory:
A stepper motor is a brushless, synchronous electric motor that converts digital
pulses into mechanical shaft rotation. Every revolution of the stepper motor is divided into a
discrete number of steps, and the motor must be sent a separate pulse for each step.
Sequence 1100, 0110, 0011, 1001 sent to stepper from arm processor to rotate in forward
direction, sequence is reversed to rotate motor in reverse direction.
Procedure:
ARM processor USB is plugged with computer.
Digital output pins of ARM processor connected to the stepper motor driver.
Stepper motor sequence is programmed in energia.
Program is uploaded to ARM processor.
LED will glow in the given sequence.
Stepper motor rotation is observed.
Program:
Int S1 = PE1;
Int S2 = PE2;
Int S3 = PE3;
Int S4 = PF1;
void setup()
{
pinMode(S1,OUTPUT);
pinMode(S2,OUTPUT);
pinMode(S3,OUTPUT);
pinMode(S4,OUTPUT);
int i = 5; // 5 meant for 5 ms, speed operation
}
void loop()
{
//Sequence 1100
digitalWrite(S1,HIGH);
digitalWrite(S2,HIGH);
digitalWrite(S3,LOW);
digitalWrite(S4,LOW);
delay(i);
33
// sequence 0110
digitalWrite(S1,LOW);
digitalWrite(S2,HIGH);
digitalWrite(S3,HIGH);
digitalWrite(S4,LOW);
delay(i);
// sequence 0011
digitalWrite(S1,LOW);
digitalWrite(S2,LOW);
digitalWrite(S3,HIGH);
digitalWrite(S4,HIGH);
delay(i);
// sequence 1001
digitalWrite(S1,HIGH);
digitalWrite(S2,LOW);
digitalWrite(S3,LOW);
digitalWrite(S4,HIGH);
delay(i);
}
Circuit diagram:
INPUT/OUTPUT
1. For forward rotation sequence 1100, 0110, 0011, 1001 is used.
2. For reverse rotation sequence 1100, 1001, 0011, 0110 is used.
3. For speed operation, delay is set to 5ms.
4. For low speed operation, delay is set to 50ms.
RESULT:
Thus the stepper motor speed control is performed by interfacing stepper with ARM
processor.
34
INTERFACING TEMPERATURE SENSOR WITH ARM PROCESSOR
AIM
To interface temperature sensor with ARM processor and display the temperature
value.
APPARATUS REQUIRED
1. ARM processor,
2. Computer
3. Temperature sensor – LM35
4. Bread Board.
5. Connecting wires
THEORY
LM35 temperature sensor has 3 pin 5v,temp out, GND. Out pin of sensor connected
to analog pin of ARM processor. In energia program is written to read analog pin value and
this scale value is multiplied with factor to get temperature value in Celcius. It can be
observed in serial monitor of energia
PROCEDURE
1. Connections are as per the circuit diagram.
2. Present room temperature is displayed in serial monitor.
3. Using heating medium temperature is increased around the LM35 temperature
sensor.
4. Observe the increase in temperature in serial monitor.
PROGRAM
float tempC;
int reading;
int tempPin =PE_3;
int INTERNAL;
void setup()
{
analogReference(INTERNAL);
Serial.begin(9600);
}
void loop()
{
reading = analogRead(tempPin);
tempC = reading / 9.31;
Serial.println(tempC);
delay(1000);
}
35
CIRCUIT DIAGRAM
INPUT
Apply Heat to Temperature sensor
OUTPUT
Increase in temperature is observed in serial monitor
32
35
37
40
RESULT
Thus the interfacing of temperature sensor is done and temperature changes are
observed.
36