Overview

Share for us

In this kit, we will learn how to use the OLED and all kinds of sensors and how to use them together. The sensors we will use include temperature and humidity DHT11, photoresistor, 3-axis accelerometer ADXL345, tilt switch, air pressure sensor BMP085, and dust sensor GP2Y1010AU0F (can test the current value of PM2.5). We will also use rotary encoder, and, of course, our protagonist OLED (0.96 inch).

Introduction to Sensors

Photoresistor

A photoresistor (see Figure 1) gets it resistance from the light. If it is dark, the sensor will read up in the millions of Ohms, but as light shines at it, it will have a lower resistance. The sensor requires a voltage divider to get a correct signal.

Tilt Sensor

The tilt sensor (see Figure 2) is used to check whether or not something is level. It has a small metal ball inside the cap; when it is tilted, the ball connects with the outer cylinder and sends HIGH to the SunFounder Uno. This sensor acts like a switch and requires a pull-up resistor.

DHT11

The DHT11 sensor shown in Figure 3 can detect temperature (C and F) and humidity. It has everything it requires built into it, so it will work very well with the SunFounder Uno. This sensor is used in conjunction with the DHT11 library.

ADXL345

The ADXL345 is a small, thin, ultra-low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3-or 4-wire) or I2C digital interface.

The ADXL345 is well suited for mobile device applications. It measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (3.9mg/LSB) enables measurement of inclination changes less than 1.0°.

It provides several special sensing functions. Activity and inactivity sensing detect the presence or lack of motion by comparing the acceleration on any axis with user-set thresholds. Tap sensing detects single and double taps in any direction. Free-fall sensing detects if the device is falling. These functions can be mapped individually to either of two interrupt output pins. An integrated, patent pending memory management system with a 32-level first in, first out (FIFO) buffer can be used to store data to minimize host processor activity and lower overall system power consumption.

Low power modes enable intelligent motion-based power management with threshold sensing and active acceleration measurement at extremely low power dissipation.

The ADXL345 is supplied in a small, thin, 3 mm × 5mm × 1mm, 14-lead, plastic package.

BMP180

The BMP180 (see Figure 5) is designed to be connected directly to a microcontroller of a mobile device via the I2C bus. The pressure and temperature data has to be compensated by the calibration data of the E2PROM of the BMP180.

The BMP180 consists of a piezo-resistive sensor, an analog to digital converter and a control unit with E2PROM and a serial I2C interface. In this tutorial, we use Adafruit_BMP085_Unified and adafruit_sensor_maste libraries to read the value of BMP180.

GP2Y1010AU0F

Optical dust sensor (GP2Y1010AU0F) (as shown in figure 6) manufactured by Sharp can effectively detect smoke and indoor dust and other dust in the air. An infrared light-emitting diode and a phototransistor are diagonally placed in the sensor, which are used to detect the reflected light of dust in the air. Sensor signals are output in the form of analog voltage that is proportional to the dust concentration. The SunFounder Uno board reads the analog voltage with analog port to get the concentration of dust in the air after proper conversion.

Rotary Encoder

A rotary encoder (see figure 7) is a kind of photoelectric sensor, which is used to detect mechanical movement and displacement, and convert them into electrical signals. It transforms analog signals into digital signals produced by shaft rotation through internal fixed circuit to determine the position, speed and angle in the automation system. Rotary encoder has single channel output and dual channel output. Here we use dual channel output rotary encoder to output two groups A/B pulses with phase difference of 90 degrees. SunFounder Uno judges the rotation direction and angle by reading the two groups of pulses.

OLED

OLED (Organic Light Emitting Diode) (as shown in figure 8) display technology features self-luminous. It uses very thin organic materials coating and glass substrates. When there is current flowing through the organic material, it will glow. In addition, OLED display screen has large viewing angle and can save power. The characteristics of OLED technology are as follows:

1. The OLED device has very thin core layer, whose thickness can be less than 1 mm, just a third of the LCD.


2. The OLED device has all solid state structure without the vacuum and liquid material, thus has good earthquake resistance, and can adapt to the huge acceleration, vibration and other bad environment.


3. The self-luminous characteristic makes the OLED almost no limitation of the angle of view, which generally can reach 170 degrees. With a broad perspective, no distortion even you see from the side.


4. The response time of the OLED display screen is shorter than that of TFT-LCD screen, which is about tens of milliseconds, now the response time of the best TFT – LCD is only 12 milliseconds. But the response time of the OLED display is about a few microseconds to tens of microseconds.


5. With good low temperature performance, the OLED can display normally even under minus 40 degrees Celsius. It is also used as a display screen in space suit at present. However, the response speed of the TFT-LCD changes with temperature. Under low temperature, it slows down. Therefore, the LCD has bad display effect under low temperature.


6. The OLED uses the principle of organic light-emitting, requires only a few materials and less production processes (less than 3 processes) corresponding to the production process of LCD. Therefore, the cost is greatly reduced.


7. The OLED uses a self-luminous diode, therefore does not need back light source. With high luminous conversion efficiency and lower energy consumption than LCD, the OLED can be manufactured on different material of substrate, whose circuit even can be printed on the elastic material – make it bendable soft display.


8. The OLED uses low voltage (under 5v) DC to drive, can be lit with batteries. With high brightness, it can reach above 300lm.