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.
  • rvendrameR Offline
    rvendrameR Offline
    rvendrame
    Hero Member
    wrote on last edited by
    #36

    How is your 'Sketchbook location' defined? (in "preferences...") Looking into the error message, it looks you are mixing windows slash "\" and unix slash "/" ...

    Home Assistant / Vera Plus UI7
    ESP8266 GW + mySensors 2.3.2
    Alexa / Google Home

    1 Reply Last reply
    0
    • 5546dug5 Offline
      5546dug5 Offline
      5546dug
      wrote on last edited by
      #37

      After consultation in the troubleshooting category, I downloaded afresh copy of Adafruit-BMP085-library into my arduino library overwriting what was there and now code compiles.
      So on to uploading the code to promini and see what the next issue might/will be.

      1 Reply Last reply
      0
      • SalmoidesS Salmoides

        I remember having one of those beginner electronic kits when I was young and I was so excited the day I listened to our local radio station with the crystal radio I built with the kit. Decades later now, I’m finally re-living my childhood with MySensors. It was fun back then and it is again. I’m definitely a noob at this, I’m not an electrical engineer, but I have a knack for adopting the work of others and applying it to my own world. So to start off this project, I first need to thank Hek and all the other more knowledgeable and capable people that have developed what I use. This is really fun.

        Many of the MySensor projects are weather related, and this one is no different. I figured if I can do simple sensoring, I’ll learn the basics necessary to move on to the more advanced technologies. I am so new to this that I had to buy a soldering iron and learn how to use it. Research and practice are all part of this, and to that end I’ve already built my Vera Serial Gateway and my first sensor – a battery powered temperature and humidity sensor that sits in my kitchen. This project is my attempt to extend that knowledge to a mini-weather station that operates outdoors.

        My requirements were simple: 1) Build an inexpensive outdoor weather station, 2) Use the low-power battery features found in the MySensors Arduino libraries, and 3) Integrate it into my Vera home automation environment. I first put a list together of the components I could put into the weather station to comply with my first requirement. The list goes as follows (I’ve been using eBay, usually in lots of 10):

        • Arduino Pro Mini 3.3v 8MHz processor @ $2.50 USD
        • NRF24L01+ Transceiver @ $0.90
        • DHT22 Humidity & Temperature sensor @ $3.50
        • BMP180 Barometric Pressure sensor @ $1.70
        • BH1750FVI Ambient Light Intensity sensor @ $2.10
        • Rain Sensor Module @ $1.30

        The weather station components total $12.00 USD without power and a project box. Humidity was actually the most expensive piece given that the BMP180 also provides temperature. The DHT11 is less costly, but doesn’t really provide the range for an outdoor sensor. I did look at adding some other sensors. For another $10 I could add Ultraviolet sensing, for $25 I could put in a lightning sensor, $45 for wind speed, and even more for wind direction and a rain gauge. All those others would be great to have, but too costly for this project. I might try my hand at building an anemometer to add to this, and I see others are working on rain gauges, but those are projects for another day.

        I then needed power and an enclosure. I could have put them in a large waterproof box ($2.70), a three cell AA battery holder ($0.80), and some DuraRabbit batteries for a year ($3.00). For an additional $6.50, I was ready to go. Oh, did I mention I was lazy? I don’t really want to swap out the batteries every six months (or less), so I decided to splurge and go the solar route.

        Add a 5v solar panel ($3.35) and a 3.7v 1000mAh li-ion battery ($3.75), and some way to charge the battery (Micro USB 5V 1A 18650 Lithium Battery Charger Board With Protection Module @ $0.75) instead, and my total project cost went to $22.55. Of that, over $10 went to the box, the panel and charger, and the battery. Then I found this.

        SolarLight.jpg

        It’s entitled “16 LED Solar Power Motion Sensor Security Lamp Outdoor Waterproof Light” (http://www.ebay.com/itm/271693521438) that you can get for $9.00. I now had a $21 weather station ready to be built.

        Taking apart the lamp, I removed the LED panel (worth at least $2.00) and the control board (this has some good stuff on it like a PIR, a light sensor, and the battery charging circuitry, but its use is well beyond my skills), and put them away for another project.

        LEDArray.jpg

        I took a 5x7cm fiberglass PCB and cut a few notches in the sides so the board would fit within the new project case. Using the mounting screws that held the LED board down, I had a good way to affix the circuit board to the case.

        5x7PBP.jpg

        Next, I laid out how to cram all these components (including the R1 at 1MΩ & R2 [a 3296W potentiometer 500kΩ] resistors for the voltage divider to track battery voltage and the capacitor for the radio) into the enclosure. I ended up with a tight fit, but very manageable.

        BoardLayout.jpg

        One rule I’ve learned is to always breadboard all the components and measure the performance. This is where I check the current being used during the sleep mode and I get to test my preliminary sketch. It is a very good use of my time as I’ve come upon some bad components in what little of this that I’ve done and this is where they can be identified.

        Breadboard.jpg

        When I started learning the how-to’s of this hobby, I bought all sorts of stuff. One of the first purchases was one of those boxes of 22-gauge wire. The first one was stranded, so then I had to try solid to see if it was any easier to work with. It is, but is still huge compared to what is needed for these low-current projects. I found some old computer cables that had 26-gauge stranded in them. Better, but not what I wanted. Finally I came upon some discussions of wire-wrapping. I now use 30-gauge solid, first installed with a wire-wrapping tool (what a scam and I even found a cheap one for less than $20.)

        I decided to add two additional features after breadboarding the circuit. First, I wanted a reset button that could be reached without taking the case apart. At times I’ve found my sensors need a quick reboot. A switch was added to the underside of the PCB and a hole in the underside of the case will allow me to use a paperclip to do a reset.

        The other feature I added was a jumper that I could use to enable or disable the rain sensor if I chose to at a later date. For some reason it adds a significant load to the circuit. Without the rain sensor enabled, the circuit idles at 270 µA. With it I get 0.98 mA during the gw.sleep command. If I was smart enough, I’m sure I could get that down, but that’s still something to be learned. The underside, as usual, looked like spaghetti.

        Wired.jpg

        After a little bit of solder (I’m actually getting pretty good at that part), I have a fully functional circuit. Since the Li-Ion charging component takes a micro-USB connection, I charged the battery fully and then adjusted the pot to get the AO output to be right at 1023. For this setup my voltmeter showed the battery at 4.15v. I then needed to calibrate the circuit to get to the lower end of the acceptable voltage range. I’ve seen several different numbers for the bottom end of a 3.7v li-ion battery, some down to 2.7v. I chose 3.3v as my lowest acceptable value and proceeded to drain the battery (those LED arrays came in handy after all) down to 3.0v to see what the circuit value came out to be. For my setup, at 3.3v I was getting a value of 800 from pin A0. I updated the sketch so that it would be equal to 0% (hopefully it never gets there.)

        I had one addition to make to the project case. The rain sensor has a board that needs to be exposed to the elements. I drilled a couple of holes in the front end of the case and found some connectors that would work. The hole in the original case for the PIR sensor was a great opening to pass the cable through. The results actually look pretty good, if I can say so myself.

        Rain.png

        A couple of last minute touch-ups: two holes in the lens of the light, one for the reset button and one for the pot that adjusts the sensitivity of the rain sensor. I also take off any LEDs on the circuit, even LED13 on the Arduino. Every little bit helps. Does an LED actually illuminate if no one is there to see it? The final product came out nice.

        FinalTop.jpg

        One last upload of the final sketch. I took all the weather prediction logic out of the pressure sketch to save room for the other components. The SLEEP_TIME parameter is set for once every minute. I also added some lines of code to have the sensor update all measurements once an hour. I really like the ability to see when a measurement was last updated. That’s a nice touch to the MySensors library.

            #include <SPI.h>
            #include <MySensor.h>  
            #include <DHT.h>  
            #include <BH1750.h>
            #include <Wire.h> 
            #include <Adafruit_BMP085.h>
            
            #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_RAIN 5
            
            #define DIGITAL_INPUT_RAIN_SENSOR 3 
            #define HUMIDITY_SENSOR_DIGITAL_PIN 4
            #define INTERRUPT DIGITAL_INPUT_RAIN_SENSOR-2
            
            boolean metric = false;
            int altitude = 221; // 741 feet above sealevel
            float lastBmpTemp = -1;
            float lastPressure = -1;
            float lastHum = -1;
            float lastTemp = -1;
            int BATTERY_SENSE_PIN = A0;
            int lastRainValue = -1;
            int lastBatteryPcnt = 0;
            int updateAll = 60;
            int updateCount = 0;
            uint16_t lastLux;
            unsigned long SLEEP_TIME = 60000;
            int batteryBasement = 800;
            float batteryConstant = 100.0 / (1023 - batteryBasement);
            
            Adafruit_BMP085 bmp = Adafruit_BMP085();
            BH1750 lightSensor;
            DHT dht;
            MySensor gw;
            
            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 msgRain(CHILD_ID_RAIN, V_TRIPPED);
            
            void setup()  
            {
              analogReference(INTERNAL);
              gw.begin();
              dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
              bmp.begin();
              gw.sendSketchInfo("Weather Sensor", "1.0");
              gw.present(CHILD_ID_HUM, S_HUM);
              gw.present(CHILD_ID_TEMP, S_TEMP);
              gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
              gw.present(CHILD_ID_BARO, S_BARO);
              gw.present(CHILD_ID_BTEMP, S_TEMP);
              gw.present(CHILD_ID_RAIN, S_MOTION);
              pinMode(DIGITAL_INPUT_RAIN_SENSOR, INPUT);
              lightSensor.begin();
              metric = gw.getConfig().isMetric;
            }
            
            void loop()      
            {
              updateCount += 1;
              if (updateCount == updateAll) {
                lastTemp = -1;
                lastHum = -1;
                lastLux = -1;
                lastBmpTemp = -1;
                lastPressure = -1;
                lastRainValue = -1;
                lastBatteryPcnt = -1;
                updateCount = 0;
              }
              delay(dht.getMinimumSamplingPeriod());
              float temperature = dht.getTemperature();
              if (isnan(temperature)) {
                  lastTemp = -1;
              } else if (temperature != lastTemp) {
                lastTemp = temperature;
                if (!metric) {
                  temperature = temperature * 1.8 + 32.0;
                }
                gw.send(msgTemp.set(temperature, 1));
              }
              float humidity = dht.getHumidity();
              if (isnan(humidity)) {
                  lastHum = -1;
              } else if (humidity != lastHum) {
                  lastHum = humidity;
                  gw.send(msgHum.set(humidity, 1));
              }
              uint16_t lux = lightSensor.readLightLevel();
              if (lux != lastLux) {
                  gw.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) {
                gw.send(msgBtemp.set(bmptemp,1));
                lastBmpTemp = bmptemp;
              }
              if (pressure != lastPressure) {
                gw.send(msgPressure.set(pressure, 0));
                lastPressure = pressure;
              }
              int rainValue = digitalRead(DIGITAL_INPUT_RAIN_SENSOR);
              if (rainValue != lastRainValue) {
                gw.send(msgRain.set(rainValue==0?1:0));
                lastRainValue = rainValue;
              }
              int sensorValue = analogRead(BATTERY_SENSE_PIN);
              int batteryPcnt = (sensorValue - batteryBasement) * batteryConstant;
              if (lastBatteryPcnt != batteryPcnt) {
                gw.sendBatteryLevel(batteryPcnt);
                lastBatteryPcnt = batteryPcnt;
             }
              gw.sleep(SLEEP_TIME);
            }
        

        Then a test to make sure it’s dumping out its results as it should

            sensor started, id 1
            send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
            read: 0-0-1 s=255,c=3,t=6,pt=0,l=1:I
            send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=14,st=ok:Weather Sensor
            send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
            send: 1-1-0-0 s=0,c=0,t=7,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=1,c=0,t=6,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=2,c=0,t=16,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=3,c=0,t=8,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=4,c=0,t=6,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=5,c=0,t=1,pt=0,l=5,st=ok:1.4.1
            send: 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,st=ok:80.8
            send: 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,st=ok:28.2
            send: 1-1-0-0 s=2,c=1,t=23,pt=3,l=2,st=ok:83
            send: 1-1-0-0 s=4,c=1,t=0,pt=7,l=5,st=ok:80.6
            send: 1-1-0-0 s=3,c=1,t=4,pt=7,l=5,st=ok:1020
            send: 1-1-0-0 s=5,c=1,t=16,pt=2,l=2,st=ok:0
            send: 1-1-0-0 s=255,c=3,t=0,pt=1,l=1,st=ok:91
        

        Finally, we then go to Vera and make sure she’s happy.

        MIOS.jpg

        This has been a great learning experience for me as it’s my first documented project. I made a bunch of mistakes in between most of the steps you see here. I’ve practiced my soldering techniques for many, many hours. One battery went bye-bye when I didn’t notice the leads had crossed. The smoke was a real good indicator that I’d messed up. I’ve ruined my fair share of components, but I chalk it all up to experience and don’t dwell on them. This hobby is a lot less expensive than golf or fishing, even with my mistakes. I look forward to bigger and better as I continue learn. Thanks again, Hek. This is a hobby that I truly enjoy.

        R Offline
        R Offline
        rfortunas
        wrote on last edited by
        #38

        @Salmoides Hi Salmoides,
        Great Project!!

        I had the sensors and was looking for a project like this!

        I got it to run on the breadboard, and sync with domoticz. and the plan is to power it out with some 18650 cells+solar panel, but i have some questions for you.

        1. aren't you using any resistors for the i2c sensors? or the dht22?
        2. how hare you connecting the battery? when fully charged it can go up to 4.2v i belive this whould burn some sensors.. are you connecting it to the arduino raw pin and feeding the sensors with the regulated 3.3v pin!?
        3. the potentiometer, are you using it only as a resistor? or are you regulating it?

        thanks for sharing, and here are some screenshots of my implementation.

        QuarterSizeRender.png
        domoticz_solar.png

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gbfromhb
          wrote on last edited by
          #39

          I don't seem to be able to get the DHT22 working. I have stripped this project down to the following prototype, and am still not able to get the DHT22 to work. I'm using the DHT example (not MySensors) script and continue to get timeout errors for both Temp and Humidity. I have tried a 4.0k ohm, 10k omh and no resistor.

          DHT22 Solar_bb.png

          I am just wanting to know if I might be missing something, and to also verify that other people have got the DHT22 working with a Arduino Pro Mini 8mhs - 3.3 volt using its regulated vcc pin. I have ordered new DHT22 modules from a different source just to see what happens.

          Thanks in advance for any input.

          1 Reply Last reply
          0
          • sundberg84S Offline
            sundberg84S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by sundberg84
            #40

            One thing comes to mind is that DHT has 3.3v as minimum power.
            If you have a "weak" pro mini board delivere power below that maybe is a problem. Can you measure the power?

            I have a 3.3v pro mini running a DHT22 fine, so it should work - but I also know there is a big difference in different hardware even if its called pro mini.

            Controller: Proxmox VM - Home Assistant
            MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
            MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
            RFLink GW - Arduino Mega + RFLink Shield, 433mhz

            1 Reply Last reply
            0
            • 5546dug5 Offline
              5546dug5 Offline
              5546dug
              wrote on last edited by
              #41

              @gbfromhb I did not use the resistor and no Vcc connection through it to D4.
              My output is straight to pro mini.
              Vcc and gnd make up the other two connections.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                gbfromhb
                wrote on last edited by gbfromhb
                #42

                @5546dug thanks for the input. I had also tried it with 4k ohm, 10k ohm and no resistor and connection to VCC to pin 2 of the DHT.

                @sundberg84 thanks for your input as well. I tried two different Pro Minis also, but from the same supplier. I think I'm going to go after a new Pro Mini from a different supplier.

                YveauxY 1 Reply Last reply
                0
                • G gbfromhb

                  @5546dug thanks for the input. I had also tried it with 4k ohm, 10k ohm and no resistor and connection to VCC to pin 2 of the DHT.

                  @sundberg84 thanks for your input as well. I tried two different Pro Minis also, but from the same supplier. I think I'm going to go after a new Pro Mini from a different supplier.

                  YveauxY Offline
                  YveauxY Offline
                  Yveaux
                  Mod
                  wrote on last edited by Yveaux
                  #43

                  @gbfromhb I seemed to have similar problems as you using the DHT22 (Straight from China, marked AM2302). Reported 2% hudity and 0 degrees, with data line directly connected to pin3 (no pullup) on 8MHz Pro Mini.
                  Switched from the MySensors DHT library to this one: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib
                  Now works like a charm with the dht22_test.ino sketch:

                  dht22_test.ino
                  LIBRARY VERSION: 0.1.20
                  
                  Type,	status,	Humidity (%),	Temperature (C)	Time (us)
                  DHT22, 	OK,	45.4,	25.9,	5216
                  DHT22, 	OK,	45.7,	26.0,	5240
                  DHT22, 	OK,	45.6,	26.0,	5136
                  DHT22, 	OK,	45.4,	26.0,	5128
                  DHT22, 	OK,	45.3,	26.1,	5176
                  DHT22, 	OK,	45.1,	26.1,	5176
                  ... etc ...
                  
                  

                  You could give this library a try; it might work with yours!

                  http://yveaux.blogspot.nl

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    gbfromhb
                    wrote on last edited by gbfromhb
                    #44

                    @Yveaux thank you for the information. I was going to post my solution tomarrow morning. I found first the library you had suggested, and found a second one that I settled on. Yesterday my top thought on this was it was a timing issue, and the slower 8Mhz pro mini. I had ruled out voltage as the issue. The library you directed me in their last revision addressed timing issues with slower clock speeds. It did work great. I did find a different one that seems to have a few more functions that I need and it seems to work great also.

                    https://github.com/adafruit/DHT-sensor-library

                    I seemed to get more accurate temperature when I put a 10k ohm resistor between pin 1 and 2 on the DHT22.

                    YveauxY 1 Reply Last reply
                    0
                    • G gbfromhb

                      @Yveaux thank you for the information. I was going to post my solution tomarrow morning. I found first the library you had suggested, and found a second one that I settled on. Yesterday my top thought on this was it was a timing issue, and the slower 8Mhz pro mini. I had ruled out voltage as the issue. The library you directed me in their last revision addressed timing issues with slower clock speeds. It did work great. I did find a different one that seems to have a few more functions that I need and it seems to work great also.

                      https://github.com/adafruit/DHT-sensor-library

                      I seemed to get more accurate temperature when I put a 10k ohm resistor between pin 1 and 2 on the DHT22.

                      YveauxY Offline
                      YveauxY Offline
                      Yveaux
                      Mod
                      wrote on last edited by
                      #45

                      @gbfromhb Good to hear you've sorted things out!
                      I'll give the Adafruit lib a try someday.

                      http://yveaux.blogspot.nl

                      1 Reply Last reply
                      0
                      • hekH Offline
                        hekH Offline
                        hek
                        Admin
                        wrote on last edited by
                        #46

                        If/when you guys have evaluated the best DHT library, maybe we should update the one distributed in the MySensors bundle?

                        YveauxY 1 Reply Last reply
                        0
                        • hekH hek

                          If/when you guys have evaluated the best DHT library, maybe we should update the one distributed in the MySensors bundle?

                          YveauxY Offline
                          YveauxY Offline
                          Yveaux
                          Mod
                          wrote on last edited by
                          #47

                          @hek tricky, as we seem to be the only ones having issues with the library included with MySensors. I only have one DHT22 so I cannot test with other sensors...

                          http://yveaux.blogspot.nl

                          ? 1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            gbfromhb
                            wrote on last edited by gbfromhb
                            #48

                            @hek I think this is a good idea to update the DHT library that is being distributed. I have tried the DHT11 & DHT22 on both of these these libraries and they seem to work. It is pretty interesting the revision logs for both of these have addressed lower clock speed issues that were resolved in different versions, and the current library that is being distributed has not been touched for over over 2 years. The library that @Yveaux is using has been updated in that last 6 months, and the one I'm currently using has been updated in the last month. Both of these libraries have been around for 3 or 4 years. There is also one more library that I was looking at that I have not tried and that is: https://github.com/piettetech/piettetech_dht.

                            I choose the one I did, because it had some functions that enabled me to work with Fahrenheit easier.

                            I don't think we are the only ones that have had issues with the DHT library that have been resolved by changing library. Take a look at the bottom of this post:
                            http://forum.mysensors.org/topic/1894/pro-mini-is-giving-a-frequent-time-out-on-dth11-read-out/8

                            1 Reply Last reply
                            0
                            • hekH Offline
                              hekH Offline
                              hek
                              Admin
                              wrote on last edited by
                              #49

                              Yep, would be great if someone had time to evaluate the different options and get back to me with a suitable choice.

                              1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                Bazeman
                                wrote on last edited by
                                #50

                                Please add an wiring diagram. Especially for the solar panel, battery and connection to the Nano.

                                D 1 Reply Last reply
                                0
                                • 5546dug5 5546dug

                                  @Salmoides great thread and project

                                  Was trying to follow the wiring on the back side of the board to wire my project and was wondering how you wrap the wires around the posts sticking through the board for soldering.
                                  Also is there a wiring diagram?

                                  B Offline
                                  B Offline
                                  Bazeman
                                  wrote on last edited by
                                  #51

                                  @5546dug Have you a wiring diagram?

                                  1 Reply Last reply
                                  0
                                  • YveauxY Yveaux

                                    @hek tricky, as we seem to be the only ones having issues with the library included with MySensors. I only have one DHT22 so I cannot test with other sensors...

                                    ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #52

                                    I've build something like this that logs temperature to an SD card, so no radio or gateway involved. Been getting NaNs from my DHT22 every few readings since I switched from a 5v Pro Mini to a 3.3v one. This never happened on the 5v one, so I guess I'll try switching library as well!

                                    1 Reply Last reply
                                    0
                                    • G Offline
                                      G Offline
                                      gbfromhb
                                      wrote on last edited by gbfromhb
                                      #53

                                      @hek I like the following library https://github.com/adafruit/DHT-sensor-library (ladyada).

                                      This seems to be working fine with the Arduino Pro Mini 8mhz.
                                      Here is a MySensors example using this library:

                                      /**
                                       * The MySensors Arduino library handles the wireless radio link and protocol
                                       * between your home built sensors/actuators and HA controller of choice.
                                       * The sensors forms a self healing radio network with optional repeaters. Each
                                       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                       * network topology allowing messages to be routed to nodes.
                                       *
                                       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                       * Copyright (C) 2013-2015 Sensnology AB
                                       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                       *
                                       * Documentation: http://www.mysensors.org
                                       * Support Forum: http://forum.mysensors.org
                                       *
                                       * This program is free software; you can redistribute it and/or
                                       * modify it under the terms of the GNU General Public License
                                       * version 2 as published by the Free Software Foundation.
                                       *
                                       *******************************
                                       *
                                       * REVISION HISTORY
                                       * Version 1.0 - Henrik EKblad
                                       * Version 1.1 - Glenn Byron - September 6, 2015 - Converted to new DHT library written by ladyada 
                                       * 
                                       * DESCRIPTION
                                       * This sketch provides an example how to implement a humidity/temperature
                                       * sensor using DHT11, DHT21, DHT-22 
                                       * http://www.mysensors.org/build/humidity
                                       */
                                       
                                      #include <SPI.h>
                                      #include <MySensor.h> 
                                      #include <DHT.h>  
                                      
                                      #define CHILD_ID_HUM 0
                                      #define CHILD_ID_TEMP 1
                                      #define HUMIDITY_SENSOR_DIGITAL_PIN 2
                                      #define DHTTYPE DHT22
                                      // DHTTYPE choices: DHT11, DHT21, DHT22
                                      
                                      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                                      
                                      MySensor gw;
                                      DHT dht(HUMIDITY_SENSOR_DIGITAL_PIN, DHTTYPE);
                                      float lastTemp;
                                      float lastHum;
                                      boolean metric = false; 
                                      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
                                      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
                                      
                                      void setup()  
                                      { 
                                        Serial.begin(115200);
                                        Serial.flush();
                                        Serial.println("MySensors: DHT example");
                                        
                                        gw.begin();
                                        dht.begin();
                                      
                                        // Send the Sketch Version Information to the Gateway
                                        gw.sendSketchInfo("Humidity", "1.0");
                                      
                                        // Register all sensors to gw (they will be created as child devices)
                                        gw.present(CHILD_ID_HUM, S_HUM);
                                        gw.present(CHILD_ID_TEMP, S_TEMP);
                                        
                                        metric = gw.getConfig().isMetric;
                                      
                                        delay(2000);
                                      }
                                      
                                      void loop()      
                                      {  
                                        float temperature = dht.readTemperature(!metric);
                                        if (isnan(temperature)) {
                                            Serial.println("Failed reading temperature from DHT");
                                        } else if (temperature != lastTemp) {
                                          lastTemp = temperature;
                                          gw.send(msgTemp.set(temperature, 1));
                                          Serial.print("Temperature: ");
                                          Serial.println(temperature);
                                        }
                                        
                                        float humidity = dht.readHumidity();
                                        if (isnan(humidity)) {
                                            Serial.println("Failed reading humidity from DHT");
                                        } else if (humidity != lastHum) {
                                            lastHum = humidity;
                                            gw.send(msgHum.set(humidity, 1));
                                            Serial.print("Humidity: ");
                                            Serial.println(humidity);
                                        }
                                      
                                        gw.sleep(SLEEP_TIME); //sleep a bit
                                      }
                                      
                                      1 Reply Last reply
                                      0
                                      • B Bazeman

                                        Please add an wiring diagram. Especially for the solar panel, battery and connection to the Nano.

                                        D Offline
                                        D Offline
                                        drock1985
                                        wrote on last edited by drock1985
                                        #54

                                        @Bazeman

                                        If i'm not mistaken, the solor panel is directly connected to the power input of the solar charger. @Salmoides wired a mini/microUSB to the power cables to make it easy connect/disconnect. It's this one, from what I can see in the pictures. http://www.aliexpress.com/item/5PCS-Micro-USB-5V-1A-18650-Lithium-Battery-Charger-Board-With-Protection-Module/1852341893.html

                                        From there, it's pretty straight forward. The battery is connected to the B+ and B- leads. The OUT+ and OUT- would be connected to the VIN/RAW and GND on your Nano, respectively.

                                        My Projects
                                        2 Door Chime Sensor
                                        Washing Machine Monitor

                                        1 Reply Last reply
                                        0
                                        • bisschopsrB Offline
                                          bisschopsrB Offline
                                          bisschopsr
                                          wrote on last edited by
                                          #55

                                          The lamp is not shipped to NL and many other countries :unamused: . Did anyone find it in Europe?

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

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


                                          17

                                          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