logo-mobile

ROHM

ROHM
Menu
  • Arduino –
  • Raspberry Pi –
  • Trending –
  • Others –
  • About –
  • Contact –

Arduino

Make a Stevenson Screen with Arduino Part 3 – Mastering the Humidity Sensor & Using Battery

Device Plus Editorial Team
Published by Device Plus Editorial Team at November 6, 2015
Categories
  • Arduino
Tags
Stevenson screen with Arduino

Stevenson screen with Arduino

We’ve arrived at part 3 of our series on how to make a Stevenson screen with Arduino. We’ve become quite comfortable using Arduino. Last time, we learned how to use 7-segment LED to display values. Today, we will implement the humidity sensor, one of the primary function of the Stevenson screen. We will also simplify the cabling of Arduino to make the Stevenson screen easier to use.

Today’s Electronics Recipe

Expected time to complete: 60 minutes
Parts needed:

  • Arduino base (Arduino Uno R3) https://www.adafruit.com/products/50
  • Breadboard https://www.adafruit.com/products/64
  • 7-segment LED (High brightness red 7-segment LED display (cathode common) NKR161-B) http://www.alliedelec.com/lumex-lds-hta512ri/70127463/
  • Humidity sensor (TDK CHS-UGR)
  • Temperature sensor (LM35DZ)
  • AC adapter http://www.amazon.com/Power-Supply-ADAPTER-LINKSYS-AD12V/dp/B002S2GQIS
  • 9V battery snap http://www.amazon.com/Parts-Express-9V-Battery-Clip/dp/B0002ZPFU8/ref=sr_1_2?s=electronics&ie=UTF8&qid=1446346972&sr=1-2&keywords=battery+snap
  • 9V battery

Reviewing the Specifications

Before we begin our work, let us review once again the specifications of the Stevenson screen that we are trying to build.

Arduino Specifications for our Stevenson screen

The features we’d like to implement for our Stevenson screen (Specification sheet):

  1. The measured values should always be accessible from the PC over the Internet
    → Connect the Stevenson screen to a LAN cable using components such as the Ethernet module
  2. It should operate without being connected to a PC to easily be moved
    → Change the power supply method of Arduino from USB to a DC adapter or batteries
  3. The number of cables connected to the Stevenson screen should be minimized (none, if possible)
    → Go cable-free by not using a DC adapter (solution mentioned above), and by using Wi-Fi instead of a LAN cable
  4. The measured values should not only be accessible on the PC, but also on the Stevenson screen itself
    → Add a display to show the measurements on the case itself
  5. It should be compact
    → We could solder parts onto the base instead of using a breadboard and/or use a smaller Arduino

According to the plan, we are working towards implementing the above features in the Stevenson screen. The humidity sensor is a basic feature that hardly needs to be mentioned explicitly on such a list. For items 2 and 3, we can take care of them this time with an AC adapter or batteries.

Trying out the Humidity Sensor

Stevenson screen humidity sensor Arduino

A staple among humidity sensors, the TDK CHS-UGR

Let’s start by learning how to use the humidity sensor. Since the humidity sensor we have selected is very easy to use, not much knowledge is necessary.

We will be using the humidity sensor CHS-UGR, which display 100% RH with a DC.1V output. To put it simply, if we set the humidity sensor as an analog input, 0V = if the analog input on the Arduino is 0, the humidity is 0%, and 1.0V = if the analog input on the Arduino is 205, the humidity is 100%. We will build a circuit based on this specification.

Arduino stevenson screen humidity sensor

The humidity sensor is larger than the parts we have been using until now

Arduino Stevenson screen humidity sensor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.print("input value:");
Serial.println(toHumidity(sensorValue)/);
delay(1000);
}
//Convert the analog input value to humidity
float toHumidity(int analog_val){
float v = 5; // Standard voltage value ( V )
float tempC = (analog_val / (1024/v)) * 100;
if(tempC &> 100){
tempC = 100;
}
return tempC
}

You can see that both the breadboard circuit and the program are simple.

In the above program, the analog input is basically read in the same way as the temperature sensor. The value is converted based on the specifications of the humidity sensor, allowing us to measure the humidity data. The humidity sensor will input analog values from 0–205 (all higher values are set to 100%), so we create a function that applies to the part written in red.

Arduino

If you run Arduino, the serial monitor should show something similar to what is displayed below. By placing your hand close to the sensor or breathing on it, you should be able to verify that it detects the humidity and the values will change accordingly.

Displaying Both Temperature and Humidity

Now that we know how to use both the temperature and humidity sensors, we will place both sensors on the breadboard and get both values.

