Project in question: http://www.instructables.com/id/Arduino-Weather-Station-AWS/
Note: Did not include the Soil Humidity sensor in my project, but however still followed through with the given steps on connecting all other parts to the Arduino
Following the wiring/assembly steps on this project, I have run into difficulties in actually getting the code to run onto my Arduino. However, instead of following the given wiring diagram image, I simply followed the wiring connections between the components and the Arduino pins that were written on the project website (Which might be a part of my issue)
I then downloaded the given library file, in .rar, decompressed it, and then moved it to the Arduino "libraries" folder, per instructions on how to manually install a library for Mac (at Installing an Arduino Library - SparkFun Learn). I then downloaded the code for the weather station, and opened it in the Arduino IDE. Finally, after attaching the library given for the project onto the sketch, I received multiple errors preventing me from uploading the sketch to my Arduino.
Also Note: I am inexperienced in Arduino coding/programming, and might have thus overlooked a simple error in my wiring, in editing the code, or in installing the library. Please correct any mistakes I might have, and probably have, made.
The code + errors returned:
#include <DHT.h>
#include <SFE_BMP180.h>
/*
Pin Configuration
Rain Drop A0
Soil Humidity A1
SDA A4
SCL A5
DHT11 Data D2
*/
int result [5]; //Sensor result array
#include <Wire.h> //Including wire library
#include <SFE_BMP180.h> //Including BMP180 library
#define ALTITUDE 3 //Altitude where I live (change this to your altitude)
SFE_BMP180 pressure; //Creating an object
#include <DHT.h> //Including DHT11 library
#define DHTPIN 2 //Define DHT11 digital pin
#define DHTTYPE DHT11 //Define DHT TYPE which is DHT11
DHT dht(DHTPIN, DHTTYPE); //Execute DHT11 library
void setup() {
Serial.begin(9600); //Starting serial communication
Serial.println("Program started");
//Analog setup
pinMode(A0, INPUT); //Soil
pinMode(A1, INPUT); //Rain
//BMP180 Setup
if (pressure.begin()) //If initialization was successful, continue
{Serial.println("BMP180 init success");
Serial.print("AWS :");
Serial.print("\t");
Serial.print("Rain Drop\t");
Serial.print("Soil Hum\t");
Serial.print("Pressure \t");
Serial.print("Air Hum\t");
Serial.print("\t");
Serial.println("Temp \t");}
else //Else, stop code forever
{
Serial.println("BMP180 init fail");
while (1);
}
//DHT11 setup
dht.begin();
}
void loop() {
//analog setup
int A_Rain = analogRead(A0);
int A_Soil = analogRead(A1);
A_Rain = map(A_Rain, 800, 1023, 100, 0);
A_Soil = map(A_Soil, 400, 1023, 100, 0);
result[0]=A_Soil;
result[1]=A_Rain;
//bmp180 setup
char status;
double T, P, p0;
status = pressure.startTemperature();
if (status != 0) {
delay(status);
status = pressure.getTemperature(T);
if (status != 0) {
status = pressure.startPressure(3);
if (status != 0) {
delay(status);
status = pressure.getPressure(P, T);
if (status != 0) {
p0 = pressure.sealevel(P, ALTITUDE);
result[2]=p0;
}}}}
result[3] = dht.readHumidity();
result[4] = dht.readTemperature();
Serial.print("AWS : ");
Serial.print(" \t");
Serial.print(result[0]);
Serial.print(" %\t");
Serial.print("\t");
Serial.print(result[1]);
Serial.print(" %\t");
Serial.print("\t");
Serial.print(result[2]);
Serial.print(" hPa \t");
Serial.print(result[3]);
Serial.print(" %\t");
Serial.print("\t");
Serial.print(result[4]);
Serial.println("C \t");
delay(5000);
}
/Users/TalviK/Downloads/FX0NWQ9IGTY644N/FX0NWQ9IGTY644N.ino:75: undefined reference to DHT::readTemperature(bool, bool)' /Users/TalviK/Downloads/FX0NWQ9IGTY644N/FX0NWQ9IGTY644N.ino:61: undefined reference to
SFE_BMP180::startTemperature()'
/Users/TalviK/Downloads/FX0NWQ9IGTY644N/FX0NWQ9IGTY644N.ino:66: undefined reference to SFE_BMP180::startPressure(char)' /Users/TalviK/Downloads/FX0NWQ9IGTY644N/FX0NWQ9IGTY644N.ino:69: undefined reference to
SFE_BMP180::getPressure(double&, double&)'
/Users/TavliK/Downloads/FX0NWQ9IGTY644N/FX0NWQ9IGTY644N.ino:71: undefined reference to `SFE_BMP180::sealevel(double, double)'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
Invalid library found in /private/var/folders/4g/yd3dzq8d45d7ptk5z14gyq0w0000gn/T/AppTranslocation/C3E7ABB6-89D5-4902-A4C7-8BDD0A140596/d/Arduino.app/Contents/Java/libraries/weather_library: /private/var/folders/4g/yd3dzq8d45d7ptk5z14gyq0w0000gn/T/AppTranslocation/C3E7ABB6-89D5-4902-A4C7-8BDD0A140596/d/Arduino.app/Contents/Java/libraries/weather_library
Invalid library found in /Users/TalviK/Documents/Arduino/libraries/library: /Users/Talvi/Documents/Arduino/libraries/library
Invalid library found in /private/var/folders/4g/yd3dzq8d45d7ptk5z14gyq0w0000gn/T/AppTranslocation/C3E7ABB6-89D5-4902-A4C7-8BDD0A140596/d/Arduino.app/Contents/Java/libraries/weather_library: /private/var/folders/4g/yd3dzq8d45d7ptk5z14gyq0w0000gn/T/AppTranslocation/C3E7ABB6-89D5-4902-A4C7-8BDD0A140596/d/Arduino.app/Contents/Java/libraries/weather_library
Invalid library found in /Users/TalviK/Documents/Arduino/libraries/library: /Users/TavliK/Documents/Arduino/libraries/library