11

Assignment (Input Output Devices)

A. Introduction:

Most mobile devices have built-in sensors that measure motion, orientation, and various environmental conditions.
These sensors are capable of providing raw data with high precision and accuracy, and are useful if you want to monitor three-dimensional device movement or positioning, or you want to monitor changes in the ambient environment near a device. For example, a game might track readings from a device's gravity sensor to infer complex user gestures and motions, such as tilt, shake, rotation, or swing. Likewise, a weather application might use a device's temperature sensor and humidity sensor to calculate and report the dewpoint, or a travel application might use the geomagnetic field sensor and accelerometer to report a compass bearing. The mobile platform supports three broad categories of sensors:

Sensor Type Description Common Uses
TYPE_ACCELEROMETER Hardware Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), including the force of gravity. Motion detection (shake, tilt, etc.).
TYPE_AMBIENT_TEMPERATURE Hardware Measures the ambient room temperature in degrees Celsius (°C). See note below. Monitoring air temperatures.
TYPE_GRAVITY Software or Hardware Measures the force of gravity in m/s2 that is applied to a device on all three physical axes (x, y, z). Motion detection (shake, tilt, etc.).
TYPE_GYROSCOPE Hardware Measures a device's rate of rotation in rad/s around each of the three physical axes (x, y, and z). Rotation detection (spin, turn, etc.).
TYPE_LIGHT Hardware Measures the ambient light level (illumination) in lx. Controlling screen brightness.
TYPE_LINEAR_ACCELERATION Software or Hardware Measures the acceleration force in m/s2 that is applied to a device on all three physical axes (x, y, and z), excluding the force of gravity. Monitoring acceleration along a single axis.
TYPE_MAGNETIC_FIELD Hardware Measures the ambient geomagnetic field for all three physical axes (x, y, z) in μT. Creating a compass.
TYPE_ORIENTATION Software Measures degrees of rotation that a device makes around all three physical axes (x, y, z). As of API level 3 you can obtain the inclination matrix and rotation matrix for a device by using the gravity sensor and the geomagnetic field sensor in conjunction with the getRotationMatrix() method. Determining device position.
TYPE_PRESSURE Hardware Measures the ambient air pressure in hPa or mbar. Monitoring air pressure changes.
TYPE_PROXIMITY Hardware Measures the proximity of an object in cm relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a person's ear. Phone position during a call.
TYPE_RELATIVE_HUMIDITY Hardware Measures the relative ambient humidity in percent (%). Monitoring dewpoint, absolute, and relative humidity.
TYPE_ROTATION_VECTOR Software or Hardware Measures the orientation of a device by providing the three elements of the device's rotation vector. Motion detection and rotation detection.
TYPE_TEMPERATURE Hardware Measures the temperature of the device in degrees Celsius (°C). This sensor implementation varies across devices and this sensor was replaced with the TYPE_AMBIENT_TEMPERATURE sensor in API Level 14 Monitoring temperatures.

Sensor Testing:

For testing purpose we used an app called Sensor record. It records the values of the onboard sensors in the form of a spreadsheet.

Data log From the Proximity senors.

GIF OF Gyroscope

B.Output Device:

Performing the assignment:

First i connected all the components together. The circuit for this assignment was fairly simple. The GND Pin of the LCD display is connected to the the GND of the arduino. The VCC is connected to the 5V.

LCD CODE

Inference from Datasheet:

This is an 16x2 LCD display screen with I2C interface. It is able to display 16x2 characters on 2 lines, white characters on blue background. Usually, Arduino LCD display projects will run out of pin resources easily, especially with Arduino Uno. And it is also very complicated with the wire soldering and connection. This I2C 16x2 Arduino LCD Screen is using an I2C communication interface. It means it only needs 4 pins for the LCD display: VCC, GND, SDA, SCL. It will saves at least 4 digital / analog pins on Arduino. All connector are standard XH2.54 (Breadboard type). You can connect with jumper wire directly. To avoid the confliction of I2C address with other I2C devices, such ultrasonic sensor, IMU, accelerometers and gyroscope, the I2C address of the module is configurable from 0x20-0x27. And its contrast can be adjusted manually.

C.Sensor Input:

In this project, we will use the Arduino DHT11 Temperature/Humidity sensor and display it to the Arduino IDE serial monitor. This project is really simple. The connections are shown above.

Performing the assignment:

First i connected all the components together. The circuit for this assignment was fairly simple. The pins on the sensor are S, for signal, the one in the middle is voltage, and the minus sign is ground. The signal pin goes to header A0 on the Arduino. The middle pin goes to 5V, and the minus sign goes to GND. Our yellow cable is our Analog cable, our red cable is power, and our black one is ground.

Adding the DHT library

in the Arduino IDE, go to Sketch >> Include Library >> Add ZIP file.
When you click the 'Add .ZIP library', you should get a file window that pops up. Add the DHT_Library.zip.

DHT11 CODE

Output:

Real World Application:

DHT11 can have various real world application. This sensor is used in Air Conditioning devices. Anyplace where the analyzation of temperature and humidity is required this sensor can be used.

Inference from Datasheet:

The DHT11 is a commonly used Temperature and humidity sensor. The sensor comes with a dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of temperature and humidity as serial data. The sensor is also factory calibrated and hence easy to interface with other microcontrollers. The sensor can measure temperature from 0°C to 50°C and humidity from 20% to 90% with an accuracy of ±1°C and ±1%. So if you are looking to measure in this range then this sensor might be the right choice for you.

D.Input and Output Circuit:

For the Input+Output circuit we used the combination of DHT11 and an I2C LCD display. The DHT11 was used to calculate the humidity and the temperature of the surrounding while the LCD unit displays both the values.

Assignment video:

INPUT OUTPUT CODE

--------------------End---------------------