Arduino Stevenson screen temperature sensor humidity sensor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
int temperaturePin = A0; // select the input pin for the potentiometer
int humidityPin = A1; // select the input pin for the potentiometer
int temperatureValue = 0; // variable to store the value coming from the sensor
int humidityValue = 1; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
temperatureValue = analogRead(temperaturePin);
humidityValue = analogRead(humidityPin);
Serial.print("temperature:");
Serial.print(toTemperature(temperatureValue));
Serial.print("/ humidity:");
Serial.println(toHumidity(humidityValue));
delay(1000);
}
//Convert analog input to celsius
float toTemperature(int analog_val){
float v = 5; // Standard voltage value ( V )
float tempC = ((v * analog_val) / 1024) * 100;
return tempC;
}
//Convert analog input to humidity
float toHumidity(int analog_val){
float v = 5; // Standard voltage value( V )
float tempC = (analog_val / (1024/v)) * 100;
if(tempC &> 100){
tempC = 100;
}
return tempC;
}

We are able to get the data from the temperature sensor with analog pin #0, and from the humidity sensor with pin #1.

Now, let’s start using the 7-seg LED from last time and display the temperature and humidity in sequence.

Arduino Stevenson screen temperature sensor humidity sensor 7seg led

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// Program to display temperature/humidity on 7-segment LED
//
int _cnt = 0; //
int _number = 0; //
int temperaturePin = A0; // select the input pin for the potentiometer
int humidityPin = A1; // select the input pin for the potentiometer
int temperatureValue = 0; // variable to store the value coming from the sensor
int humidityValue = 1; // variable to store the value coming from the sensor
boolean _switchFlg = false; //Flag for switching between temperature/humidity display
boolean _flg = false;
void setup(){
Serial.begin(9600);
//Set pins 2-8 to digital output
for (int i=2; i&<=8; i++){
pinMode(i,OUTPUT);
}
pinMode(13,OUTPUT);
pinMode(11,OUTPUT);
}
// Define LED layout
boolean Num_Array[10][7]={
{1,1,1,1,1,1,0}, //0
{0,1,1,0,0,0,0}, //1
{1,1,0,1,1,0,1}, //2
{1,1,1,1,0,0,1}, //3
{0,1,1,0,0,1,1}, //4
{1,0,1,1,0,1,1}, //5
{1,0,1,1,1,1,1}, //6
{1,1,1,0,0,1,0}, //7
{1,1,1,1,1,1,1}, //8
{1,1,1,1,0,1,1} //9
};
// Define LED display function
void NumPrint(int Number){
for (int w=0; w&<=7; w++){
digitalWrite(w+2,-Num_Array[Number][w]);
}
}
// Parse 2 digits into individual digits
int NumParse(int Number,int s){
if(s == 1){
return Number % 10;
}
else if(s == 2){
return Number / 10;
}
return 0;
}
void loop(){
// Obtain temperature/humidity and set variable to converted value
if(_switchFlg){
_number = toTemperature(analogRead(temperaturePin))
}
else{
_number = toHumidity(analogRead(humidityPin))
}
if(_flg){
digitalWrite(11,LOW);
digitalWrite(13,HIGH);
_flg = false;
NumPrint(NumParse(_number,1));
}
else{
digitalWrite(11,HIGH);
digitalWrite(13,LOW);
_flg = true;
NumPrint(NumParse(_number,2));
}
if(_cnt &>= 100){
_cnt = 0;
if(_switchFlg){
_switchFlg = false;
}
else{
_switchFlg = true;
}
}
_cnt++;
delay(10);
}
//Convert analog input value to Celsius
float toTemperature(int analog_val){
float v = 5; // Standard voltage value ( V )
float tempC = ((v * analog_val) / 1024) * 100;
return tempC;
}
//Convert analog input value to humidity
float toHumidity(int analog_val){
float v = 5; // Standard voltage value ( V )
float tempC = (analog_val / (1024/v)) * 100;
if(tempC &> 100){
tempC = 100;
}
return tempC;
}

In this program, we are basically sending analog values to the 7-seg LED display program we created previously. But since we also want to display both temperature and humidity in sequence, we use _switchFlg as a flag which switches between true/false in a set interval, in order to alternate _number between temperature and humidity. This time, we increment _cnt at the end of the loop function every delay(10) = 0.01 seconds, and when _cnt reaches 100, we reset _cnt to 0 and switch the value of _switchFlg, therefore the alternation occurs every 0.01sec×100=1 second.

Powering Arduino with a Different Power Source

