diff --git a/3D/Anemometer/Base.FCStd b/3D/Anemometer/Base.FCStd new file mode 100644 index 0000000..2b2b09c Binary files /dev/null and b/3D/Anemometer/Base.FCStd differ diff --git a/3D/Anemometer/Base.stl b/3D/Anemometer/Base.stl new file mode 100644 index 0000000..5898819 Binary files /dev/null and b/3D/Anemometer/Base.stl differ diff --git a/3D/Anemometer/Cup.FCStd b/3D/Anemometer/Cup.FCStd new file mode 100644 index 0000000..a1a9246 Binary files /dev/null and b/3D/Anemometer/Cup.FCStd differ diff --git a/3D/Anemometer/Cup.stl b/3D/Anemometer/Cup.stl new file mode 100644 index 0000000..285c158 Binary files /dev/null and b/3D/Anemometer/Cup.stl differ diff --git a/3D/Anemometer/Pivot.FCStd b/3D/Anemometer/Pivot.FCStd new file mode 100644 index 0000000..8764e94 Binary files /dev/null and b/3D/Anemometer/Pivot.FCStd differ diff --git a/3D/Anemometer/Pivot.stl b/3D/Anemometer/Pivot.stl new file mode 100644 index 0000000..448231b Binary files /dev/null and b/3D/Anemometer/Pivot.stl differ diff --git a/3D/WindDirection/Arrow.FCStd b/3D/WindDirection/Arrow.FCStd new file mode 100644 index 0000000..34a3d2b Binary files /dev/null and b/3D/WindDirection/Arrow.FCStd differ diff --git a/3D/WindDirection/Arrow.stl b/3D/WindDirection/Arrow.stl new file mode 100644 index 0000000..e80ef2a Binary files /dev/null and b/3D/WindDirection/Arrow.stl differ diff --git a/3D/WindDirection/Base.FCStd b/3D/WindDirection/Base.FCStd new file mode 100644 index 0000000..5b17108 Binary files /dev/null and b/3D/WindDirection/Base.FCStd differ diff --git a/3D/WindDirection/Base.stl b/3D/WindDirection/Base.stl new file mode 100644 index 0000000..e1667f4 Binary files /dev/null and b/3D/WindDirection/Base.stl differ diff --git a/3D/WindDirection/Pivot.FCStd b/3D/WindDirection/Pivot.FCStd new file mode 100644 index 0000000..a3ca272 Binary files /dev/null and b/3D/WindDirection/Pivot.FCStd differ diff --git a/3D/WindDirection/Pivot.stl b/3D/WindDirection/Pivot.stl new file mode 100644 index 0000000..c86aba3 Binary files /dev/null and b/3D/WindDirection/Pivot.stl differ diff --git a/Arduino/Arduino.ino b/Arduino/Arduino.ino index 8a453f7..455c61c 100644 --- a/Arduino/Arduino.ino +++ b/Arduino/Arduino.ino @@ -1,11 +1,15 @@ #include +#include #include "SIM800L.h" +#include #define SIM800_RX_PIN 10 #define SIM800_TX_PIN 11 #define SIM800_RST_PIN 7 SIM800L* sim800l; +BME280I2C bme; + const char APN[] = "TM"; String BASE_URL = "http://2.238.194.8/index.php?"; @@ -23,24 +27,28 @@ unsigned long startime = 0; unsigned long timer = 0; int windSpeed = 0; +float temperature = 0; +float humidity = 0; +float pressure = 0; + int northPin = 4; int eastPin = 5; int southPin = 2; int westPin = 3; -int timerLimit = 3000;//300000; // 5 minutes - -bool printSensorsData = true; - +int timerLimit = 10000;//300000; // 5 minutes String windDirection = ""; - +bool printSensorsData = true; void setup() { // Initialize Serial Monitor for debugging - Serial.begin(115200); + Serial.begin(9600); while(!Serial); + pinMode(13, OUTPUT); + digitalWrite(13, HIGH); + // Initialize a SoftwareSerial SoftwareSerial* serial = new SoftwareSerial(SIM800_RX_PIN, SIM800_TX_PIN); serial->begin(9600); @@ -49,47 +57,14 @@ void setup() { // Initialize SIM800L driver with an internal buffer of 200 bytes and a reception buffer of 512 bytes, debug disabled sim800l = new SIM800L((Stream *)serial, SIM800_RST_PIN, 200, 512); - // Setup module for GPRS communication - setupModule(); + // Setup modules + setupSIM800L(); + setupBME280(); + timer = millis() + timerLimit; } void loop() { - - windDirection = ""; - anemometerVal = digitalRead(anemometerPin); - - if ((anemometerState == 1) && (anemometerVal == 0)) { - anemometerDuration = millis() - startime; - startime = millis(); - windSpeed = 2500.0/anemometerDuration; - } - - anemometerState = anemometerVal; - - if(millis() >= timer) { - - Serial.println("--------------------------"); - Serial.println("Sending..."); - - timer = millis() + timerLimit; - - if(digitalRead(northPin)) {windDirection = windDirection + "N";} - if(digitalRead(southPin)) {windDirection = windDirection + "S";} - if(digitalRead(eastPin)) {windDirection = windDirection + "E";} - if(digitalRead(westPin)) {windDirection = windDirection + "W";} - - if(printSensorsData) { - Serial.print("Wind speed:\t"); - Serial.print(windSpeed); - Serial.println("Km/h"); - - Serial.print("Wind direction:\t"); - Serial.println(windDirection); - - } - - sendRequest(); - - } + + getWind(); } diff --git a/Arduino/GetData.ino b/Arduino/GetData.ino index cde465a..cf67748 100644 --- a/Arduino/GetData.ino +++ b/Arduino/GetData.ino @@ -4,22 +4,19 @@ void getWind() { windDirection = ""; anemometerVal = digitalRead(anemometerPin); - //Serial.println(anemometerVal); - if ((anemometerState == 1) && (anemometerVal == 0)) { anemometerDuration = millis() - startime; startime = millis(); windSpeed = 2500.0/anemometerDuration; } - + anemometerState = anemometerVal; if(millis() >= timer) { - + Serial.println("--------------------------"); - timer = millis() + timerLimit; - + if(digitalRead(northPin)) {windDirection = windDirection + "N";} if(digitalRead(southPin)) {windDirection = windDirection + "S";} if(digitalRead(eastPin)) {windDirection = windDirection + "E";} @@ -29,15 +26,11 @@ void getWind() { Serial.print("Wind speed:\t"); Serial.print(windSpeed); Serial.println("Km/h"); - + Serial.print("Wind direction:\t"); Serial.println(windDirection); } - - sendRequest(); - //delay(5000); - + //sendRequest(); } - } diff --git a/Arduino/GetSensor.ino b/Arduino/GetSensor.ino new file mode 100644 index 0000000..46bf012 --- /dev/null +++ b/Arduino/GetSensor.ino @@ -0,0 +1,14 @@ +void getBME280Data() { + + float temp(NAN), hum(NAN), pres(NAN); + + BME280::TempUnit tempUnit(BME280::TempUnit_Celsius); + BME280::PresUnit presUnit(BME280::PresUnit_Pa); + + bme.read(pres, temp, hum, tempUnit, presUnit); + + temperature = temp; + humidity = hum; + pressure = pres; + +} diff --git a/Arduino/Request.ino b/Arduino/Request.ino index 2ba4593..6f37e34 100644 --- a/Arduino/Request.ino +++ b/Arduino/Request.ino @@ -1,11 +1,19 @@ void sendRequest() { + getBME280Data(); + s = BASE_URL; - s.concat("windSpeed="); + s.concat("windS="); s.concat(windSpeed); - s.concat("&windDirection="); + s.concat("&windD="); s.concat(windDirection); + s.concat("&temp="); + s.concat(temperature); + s.concat("&pres="); + s.concat(pressure); + s.concat("&hum="); + s.concat(humidity); s.toCharArray(URL, 100); Serial.println(URL); @@ -24,7 +32,7 @@ void sendRequest() { Serial.println(F("GPRS not connected !")); Serial.println(F("Reset the module.")); sim800l->reset(); - setupModule(); + setupSIM800L(); return; } @@ -67,6 +75,6 @@ void sendRequest() { Serial.println(F("Failed to switch module to low power mode")); } - + timer = millis() + timerLimit; windSpeed = 0; } diff --git a/Arduino/Setup.ino b/Arduino/Setup.ino index 4903c25..7f29c6a 100644 --- a/Arduino/Setup.ino +++ b/Arduino/Setup.ino @@ -1,6 +1,6 @@ -void setupModule() { - // Wait until the module is ready to accept AT commands +void setupSIM800L() { + // Wait until the module is ready to accept AT commands while(!sim800l->isReady()) { Serial.println(F("Problem to initialize AT command, retry in 1 sec")); delay(1000); @@ -35,3 +35,24 @@ void setupModule() { } Serial.println(F("GPRS config OK")); } + + +void setupBME280() { + Wire.begin(); + + while(!bme.begin()) { + Serial.println("Could not find BME280 sensor!"); + delay(1000); + } + + switch(bme.chipModel()) { + case BME280::ChipModel_BME280: + Serial.println("Found BME280 sensor! Success."); + break; + case BME280::ChipModel_BMP280: + Serial.println("Found BMP280 sensor! No Humidity available."); + break; + default: + Serial.println("Found UNKNOWN sensor! Error!"); + } +} diff --git a/Circuits/arduino.pdf b/Circuits/arduino.pdf new file mode 100644 index 0000000..385dc6d Binary files /dev/null and b/Circuits/arduino.pdf differ diff --git a/Circuits/arduino.svg b/Circuits/arduino.svg new file mode 100644 index 0000000..209a8a8 --- /dev/null +++ b/Circuits/arduino.svg @@ -0,0 +1,10937 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Circuits/full.pdf b/Circuits/full.pdf new file mode 100644 index 0000000..b3d0acc Binary files /dev/null and b/Circuits/full.pdf differ diff --git a/Circuits/sensors.pdf b/Circuits/sensors.pdf new file mode 100644 index 0000000..c3ca9cf Binary files /dev/null and b/Circuits/sensors.pdf differ diff --git a/Circuits/sensors.svg b/Circuits/sensors.svg new file mode 100644 index 0000000..1a1e656 --- /dev/null +++ b/Circuits/sensors.svg @@ -0,0 +1,10748 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/Arduino-SIM800L-driver-master.zip b/libraries/Arduino-SIM800L-driver-master.zip new file mode 100644 index 0000000..ffc0bc2 Binary files /dev/null and b/libraries/Arduino-SIM800L-driver-master.zip differ diff --git a/libraries/BME280-master.zip b/libraries/BME280-master.zip new file mode 100644 index 0000000..fc1a12d Binary files /dev/null and b/libraries/BME280-master.zip differ