Professional Documents
Culture Documents
Since this work counts toward your formal assessment for this course, please write your name and student
number where indicated above, and sign. Attach this cover sheet to the front of your submission, so
thatyour name and student number can be seen without any cover needing to be opened.
We declare that this assessment item is our own work, except where acknowledged, and has not been
submitted for academic credit elsewhere, and acknowledge that the assessor of this item may, for
thepurpose of assessing this item:
• Reproduce this assessment item and provide a copy to another member of the University ; and/or,
• Communicate a copy of this assessment item to a plagiarism checking service (which may then
retaina copy of the assessment item on its database for the purpose of future plagiarism checking).
We certify that we have read and understood the University Rules in respect of Student Academic
Misconduct.
Date:23/01/2022
TABLE OF CONTENT
NO CONTENT PAGE NO
1 TITLE 1
2 INTRODUCTION 1
3 FUNCTIONAL PARTS IN THE PROJECT 2-3
4 ARDUINO IDE PROGRAM 4
8 PROGRAM FLOW 10
9 CONTROLS NAMING 11
10 ARDUINO UNO AND LM35 TEMPERATURE SENSOR WITH 12-13
LED ALERT SETUP
11 CONCLUSION 14
TITLE
Reading LM35 Temperature Sensor with LED Alert using Arduino Uno and
Visual Basic Programming
INTRODUCTION
The Arduino board can interface with the Arduino IDE's serial monitor, but it only has text and
numeric options. Visual Basic is the first thing that comes to mind when we think of a graphical
interface and control. Visual studio supports a variety of programming languages, and the
visual studio Arduino IDE is also available on the internet. I used Microsoft Visual Studio 2022
for my project, and the purpose is to use one windows application to take temperature reading
using a LM35 sensor and will tigger a Red LED when the readings exceed 40 degrees Celsius
once the temperature reading start to drop the red LED will stop light up. Visual Basic for
Windows programme development gives the best GUI (Graphical User Interface) as well as a
customisable Serial Port to control devices attached to the computer.
1|Page
FUNCTIONAL PARTS IN THE PROJECT:
1) Arduino Uno
4) Red Led
2|Page
5) Breadboard
6) 220-ohm resistor
7) Power cable
3|Page
ARDUINO IDE PROGRAM
#define LM35 A0
#define RED 7
float lm_value;
float tempc;
void setup() {
Serial.begin(115200);
pinMode(RED, OUTPUT);
void loop() {
lm_value = analogRead(LM35);
tempc = (lm_value * 500) / 1023;
Serial.println(tempc);//Temperature in Celcius
//Condition
if (tempc > 40) {
digitalWrite(RED, HIGH);
}
else {
digitalWrite(RED, LOW);
}
delay(100);
}
4|Page
SCHEMATIC DRAWINGS
5|Page
6|Page
GRAPHICAL USER INTERFACE (GUI)
7|Page
WINDOWS VISUAL BASIC 2022 PROGRAMING
Imports System.IO.Ports
End Try
Else
SerialPort1.Close()
TBSerialSend.Enabled = False
GroupBox1.Enabled = True
BtnConn.Text = "Connect"
End If
End Sub
End Sub
Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles
BtnClear.Click
RTBReceiveSerial.Clear()
End Sub
8|Page
Private Sub BtnSave_Click(sender As Object, e As EventArgs) Handles
BtnSave.Click
If sfdSaveFile.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim swrfile As System.IO.StreamWriter
swrfile = System.IO.File.CreateText(sfdSaveFile.FileName + ".txt")
For i As Integer = 0 To RTBReceiveSerial.Lines.Length - 2
swrfile.WriteLine(i.ToString + ") " + Format(Now, "hh-mm-ss") + "
(" + RTBReceiveSerial.Lines(i))
Next
swrfile.Close()
End If
MessageBox.Show("operation cancelled")
End Sub
End Class
9|Page
PROGRAM FLOW
10 | P a g e
CONTROLS NAMING
GroupBox1 - CONNECTION
Label1 - PORT
Label2 - BAUDRATE
CombBox1 CBPort -
CombBox2 CBBaudRate -
Button1 BtnConn Connect
Button2 BtnSave SAVE TEXT
Button3 BtnClear CLEAR
TextBox TbSerialSend -
RichTextBox RTBReceiveSerial -
SaveFileDialog sfdSaveFile -
11 | P a g e
ARDUINO UNO AND LM35 TEMPERATURE SENSOR WITH LED ALERT SETUP
12 | P a g e
Red LED trigged when the temperature readings exceed 40 degrees Celsius
13 | P a g e
CONCLUSION
As a conclusion, I have learned how to setup an Arduino uno with an input sensor which
I used is LM35 temperature sensor with red LED alert. In this project I have learned
how to custom graphical user interface (GUI) hardware and software to controlling an
LED and make the GUI run successfully by using windows visual basic 2022.I also
learned how to logging data in windows visual basic 2022 to save and clear a text. I ’ve
learned how to define tasks as state that can execute independently of other state.
The results demonstrated that the LM35 temperature sensor with red LED alert is
functioning as per intended design, and meeting the project objectives
14 | P a g e