We’re finally at the point where the functionality of the Stevenson screen is complete. Let’s operate Arduino with a different power source. Until now, we have been using Arduino by connecting it to a PC with a USB cable. But as we discussed, the programs are already stored on Arduino, so it is operational as long as we can secure a power source.

How much power do we actually need for Arduino? On the specification for Arduino UNO that we have been using, the minimum operational voltage is 5V, and the standard voltage is 7–12V. Today, we’ll attempt to use an AC adapter and a 9V battery as power sources for Arduino.

Powering Arduino with an AC Adapter

To use Arduino with an AC adapter, simply plug in the adapter to the adapter port on Arduino.

Arduino with AC adapter

Powering Arduino with a 9V Battery

To use Arduino with a 9V battery, you can connect it just like the AC adapter as long as the battery box is compatible with the Arduino port. However, if it is wired, you can power it by connecting the + side to Arduino’s Vin port and connecting the – side to GND.

Arduino with 9v battery

By comparing it to a cell battery, we can really see how small Arduino is.

Now, let us review the specifications:

  1. The measured values should always be accessible from the PC over the Internet
  2. It should operate without being connected to a PC to easily be moved
  3. The number of cables connected to the Stevenson screen should be minimized (none, if possible)
  4. The measured values should not only be accessible on the PC, but also on the
  5. Stevenson screen itself
  6. It should be compact

We have implemented most of the features we established at the beginning. There happened to be a stand clip for smartphones by my side, so I’ve made a rudimentary setup.

Arduino Stevenson screen

Wow, the circuit board looks cool here when it’s shown like that.

But it looks like the wiring can come off easily, and it’s connected by wire to Arduino base… It will certainly fall apart with a little bump! (Laughs)

This is definitely far from being complete. Next time, I’d like to build on what’s been done so far, and complete our Stevenson screen, and include an external case!

Device Plus Editorial Team
Device Plus Editorial Team
Device Plus is for everyone who loves electronics and mechatronics.

Check us out on Social Media

  • Facebook
  • Twitter

Recommended Posts

  • Make a Stevenson Screen with Arduino Part 4 – Project Completion with Case Building and SolderingMake a Stevenson Screen with Arduino Part 4 – Project Completion with Case Building and Soldering
  • Make a Stevenson Screen with Arduino Part 2 – Display Numerical Values on an Electronic Scoreboard (7 segment LED)Make a Stevenson Screen with Arduino Part 2 – Display Numerical Values on an Electronic Scoreboard (7 segment LED)
  • Use Arduino to Control a Motor Part 1 – Motor BasicsUse Arduino to Control a Motor Part 1 – Motor Basics
  • Make a Stevenson Screen with Arduino Part 1Make a Stevenson Screen with Arduino Part 1
  • Use Arduino to Control a Motor Part 3 – Making an RC Car Using a Servo Motor for the SteeringUse Arduino to Control a Motor Part 3 – Making an RC Car Using a Servo Motor for the Steering
  • How To Make Your Own Robot (Part 2)How To Make Your Own Robot (Part 2)
Receive update on new postsPrivacy Policy

Recommended Tutorials

  • How to integrate an RFID module with Raspberry Pi How to integrate an RFID module with Raspberry Pi
  • How to Use the NRF24l01+ Module with Arduino How to Use the NRF24l01+ Module with Arduino
  • How to Run Arduino Sketches on Raspberry Pi How to Run Arduino Sketches on Raspberry Pi
  • Setting Up Raspberry Pi as a Home Media Server Setting Up Raspberry Pi as a Home Media Server

Recommended Trends

  • SewBot Is Revolutionizing the Clothing Manufacturing Industry SewBot Is Revolutionizing the Clothing Manufacturing Industry
  • All About The Sumo Robot Competition And Technology All About The Sumo Robot Competition And Technology
  • 5 Interesting Tips to Calculating the Forward Kinematics of a Robot 5 Interesting Tips to Calculating the Forward Kinematics of a Robot
  • Go Inside the Drones That Are Changing Food Delivery Go Inside the Drones That Are Changing Food Delivery
Menu
  • Arduino –
    Arduino Beginner’s Guide
  • Raspberry Pi –
    Raspberry Pi Beginner's Guide
  • Trending –
    Updates on New Technologies
  • Others –
    Interviews / Events / Others

Check us out on Social Media

  • Facebook
  • Twitter
  • About
  • Company
  • Privacy Policy
  • Terms of Service
  • Contact
  • Japanese
  • 简体中文
  • 繁體中文
Don’t Forget to Follow Us!
© Copyright 2016-2023. Device Plus - Powered by ROHM
© 2023 Device Plus. All Rights Reserved. Muffin group

istanbul escort istanbul escort istanbul escort