Assignment 4

Part A: Sensors in the phone List of sensors in the phone


Testing two sensors on phone
Light Sensor



Position sensor




Part B: Measuring the distance using Ultrasonic Sensors

Step 1: Wiring the devise

Ultrasonic sensors are used to measure distance by using ultrasonic waves. The sensor head emits an ultrasonic wave and receives the wave reflected back from the target. Ultrasonic Sensors also measure the distance to the target by measuring the time between the emission and reception. The trig pin acts in sending the signal and the echo pin recieves the signal and the time in between is used to find the location of the object Wiring the ultrasonic sensor with the arduino For measuring the distance the ultrasonic sensor was connected to the breadboard and the following connections were made Vcc - 5v Trig - pin 12 (input) Echo - pin 11 (output) GND - GND The data connection was made through the trig pin and the echo pin connection Power and ground connection was made through the Vcc and ground point. page 1

Step 2: Writing the code

Arduino IDE was used to write the code. The code used for this used specified the data pin (trig and echo). The trig pin acts in sending the signal and the echo pin recieves the signal and the time in between is used to find the location of the object Since Both sides of the serial connection (i.e. the Arduino and your computer) need to be set to use the same speed serial connection in order to get any sort of intelligible data -Serial.begin command was used to set the same transmission rate between the computer and the ARDUINO (9600 is the default value used) page 1 Library file was attatched to the existing code to make the program shorter. The library was included at the beginning of the code and simple commands were used to control the behaviour of the sensor Sketch> include library> .ZIP library (library attatchment made at the beginning of the code) page 1 For printing the display in the monitor void loop was set up with distance, unit and delay was provided There was an error in running the program- the port for ARDUINO connection was wrongly selected. So we opened Tools> Port: (and selected the correct port) After fixing the error, then to read the data the serial monitor was opened- Tools> Serial Monitor The screen displayed the changing distance of obstacles in front of the sensor page 1 page 1 use could be mounted to cycles to create smart cycles
Part C: Output device LCD Display
				

Step 1: Wiring the devise

The LCD used was an LED backlight with two rows of display with up to 16 characters on each row. Its is used to show letters and characters. 1602 means it displays 2 lines of 16 characters. Each position can display one character. The four connection was used in this case. The LCD used was an LED backlight with two rows of display with up to 16 characters on each row. GND - GND VCC - 5V SDA - A4 SCL - A5 The data connection was made through the SDA and the SLC pin connection Power and ground connection was made through the Vcc and ground point.

Step 2: Writing the code

LiquidCrystal library was included at the beginning of the code to make it shorter. In the void setup, lcd.begin() was used to initialize the interface of the LCD screen lcd.backlight was used to turn on the backlight for the display syntax used- lcd.clear -was used to position the cursor at the upper left corner (clearing the old display) lcd.print -the information that we want to be displayed on the monitor lcd.setCursor -set the location at which subsequent text written to the LCD will be displayed. Here this was used to specify the position of the second line of text. Position used was (0,1) to begin in the second line page 1 page 1
Part D: Combining a temperature and humidity sensor with an LCD monitor

Input device - DTH 11 temperature and humidity sensor Output device - LCD monitor

Step 1: Wiring the devise

The LCD used was an LED backlight with two rows of display with up to 16 characters on each row. Its is used to show letters and characters.
1602 means it displays 2 lines of 16 characters .


For the DTH 11 

GND - GND
VDD - 5V
NC  - Empty pin
DATA - PIN 7

The DTH 11 sensor contains a callibrated digital signal output of temperature and humidity.  The sensor includes a resistive sense of wet components 
and a NTC temperature measurement device

For the LCD Display

GND - GND
VCC - 5V
SDA - A4
SCL - A5

For the LCD display
The code was edited to clear the previos text, 

page 1

Step 2: Writing the code

Included both the libraries for the operation in the same process as mentioned above syntax float var = val var = variable name val = value assigned to the variable