element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • 'Choose another store...'
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Arduino Project Step 2
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jeepingoody
  • Date Created: 12 Apr 2017 1:50 AM Date Created
  • Views 379 views
  • Likes 0 likes
  • Comments 0 comments
  • sensors 3
  • arduno
  • lcd 16x2
Related
Recommended

Arduino Project Step 2

jeepingoody
jeepingoody
12 Apr 2017

Continued from my first project (First Arduino Project )

 

This time i was able to connect 2 more sensors, bring total to 3.

 

Not sure what happened but sensor B was reading "correctly" (3-4 degree difference from Sensor A that was right next to it) and now it's reading 185 and won't change. Not sure what I did there.

 

Sensor C is a analog sensor from a kit I bought that provided very little info on the sensors. So i just googled how to convert analog to Celsius, pretty sure I found the wrong formula for it. and it wont change either.

 

The goal of this project was to read multiple sensor data and display it on the LCD. Yes the data is inaccurate, which I'll work on fixing. All in all I'm calling it a success.

 

Next project: LCD menu

 

// Display temp and humidity on LCD

// Display multiple sensor data on LCD

 

 

// DHT11 SensorA

#include <SimpleDHT.h>

 

 

#include<LiquidCrystal.h>

LiquidCrystal lcd (4,5,6,7,8,9); //pins for RS, E, DB4, DB5, DB6, DB7

 

 

//DS18B20 SensorB

#include <DallasTemperature.h>

#include <OneWire.h>

#include <DallasTemperature.h>

 

 

// For DHT11 (SensorA)

//      VCC: 5V or 3V

//      GND: GND

//      DATA: 2

int sensor = 10; // sensorA is on pin 10

SimpleDHT11 dht11;

#define LED 11  // LED is on pin 11

 

 

// For DS18B20 SensorB

 

 

// Data wire is plugged into port 2 on the Arduino

#define SensorB 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)

OneWire oneWire(SensorB);

// Pass our oneWire reference to Dallas Temperature.

DallasTemperature sensors(&oneWire);

 

 

 

 

// Analog Temp Module SensorC

 

 

// select the input  pin for  the Sensor

int  sensorC  =  A0;

// variable to  store  the value  coming  from  the sensor   

int  sensorCValue =  0; 

 

 

 

 

void setup() {

// LCD setup

  lcd.begin(16,2);

  lcd.clear();

 

  pinMode(LED,OUTPUT); // set led to output

 

 

  // Start up the library SensorB

  sensors.begin();

}

 

 

void loop()

{

  lcd.clear(); // clear LCD

 

  // SensorA Check

 

  byte temperature = 0;

  byte humidity = 0;

  if (dht11.read(sensor, &temperature, &humidity, NULL)){

    // if sensor shows no data let me know

  lcd.setCursor(1,0);

  lcd.print("**************");

  lcd.setCursor(0,1);

  lcd.print("**CHECK SENSOR**.");

  delay(1000);

  digitalWrite(LED,HIGH); // turn on LED if no data found

  return;

  }

 

 

 

// convert C to F SensorA

 

float cA = 0;

  float tempA = 0;

  cA = temperature;

  tempA = (1.8 * cA) + 32;

 

 

  // convert C to F SensorB

float cB = 0;

  float tempB = 0;

  cB = sensors.getTempCByIndex(0);

  tempB = (1.8 * cB) + 32;

 

 

  // convert Analog to C to F SensorC

  sensorCValue =  analogRead(sensorC);

  float cC = 0;

cC = ((((sensorC) - 500) * 0.1) * -0.1);

float tempC = 0;

  tempC = (1.8 * cC) + 32;

 

 

 

// Display data

 

  digitalWrite(LED,LOW);   // turn LED off

 

 

// Display Temp and Humidity From Sensor A

 

  lcd.setCursor(4,0);

  lcd.print("SENSOR A ");

  lcd.setCursor(1,1);

  lcd.print(tempA,1);

  lcd.print(" F    ");

  lcd.print((int)humidity);

  lcd.print("%");

  delay(2000);

 

 

  // Display Temp From Sensor B

 

 

  lcd.clear(); // clear LCD for new sensor data

  lcd.setCursor(4,0);

  lcd.print("SENSOR B ");

  lcd.setCursor(1,1);

  lcd.print(tempB,1);

  lcd.print(" F    ");

  delay(2000);

 

 

// Display Temp From Sensor B

 

 

  lcd.clear(); // clear LCD for new sensor data

  lcd.setCursor(4,0);

  lcd.print("SENSOR C ");

  lcd.setCursor(1,1);

  lcd.print(tempC,1);

  lcd.print(" F    ");

  delay(2000);

}

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube