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. Development
  3. Need a bid of help...

Need a bid of help...

Scheduled Pinned Locked Moved Development
15 Posts 3 Posters 2.7k Views 3 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.
  • R Offline
    R Offline
    Rene046
    wrote on last edited by
    #3

    What are the read command for an bme280
    float temperature = bme.readTemperature();
    float humidity = bme.readHumidity();
    float pressure= bme.readPressure()
    ?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rene046
      wrote on last edited by Rene046
      #4

      this is what i got s far...
      mysensor.readTempC() and bmp.readTemperature(); both not working.
      now i got it accepted but my working sketch peaces give problems.

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <BH1750.h>
      #include <Wire.h>
      //#include <Adafruit_BME280.h>
      //#include <SparkFunBME280.h>
      #include <BME280_MOD-1022.h>
      
      
      unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
      int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
      int SOLAR_SENSE_PIN = A1;  // select the input pin for the solar sense point
      #define CHILD_ID_BATTERY 4
      #define CHILD_ID_SOLAR 6
      #define CHILD_ID_LIGHT 1
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 2
      #define CHILD_ID_BARO 3
      BH1750 lightSensor;
      
      int oldBatteryPcnt = 0;
      MyMessage msgTemp(CHILD_ID_TEMP,V_TEMP);
      MyMessage msgHum(CHILD_ID_HUM,V_HUM);
      MyMessage msgPres(CHILD_ID_BARO,V_PRESSURE);
      MyMessage msgbatt(CHILD_ID_BATTERY, V_VOLTAGE);
      MyMessage msgsolar(CHILD_ID_SOLAR, V_VOLTAGE);
      MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      uint16_t lastlux;  //lux
      
      void setup(){
       
      	// use the 1.1 V internal reference
      #if defined(__AVR_ATmega2560__)
      	analogReference(INTERNAL1V1);
      #else
      	analogReference(INTERNAL);
      #endif
      { 
      
      	// Send the sketch version information to the gateway and Controller
      	sendSketchInfo("Battery Meter", "2.0");
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_BARO, S_BARO);
        present(CHILD_ID_HUM, S_HUM);  
      }}
      
      void loop()
      {
      	// get the battery Voltage
      	int sensorValue2 = analogRead(BATTERY_SENSE_PIN);
        delay(1000);   
        
        int sensorValue1 = analogRead(BATTERY_SENSE_PIN);
        delay(100);
        
        int sensorValue = analogRead(BATTERY_SENSE_PIN);
        delay(1000);
          
        int sensorValueS = analogRead(SOLAR_SENSE_PIN);
        delay(1000);
      
        // Read out the data - must do this before calling the getxxxxx routines
        BME280.readMeasurements();
      
        // get temperature from BME280
        float temperature = BME280.getTemperatureMostAccurate(); 
        
        // get humidity from BME280
        float humidity = BME280.getHumidityMostAccurate();
        
        // get pressure from BME280
        float pressure = BME280.getPressureMostAccurate();   
         
        }
      
      #ifdef MY_DEBUG
      	Serial.print("Battery Voltage2: ");
        Serial.println(sensorValue2);
        Serial.print("Battery Voltage1: ");
        Serial.println(sensorValue1);
        Serial.print("Battery Voltage: ");
        Serial.println(sensorValue);
        Serial.print("Solar Voltage: ");
        Serial.println(sensorValueS);
      
      Serial.print("Buiten Temp: ");
        Serial.print(temperature);
        Serial.println(" Celcius");
      send(msgTemp.set(temperature, 1));
      
      Serial.print("Vochtigheid: ");
        Serial.print(humidity);
        Serial.println(" ?");
      send(msgHum.set(humidity, 1));
      
      Serial.print("Buiten Druk: ");
        Serial.print(pressure);
        Serial.println(" ?");
      send(msgPres.set(pressure, 2));
      
      Serial.print("Battery Voltage: ");
        Serial.print(batteryV);
        Serial.println(" V");
      send(msgbatt.set(batteryV ,2));
      
        Serial.print("Solar Voltage: ");
        Serial.print(batteryS);
        Serial.println(" V");
      send(msgsolar.set(batteryS ,2));
      
        Serial.print("Battery percent: ");
        Serial.print(batteryPcnt);
        Serial.println(" %");
      #endif
      
      
      	// 1M, 470K divider across battery and using internal ADC ref of 1.1V
      	// Sense point is bypassed with 0.1 uF cap to reduce noise at that point
      	// ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
      	// 3.44/1023 = Volts per bit = 0.003363075
        const float vRef = 4.200/ 1.05/ 1023 ;  
      	int batteryPcnt = sensorValue / 10;
        float batteryV  = sensorValue * 0.0042598 ; // 0.0038952294568380753114792412093 max 4,2 volt
        float batteryS  = sensorValueS * 0.0102459 ; // 0.0038952294568380753114792412093 max 10 volt
        
      	if (oldBatteryPcnt != batteryPcnt) {
      		// Power up radio after sleep
      		sendBatteryLevel(batteryPcnt);
      		oldBatteryPcnt = batteryPcnt;
      	}
            
        uint16_t lux = lightSensor.readLightLevel();// Get Lux value
        Serial.println(lux);
        if (lux != lastlux) {
            send(msg.set(lux));
            lastlux = lux;
        }
      
      	sleep(SLEEP_TIME);
      }```
      1 Reply Last reply
      0
      • gohanG Offline
        gohanG Offline
        gohan
        Mod
        wrote on last edited by
        #5

        Take a look at nodemanager, it will simplify your life ☺️

        R 1 Reply Last reply
        0
        • gohanG gohan

          Take a look at nodemanager, it will simplify your life ☺️

          R Offline
          R Offline
          Rene046
          wrote on last edited by Rene046
          #6

          @gohan

          Hi Gohan.

          Im still learning .. nodemanager ????

          Features

          Manage all the aspects of a sleeping cycle by leveraging smart sleep
          Allow configuring the sleep mode and the sleep duration remotely
          Allow waking up a sleeping node remotely at the end of a sleeping cycle
          Allow powering on each connected sensor only while the node is awake to save battery
          Report battery level periodically and automatically
          Calculate battery level without requiring an additional pin and the resistors
          Report battery voltage through a built-in sensor
          Can report battery level on demand
          Allow rebooting the board remotely
          Provide out-of-the-box sensors personalities and automatically execute their main task at each cycle
          

          it looks intresting but i just started...

          1 Reply Last reply
          0
          • gohanG Offline
            gohanG Offline
            gohan
            Mod
            wrote on last edited by
            #7

            For beginners it's easier, it cuts down code quite a lot

            R 1 Reply Last reply
            0
            • gohanG gohan

              For beginners it's easier, it cuts down code quite a lot

              R Offline
              R Offline
              Rene046
              wrote on last edited by
              #8

              @gohan

              Do you have a sample or could you help me starting with the sketch i already have ?

              R 1 Reply Last reply
              0
              • R Rene046

                @gohan

                Do you have a sample or could you help me starting with the sketch i already have ?

                R Offline
                R Offline
                Rene046
                wrote on last edited by
                #9

                @Rene046 said in Need a bid of help...:

                @gohan

                Do you have a sample or could you help me starting with the sketch i already have ?

                i installed nodemanager i think ...lol

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Rene046
                  wrote on last edited by Rene046
                  #10
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • gohanG Offline
                    gohanG Offline
                    gohan
                    Mod
                    wrote on last edited by
                    #11

                    maybe you set the something wrong in the sleep settings, but without seeing your code it's hard to give you an answer :)

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Rene046
                      wrote on last edited by Rene046
                      #12

                      Found it i connected the BME280 in the BH1750 line after removing i worked again....
                      the sketch could not work without Seeing the BH1750.

                      my code is in my first post on top of this topic.

                      1 Reply Last reply
                      0
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #13

                        Yes, but I wanted to see if you made the modifications to run the nodemanager

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          Rene046
                          wrote on last edited by
                          #14

                          nope i dont even know where to start....

                          1 Reply Last reply
                          0
                          • alowhumA Offline
                            alowhumA Offline
                            alowhum
                            Plugin Developer
                            wrote on last edited by
                            #15

                            Try this code:
                            https://github.com/flatsiedatsie/MySensorsArduinoExamples/blob/5c84100098352bab6db4b9c86e76db79842131ec/examples/WeatherStationSensor/WeatherStationSensor.ino

                            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.1k

                            Posts


                            Copyright 2025 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