top of page

DSL810

Special Topics in Design
Output Sensors

Add an output device to a microcontroller board and program it to do something. Upload the arduino code.

Here I have used a 16×2 character LCD on Arduino board to show the phrase "hello there".

​

So I needed a bread board, jumper cables, and Aurdino Uno and a I2C LCD display unit.

​

The code used is given below-


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello there!");
}

IMG_20181030_133508.jpg

From The Datasheet-

The OLED displays are one of the most attractive displays available for a microcontroller. It has a good view angle and pixel density which makes it reliable for displaying small level graphics.

It is a slim, attractive and efficient display module to make the project look cool with graphics.

​

It has a 128×64 pixel resolution with 160° viewing angle and can be easily interfaced with Arduino.

​

Can be powered by either 3.3V or 5V.

Combine the input and output device to work together and collect data for an activity connected to you. Analyze that data and make sense of it.

​

Here I have tried to use a soil moisture sensor as the input device and the i2c display unit as the output device.

​

So I needed a bread board, jumper cables, Aurdino Uno, a soil moisture sensor and a LCD display unit.

Also to test the circuit, I needed a paper cup half filled with soil and a little water to sprinkle on it during the experiment. 

​

The code used is given below-

​

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

​

const int analogInPin = A0; // Analog input pin that the Sensor is attached to

​

int sensorValue = 0;

// value read from the Soil Moisture

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

delay(100);

}

void loop() {

lcd.clear();

lcd.print("Sensor:");// print the results to the LCD Display:

sensorValue = analogRead(analogInPin);// read the analog in value:

lcd.setCursor(0, 1);

lcd.print(sensorValue);

// wait 300 milliseconds before the next loop for the

//analog-to-digital converter to settle after the last reading:

delay(300);

}

IMG_20181030_140522 (1).jpg
bottom of page