Navigation

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

    arnoldg

    @arnoldg

    0
    Reputation
    9
    Posts
    469
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    arnoldg Follow

    Best posts made by arnoldg

    This user hasn't posted anything yet.

    Latest posts made by arnoldg

    • RE: My Slim 2AA Battery Node

      Below is my first sketch with this awsome 2aa battery powerd board.
      i didn't measure the current. but i tryed to be as efficient with the power as possible.

      my avr is running on 8Mhz, this is becaus the DTH22 doesn't run on 1Mhz.

      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      #include <Vcc.h>
      
      
      #define CHILD_ID_TEMP 1               // Child id for temperatur
      #define CHILD_ID_HUM 2                // Child id for humidity
      #define CHILD_ID_VOLT 3               // Child id for battery reading
      
      #define HUMIDITY_SENSOR_DIGITAL_PIN 3 // Where is my DHT22 data pin connected to
      
      int node_id=6;                        // What is my node id
      
      unsigned long SLEEP_TIME =30000UL;    // Sleep time between reads (in milliseconds)
      int sleepcycle=1;                     // Counter to count the amout of time not sending data
      int humoffset=2;                      // only data is send if humidity is changed for this amout
      int tempoffset=0.5;                   // only data is if temperature is changed for this amout 
      int gwsendtimout=20;                  // each 20*sleep_time (10 minutes) data will be send
      
      const float VccMin   = 1.5;           // Minimum expected Vcc level, in Volts.
      const float VccMax   = 3.0;           // Maximum expected Vcc level, in Volts.
      const float VccCorrection = 1.0/1.0;  // Measured Vcc by multimeter divided by reported Vcc
      
      Vcc vcc(VccCorrection);
      
      MySensor gw;
      DHT dht;
      //Store last values
      float lastTemp = 0 ;                  
      float lastHum = 0 ;
      float batteryV=0;
      int oldBatteryPcnt = 0;             
      
      boolean lastTripped = false ;
      boolean metric = true; 
      
      boolean gwsend = true;              // to determin if data has to be send
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgVolt(CHILD_ID_VOLT, V_VOLTAGE);
      
      void setup()  
      { 
        gw.begin(NULL,node_id,false);
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity", "1.1",true);
      
      
       
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM,"Humidity douche");
        gw.present(CHILD_ID_TEMP, S_TEMP,"Temperatuur douche");
        gw.present(CHILD_ID_VOLT, S_MULTIMETER,"Battery voltage");
         
        metric = gw.getConfig().isMetric;
      }
      
      void loop()      
      
      {  
        // get the battery Voltage
         batteryV  = vcc.Read_Volts();
         int batteryPcnt = vcc.Read_Perc(VccMin, VccMax);
      
         if (oldBatteryPcnt != batteryPcnt) {
           // Power up radio after sleep
           gwsend=true;
           oldBatteryPcnt = batteryPcnt;
         }
          
        delay(dht.getMinimumSamplingPeriod());
      
        float temp1 = dht.getTemperature();
        float humidity = dht.getHumidity();
      
        if (isnan(temp1)) {
      //      Serial.println("Failed reading temperature from DHT");
        } else if ((temp1 <= lastTemp-tempoffset)||(temp1 >= lastTemp+tempoffset)) {
          lastTemp = temp1;
          if (!metric) {
            temp1 = dht.toFahrenheit(temp1);
          }
          gwsend=true;
        }
      
        if (isnan(humidity)) {
          //      Serial.println("Failed reading humidity from DHT");
        } else if ((humidity <= lastHum-humoffset)||(humidity >= lastHum+humoffset)) {
            lastHum = humidity;
            gwsend=true;
          }
      
        if (sleepcycle>gwsendtimout){
          gwsend=true;
         }
      
      if (gwsend){     
          gw.sendBatteryLevel(oldBatteryPcnt);
          gw.send(msgVolt.set(batteryV, 1));
          gw.send(msgTemp.set(lastTemp, 1));  
          gw.send(msgHum.set(lastHum, 1));
          gwsend=false;
          sleepcycle=1;
        }
        sleepcycle++;  
        gw.sleep(SLEEP_TIME);
      }
      
      posted in My Project
      arnoldg
      arnoldg
    • RE: My Slim 2AA Battery Node

      @arnoldg said:

      When i use a ziff programming board, the avr is programmeble. so usbasp is working.

      This is solved, with the use of the right boards.txt file i now can burn the bootloader from within arduino.

      posted in My Project
      arnoldg
      arnoldg
    • RE: My Slim 2AA Battery Node

      When i use a ziff programming board, the avr is programmeble. so usbasp is working.

      posted in My Project
      arnoldg
      arnoldg
    • RE: My Slim 2AA Battery Node

      I can't program my slim node through ISP, is there a reason it isn't working.
      I use USBASP with jumper 3 connected.
      But it can't find the node.

      someone have a clue how to solve this.

      it doesn't recognise the avr.

      This is the error i get:
      avrdude: error: programm enable: target doesn't answer. 1
      avrdude: initialization failed, rc=-1
      Double check connections and try again, or use -F to override
      this check.

      avrdude done. Thank you.

      posted in My Project
      arnoldg
      arnoldg
    • RE: My Slim 2AA Battery Node

      Oke, that's tru i didn't think of that.
      but when i use a 5v - 3v power suply in between it could work.

      posted in My Project
      arnoldg
      arnoldg
    • RE: My Slim 2AA Battery Node

      can i run it on 5V without any problem.

      For the RF433 interface i need 5V so i would like to make one that is powerd by an usb charger.

      posted in My Project
      arnoldg
      arnoldg
    • My first project, KAKU RF reciever/transmitter

      Hello,

      I build my first mysensor project around an Arduino nano and some cheap RF reciever/transmitter.

      The code could be optimized, maybe some kind of self learning, but don't know how to do that 🙂

      Also like to decode the recived signal to normal code like (KAKU code A,1)

      So feel free to give some advise 😉

      /**
       * 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.1 - Arnold Geurtse
       * 
       * DESCRIPTION
       * This sketch is to control my RF433 KAKU plugins with mysensor
       * in this case i use the old rotating switch type recievers
       * Reciver connected to pin 3
       * Transmitter connected to pin 7
       * As transmitter/reciver library i use this site
       * https://bitbucket.org/fuzzillogic/433mhzforarduino/wiki/Home
       * 
       * also going to build a beter antene for the reciver and transmitter.
       * http://www.elektor.nl/Uploads/Forum/Posts/How-to-make-a-Air-Cooled-433MHz-antenna.pdf
       */ 
      
      #include <MySensor.h>
      #include <SPI.h>
      #include <RemoteTransmitter.h>
      #include <RemoteReceiver.h>
      
      #define MY_NODE_ID 100
      #define NODE_TXT "RF433 interface" 
      
      #define CHILD_ID1 1   // Id of the sensor child
      #define CHILD_ID2 2   // Id of the sensor child
      #define CHILD_ID3 3   // Id of the sensor child
      #define CHILD_ID4 4   // Id of the sensor child
      #define CHILD_ID5 5   // Id of the sensor child
      
      #undef MY_DEBUG;
      
      MyMessage switch1(CHILD_ID1, V_LIGHT);
      MyMessage switch2(CHILD_ID2, V_LIGHT);
      MyMessage switch3(CHILD_ID3, V_LIGHT);
      MyMessage switch4(CHILD_ID4, V_LIGHT);
      MyMessage switch5(CHILD_ID5, V_LIGHT);
      
      bool State;
      
      // Intantiate a new KaKuTransmitter remote, also use pin 11 (same transmitter!)
      KaKuTransmitter kaKuTransmitter(7);
      
      MySensor gw;
      
      void setup()  
      {  
        gw.begin(incomingMessage,MY_NODE_ID);
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("RF 433 kaku interface", "1.0");
      
      
        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID1, S_LIGHT, "Keuken", NODE_TXT);
        gw.present(CHILD_ID2, S_LIGHT, "Computer", NODE_TXT);
        gw.present(CHILD_ID3, S_LIGHT, "Bank", NODE_TXT);
        gw.present(CHILD_ID4, S_LIGHT, "Vensterbank", NODE_TXT);
        gw.present(CHILD_ID5, S_LIGHT, "TV", NODE_TXT);
      
      
          // Initialize receiver on interrupt 0 (= digital pin 2), calls the callback "showCode"
        // after 3 identical codes have been received in a row. (thus, keep the button pressed
        // for a moment)
        //
        // See the interrupt-parameter of attachInterrupt for possible values (and pins)
        // to connect the receiver.
        RemoteReceiver::init(0, 3, showCode);
        
      
      
      }
      
      
      /*
      *  Example on how to asynchronously check for new messages from gw
      */
      void loop() 
      {
        gw.process();
      } 
      
      
      void showCode(unsigned long receivedCode, unsigned int period) {
          switch (receivedCode) {
            case 24:
              gw.send(switch1.set(0));
            break;
            case 26:
              gw.send(switch1.set(1));
            break;
            case 4398: 
              gw.send(switch2.set(0));
            break;
            case 4400: 
              gw.send(switch2.set(1));
            break;
            case 1482: 
              gw.send(switch3.set(0));
            break;
            case 1484: 
              gw.send(switch3.set(1));
            break;
            case 354318: 
              gw.send(switch4.set(0));
            break;
            case 354320: 
              gw.send(switch4.set(1));
            break;
            case 358692: 
              gw.send(switch5.set(0));
            break;
            case 358694: 
              gw.send(switch5.set(1));
            break;
          }
      
      }
      
      
      
      void incomingMessage(const MyMessage &message) {
      
        if (message.type == V_LIGHT) {
           // Change relay state
          State = message.getBool();
      
          switch (message.sensor) {
            case 1:
              kaKuTransmitter.sendSignal('A',1,State);
            break;
            case 2:
              kaKuTransmitter.sendSignal('A',2,State);
            break;
            case 3:
              kaKuTransmitter.sendSignal('A',3,State);
            break;
            case 4:
              kaKuTransmitter.sendSignal('B',1,State);
            break;
            case 5:
              kaKuTransmitter.sendSignal('B',2,State);
            break;   
           }
         } 
      }
      
      posted in My Project
      arnoldg
      arnoldg
    • RE: My Slim 2AA Battery Node

      Is there some one who have lying around several boards, who can share them with me.
      i'm from the netherlands, and for now i only need 5 to 6 boards, not 30 🙂

      so i hope i could take over a couple from someone.

      posted in My Project
      arnoldg
      arnoldg
    • Setting up mysensor and mysensor gateway

      Hello,

      I have 2 arduino mini pro boards, both are hooked with an nrf24l01 and level shifter in between.

      when i startup the gateway board.
      i get this output on the serial port.

      0;0;3;0;9;gateway started, id=0, parent=0, distance=0
      0;0;3;0;14;Gateway startup complete.

      next i powerup the sensor board, a simpel push button sketch is loaded i get the following data on the gateway.

      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;

      sometimes when i connect digital pin 3 to gnd it send's something and somtimes not.
      but there is no differens in the sended data, so it looks to mee that there is somthing wrong, but i don't know what.

      below are some lines that where sended after connecting and disconecting pin 3 to ground.

      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;
      0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;

      posted in Troubleshooting
      arnoldg
      arnoldg