Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Markus.
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Markus.

    @Markus.

    2
    Reputation
    56
    Posts
    648
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Markus. Follow

    Best posts made by Markus.

    • RE: Easy/Newbie PCB for MySensors

      @korttoma yes i use the pro mini 3,3V but can Ireplace the Radios simply with a modification of the Sketch ? Because hen I Flash following Sketch to the Easy pcb:

      // Sample RFM69 receiver/gateway sketch, with ACK and optional encryption, and Automatic Transmission Control
      // Passes through any wireless received messages to the serial port & responds to ACKs
      // It also looks for an onboard FLASH chip, if present
      // **********************************************************************************
      // Copyright Felix Rusu 2016, http://www.LowPowerLab.com/contact
      // **********************************************************************************
      // License
      // **********************************************************************************
      // This program is free software; you can redistribute it 
      // and/or modify it under the terms of the GNU General    
      // Public License as published by the Free Software       
      // Foundation; either version 3 of the License, or        
      // (at your option) any later version.                    
      //                                                        
      // This program is distributed in the hope that it will   
      // be useful, but WITHOUT ANY WARRANTY; without even the  
      // implied warranty of MERCHANTABILITY or FITNESS FOR A   
      // PARTICULAR PURPOSE. See the GNU General Public        
      // License for more details.                              
      //                                                        
      // Licence can be viewed at                               
      // http://www.gnu.org/licenses/gpl-3.0.txt
      //
      // Please maintain this license information along with authorship
      // and copyright notices in any redistribution of this code
      // **********************************************************************************
      #include <RFM69.h>         //get it here: https://www.github.com/lowpowerlab/rfm69
      #include <RFM69_ATC.h>     //get it here: https://www.github.com/lowpowerlab/rfm69
      #include <SPIFlash.h>      //get it here: https://www.github.com/lowpowerlab/spiflash
      #include <SPI.h>           //included with Arduino IDE install (www.arduino.cc)
      
      //*********************************************************************************************
      //************ IMPORTANT SETTINGS - YOU MUST CHANGE/CONFIGURE TO FIT YOUR HARDWARE *************
      //*********************************************************************************************
      #define NODEID        1    //unique for each node on same network
      #define NETWORKID     100  //the same on all nodes that talk to each other
      //Match frequency to the hardware version of the radio on your Moteino (uncomment one):
      //#define FREQUENCY     RF69_433MHZ
      #define FREQUENCY     RF69_868MHZ
      //#define FREQUENCY     RF69_915MHZ
      #define ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
      #define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
      //*********************************************************************************************
      //Auto Transmission Control - dials down transmit power to save battery
      //Usually you do not need to always transmit at max output power
      //By reducing TX power even a little you save a significant amount of battery power
      //This setting enables this gateway to work with remote nodes that have ATC enabled to
      //dial their power down to only the required level
      #define ENABLE_ATC    //comment out this line to disable AUTO TRANSMISSION CONTROL
      //*********************************************************************************************
      #define SERIAL_BAUD   115200
      
      #ifdef __AVR_ATmega1284P__
        #define LED           15 // Moteino MEGAs have LEDs on D15
        #define FLASH_SS      23 // and FLASH SS on D23
      #else
        #define LED           9 // Moteinos have LEDs on D9
        #define FLASH_SS      8 // and FLASH SS on D8
      #endif
      
      #ifdef ENABLE_ATC
        RFM69_ATC radio;
      #else
        RFM69 radio;
      #endif
      
      SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for 4mbit  Windbond chip (W25X40CL)
      bool promiscuousMode = false; //set to 'true' to sniff all packets on the same network
      
      void setup() {
        Serial.begin(SERIAL_BAUD);
        delay(10);
        radio.initialize(FREQUENCY,NODEID,NETWORKID);
      #ifdef IS_RFM69HW_HCW
        radio.setHighPower(); //must include this only for RFM69HW/HCW!
      #endif
        radio.encrypt(ENCRYPTKEY);
        radio.promiscuous(promiscuousMode);
        //radio.setFrequency(919000000); //set frequency to some custom frequency
        char buff[50];
        sprintf(buff, "\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
        Serial.println(buff);
        if (flash.initialize())
        {
          Serial.print("SPI Flash Init OK. Unique MAC = [");
          flash.readUniqueId();
          for (byte i=0;i<8;i++)
          {
            Serial.print(flash.UNIQUEID[i], HEX);
            if (i!=8) Serial.print(':');
          }
          Serial.println(']');
          
          //alternative way to read it:
          //byte* MAC = flash.readUniqueId();
          //for (byte i=0;i<8;i++)
          //{
          //  Serial.print(MAC[i], HEX);
          //  Serial.print(' ');
          //}
        }
        else
          Serial.println("SPI Flash MEM not found (is chip soldered?)...");
          
      #ifdef ENABLE_ATC
        Serial.println("RFM69_ATC Enabled (Auto Transmission Control)");
      #endif
      }
      
      byte ackCount=0;
      uint32_t packetCount = 0;
      void loop() {
        //process any serial input
        if (Serial.available() > 0)
        {
          char input = Serial.read();
          if (input == 'r') //d=dump all register values
            radio.readAllRegs();
          if (input == 'E') //E=enable encryption
            radio.encrypt(ENCRYPTKEY);
          if (input == 'e') //e=disable encryption
            radio.encrypt(null);
          if (input == 'p')
          {
            promiscuousMode = !promiscuousMode;
            radio.promiscuous(promiscuousMode);
            Serial.print("Promiscuous mode ");Serial.println(promiscuousMode ? "on" : "off");
          }
          
          if (input == 'd') //d=dump flash area
          {
            Serial.println("Flash content:");
            int counter = 0;
      
            while(counter<=256){
              Serial.print(flash.readByte(counter++), HEX);
              Serial.print('.');
            }
            while(flash.busy());
            Serial.println();
          }
          if (input == 'D')
          {
            Serial.print("Deleting Flash chip ... ");
            flash.chipErase();
            while(flash.busy());
            Serial.println("DONE");
          }
          if (input == 'i')
          {
            Serial.print("DeviceID: ");
            word jedecid = flash.readDeviceId();
            Serial.println(jedecid, HEX);
          }
          if (input == 't')
          {
            byte temperature =  radio.readTemperature(-1); // -1 = user cal factor, adjust for correct ambient
            byte fTemp = 1.8 * temperature + 32; // 9/5=1.8
            Serial.print( "Radio Temp is ");
            Serial.print(temperature);
            Serial.print("C, ");
            Serial.print(fTemp); //converting to F loses some resolution, obvious when C is on edge between 2 values (ie 26C=78F, 27C=80F)
            Serial.println('F');
          }
        }
      
        if (radio.receiveDone())
        {
          Serial.print("#[");
          Serial.print(++packetCount);
          Serial.print(']');
          Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] ");
          if (promiscuousMode)
          {
            Serial.print("to [");Serial.print(radio.TARGETID, DEC);Serial.print("] ");
          }
          for (byte i = 0; i < radio.DATALEN; i++)
            Serial.print((char)radio.DATA[i]);
          Serial.print("   [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");
          
          if (radio.ACKRequested())
          {
            byte theNodeID = radio.SENDERID;
            radio.sendACK();
            Serial.print(" - ACK sent.");
      
            // When a node requests an ACK, respond to the ACK
            // and also send a packet requesting an ACK (every 3rd one only)
            // This way both TX/RX NODE functions are tested on 1 end at the GATEWAY
            if (ackCount++%3==0)
            {
              Serial.print(" Pinging node ");
              Serial.print(theNodeID);
              Serial.print(" - ACK...");
              delay(3); //need this when sending right after reception .. ?
              if (radio.sendWithRetry(theNodeID, "ACK TEST", 8, 0))  // 0 = only 1 attempt, no retries
                Serial.print("ok!");
              else Serial.print("nothing");
            }
          }
          Serial.println();
          Blink(LED,3);
        }
      }
      
      void Blink(byte PIN, int DELAY_MS)
      {
        pinMode(PIN, OUTPUT);
        digitalWrite(PIN,HIGH);
        delay(DELAY_MS);
        digitalWrite(PIN,LOW);
      }
      
      

      I get following result:

      Listening at 868 Mhz...
      SPI Flash MEM not found (is chip soldered?)...
      RFM69_ATC Enabled (Auto Transmission Control)
      
      
      
      
      posted in Hardware
      Markus.
      Markus.
    • RE: Easy/Newbie PCB for MySensors

      @gohan Sounds good šŸ™‚ well, I have a 10uF electrolytic there. Hope it makes not the big difference. On the boards with NRF works that fine so far.

      posted in Hardware
      Markus.
      Markus.

    Latest posts made by Markus.

    • RE: Soil moisture sensor - strange readings

      now it Looks better šŸ™‚
      reversed D2 and D6

      D2 -> Input 10K resistor-> Output 10K Input Fork and A1-> Output fork -> D6
      The values now makes sense šŸ™‚
      However...Would be great if someone can have a look on the Sketch because Ihave removed the OTA part and not sure If it was correct on this way.

      Many thanks
      Markus

      posted in Hardware
      Markus.
      Markus.
    • RE: Soil moisture sensor - strange readings

      Well its measuring "something"

      Fork in water
      Value1=0 1.00
      Value2=730 33.95

      Fork dry
      Value1=218 27.25
      Value2=0 100.00

      posted in Hardware
      Markus.
      Markus.
    • RE: Soil moisture sensor - strange readings

      Would be great If someone can check this Sketch.Because its giving me Always the same results

      Value1=219 27.37
      Value2=0 100.00
      Result = 63.69% (6.51cb)
      VCC = 3.39 Volts
      VCC% = 32 %
      
      #define MY_DEBUG
      #define MY_SPECIAL_DEBUG
      #define MY_SIGNAL_REPORT_ENABLED
      
      // Enable and select radio type attached 
      //#define MY_RADIO_NRF24
      #define MY_RADIO_RFM69
      //#define MY_RS485
      #define MY_RFM69_FREQUENCY RFM69_868MHZ
      
      #define MY_BAUD_RATE 38400
      
      #include <MySensors.h>
      #include <SPI.h>
      #include <Vcc.h>
      #include <Streaming.h>
      #include <math.h>
      
      //#define SLEEP_TIME_15min  900000    // 15min x 60s = 900000 ms -13% = 783000                (my arduinos show a delay of 8s/min = 13%)
      #define SLEEP_TIME_15min  5000
      #define SLEEP_TIME_1h     3600000   // 1 h = 1*60*60000 = 3600000 ms -13% = 3132000 ms
      #define SLEEP_TIME_2h     7200000   // 2 h = 2*60*60000 = 7200000 ms -13% = 6264000 ms
      #define SLEEP_TIME_3h     10800000  // 3 h = 3*60*60000 = 10800000 ms -13% = 9396000 ms
      
      #define VERSION "3.0"
      #define PIN_ALIM1 2                                   // Connect to input of resistor
      #define PIN_ALIM2 6                                   // Connect to input of measuring probe
      #define PIN_LECTURA A1
      
      #define AGUA_DIR            800.0
      #define AGUA_INV            160.0
      #define AIRE_DIR            0.0
      #define AIRE_INV            1023.0
      #define TIEMPO_LECTURA      10
      #define MAX_REP_LECTURA     20
      #define MAX_REPORTING_LOOPS 4
      
      // Battery calibration (Li-ion)
      const float VccMin   = 3.0;                         // Minimum expected Vcc level, in Volts.
      const float VccMax   = 4.2;                         // Maximum expected Vcc level, in Volts.
      const float VccCorrection = 3.82/3.74;              // Measured Vcc by multimeter divided by reported Vcc
      
      #define CHILD_MOIST_ID 1
      MyMessage msgmoist(CHILD_MOIST_ID, V_LEVEL);
      Vcc vcc(VccCorrection);
      
      int count=0;
      signed int oldv1=0, oldv2=0;
      float oldresultcb=0;
      
      void setup() {
      #ifdef MY_DEBUG
        Serial.begin(38400);
      #endif
        analogReference(DEFAULT);
        pinMode(PIN_LECTURA, INPUT);
        pinMode(PIN_ALIM1, OUTPUT);
        pinMode(PIN_ALIM2, OUTPUT);
      }
      
      void presentation(){
          sendSketchInfo("Sensor de humedad", VERSION);
          present(CHILD_MOIST_ID, S_MOISTURE, "Humedad suelo");
      }
      
      void loop()
      {
        {
         signed int value1=0, value2=0, i=0;
          float result1, result2, resultp, resultcb;
      
          //Loop until readings are stable or max number of readings is reached
          do {
            oldv1=value1; oldv2=value2;
            wait(TIEMPO_LECTURA);
            digitalWrite(PIN_ALIM1, HIGH);
            digitalWrite(PIN_ALIM2, LOW);
            wait(TIEMPO_LECTURA);
            value1 = analogRead(PIN_LECTURA);
      
            digitalWrite(PIN_ALIM1, LOW);
            digitalWrite(PIN_ALIM2, HIGH);
            wait(TIEMPO_LECTURA);
            value2 = analogRead(PIN_LECTURA);;
            digitalWrite(PIN_ALIM1, LOW);
            digitalWrite(PIN_ALIM2, LOW);
          } while (((oldv1 != value1) && (oldv2 != value2)) || (i == MAX_REP_LECTURA));
      
      /*
            0-10 Saturated Soil. Occurs for a day or two after irrigation 
            10-20 Soil is adequately wet (except coarse sands which are drying out at this range) 
            20-60 Usual range to irrigate or water (most soils except heavy clay soils). 
            60-100 Usual range to irrigate heavy clay soils 
            100-200 Soil is becoming dangerously dry
          */
          result1=constrain(value1/(AGUA_DIR-AIRE_DIR)*100.0, 1, 100);
          result2=constrain(100-(value2-AGUA_INV)/(AIRE_INV-AGUA_INV)*100.0,1,100);
          resultp = (result1+result2)/2.0;
          resultcb = resultcb + constrain(square((-2.96699 + 351.395/resultp)),0,200);                           //Equation fit using stat software
          count++;
        
          //Send the data - only if moisture changed to save battery (send anyways once every 4 readings). If moisture sent, send battery level.
          if ((oldresultcb!=resultcb) || (count==MAX_REPORTING_LOOPS)) {
            send(msgmoist.set((unsigned int)resultcb));
            oldresultcb=resultcb;
            //Measure battery voltage and send level
            float v = vcc.Read_Volts();  
            int p = vcc.Read_Perc(VccMin, VccMax);
            p=constrain(p,0,100);
            sendBatteryLevel(p);
            #ifdef MY_DEBUG
              Serial << "Value1=" << value1 << " " << result1 << endl << "Value2=" << value2 << " " << result2 << endl << "Result = " << resultp << "% (" << resultcb << "cb)" << endl;
              Serial << "VCC = " << v << " Volts" << endl << "VCC% = " << p << " %" << endl;
            #endif
          }
        
          if (count==MAX_REPORTING_LOOPS) count=0;
          //sleep(SLEEP_TIME_3h, true);
          sleep(SLEEP_TIME_15min, true);
        }
      }
      

      its connected on following Schema

      D2 -> Input 10K resistor-> Output 10K Input Fork and A1-> Output fork -> D6
      I am using a Adruino pro mini 3,3V on an Easy PCB Board.

      Many thanks

      Markus

      posted in Hardware
      Markus.
      Markus.
    • RE: Soil moisture sensor - strange readings

      @manutremo
      ….I used two digital pins (4 and 7 in my case) which I enable and disable so I can polarize the fork in one direction or the opposite. Be aware that the resistor should be connected to pin in this case, and the fork to pin 7; otherwise the formula of the voltage divider needs to be modified..

      Hi Manutremo,
      The resistor must be connected to D4 in your example? and the fork "end" to D7? The sampling pint then to A0? Or a equivalent Analog Input..?

      Thanks

      Markus

      posted in Hardware
      Markus.
      Markus.
    • Mulitple Gatways and NodeID0

      Hi All,
      I have two Gateways connected to one Controller and I want to attach on each Gateway, which have different Radios, a sensor. I know always NodeID 0 is assigned to a sensor attached to the Gateways.
      Is there any chance to give a sensor attached to the Gateway another NodeID?
      Thanks

      Markus

      posted in General Discussion
      Markus.
      Markus.
    • RE: Serial Gateway Sketch with si7021

      @gohan šŸ˜‰ will try it.... -> Learning leasson... šŸ™‚

      posted in General Discussion
      Markus.
      Markus.
    • RE: Serial Gateway Sketch with si7021

      the sensor conenction was the Problem at the end. Changed SCD and SCL and now it Looks good so far. At the Moment is the Gateway not connected to a Controller. Hope the sensor will be then also send the values...

       __  __       ____
      |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
              |___/                      2.2.0-beta
      
      0;255;3;0;9;53 MCO:BGN:INIT GW,CP=RRNGA---,VER=2.2.0-beta
      0;255;3;0;9;83 TSM:INIT
      0;255;3;0;9;92 TSF:WUR:MS=0
      0;255;3;0;9;100 TSM:INIT:TSP OK
      0;255;3;0;9;108 TSM:INIT:GW MODE
      0;255;3;0;9;118 TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;129 MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.2.0-beta
      0;255;3;0;11;Gateway_SI7021
      0;255;3;0;12;1.0 161017
      0;0;0;0;6;
      0;1;0;0;7;
      0;255;3;0;9;159 MCO:BGN:STP
      Serial started
      Node and 2 children presented.
      0;255;3;0;9;684 MCO:BGN:INIT OK,TSP=1
      Loop1 started
      T: 21.49
      TempDiff :121.49
      0;0;1;0;0;21.5
      T sent!
      H: 64
      HumDiff  :164.00
      0;1;1;0;1;64
      H sent!
      Before first sleep
      0;255;3;0;9;733 MCO:SLP:MS=300000,SMS=0,I1=255,M1=255,I2=255,M2=255
      0;255;3;0;9;768 !MCO:SLP:REP
      0;255;3;0;9;124672 TSF:MSG:READ,106-106-0,s=0,c=1,t=1,pt=7,l=5,sg=0:63.3
      106;0;1;0;1;63.3
      0;255;3;0;9;124702 TSF:MSG:READ,106-106-0,s=255,c=3,t=0,pt=1,l=1,sg=0:90
      106;255;3;0;0;90
      0;255;3;0;9;124735 TSF:MSG:READ,106-106-0,s=3,c=1,t=38,pt=7,l=5,sg=0:3.71
      106;3;1;0;38;3.71
      After first sleep
      Loop1 started
      T: 21.64
      TempDiff :0.15
      H: 65
      HumDiff  :0.00
      Before first sleep
      0;255;3;0;9;300797 MCO:SLP:MS=300000,SMS=0,I1=255,M1=255,I2=255,M2=255
      0;255;3;0;9;300830 !MCO:SLP:REP
      0;255;3;0;9;428443 TSF:MSG:READ,106-106-0,s=255,c=3,t=0,pt=1,l=1,sg=0:90
      106;255;3;0;0;90
      0;255;3;0;9;428476 TSF:MSG:READ,106-106-0,s=3,c=1,t=38,pt=7,l=5,sg=0:3.72
      106;3;1;0;38;3.72
      

      But how can I prevent the Situation that a defect or missing sensor on the Gateway blocks also the Gateway function ?

      Thanks

      Markus

      posted in General Discussion
      Markus.
      Markus.
    • RE: Serial Gateway Sketch with si7021

      the Code stops here

      si7021_env data = humiditySensor.getHumidityAndTemperature();
      

      Anything wrong with the sensor I guess. But how can I handle such things?

      posted in General Discussion
      Markus.
      Markus.
    • RE: Serial Gateway Sketch with si7021

      @gohan how can i do this ? šŸ˜ž

      posted in General Discussion
      Markus.
      Markus.
    • RE: Serial Gateway Sketch with si7021

      tried now the Sketch... Seems that something is wrong with the sensor.

       __  __       ____
      |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
      | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
      | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
      |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
              |___/                      2.2.0-beta
      
      0;255;3;0;9;53 MCO:BGN:INIT GW,CP=RRNGA---,VER=2.2.0-beta
      0;255;3;0;9;83 TSM:INIT
      0;255;3;0;9;92 TSF:WUR:MS=0
      0;255;3;0;9;100 TSM:INIT:TSP OK
      0;255;3;0;9;108 TSM:INIT:GW MODE
      0;255;3;0;9;118 TSM:READY:ID=0,PAR=0,DIS=0
      0;255;3;0;9;129 MCO:REG:NOT NEEDED
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.2.0-beta
      0;255;3;0;11;Gateway_SI7021
      0;255;3;0;12;1.0 161017
      0;0;0;0;6;
      0;1;0;0;7;
      0;255;3;0;9;159 MCO:BGN:STP
      Serial started
      Node and 2 children presented.
      0;255;3;0;9;684 MCO:BGN:INIT OK,TSP=1
      

      Also the issue with the attached sensor blocks completly the Gateway function.Means that the Gateway didn't receive anything. Is it possible to prevent such issue? what I mean, is it possible to seperate both functions in the Sketch in that way If something is wrong with the sensor, the Gateway can still operate?
      THX
      Markus

      posted in General Discussion
      Markus.
      Markus.