Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Solar Powered Mini-Weather Station

Solar Powered Mini-Weather Station

Scheduled Pinned Locked Moved My Project
111 Posts 39 Posters 119.3k Views 27 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Elfnoir

    @Renard : Bonjour! Je fais le raccordement cette semaine j'espère, je galère sur la déclaration dans Domoticz et l'étalonnage pour controler la charge de la batterie, mais je dirais:

    • OUT+ et - sur RAW et GND de l'Arduino
    • B+ B- à la batterie
    • "+ et -" au panneau solaire, c'est ce qu'il me semble sur les photos.

    @bisschopsr : Hi, There is no charge controler 5 or 12 volts. On my Fritzing to understand better the scheme (Post #70), I draw batteries and solar panel, but Fritzings following are with 12volts charger, I don't know why. If you purchased a solar lamp, it's to avoid 5 or 12volts charger and use the sun ;-)

    bisschopsrB Offline
    bisschopsrB Offline
    bisschopsr
    wrote on last edited by
    #101

    Thanks for the anwer @Elfnoir. I looked back at your schedule and there is some logic between the solar panel, the batteries and the other components (as the power consumers). That logic in the middle is what I refered to as charge controller. I would like to know what part this is.
    Thanks again.
    Ralph

    Domoticz, P1 meter interface, MySensors and more to come!

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Elfnoir
      wrote on last edited by
      #102

      @Renard c'est bien l'arduino qui gère la décharge et envoi l'info à Domoticz; c'est pour cela que tu dois étalonner le min/max avec le potentiomètre
      it is the Arduino which manages the discharge and send the info to Domoticz ; that's why you have to calibrate the min / max with the potentiometer

      @bisschopsr If I well understand your question, the module which take the solar power to charge the battery with providing in the same time power to the arduino, and provide power of the battery to the arduino when there is no sun or at night: it's the Lipo Ride. There is no monitoring from the Arduino to the Lipo, but the Arduino read the level of voltage coming from the battery and send it to Domoticz.
      Do I understand well your question please?

      bisschopsrB 1 Reply Last reply
      0
      • E Elfnoir

        @Renard c'est bien l'arduino qui gère la décharge et envoi l'info à Domoticz; c'est pour cela que tu dois étalonner le min/max avec le potentiomètre
        it is the Arduino which manages the discharge and send the info to Domoticz ; that's why you have to calibrate the min / max with the potentiometer

        @bisschopsr If I well understand your question, the module which take the solar power to charge the battery with providing in the same time power to the arduino, and provide power of the battery to the arduino when there is no sun or at night: it's the Lipo Ride. There is no monitoring from the Arduino to the Lipo, but the Arduino read the level of voltage coming from the battery and send it to Domoticz.
        Do I understand well your question please?

        bisschopsrB Offline
        bisschopsrB Offline
        bisschopsr
        wrote on last edited by
        #103

        @Elfnoir You understood the question correct :). That was the answer I was looking for. So your battery is something like a 3.7V LiOn?
        Thanks again
        Ralph

        Domoticz, P1 meter interface, MySensors and more to come!

        E 1 Reply Last reply
        0
        • bisschopsrB bisschopsr

          @Elfnoir You understood the question correct :). That was the answer I was looking for. So your battery is something like a 3.7V LiOn?
          Thanks again
          Ralph

          E Offline
          E Offline
          Elfnoir
          wrote on last edited by
          #104

          @bisschopsr yes, the battery inside the “16 LED Solar Power Motion Sensor Security Lamp Outdoor Waterproof Light” (http://www.ebay.com/itm/271693521438) is 3.7v 800mAh.

          bisschopsrB 1 Reply Last reply
          0
          • E Elfnoir

            @bisschopsr yes, the battery inside the “16 LED Solar Power Motion Sensor Security Lamp Outdoor Waterproof Light” (http://www.ebay.com/itm/271693521438) is 3.7v 800mAh.

            bisschopsrB Offline
            bisschopsrB Offline
            bisschopsr
            wrote on last edited by
            #105

            @Elfnoir Thank you very much. I found a local LED lamp with 3.6V 600mAh NiMh battery. I'm going to try and make a simular solution from that one.

            Domoticz, P1 meter interface, MySensors and more to come!

            1 Reply Last reply
            0
            • PetjepetP Offline
              PetjepetP Offline
              Petjepet
              wrote on last edited by
              #106

              @Salmoides I built this weather station (exactly as decribed above in the initial message) and have some problems with the radio when going about 15 meters from the gateway.
              I have several other nodes on similar distance working just fine.

              I guess the metal top of the case (where the solar panel is in) is causing the issue. Is there a way to change that? Maybe an additional antenna wire (how)?

              bisschopsrB 1 Reply Last reply
              0
              • PetjepetP Petjepet

                @Salmoides I built this weather station (exactly as decribed above in the initial message) and have some problems with the radio when going about 15 meters from the gateway.
                I have several other nodes on similar distance working just fine.

                I guess the metal top of the case (where the solar panel is in) is causing the issue. Is there a way to change that? Maybe an additional antenna wire (how)?

                bisschopsrB Offline
                bisschopsrB Offline
                bisschopsr
                wrote on last edited by
                #107

                @Petjepet The metal is definitely influencing the radio performance. It’s 2.4 GHz like the home wifi signal, so you might understand the impact if you compare these two. A solution to use a radio with an external antenna that can be placed outside the metal case. There is a radio with ext. antenna available, you might need an additional extension cable of say 15-30 cm. Does this help.

                Regards,

                Ralph

                Domoticz, P1 meter interface, MySensors and more to come!

                1 Reply Last reply
                0
                • PetjepetP Offline
                  PetjepetP Offline
                  Petjepet
                  wrote on last edited by
                  #108

                  @bisschopsr That must be the same one I use for the gateway with the external antenna.
                  I also saw once a wire connected to the standard radio but can't recall where I saw that.

                  bisschopsrB 1 Reply Last reply
                  0
                  • PetjepetP Petjepet

                    @bisschopsr That must be the same one I use for the gateway with the external antenna.
                    I also saw once a wire connected to the standard radio but can't recall where I saw that.

                    bisschopsrB Offline
                    bisschopsrB Offline
                    bisschopsr
                    wrote on last edited by
                    #109

                    @Petjepet Yes, you are probably using this version for the GW (I know I am :-)). I have also see people hacking the original module by attaching a wire antenna instead of the on board printed antenna. The advantage of the other antenna based board is, you can actually bring the antenna to the outside. Something more difficult to do with a wire hack.

                    Domoticz, P1 meter interface, MySensors and more to come!

                    1 Reply Last reply
                    0
                    • mrc-coreM Offline
                      mrc-coreM Offline
                      mrc-core
                      wrote on last edited by
                      #110

                      I have been adapting this mini-weather station code to he API 2.0 and add it the battery sensor. Here's my first attemp

                      // Enable debug prints to serial monitor
                      #define MY_DEBUG 
                      
                      // Enable and select radio type attached
                      #define MY_RADIO_NRF24
                      //#define MY_RADIO_RFM69
                      
                      #define MY_NODE_ID 2
                      #define MY_PARENT_NODE_ID  0
                      #define MY_PARENT_NODE_IS_STATIC
                      
                      #include <SPI.h>
                      #include <MySensors.h>  
                      #include <DHT.h>
                      #include <BH1750.h>
                      #include <Wire.h> 
                      #include <Adafruit_BMP085.h>
                      
                      #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
                      
                      #define CHILD_ID_HUM 0
                      #define CHILD_ID_TEMP 1
                      #define CHILD_ID_LIGHT 2
                      #define CHILD_ID_BARO 3
                      #define CHILD_ID_BTEMP 4
                      #define CHILD_ID_WINDSPEED 5
                      #define CHILD_ID_BATTERY 6
                          
                      #define MESSAGEWAIT 500
                      #define DHT_DATA_PIN 3          // Pin 3 digital = DHT11 or DHT12
                      #define windSpeedPin 4          // Pin 4 digital = Anenometer
                      #define SENSOR_TEMP_OFFSET 0
                      #define STABILIZATION_TIME 500  // Let the sensor stabilize 0.5 seconds before reading
                      
                      static const uint8_t FORCE_UPDATE_N_READS = 10;
                      static const uint64_t UPDATE_INTERVAL = 60000;
                      
                      #define BATTERY_FULL 7400 // 3,000 millivolts when battery is full (assuming 2xAA)
                      #define BATTERY_ZERO 2800 // 1,700 millivolts when battery is empty (reqires blown brownout detection fuse, use 2,800 otherwise)
                      
                      const float ALTITUDE = 162; // <-- adapt this value to your own location's altitude.
                      
                      int windSpeedPinCounter = 0;        // impuls counter
                      int windSpeedPinStatus = 0;         // actual impuls
                      int windSpeedPinStatusAlt = 0;      // oude Impuls-Status
                      unsigned long windmeterStart;
                      unsigned long windmeterStartAlt = 0;
                      int windSpeed;                      // Variable voor Wind Speed
                      int beaufort = 0;                   // Variable Wind in Beaufort
                      const int windmeterTime = 10000;
                      //float knoten = 0.0;
                      //float wind = 0.0;
                      unsigned int knoten;
                      unsigned int wind;
                      
                      long oldvoltage = 0;
                      bool metric = true;
                      float lastBmpTemp;
                      float lastPressure;
                      float lastHum;
                      float lastTemp;
                      uint8_t nNoUpdatesTemp;
                      uint8_t nNoUpdatesHum;
                      
                      int updateAll = 60;
                      int updateCount = 0;
                      uint16_t lastLux;
                      
                      unsigned long SLEEP_TIME = 60000;
                      
                      
                      Adafruit_BMP085 bmp = Adafruit_BMP085();
                      BH1750 lightSensor;
                      DHT dht;
                      
                      MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
                      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                      MyMessage msgLux(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
                      MyMessage msgBtemp(CHILD_ID_BTEMP, V_TEMP);
                      MyMessage msgPressure(CHILD_ID_BARO, V_PRESSURE);
                      MyMessage msgWindSpeed(CHILD_ID_WINDSPEED, V_WIND);
                      MyMessage msgWGust(CHILD_ID_WINDSPEED, V_GUST);
                      MyMessage msgWDirection(CHILD_ID_WINDSPEED, V_DIRECTION);
                      
                      void setup()
                      {
                        analogReference(INTERNAL);
                        dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
                        if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) 
                        {
                          Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
                        }
                        // Sleep for the time of the minimum sampling period to give the sensor time to power up
                        // (otherwise, timeout errors might occure for the first reading)
                        sleep(dht.getMinimumSamplingPeriod());
                        if (!bmp.begin()) 
                        {
                          Serial.println("Could not find a valid BMP085 sensor, check wiring!");
                          while (1) {}
                        }  
                        metric = getConfig().isMetric;
                      }
                      
                      void presentation()  
                      {
                        lightSensor.begin();
                        
                        sendSketchInfo("Weather Sensor", "4.1.C");
                        
                        present(CHILD_ID_HUM, S_HUM, "WS Humidity");
                      //  present(CHILD_ID_TEMP, S_TEMP, "WS Temperature");
                        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL, "WS Lux");
                        present(CHILD_ID_BARO, S_BARO, "WS Pressure");
                        present(CHILD_ID_BTEMP, S_TEMP, "WS P Temperature");
                        present(CHILD_ID_WINDSPEED, S_WIND, "WS Windspeed");
                        present(CHILD_ID_BATTERY, S_CUSTOM, "WS Battery"); 
                      }
                      
                      // Wind Meter https://github.com/chiemseesurfer/arduinoWeatherstation/blob/master/weatherstation/weatherstation.ino
                      
                      float windmeter()
                      {
                        windmeterStart = millis(); // Actual start time measuringMessung
                        windmeterStartAlt = windmeterStart; // Save start time
                        
                        windSpeedPinCounter = 0; // Set pulse counter to 0
                        windSpeedPinStatusAlt = HIGH; // Set puls status High
                          
                        while ((windmeterStart - windmeterStartAlt) <= windmeterTime) // until 10000 ms (10 Seconds) ..
                        {
                          windSpeedPinStatus = digitalRead(windSpeedPin); // Read input pin 2
                          if (windSpeedPinStatus != windSpeedPinStatusAlt) // When the pin status changed
                          {
                            if (windSpeedPinStatus == HIGH) // When status - HIGH
                            {
                              windSpeedPinCounter++; // Counter + 1
                             }
                           }
                           windSpeedPinStatusAlt = windSpeedPinStatus; // Save status for next loop
                           windmeterStart = millis(); // Actual time
                         }
                         windSpeed =  ((windSpeedPinCounter * 24) / 10) + 0.5; //  WindSpeed - one Pulse ~ 2,4 km/h, 
                         windSpeed = (windSpeed / (windmeterTime / 1000)); // Devided in measure time in seconds
                         Serial.print("wind Speed : ");
                         Serial.println(windSpeed);    
                         knoten = windSpeed / 1.852; //knot's
                         return windSpeed;
                      }
                      
                      void loop()      
                      {
                        updateCount += 1;
                        if (updateCount == updateAll) 
                        {
                          lastTemp = -1;
                          lastHum = -1;
                          lastLux = -1;
                          lastBmpTemp = -1;
                          lastPressure = -1;
                          updateCount = 0;
                         }
                      
                         long voltage = readVcc();
                         if (oldvoltage != voltage) { // Only send battery information if voltage has changed, to conserve battery.
                            send(voltage_msg.set(voltage / 1000.0, 3)); // redVcc returns millivolts and set wants volts and how many decimals (3 in our case)
                            sendBatteryLevel(round((voltage - BATTERY_ZERO) * 100.0 / (BATTERY_FULL - BATTERY_ZERO)));
                            oldvoltage = voltage;
                         }
                          
                         delay(2000);
                      
                         // Force reading sensor, so it works also after sleep()
                         dht.readSensor(true);
                        
                         // Get temperature from DHT library
                         float temperature = dht.getTemperature();
                         if (isnan(temperature)) 
                         {
                          Serial.println("Failed reading temperature from DHT!");
                         }
                         else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) 
                         {
                          // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
                          lastTemp = temperature;
                          if (!metric) 
                          {
                            temperature = dht.toFahrenheit(temperature);
                          }
                          // Reset no updates counter
                          nNoUpdatesTemp = 0;
                          temperature += SENSOR_TEMP_OFFSET;
                          send(msgTemp.set(temperature, 1));
                      
                          #ifdef MY_DEBUG
                          Serial.print("T: ");
                          Serial.println(temperature);
                          #endif
                          }
                          else 
                          {
                            // Increase no update counter if the temperature stayed the same
                            nNoUpdatesTemp++;
                          }
                      
                          // Get humidity from DHT library
                          float humidity = dht.getHumidity();
                          if (isnan(humidity)) 
                          {
                            Serial.println("Failed reading humidity from DHT");
                          } 
                          else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) 
                          {
                            // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
                            lastHum = humidity;
                            // Reset no updates counter
                            nNoUpdatesHum = 0;
                            send(msgHum.set(humidity, 1));
                      
                          #ifdef MY_DEBUG
                          Serial.print("H: ");
                          Serial.println(humidity);
                          #endif
                          }
                          else 
                          {
                            // Increase no update counter if the humidity stayed the same
                            nNoUpdatesHum++;
                          }
                          uint16_t lux = lightSensor.readLightLevel();
                          if (lux != lastLux) 
                          {
                            send(msgLux.set(lux));
                            lastLux = lux;
                          }
                          float pressure = bmp.readSealevelPressure(ALTITUDE) * 0.01;
                          float bmptemp = bmp.readTemperature();
                          if (!metric)
                          {
                            bmptemp = bmptemp * 1.8 + 32.0;
                          }
                          if (bmptemp != lastBmpTemp) 
                          {
                            send(msgBtemp.set(bmptemp,1));
                            lastBmpTemp = bmptemp;
                          }
                          if (pressure != lastPressure) 
                          {
                            send(msgPressure.set(pressure, 0));
                            lastPressure = pressure;
                          }
                      
                          wind = windmeter();
                          Serial.print("Wind : ");
                          Serial.println(wind);
                          int wdirection = 1;
                          int wgust = 1;
                          send(msgWindSpeed.set(wind, 1));
                          send(msgWGust.set(wgust, 1));
                          send(msgWDirection.set(wdirection, 1));
                          sleep(SLEEP_TIME);
                      }
                      
                      void incomingMessage(const MyMessage & message) 
                      {
                        // We only expect one type of message from controller. But we better check anyway.
                        if (message.isAck()) 
                        {
                          Serial.println("This is an ack from gateway");
                        }
                      }
                      
                      long readVcc()
                      {
                        // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
                        // Read 1.1V reference against AVcc
                        // set the reference to Vcc and the measurement to the internal 1.1V reference
                      #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
                        ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                      #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
                        ADMUX = _BV(MUX5) | _BV(MUX0);
                      #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
                        ADMUX = _BV(MUX3) | _BV(MUX2);
                      #else
                        ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                      #endif
                      
                        delay(2); // Wait for Vref to settle
                        ADCSRA |= _BV(ADSC); // Start conversion
                        while (bit_is_set(ADCSRA, ADSC)); // measuring
                      
                        uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH
                        uint8_t high = ADCH; // unlocks both
                      
                        long result = (high << 8) | low;
                      
                        result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
                        return result; // Vcc in millivolts
                      }
                      

                      It a little big but does what i need and the best thing it's that the anenometer works :+1:

                      1 Reply Last reply
                      0
                      • ร Offline
                        ร Offline
                        รอเรือ
                        wrote on last edited by รอเรือ
                        #111

                        My experience with using a "Micro USB 5V 1A 18650 Lithium Battery Charger Board With Protection Module" together with the "16 LED Solar Power Motion Sensor Security Lamp Outdoor Waterproof Light"s solar panel is that it's not charging the battery as well as the original built in PCB. Due to the varying voltage (up to 6V) of the solar panel it's not so well suited as a power source for "Micro USB 5V 1A 18650 Lithium Battery Charger Board With Protection Module". I experimented with diodes in serial (2 diodes gave best result) to lower the voltage. However using the original board allowed the battery to charge with a much higher current. I just cut of the motion sensor, and the power switch. It seems to work well. It's even charging a few mA now here when it's raining. My conclusion is that the "Micro USB 5V 1A 18650 Lithium Battery Charger Board With Protection Module" might be used but the original PCB makes a better job charging the battery.

                        Cheers!

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        14

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.0k

                        Posts


                        Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • MySensors
                        • OpenHardware.io
                        • Categories
                        • Recent
                        • Tags
                        • Popular