Navigation

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

    Posts made by micah

    • RE: 💬 Smart Alarm Clock

      Another thing that I've thought of is removing the RTC module completely since we can query the time from the server periodically.

      This would save components and pins, but it would limit the clock to only working with the controller, whereas the current design allows it to run independently

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      The method Check_KeyPad (Line 300) handles the buttons.
      Currently my buttons do the following

      • show/program alarm
      • hour
      • minute
      • turn alarm on and off
      • turn on or off nightlight
      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      @dbemowsk
      To use a 24 hour clock switch the following bool

      bool Screen_HourFormat24 = false;
      

      I think I used the colon to signify that an alarm was set, I think I flashed it on and off. in the Update_Screen method

         if ((Alarm1_Enabled) && (!Keys_ShowAlarmOnScreen)){
            if(Screen_ClockPoint)ledScreen.point(POINT_ON);
            else ledScreen.point(POINT_OFF);
          } else
            ledScreen.point(POINT_ON);
      
      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      I often wish our fancy mysensor nRF chips only used 1 arduino wire 😞

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      I found a library online.... #include <AnalogMatrixKeypad.h>

      I made some modifications (although I can't quite remember what they were), I think about the number of buttons, or combinations, or target values.

      But generally the library provided the 1 wire, resistor ladder and debouncing functionality I needed

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      @Nca78
      exactly correct.

      I originally went with the same resistor value so that it was easy. But then when I thought about how many button combinations I wanted (thinking about a real clock where you hold down the alarm set button then press the hour button) I went with different values.

      My implementation still isn't perfect, since I'm a bloody amateur... lol. I think 1 or 2 of the combinations I never got working.

      But for the most part it accomplished what I wanted... provided many buttons and combinations on a single input pin, since I was quickly running out of them

      posted in OpenHardware.io
      micah
      micah
    • RE: What did you build today (Pictures) ?

      Here is a project I finished this weekend.... 5m LED strip controller (the cover is off for the photo)
      0_1508764628331_IMG_20170317_175657100.jpg

      I think you can say I've come quite far since my first ever arduino build... lol
      0_1508764679200_2016-02-09-21h05m49-[DSC_0001].jpg

      posted in General Discussion
      micah
      micah
    • RE: RGB LED strip

      Here is a photo of my actual device with the cover off

      0_1508763006582_IMG_20170317_175657100.jpg

      posted in My Project
      micah
      micah
    • RE: RGB LED strip

      @maghac Great project.

      I've made something similar, Arduino Pro Mini 5v, 5m LED strip (non-addressable), nrf24L01+ and MOSTFETs

      I know it took me awhile to find code examples, so I figured I would share my code incase it helps anyone else.

      I use Domoticz as a controller. This code talks to:

      • Switch - to control turning my color cycle fade effect on
      • Dimmer - to control the speed of the color cycle fade effect
      • RGB switch - to control having only a single color turned on and the brightness of the string.

      Much of my code is standard stuff, using FastLED analogue, but I'm particularly proud of the brightness part, since I bashed my head against the keyboard several times trying to figure it out

      //## INCLUDES ##
      #define MY_DEBUG
      #define MY_RADIO_NRF24
      #define MY_NODE_ID 20
      
      #include <MySensors.h>
      #include <SPI.h>
      #include <FastLED.h>
      
      #define cID_RGB_SELECTOR 0
      #define cID_CYCLE_EFFECT 1
      #define cID_CYCLE_EFFECT_SPEED 2
      
      #define PIN_RED   5
      #define PIN_GREEN 6
      #define PIN_BLUE  3
      
      //## VARIABLES ##
      // MySensors
      #define MySensors_SketchName      "RGB LED Strip"
      #define MySensors_SketchVersion   "v0.3"
      MyMessage MySensors_MSG_Last_Color(cID_RGB_SELECTOR,V_VAR1);
      MyMessage MySensors_MSG_RGB_Selector(cID_RGB_SELECTOR, V_LIGHT);
      MyMessage MySeonsors_MSG_CYCLE_EFFECT(cID_CYCLE_EFFECT, V_LIGHT);
      MyMessage MySensors_MSG_CYCLE_EFFECT_SPEED(cID_CYCLE_EFFECT_SPEED, V_DIMMER);
      bool MySensors_RequestACK = false;
      // Single color
      int Solid_RGB_Active=0;
      char Solid_RGB_Color[] = "000000";
      uint16_t Solid_RGB_Brightness = 0xFF;
      // Cycle effect
      int Cycle_Effect_Active=0;
      unsigned long Cycle_Effect_pMillis = 0;
      long Cycle_Effect_Speed = 20;
      static uint8_t Cycle_Effect_Current_Hue;
      // Supporting
      bool Status_Change = false;
      bool Print_Debug = false;
      
      // ## Primary flow control
      void setup() {
        Serial.begin(115200);
        while (!Serial) ;
        Serial.print("compiled: ");Serial.print(__DATE__);Serial.println(__TIME__);
      
        pinMode(PIN_RED,   OUTPUT);
        pinMode(PIN_GREEN, OUTPUT);
        pinMode(PIN_BLUE,  OUTPUT);
      
        Event_ColorTestBars();
      
        request(cID_RGB_SELECTOR, V_VAR1);
        request(cID_RGB_SELECTOR, V_LIGHT);
        request(cID_CYCLE_EFFECT, V_LIGHT);
        request(cID_CYCLE_EFFECT_SPEED, V_DIMMER);
      }
      void loop() {
        if (Cycle_Effect_Active == 1){
          unsigned long currentMillis = millis();
          Event_RunCycleEffect(currentMillis);
        } else if (Status_Change){
          Status_Change = false;
            #ifdef MY_DEBUG
              if (Print_Debug) {Serial.println("STATUS CHANGE");}
            #endif
          if (Solid_RGB_Active == 0){
            Event_SetLEDColors( CRGB::Black );
          }else if (Solid_RGB_Active == 1){
            CHSV colorHSV = rgb2hsv_approximate(str2CRGB(Solid_RGB_Color));
            Event_SetLEDColors(CHSV(colorHSV.h, colorHSV.s, Solid_RGB_Brightness));
          }
        }
      }
      // ## MySensors Methods
      void presentation()  {
        sendSketchInfo(MySensors_SketchName, MySensors_SketchVersion);
      
        present(cID_RGB_SELECTOR, S_RGB_LIGHT, "RGB Color Selector", MySensors_RequestACK);
        present(cID_CYCLE_EFFECT, S_LIGHT, "RGB Cycle Effect", MySensors_RequestACK);
        present(cID_CYCLE_EFFECT_SPEED, S_DIMMER, "RGB Cycle Effect Speed", MySensors_RequestACK);
      }
      void receive(const MyMessage &message){
        #ifdef MY_DEBUG
          if (message.isAck()){
            Serial.println("Got ack from gateway");
          }
        #endif
        if (message.type == V_LIGHT){
          #ifdef MY_DEBUG
            if (Print_Debug) {Serial.println("message v_light");}
          #endif
          int current_Light_State = message.getString()[0] == '1';// Incoming on/off command sent from controller ("1" or "0")
          if (message.sensor==cID_CYCLE_EFFECT){// is Cycle Message
            if (current_Light_State==1){//turn cycle on
              Event_LightCycle(true, true, false);
              Event_SolidColor(false, false, true);
            } else {//turn cycle off
              Event_LightCycle(false, true, false);
              Event_SolidColor(false, false, true);
            }
          } else if (message.sensor==cID_RGB_SELECTOR){// is RGB Message
            if (current_Light_State==1){//turn RGB on
              Event_SolidColor(true, true, false);
              Event_LightCycle(false, false, true);
            } else {//turn RGB off
              Event_SolidColor(false, true, false);
              Event_LightCycle(false, false, true);
            }
          } else {
            #ifdef MY_DEBUG
              Serial.print("UNKNOWN Light - Message:");
              Serial.print(message.getString());
              Serial.print(" - Sensor:");
              Serial.println(message.sensor);
            #endif
          }
        } else if (message.type == V_RGB){
          #ifdef MY_DEBUG
            if (Print_Debug) {Serial.println("message v_rgb");}
          #endif
          String szMessage=message.getString();
          strcpy(Solid_RGB_Color, getValue(szMessage,'&',0).c_str());
          Solid_RGB_Active = 1;
        }else if (message.type == V_DIMMER) {// if DIMMER type, adjust brightness
          #ifdef MY_DEBUG
            if (Print_Debug) {Serial.println("message v_dimmer");}
          #endif
          if (message.sensor==cID_RGB_SELECTOR){// is single Message
            if (Solid_RGB_Active==1){//turn RGB on
              Event_SolidColor(true, true, false);
              Event_LightCycle(false, false, true);
            } else {//turn RGB off
              Event_SolidColor(false, true, false);
              Event_LightCycle(false, false, true);
            }
            Solid_RGB_Brightness = map(message.getLong(), 0, 100, 0, 255);
            CRGB colorRGB = str2CRGB(Solid_RGB_Color);
            CHSV colorHSV = rgb2hsv_approximate(colorRGB);
            colorHSV = CHSV(colorHSV.h, colorHSV.s, Solid_RGB_Brightness);
            Event_SetLEDColors(colorHSV);
            #ifdef MY_DEBUG
              if (Print_Debug) {
                Serial.print("colorHSV.h:");
                Serial.println(colorHSV.h);
                Serial.print("colorHSV.s:");
                Serial.println(colorHSV.s);
                Serial.print("colorHSV.v:");
                Serial.println(colorHSV.v);
              }
            #endif
            Event_SendLastColor();
          } else if (message.sensor==cID_CYCLE_EFFECT_SPEED){// is Speed dimmer Message
            Cycle_Effect_Speed = map(message.getLong(), 0, 100, 1, 202);
            #ifdef MY_DEBUG
              if (Print_Debug) {
                Serial.print("Cycle_Effect_Speed: ");
                Serial.println(Cycle_Effect_Speed);
              }
            #endif
          }
        }else if (message.type == V_STATUS) {           // if on/off type, toggle brightness
          #ifdef MY_DEBUG
            if (Print_Debug) {Serial.println("message v_status");}
          #endif
          Solid_RGB_Active = message.getInt();
          Cycle_Effect_Active = 0;
          if (Solid_RGB_Active == 0){
            if (Print_Debug) {Serial.println("Strip OFF");}
            Event_SetLEDColors( CRGB::Black );
          }else{
            if (Print_Debug) {Serial.println("Strip ON");}
            Event_SetLEDColors(strtol(Solid_RGB_Color, NULL, 16));
          }
          //Event_SendLastColor();
        }else if (message.type==V_VAR1) {            // color status
          String szMessage=message.getString();
          #ifdef MY_DEBUG
            if (Print_Debug) {
              Serial.println("message v_var1");
              Serial.println(szMessage);
            }
          #endif
          strcpy(Solid_RGB_Color, getValue(szMessage,'&',0).c_str());
          Solid_RGB_Active = 1;
          Cycle_Effect_Active = 0;
        }
        Status_Change = true;
      }
      // ## Events
      void Event_LightCycle(bool t, bool s, bool u) {
        Cycle_Effect_Active = (t) ? 1 : 0;
        if (u){
          send(MySeonsors_MSG_CYCLE_EFFECT.set(Cycle_Effect_Active),MySensors_RequestACK);
        }
      }
      void Event_SolidColor(bool t, bool s, bool u) {
        Solid_RGB_Active = (t) ? 1 : 0;
        if (u){
          send(MySensors_MSG_RGB_Selector.set(Solid_RGB_Active),MySensors_RequestACK);
        }
      }
      void Event_SetLEDColors( const CRGB& rgb){
        analogWrite(PIN_RED,   rgb.r );
        analogWrite(PIN_GREEN, rgb.g );
        analogWrite(PIN_BLUE,  rgb.b );
      }
      void Event_SendLastColor(){
        String current_status=Solid_RGB_Color+String("&")+String(Solid_RGB_Brightness)+String("&")+String(Solid_RGB_Active);
        send(MySensors_MSG_Last_Color.set(current_status.c_str()),MySensors_RequestACK);
      }
      void Event_RunCycleEffect(unsigned long theMills){
        if (theMills - Cycle_Effect_pMillis >= Cycle_Effect_Speed){
          Cycle_Effect_pMillis = theMills;
          Cycle_Effect_Current_Hue = Cycle_Effect_Current_Hue + 1;
          Event_SetLEDColors( CHSV( Cycle_Effect_Current_Hue, 255, 255) );
        }
      }
      void Event_ColorTestBars(){// Event_ColorTestBars: flashes Red, then Green, then Blue, then Black. Helpful for diagnosing if you've mis-wired which is which.
        Event_SetLEDColors( CRGB::Red );   delay(500);
        Event_SetLEDColors( CRGB::Green ); delay(500);
        Event_SetLEDColors( CRGB::Blue );  delay(500);
        Event_SetLEDColors( CRGB::Black ); delay(500);
      }
      // ## Helper Functions
      String getValue(String data, char separator, int index){
       int found = 0;
        int strIndex[] = {0, -1};
        int maxIndex = data.length()-1;
        for(int i=0; i<=maxIndex && found<=index; i++){
          if(data.charAt(i)==separator || i==maxIndex){
            found++;
            strIndex[0] = strIndex[1]+1;
            strIndex[1] = (i == maxIndex) ? i+1 : i;
          }
        }
        return found>index ? data.substring(strIndex[0], strIndex[1]) : "";
      }
      int x2i(char *s) {
        int x = 0;
        for(;;) {
          char c = *s;
          if (c >= '0' && c <= '9') {
            x *= 16;
            x += c - '0';
          }else if (c >= 'A' && c <= 'F') {
            x *= 16;
            x += (c - 'A') + 10;
          }else {
            break;
          }
          s++;
        }
        return x;
      }
      char* str2char(String command){
          if(command.length()!=0){
              char *p = const_cast<char*>(command.c_str());
              return p;
          }
      }
      CRGB str2CRGB(String s){
        String r = str2char(s.substring(0,2));
        String g = str2char(s.substring(2,4));
        String b = str2char(s.substring(4,6));
        uint8_t red = x2i(r.c_str());
        uint8_t green = x2i(g.c_str());
        uint8_t blue = x2i(b.c_str());
        #ifdef MY_DEBUG
          if (Print_Debug) {
            Serial.print("r:");
            Serial.println(r);
            Serial.print("g:");
            Serial.println(g);
            Serial.print("b:");
            Serial.println(b);
            Serial.print("red:");
            Serial.println(red);
            Serial.print("green:");
            Serial.println(green);
            Serial.print("blue:");
            Serial.println(blue);
          }
        #endif
        CRGB colorRGB = CRGB(red, green, blue);
        return colorRGB;
      }
      

      Hopefully this proves useful to someone 🙂

      posted in My Project
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      Hey everyone.

      Sorry, had a computer crash and file loss issue a few months ago.

      I can't find my final code file, but I did find an older version (incomplete) called ClockRebuild.ino and I uploaded it to the project.

      Hopefully that helps

      One day I'll come back and truly finish this project, life just keeps getting in the way

      posted in OpenHardware.io
      micah
      micah
    • RE: RGB LED strip controller with FastLED

      @gohan maybe, I don't know, I only pretend to be an electrical engineer in my spare time... Lol

      posted in My Project
      micah
      micah
    • RE: RGB LED strip controller with FastLED

      Yeah I usually use some 78xx variant

      posted in My Project
      micah
      micah
    • RE: Hacking a remote control Hunter ceiling fan controller

      I'm actually working on something similar right now. I also ripped apart my remote control.

      Originally I was planning on getting a radio transceiver set to read and then mimic the remote codes, but I couldn't get it working.

      So instead I'm in the process of connecting the remote board Frankenstein style to an arduino with transistors and stuff.

      The remote board has contact patches for all the buttons, and if you connect them to ground it triggers that specific button.

      So my final build will have the remote control board, a pro mini, nrf and other parts all cobbled together and stuck in a box on my nightstand. From there I can use my phone domoticz app to control anything.

      I'm also adding a temperature sensor so I can automatically control the fan based on room temperature.

      posted in My Project
      micah
      micah
    • RE: Converting a wifi outlet to an nRF24 MySensors device

      It may have been this project I forked, I can't remember https://github.com/Danimal4326/homebridge-ecoplug

      posted in My Project
      micah
      micah
    • RE: Converting a wifi outlet to an nRF24 MySensors device

      I have the same plugs (Eco Plug I think)

      I use domoticz on a raspberry pi for my mysensors and other stuff.

      I didn't hack mine, I just forked a homebridge plugin (it was either python or node based, I can't remember) and got it working on my domoticz

      posted in My Project
      micah
      micah
    • RE: RGB LED strip controller with FastLED

      @pansen I've burned out a couple nano's and pro mini's by supplying what was supposedly 12v from a wall wart.

      So I would advise using a linear voltage regulator

      posted in My Project
      micah
      micah
    • RE: My basement flooding alarm

      Nice build, and great idea using the ultra sonic sensor.

      This sort of thing was the exact reason I got into arduino and eventually mysensors. I had a concern about a damp basement and went looking for a water leak detection alarm but the prices were so high at the time... eventually I stumbled upon arduino and the obsession went from there.

      The first node I ever made was a water leak detection system that used the 4cm thing mentioned above... then I realized I had all these left over pins 😉 so I filled them up with a gas, flame, temperature, humidity and light sensor.

      Forget nest protect and commercial water leak detection systems... I now have an all in one DIY solution that probably only cost $30

      posted in My Project
      micah
      micah
    • RE: Fire pit RGB striplight controller

      @Boots33

      I've fried a couple pro mini's and a nano running 12v to the vin/raw... actually in one case it might have been up to 15v .... oops.

      But I've since learned my lesson.... I now use a Linear Voltage Regulator between the source and the arduino for all my builds that have a higher voltage power source (i.e.: builds that run lights). Typically a L7805CV or L7809CV or L7810CV (or other) depending on the voltage of my source and what I want to send to the arduino.

      Here is an example L7809CV from AliExpress

      posted in My Project
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      I've finally settled on an enclosure design for my first (of 3) clock. This one is for my 10 year old son, I think he's going to love it.

      I originally found this on pintrest....

      fake bomb clock
      Fake bomb clock

      I'm going to use the bomb idea but modify it to fit all my existing design elements.

      I'm currently awaiting some parts from aliexpress and I'm still trying to find materials for the dynamite sticks. Hopefully I'll have everything I need soon so I can start to build it

      posted in OpenHardware.io
      micah
      micah
    • RE: Pro mini

      @Oitzu said:

      The RAW pin runs into the oboard voltage regulator and can be feed 3.3V - 12V (Be aware that most china clones don't withstand the full 12V)

      I can attest to this fact, since in the last few weeks I fried 3 clones building my 12v led controller before realizing they just can't handle 12v on the raw/vcc pin.

      posted in Hardware
      micah
      micah
    • RE: How can I get Arduino working even it can not connect with Gate Way?

      I'm looking for an answer to this too... My nodes sometimes have trouble connecting on boot... And it seems like they won't do anything until they make the connection to the gateway.

      Is there an api function I'm missing that lets the node continue attempting to connect in the background after x number of tries while still letting the node do it's own work?

      posted in My Project
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      Eventually I'm going to make a case/enclosure for it.

      I don't want to make it boring, like a basic alarm clock rectangle.... instead I want to build it into something... kinda like this stereo in a mannequin I found on Pinterest
      alt text

      or like this clock in an NES
      alt text

      Although since it's for kids I'll probably use a toy dinosaur or something

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      @petewill

      Don't we all have a list that is too long.

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      @hek

      I welcome the challenge 🙂

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      @hek
      thanks!!!!

      I've got a bunch of other things I want to add to it...

      I'm really excited about adding @petewill 's Bed-Occupancy-Sensor... I've got two kids (and I'm planning on building them both a clock)... and they are at my house 50% of the time... so I want the alarms to go off on school days, but only when they are at my house.

      So I plan on using the bed occupancy sensor to cancel the alarm if no one is in the bed.

      On the flip side, if the kid turns off the alarm, but doesn't get out of bed within a set amount of time, I want the alarm to go off again... kinda like a forced snooze.

      I also want to add an SD card and mini amplifier (LM386) so I can play their favorite song as the wake-up music... but I've got to wait for my aliexpress order of the LM386 to arrive (in 30 to 60 days...lol)

      posted in OpenHardware.io
      micah
      micah
    • RE: 💬 Smart Alarm Clock

      @hek
      Thanks!!!

      I've been stalking the forum and asking beginner questions for at least a year now... I've learned so much and am so grateful for everyone's help... Now I've finally got a project close to completion, so I thought it was about time to try and give back 🙂

      Plus by sharing, the super smart forum members like yourself will probably tell me where I messed and could have done better... lol

      posted in OpenHardware.io
      micah
      micah
    • RE: How to send updated V_TEXT/S_INFO to controller?

      @hek

      Oh, I didn't know I needed to use both.

      Well I tried a million combinations after seemingly reading everything on the subject, and I still couldn't get {int + char + int} converted into a char[] using strcpy and strcat

      for some reason my brain is just not wrapping itself around the concept today... maybe I'll come back to it tomorrow.

      In the mean time, I tried the following and it worked.

      char buf[20];    
      sprintf(buf, "%d.%d", Alarm1_Time_Local[0], Alarm1_Time_Local[1]);
      send(MySensors_MSG_Alarm1_Time.set(buf), true);
      

      I've read that using sprintf increases the size of your sketch... but for now I'm fine with it, since it works and I can move on to being creative and productive.. lol

      posted in Troubleshooting
      micah
      micah
    • RE: How to send updated V_TEXT/S_INFO to controller?

      @hek
      Ok, I think I understand what you are saying, but I can't figure out the implementation.

      This didn't work

      char temp_Msg[3];
      strcpy (temp_Msg, char("1"));
      strcpy (temp_Msg, char("."));
      strcpy (temp_Msg, char("1"));
      send(MySensors_MSG_Alarm1_Time.set(temp_Msg), true);
      

      or this

      char temp_Msg[3];
      strcpy (temp_Msg, "1");
      strcpy (temp_Msg, ".");
      strcpy (temp_Msg, "1");
      send(MySensors_MSG_Alarm1_Time.set(temp_Msg), true);
      

      or this

      char temp_Msg[3];
      strcpy (temp_Msg, '1');
      strcpy (temp_Msg, '.');
      strcpy (temp_Msg, '1');
      send(MySensors_MSG_Alarm1_Time.set(temp_Msg), true);
      

      But this does work (message is sent and loaded into Domoticz)

      send(MySensors_MSG_Alarm1_Time.set("1.1"), true);
      

      What am I not understanding?

      posted in Troubleshooting
      micah
      micah
    • How to send updated V_TEXT/S_INFO to controller?

      I'm working on an alarm clock... my controller is Domotiocz. I'm using a text sensor to send the alarm time to my arduino.... the following post helped me get it all working properly -> lcd-clock-and-text-sensor-node-with-new-v_text

      My clock also has buttons (like a traditional alarm clock), I've written all the code to change the alarm using the buttons.

      Now I want to send the new alarm time set on the arduino to the controller (Domoticz), and have the text sensor updated. I thought this would simply be a send(....) command, but I can't get it working.

      Here is a sub-set sample code of what I thought I needed to do to send the update (I'm on mysensors 2.0.*)

      #define MY_DEBUG 
      #define MY_RADIO_NRF24
      #define MY_NODE_ID 9
      #include <SPI.h>
      #include <MySensors.h>
      #define cID_ALARM_TIME 1
      
      MyMessage MySensors_MSG_Alarm1_Time(cID_ALARM_TIME, V_TEXT);
      
      void setup() {
      	Serial.begin(115200);
      
      	request(cID_ALARM_TIME, V_TEXT);
      }
      void presentation()  {
      	sendSketchInfo("WakeUp Clock", "0.0.1");
      	
      	present(cID_ALARM_TIME, S_INFO, "Alarm Time", true);
      }
      void loop() {
      
      	int newHour = 12;
      	int newMinute = 45;
      
      	String val = String(newHour) + "." + String(newMinute);
      
      	send(MySensors_MSG_Alarm1_Time.set(val), true);
      }
      void receive(const MyMessage &message) {
      	if (message.type==V_TEXT) {
      		if (message.sensor == cID_ALARM_TIME){
      			// Here is where the return value comes from Domoticz when requesting the V_TEXT
      		}
      	}
      }
      

      When I run it I get the following console message....

      35287 TSF:MSG:SEND,9-9-0-0,s=1,c=1,t=47,pt=1,l=1,sg=0,ft=0,st=OK:1
      35297 TSF:MSG:READ,0-0-9,s=1,c=1,t=47,pt=1,l=1,sg=0:1
      35302 TSF:MSG:ACK
      

      and then my controller (Domoticz) updates the text sensor to the value of 1

      I'm very confused, please help 🙂

      posted in Troubleshooting
      micah
      micah
    • RE: Having trouble getting 2.0.1-beta running on Raspberry Pi2 as gateway and controller

      UPDATE

      I think it's a problem with the arduino board itself.

      So since my previous posts I've tried multiple radios and I've got a 4 working nodes now:

      1. Mega + NRF24
      2. UNO R3 + NRF24
      3. DCcEle (clone) + NRF24
      4. Nano DCCduino (clone) + NRF24

      Plus the Raspberry Pi 2 as gateway with NRF24L01+ PA/LNA is working.

      So... it seems like it's a problem with that Uno board.... weird.

      I've tried multiple radios (specifically ones that worked on the other boards) and none of them work. Like I said before, the board and the Rp2 seem to be communication but not properly.

      Has anyone ran into a similar problem before?

      posted in Troubleshooting
      micah
      micah
    • RE: Having trouble getting 2.0.1-beta running on Raspberry Pi2 as gateway and controller

      Just tried a few more things...

      1. added irq pin 15 to Rp2, then rebuild with the following --- CHECK
      ./configure --my-gateway=serial --my-rf24-pa-level=RF24_PA_LOW --my-rf24-irq-pin=15
      
      1. soldered decoupling capacitor to both radios (previously they were jammed into the wires) --- CHECK
      2. rechecked all wires --- CHECK
      posted in Troubleshooting
      micah
      micah
    • RE: Having trouble getting 2.0.1-beta running on Raspberry Pi2 as gateway and controller

      Other things I've tried....

      1. make sure the connections are good --- CHECK
      2. make sure there is enough distance --- CHECK (about 15 feet)
      3. cleareepron on node and reload code --- CHECK
      4. test with two arduinos -- CHECK (I setup another arduino with a radio as a gateway and it communicated properly with the node described above)

      Also, I'm using a fresh download of the mysensor libraries... from yesterday on both the Rp2 and my arduino

      posted in Troubleshooting
      micah
      micah
    • Having trouble getting 2.0.1-beta running on Raspberry Pi2 as gateway and controller

      I think I've read every topic on this so far and I must have tried every combination.... and I'm stuck, so I'm hoping someone can see my mistake and help me get this sorted

      Here is how I setup MySensors on my Raspberry Pi 2 - I followed the guide to install the NRF24L01+ PA/LNA radio with 4.7µ decoupling (and it previously worked on version 1.4 of mysensors)

      Here is the contents of my mysGateway.cpp

      #include <iostream>
      #include <cstdio>
      #include <unistd.h>
      #define MY_LINUX_CONFIG_FILE "/etc/mysensors.dat"
      #define MY_GATEWAY_MAX_CLIENTS 20
      #define MY_IS_SERIAL_PTY
      #define MY_LINUX_SERIAL_PTY "/dev/ttyMySensorsGateway"
      #define MY_LINUX_SERIAL_GROUPNAME "tty"
      #include <MySensors.h>
      void setup() {}
      void presentation() {}
      void loop() {}
      

      Here is how I make and then monitor it

      ./configure --my-gateway=serial --my-rf24-pa-level=RF24_PA_LOW
      sudo make all
      sudo make install
      sudo ./examples_linux/mysGateway -d
      

      Here is my Arduino Node code - It's a simple Uno with a DHT sensor and an NRF24L01+ radio with 4.7µ decoupling

      #define MY_DEBUG
      #define MY_RADIO_NRF24
      #define MY_NODE_ID 5
      #define MY_PARENT_NODE_ID 0
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DHT.h>  
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define HUMIDITY_SENSOR_DIGITAL_PIN 5
      
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      unsigned long pMillis_DHT = 0;
      long sCheck_DHT = 10000;
      
      bool requestACK = false;
      
      void setup(){ 
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
        metric = getConfig().isMetric;
      }
      void presentation(){ 
        // Send the Sketch Version Information to the Gateway
        sendSketchInfo("Just Temperature and Humidity", "0.1");
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM, "DHT22 Humidity", requestACK);
        present(CHILD_ID_TEMP, S_TEMP, "DHT22 Temperature", requestACK);
      }
      
      void loop(){  
        unsigned long currentMillis = millis();
       
        // Check Temp and Humidity
        if (currentMillis - pMillis_DHT >= sCheck_DHT){
          pMillis_DHT = currentMillis;
          
          float temperature = dht.getTemperature();
          if (isnan(temperature)) {
              Serial.println("Failed reading temperature from DHT");
          } else if (temperature != lastTemp) {
            lastTemp = temperature;
            if (!metric) {
              temperature = dht.toFahrenheit(temperature);
            }
            send(msgTemp.set(temperature, 1));
            #ifdef MY_DEBUG
            Serial.print("T: ");
            Serial.println(temperature);
            #endif
          }
          
          // Fetch humidity from DHT sensor
          float humidity = dht.getHumidity();
          if (isnan(humidity)) {
              Serial.println("Failed reading humidity from DHT");
          } else if (humidity != lastHum) {
              lastHum = humidity;
              send(msgHum.set(humidity, 1));
              #ifdef MY_DEBUG
              Serial.print("H: ");
              Serial.println(humidity);
              #endif
          }
        }
      }
      

      So far I thought I was doing everything correctly.... but here is my debug output

      On Gateway (Rp2) -The last 6 lines continue to repeat

      mysGateway: Starting gateway...
      mysGateway: Protocol version - 2.0.1-beta
      mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta
      mysGateway: TSF:LRT:OK
      mysGateway: TSM:INIT
      mysGateway: TSM:INIT:TSP OK
      mysGateway: TSM:INIT:GW MODE
      mysGateway: TSM:READY
      mysGateway: MCO:REG:NOT NEEDED
      mysGateway: MCO:BGN:STP
      mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
      mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysGateway: TSF:MSG:BC
      mysGateway: TSF:MSG:FPAR REQ,ID=5
      mysGateway: TSF:CKU:OK,FCTRL
      mysGateway: TSF:MSG:GWL OK
      mysGateway: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
      mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      mysGateway: TSF:MSG:PINGED,ID=5,HP=1
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
      mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      mysGateway: TSF:MSG:PINGED,ID=5,HP=1
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
      mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      mysGateway: TSF:MSG:PINGED,ID=5,HP=1
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
      mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      mysGateway: TSF:MSG:PINGED,ID=5,HP=1
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
      mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysGateway: TSF:MSG:BC
      mysGateway: TSF:MSG:FPAR REQ,ID=5
      mysGateway: TSF:CKU:OK,FCTRL
      mysGateway: TSF:MSG:GWL OK
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysGateway: TSF:MSG:BC
      mysGateway: TSF:MSG:FPAR REQ,ID=5
      mysGateway: TSF:CKU:OK,FCTRL
      mysGateway: TSF:MSG:GWL OK
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysGateway: TSF:MSG:BC
      mysGateway: TSF:MSG:FPAR REQ,ID=5
      mysGateway: TSF:CKU:OK,FCTRL
      mysGateway: TSF:MSG:GWL OK
      mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysGateway: TSF:MSG:BC
      mysGateway: TSF:MSG:FPAR REQ,ID=5
      mysGateway: TSF:CKU:OK,FCTRL
      mysGateway: TSF:MSG:GWL OK
      
      

      On Arduino Node

      0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.0.1-beta
      4 TSM:INIT
      10 TSM:INIT:TSP OK
      12 TSM:INIT:STATID=5
      14 TSF:SID:OK,ID=5
      15 TSM:FPAR
      51 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      504 TSF:MSG:READ,0-0-5,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      508 TSF:MSG:FPAR PREF
      510 TSF:MSG:FPAR OK,ID=0,D=1
      514 TSM:FPAR:OK
      515 TSM:ID
      516 TSM:ID:OK
      518 TSM:UPL
      553 !TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      2562 TSM:UPL
      2567 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=OK:1
      4574 TSM:UPL
      4576 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      6584 TSM:UPL
      6620 !TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1
      8628 !TSM:UPL:FAIL
      8629 TSM:FPAR
      8666 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
      10673 !TSM:FPAR:NO REPLY
      10675 TSM:FPAR
      10711 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      12719 !TSM:FPAR:NO REPLY
      12721 TSM:FPAR
      12756 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      14765 !TSM:FPAR:NO REPLY
      14767 TSM:FPAR
      14802 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      

      So I'm totally confused by these messages... it seems like they are hearing each other but are having trouble communicating properly.

      HELP!!!

      posted in Troubleshooting
      micah
      micah
    • RE: My NRF24 Gateway and Nodes were working fine for 2 days then everything stopped!!!

      @sundberg84 said:

      Hard to say. St:fail generally means that you don't get ack from the receiver. This is normally range, power or hardware. There is not a general fix for this but you need to try and learn... i admit its strange I worked for some days. Maybe a radio fried ?

      Don't have the radios to close to eachother. Try a.couple of meters.
      Sorry I'm out of more solid ideas.

      Hey sundberg84, quick question for you.

      If you look at my debug logs above it looks like the gateway is infact receiving the message but the node thinks it fails. Con you confirm my interpretation of the following two lines?

      NODE DEBUG
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      
      GATEWAY DEBUG
      0;255;3;0;9;read: 42-42-0 s=1,c=1,t=0,pt=7,l=5,sg=0:20.0
      

      If that's correct, could that change what the issue might be?

      posted in Troubleshooting
      micah
      micah
    • RE: My NRF24 Gateway and Nodes were working fine for 2 days then everything stopped!!!

      @sundberg84 said:

      Hard to say. St:fail generally means that you don't get ack from the receiver. This is normally range, power or hardware. There is not a general fix for this but you need to try and learn... i admit its strange I worked for some days. Maybe a radio fried ?

      Don't have the radios to close to eachother. Try a.couple of meters.
      Sorry I'm out of more solid ideas.

      Thanks so much for all your suggestions so far.

      I'll try the couple of meter thing tonight.

      I've got a 10pk of radios and 1 long range one. I'll try combinations of all of them.

      If those don't work then I'm stumped. I'll report back once I've tried those things

      posted in Troubleshooting
      micah
      micah
    • RE: My NRF24 Gateway and Nodes were working fine for 2 days then everything stopped!!!

      @sundberg84 I just can't figure out how a gateway and two nodes were working fine for days (plugged in the wall) and passing data every minute to my OpenHAB and the just instantly stop

      posted in Troubleshooting
      micah
      micah
    • RE: My NRF24 Gateway and Nodes were working fine for 2 days then everything stopped!!!

      @sundberg84 thanks for the tips.

      I just got my "decoupling capacitor of 4.7uF" in the mail today, installed them, and nothing.

      Other than that I've tried everything:

      • Different UNOs
      • Different radios
      • Re-downloaded mysensors dev
      • Using usb cables directly into my Mac
      • Re-uploaded code
      • Tried with just a standard serialgateway script (with proper wiring)
      • The nodes are 1 feet apart

      Here is what my current testbed looks like:

      • Mac > Uno > NRF24L01+ with standard wiring and a 4.7uF (as gateway)
      • Mac > Uno > NRF24L01+ with standard wiring and a 4.7uF (as node)

      First I ran the following on both boards

      #include <EEPROM.h>
      void setup() {
        // initialize the LED pin as an output.
        pinMode(13, OUTPUT);
        for (int i = 0 ; i < EEPROM.length() ; i++) {
          EEPROM.write(i, 0);
        }
        // turn the LED on when we're done
        digitalWrite(13, HIGH);
      }
      void loop() {
      }
      

      Then on the node board I ran the following

      #define MY_CORE_ONLY
      #include <MySensor.h>
      #define NEW_NODE_ID 42 // Change 42 to the new node ID you want
      void setup(){
        Serial.begin(MY_BAUD_RATE);
        Serial.print("Old node ID: ");
        Serial.println(hwReadConfig(EEPROM_NODE_ID_ADDRESS));
        Serial.println("Writing new ID");
        hwWriteConfig(EEPROM_NODE_ID_ADDRESS, NEW_NODE_ID);
        Serial.print("New node ID: ");
        Serial.println(hwReadConfig(EEPROM_NODE_ID_ADDRESS));
      }
      void loop(){
      }
      

      Then I loaded the standard serialgateway code from the 2.0 dev branch which I downloaded yesterday

      #define MY_DEBUG 
      #define MY_RADIO_NRF24
      #define MY_RF24_PA_LEVEL RF24_PA_LOW
      #define MY_GATEWAY_SERIAL
      #define MY_LEDS_BLINKING_FEATURE
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      #define MY_INCLUSION_MODE_FEATURE
      #define MY_INCLUSION_BUTTON_FEATURE
      #define MY_INCLUSION_MODE_DURATION 60 
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      #include <SPI.h>
      #include <MySensor.h>  
      void setup() { 
      }
      void presentation() {
      }
      void loop() { 
      }
      

      Then I loaded this test script onto the node

      #define MY_DEBUG
      #define MY_RADIO_NRF24
      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      #define CHILD_ID_TEMP 1
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      void setup(){ 
      }
      void presentation(){ 
        sendSketchInfo("TEST - Fake Temp", "0.1");
        present(CHILD_ID_TEMP, S_TEMP);
      }
      void loop(){
        send(msgTemp.set(20, 1));
        delay(500);
      }
      

      and here is my result
      Gateway Serial

      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0-beta)
      0;255;3;0;9;Radio init successful.
      0;255;3;0;14;Gateway startup complete.
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0
      0;255;3;0;9;read: 42-42-0 s=1,c=1,t=0,pt=7,l=5,sg=0:20.0
      42;1;1;0;0;20.0
      0;255;3;0;9;read: 42-42-0 s=1,c=1,t=0,pt=7,l=5,sg=0:20.0
      42;1;1;0;0;20.0
      0;255;3;0;9;read: 42-42-0 s=1,c=1,t=0,pt=7,l=5,sg=0:20.0
      42;1;1;0;0;20.0
      0;255;3;0;9;read: 42-42-0 s=1,c=1,t=0,pt=7,l=5,sg=0:20.0
      42;1;1;0;0;20.0
      0;255;3;0;9;read: 42-42-0 s=1,c=1,t=0,pt=7,l=5,sg=0:20.0
      42;1;1;0;0;20.0
      0;255;3;0;9;read and forward: 42-42-255 s=255,c=3,t=7,pt=0,l=0,sg=0
      0;255;3;0;9;send: 0-0-42-42 s=255,c=3,t=8,pt=1,l=1,sg=0,st=fail:0
      

      Node Serial

      Starting sensor (RNNNA-, 2.0.0-beta)
      Radio init successful.
      send: 42-42-0-0 s=255,c=3,t=15,pt=0,l=2,sg=0,st=fail:
      send: 42-42-0-0 s=255,c=0,t=17,pt=0,l=10,sg=0,st=fail:2.0.0-beta
      send: 42-42-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
      send: 42-42-0-0 s=255,c=3,t=11,pt=0,l=16,sg=0,st=fail:TEST - Fake Temp
      send: 42-42-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:0.1
      send: 42-42-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
      find parent
      send: 42-42-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      Init complete, id=42, parent=0, distance=255
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      send: 42-42-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.0
      find parent
      send: 42-42-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      

      I'm stumped

      Is there anything else that could be causing it, or that I could try.

      I doubt this is relevant but the only thing that changed the evening that it broke was that I brought home a new iPhone.... I'm sure it's not relevant but thought I should mention it.

      Also I just ran across this post http://forum.mysensors.org/topic/3608/issues-with-setting-up-my-arduino-nano-serialgateway and thing that it sounds very similar to my issue.

      posted in Troubleshooting
      micah
      micah
    • My NRF24 Gateway and Nodes were working fine for 2 days then everything stopped!!!

      I'm using the dev branch, pulled last Friday

      So I setup an GatewayW5100MQTTClient

      • Uno
      • NRF24 long range
      • W5100 shield
      #include <SPI.h>
      #define MY_DEBUG 
      #define MY_RADIO_NRF24
      #define MY_GATEWAY_MQTT_CLIENT
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      #define MY_MQTT_CLIENT_ID "mysensors-1"
      
      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
        #define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN 14
        #define MY_SOFT_SPI_MISO_PIN 16
        #define MY_SOFT_SPI_MOSI_PIN 15
      #endif  
      
      #define MY_RF24_CE_PIN 5
      #define MY_RF24_CS_PIN 6
      #define MY_IP_GATEWAY_ADDRESS 192,168,2,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      #define MY_CONTROLLER_IP_ADDRESS 192, 168, 2, 3
      #define MY_PORT 1883      
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      
      #include <Ethernet.h>
      #include <MySensor.h>
      void setup() { 
      }
      void presentation() {
      }
      void loop() {
      }
      

      and a node with a temp + hum

      • Uno
      • NRF24
      • DHT**
      #define MY_DEBUG
      #define MY_RADIO_NRF24
      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define HUMIDITY_SENSOR_DIGITAL_PIN 5
      
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      
      unsigned long pMillis_DHT = 0;
      long sCheck_DHT = 60000;
      
      void setup(){ 
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
        metric = getConfig().isMetric;
      }
      void presentation(){ 
        // Send the Sketch Version Information to the Gateway
        sendSketchInfo("Just Temperature and Humidity", "0.1");
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
      }
      
      void loop(){  
        unsigned long currentMillis = millis();
       
        // Check Temp and Humidity
        if (currentMillis - pMillis_DHT >= sCheck_DHT){
          pMillis_DHT = currentMillis;
          
          float temperature = dht.getTemperature();
          if (isnan(temperature)) {
              Serial.println("Failed reading temperature from DHT");
          } else if (temperature != lastTemp) {
            lastTemp = temperature;
            if (!metric) {
              temperature = dht.toFahrenheit(temperature);
            }
            send(msgTemp.set(temperature, 1));
            #ifdef MY_DEBUG
            Serial.print("T: ");
            Serial.println(temperature);
            #endif
          }
          
          // Fetch humidity from DHT sensor
          float humidity = dht.getHumidity();
          if (isnan(humidity)) {
              Serial.println("Failed reading humidity from DHT");
          } else if (humidity != lastHum) {
              lastHum = humidity;
              send(msgHum.set(humidity, 1));
              #ifdef MY_DEBUG
              Serial.print("H: ");
              Serial.println(humidity);
              #endif
          }
        }
      }
      

      Then I got my Raspberry Pi running with OpenHAB and Mosquitto.

      Everything was working great for 2 days. Then around 10pm yesterday it just stopped. I didn't notice it until this afternoon

      What I've tried so far

      • Took off the W5100 shield
      • Swapped the long range radio for another one
      • Swapped the radio on the node
      • Re-uploaded the code that was working
      • Swapped the uno's

      Now here is all I'm getting in the serial monitor of the gateway

      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0-beta)
      0;255;3;0;9;Radio init successful.
      

      and here is what I'm getting from the serial monitor of the node

      Starting sensor (RNNNA-, 2.0.0-beta)
      Radio init successful.
      send: 4-4-0-0 s=255,c=3,t=15,pt=0,l=2,sg=0,st=fail:
      send: 4-4-0-0 s=255,c=0,t=17,pt=0,l=10,sg=0,st=fail:2.0.0-beta
      send: 4-4-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
      send: 4-4-0-0 s=255,c=3,t=11,pt=0,l=25,sg=0,st=fail:Just Temperature and Humi
      send: 4-4-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:0.1
      send: 4-4-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,st=fail:
      find parent
      send: 4-4-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
      send: 4-4-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=fail:
      Init complete, id=4, parent=0, distance=255
      read and drop: 2-2-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      read and drop: 2-2-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      send: 4-4-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=fail:20.7
      T: 20.70
      send: 4-4-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=fail:38.0
      H: 38.00
      

      Note: I also have another sensor node that is sending information

      I'm completely stumped...

      HELP!!!

      posted in Troubleshooting
      micah
      micah
    • RE: Can't get OpenHAB2 to see my MQTT messages

      VICTORY!!!!

      Apparently I just needed to bang my head against the keyboard and randomly try combinations until it worked.

      So to hopefully help other people I'll post how I got it to work.

      OpenHAB: Items

      Number  BasementMonitor_Temp01  "Temperature [%.1f °C]"  		<temperature>   (gC_Furnace, gTemperature)   {mqtt="<[mysensors:mygateway1-out/2/1/1/0/0:state:default]"}
      Number  BasementMonitor_Hum01   "Humidity [%.1f %%]"     		<temperature>   (gC_Furnace, gHumidity)      {mqtt="<[mysensors:mygateway1-out/2/0/1/0/1:state:default]"}
      

      OpenHAB: mqtt.cfg

      mysensors.url=tcp://localhost:1883
      mysensors.clientId=openHAB
      

      OpenHAB: mqtt-persistance.cfg

      broker=mysensors
      

      OpenHAB: mqtt-eventbus.cfg

      broker=mysensors
      stateSubscribeTopic=MyMQTT/stateUpdates/${item}/state
      commandSubscribeTopic=MyMQTT/commandUpdates/${item}/command
      

      Arduino: GatewayW5100MQTTClient

      #define MY_MQTT_CLIENT_ID "mysensors-1"
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      

      So to summarize here are the key parts (I think):

      • Broker = mysensors
      • clientId = openHAB
      • pattern for items = {mqtt="<[mysensors:mygateway1-out/2/0/1/0/1:state:default]"}

      I'm still not sure if the second and third line in the mqtt-eventbus.cfg is correct. I don't have MyMQTT anywhere else, so I think I may try different combinations to see what works.

      posted in OpenHAB
      micah
      micah
    • RE: Arduino + Motorcycle

      @TheoL you are probably completely correct.

      I don't actually plan on building it.... it was just an interesting thought exercise.

      posted in General Discussion
      micah
      micah
    • RE: Arduino + Motorcycle

      I just thought of another great motorcycle project.

      Some sort of GPS tracking + tilt sensor + logging

      posted in General Discussion
      micah
      micah
    • Can't get OpenHAB2 to see my MQTT messages

      So, I thought I finally had everything setup properly, but alas something is still not working.

      Overview

      • MySensors.org 2.0 (downloaded about 3 days ago)
      • OpenHAB 2 (installed yesterday)
      • Raspberry Pi (Rasbian 1.9, updated)
      • Mosquitto (whatever the current version is)

      Devices

      • Sensor with a temperature and humidity sensor
      • I'm using the GatewayW5100MQTTClient on an Arduino Uno with a W5100 shield
      • Raspberry Pi 2 B, which is handling the MQTT broker and OpenHAB

      Status

      • Uno+Sensors+Radio is working properly
      • Gateway+Radio+Ethernet is working properly
      • Mosquitto is working properly
      • openHAB 2 is setup, but it doesn't display the sensor results

      As you can see my Arduino side of things is working properly, here is a sample of the messages I receive on my Raspberry Pi when I type mosquitto_sub -v -t 'mygateway1-out/#'

      mygateway1-out/2/1/1/0/0 19.8
      mygateway1-out/2/0/1/0/1 21.2
      

      I'm hoping someone can help me troubleshoot the following code snippets to figure out what's wrong, I'm pretty sure the issue in between OpenHAB 2 and Mosquitto.

      So here goes.

      OpenHAB: Sitemap

      sitemap belmont label="Main Menu"{
      	Frame {
      		Group item=gSF label="Attic" icon="secondfloor"
      		Group item=gFF label="First Floor" icon="firstfloor"
      		Group item=gGF label="Ground Floor" icon="groundfloor"
      		Group item=gC label="Basement" icon="cellar"	
      		Group item=Garden icon="garden" 
      	}
      	Frame label="Basement Monitor" {
      		Text item=BasementMonitor_Temp01
      		Text item=BasementMonitor_Hum01
          }
      }
      

      OpenHAB: Items

      Group All
      
      // Sensor Types
      Group gTemperature (All) // Contains all temperature sensors
      Group gHumidity (All) // Contains all humidity sensors
      
      // Floor Mappings
      Group gSF           "Attic"   		<secondfloor>
      Group gFF           "First Floor"   <firstfloor>
      Group gGF           "Ground Floor"  <groundfloor>
      Group gC            "Basement"      <cellar>
      Group Garden        "Garden"        <garden>
      
      // Room Mappings
      Group SF_Play       "Play Room"     <corridor>      (gSF)
      Group SF_Office		"Office"   		<office>     	(gSF)
      
      Group GF_Living     "Living Room"   <video>     	(gGF)
      Group GF_Dining     "Dining Room"   <video>     	(gGF)
      Group GF_Kitchen    "Kitchen"       <kitchen>   	(gGF)
      Group GF_Corridor   "Corridor"      <corridor>  	(gGF)
      
      Group FF_Bath       "Bathroom"      <bath>      	(gFF)
      Group FF_Kate       "Kate's Room"   <girl1>    		(gFF)
      Group FF_Jake       "Jake's Room"   <boy1>      	(gFF)
      Group FF_Bed        "Master Bedroom"   	<bedroom>   (gFF)
      Group FF_Corridor   "Corridor"      <corridor>  	(gFF)
      
      Group gC_Furnace    "Furnace Room"  <corridor>     	(gC)
      
      Number  BasementMonitor_Temp01  "Temperature [%.1f °C]"  		<temperature>   (gC_Furnace, gTemperature)   {mqtt="<[MyMQTT-2:mygateway1-out/2/1/1/0/0:state:default]"}
      Number  BasementMonitor_Hum01   "Humidity [%.1f %%]"     		<temperature>   (gC_Furnace, gHumidity)      {mqtt="<[MyMQTT-2:mygateway1-out/2/0/1/0/1:state:default]"}
      

      OpenHAB: mqtt.cfg

      openhab.url=tcp://localhost:1883
      openhab.clientId=MyMQTT-2
      

      OpenHAB: mqtt-persistance.cfg

      broker=openhab
      

      OpenHAB: mqtt-eventbus.cfg

      broker=openhab
      stateSubscribeTopic=MyMQTT-2/stateUpdates/${item}/state
      commandSubscribeTopic=MyMQTT-2/commandUpdates/${item}/command
      

      Help

      What am I doing wrong?

      posted in OpenHAB
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      SUCCESS!!!!

      My new card worked, and my RPi is up and running. Now I just need to install OpenHAB onto it

      0_1460121223196_DSC_0016.JPG

      posted in General Discussion
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      @alexsh1 said:

      @micah I think you can get a Samsung Class 10 microSD card for like $10 or something. I would avoid using a noname card from eBay/Aliexpress. Saves a lot of time.

      BTW - this is hardly RPi's fault, isn't it?

      Your right, it isn't the RPi's fault, although would it kill them to just include an 8gb flash chip on the device

      posted in General Discussion
      micah
      micah
    • RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      @mfalkvidd said:

      I'm unfortunately at about the same level as you. I can compile stuff and do basic troubleshooting, but merging the dev branch with the gateway code is way out of my league.

      There is no way you are at 3.275% knowledge like me... I've seen many of your posts on here and you are at least a 4.532%... lol.... no honestly I've liked your posts and you seem very knowledgeable. You've got to be at least a 84.5% 😉

      posted in Hardware
      micah
      micah
    • RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      Any thoughts on making a version for the 2.0 dev branch?

      I recently switched my in-progress builds to 2.0 and am in the process of "trying" to get my Raspberry Pi2 setup with OpenHab and Mosquito. And the idea of not having to have an ethernet gateway arduino in the mix is appealing to me.

      I would do it myself but I probably only have 3.275% of the required knowledge at this point

      posted in Hardware
      micah
      micah
    • RE: Best value sensors for Carbon Monoxide and Smoke

      @korttoma thanks, but ouch, $37 CAD seems expensive, since I already have real smoke detectors in the house, and since I'm planning 3 of these devices that would be over $110

      I was really hoping the answer would have been something like this MQ-9 😟

      posted in Hardware
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      @the1laz well I have now learned my lesson

      I just picked this up from Best Buy at lunch. Hopefully it'll fix the problem tonight

      0_1460046979551_DSC_0015.JPG

      posted in General Discussion
      micah
      micah
    • Best value sensors for Carbon Monoxide and Smoke

      I've read most of the fabulous and long thread on Air Quality Sensor here in the forum.

      I had a question, and I didn't post it in that thread because I didn't want to de-rail the flow, which seemed to focus a lot on calibration, examples and fabulous technical detail.

      Use Case
      I'm planning on making a combination device that sits on the nightstand and performs all the following:

      • Alarm clock (with remote access, personalized wake-up midi songs, manual and auto snooze i.e.: if you don't get out of bed it rings again)
      • Wake-up light
      • Bed Occupancy Monitor (I'm going to gladly and shamelessly copy petewill's great example
      • Switch/button that will turn on the room light

      Since I'll have wall power for this device I figured it would be really smart to add a Carbon Monoxide and Smoke sensor capabilities, since I'm planning on making one for each of my kids two bedrooms.

      So I've got a simple question, which sensor should I buy?

      I'd like something relatively economical, so not this SainSmart MH-Z14 Infrared Carbon Dioxide Sensor For Arduino... lol

      So should I be looking at a MQ-2, MQ-3, MQ-4, MQ-5, MQ-6, MQ-7, MQ-8, MQ-9, MQ-131, MQ-135, MQ-136, MQ-137, MQ-138, MQ-214, MQ-216, MQ-303a, MQ-306a, MQ-307a, MQ-309a, MG811, AQ-104, AQ-2, AQ-3, AQ-7.... as you can see there are lots of choices.

      I think I know the right answer already, but I'd love to hear the wisdom of the much more advanced crowd here at MySensors

      3... 2... 1... go!

      posted in Hardware
      micah
      micah
    • RE: Arduino + Motorcycle

      @dakipro said:

      ...and I do not want to be distracted while on the bike.

      I completely agree. When I first got my bike 3 years ago I was shocked by how little information the dash provided, there wasn't even a clock!!!

      But now I love that fact, I love riding around having no idea of the time, since when I'm on my bike I'm never in a rush and the journey is the reward

      posted in General Discussion
      micah
      micah
    • RE: Arduino + Motorcycle

      @dakipro said:

      With mysensors I could have motorcycle "online" when it is in the garage, and once it becomes offline, domoticz will check if my phone is still at home and notify my wife. If she is with me on motorcycle, then I can go back for phone, or if she is at home she can maybe contact someone that I am visiting or something (i need to figure this out a bit more :)).

      When I was re-reading this part I actually had a different idea.

      I park my bike in the backyard, since I'm terribly unfortunate and do not have a garage. I only have a Suzuki GS500F, so I'm not really worried about anyone stealing it, but....

      Your solution could easily be turned into a "theft warning" system that communicates to your phone, since your bike shouldn't be leaving your house without you on it.

      posted in General Discussion
      micah
      micah
    • RE: Arduino + Motorcycle

      @dakipro said:

      I was actually thinking on using arduino to notify my wife that I forgot the phone, and another one maybe that I forgot the key in the ignition (with the main lights on, but maybe buzzer can do this as well 🙂 ).

      I think I've figured out the perfect solution to your forgotten phone and keys problem... it comes with several benefits including:

      • Cheap
      • Easily replacable
      • Unobtrusive
      • Can be colour coded for different purposes
      • Only takes 1 minute to build
      • Very power/energy efficient

      ...

      ...

      ...

      0_1460033057338_1eb48064a39155832df4cee00f8db1af.jpg

      lol... sorry, I couldn't resist a bit of humor this morning 😄 . In actual fact your forgotten phone solution does sound interesting

      posted in General Discussion
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      @Qu3Uk Thanks.

      posted in General Discussion
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      @the1laz so what you are saying is that the super cheap ones on AliExpress are not high quality real ones? 😆

      lol

      I guess that's the cost of getting cheap components directly from China.... every now and then one of them is crappy

      posted in General Discussion
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      @TRS-80 I used to have a nice high quality 16gb card in my cell phone, but I recently gave it to my son for his tablet 😞 that's what I get for being a caring father... lol

      I tried a few more installs last night of versions 1.5 and 1.8 and 1.9 of noobs and they all failed with different issues, so I'm ready to admit that it's the card.... so I'm off to the store at lunch for a new one.

      posted in General Discussion
      micah
      micah
    • RE: Basement Monitor

      @Mike-Musskopf thanks for all the great tips... I'm sure I'll be coming back to this post all frustrated in a week or so once my batteries are dead 😉

      There is just so much to learn with this Arduino MySensors stuff... I'm loving it, but there is just so much!

      posted in My Project
      micah
      micah
    • RE: Raspberry Pi is frustrating and I wanted to vent

      @TheoL I don't know what the issue it yet.

      I just tried another Noobs install which was supposedly successful, but then on the auto reboot I'm getting tons of ext4-fs errors until it stops loading.

      Some online digging suggested it may be an issue with the 1.9 version of Noobs (which I doubt). So I'm downloading an older release and I'll try that first, before tossing the SD card and replacing it.

      posted in General Discussion
      micah
      micah
    • Arduino + Motorcycle

      I'm dying up here in Canada waiting for the real spring to start so I can get my motorcycle out.

      So in the meantime I've been dreaming about the cool arduino things I could do to my bike (although I'm way to busy to ever get around to it).

      I know it's not MySensors related, but I found two really cool arduino + motorcycle projects and I though you guys might enjoy checking them out.

      Arduino Shift Light + Tachometer from Chippernut
      Link to site
      Youtube Link

      Motorcycle Blind-Spot Detection System
      YouTube Link

      posted in General Discussion
      micah
      micah
    • Raspberry Pi is frustrating and I wanted to vent

      ERGGGGG!!!!!!!!!

      I spent 5 hours last night trying to get my new Raspberry Pi 2 setup. I don't mean the fancy MySensors integration stuff, I mean literally 5 hours trying to install Raspian!!!!!!

      At this point I'm leaning towards a somehow broken micro SD that I got from AliExpress. I'll probably head to the computer store to buy a new one and try again.

      It's so frustrating to waste so much time on a part or the process that should have been easy.

      I didn't really write this post for help, although that's always welcome, it was more just as a place to vent. When I try and explain this kind of stuff to my friends their eyes just glaze over and they have no idea what I'm talking about.... I think I need to find some new friends who are technologically competent 😛

      Thanks for listening to my complaining, I feel better already 🙂

      posted in General Discussion
      micah
      micah
    • RE: Basement Monitor

      @TheoL The nano is only temporary while I wait for AliExpress to deliver my 6 Pro Minis I ordered last week.... so hopefully the AAs will last 4 to 5 weeks... lol

      posted in My Project
      micah
      micah
    • RE: Basement Monitor

      I figure I should add a wiring diagram

      0_1459962491785_mb_BasementMonitor.jpg

      posted in My Project
      micah
      micah
    • RE: Basement Monitor

      @Mike-Musskopf

      Thanks for the feedback Mike.

      The PIR is a good idea, but I've converted my basement into an apartment and have a tenant, so I don't want to mess with his lights, I just want to know if he leaves them on all the time 😉

      Great tip on replacing the breadboard. Learning to solder is the next thing on my list.

      I've also just placed a big order from AliExpress for more toys... lol... including some Arduino Pros.

      This hobby is addicting and quickly spirals out of control... I initially only wanted to make 1 sensor, and now I've already got a list of 8 projects I want to make 🙂

      posted in My Project
      micah
      micah
    • Basement Monitor

      Hi everyone.

      Been wanting to implement some mysensors goodness for awhile now, and I finally got around to building the first node for my home automation project.

      I'm learning as I go, so things aren't pretty yet.

      Before I continue, I wanted to start by thanking everyone on here, I've learned so much by reading your posts.

      This first node is called "BasementMonitor". It'll eventually be mounted to the wall under the stairs in the basement. It's purpose is to scan the following and report them to my (soon to be built) Raspberry Pi OpenHAB.

      • Temperature
      • Humidity
      • Gas (CO2)
      • Ambient light (to know if the lights were left on)
      • Flame
      • Water (on the floor)

      Since this is my first build it's not pretty... basically stuff hot glued into a tupperware container. I'll pretty it up once I'm done all my testing.

      My Node
      My Node view 2

      Here is my sketch so far. It's still pretty raw and I've got a bunch more things to implement, but it works 🙂

      #define MY_NODE_ID 2
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_LIGHT 2
      #define CHILD_ID_FLAME 3
      #define CHILD_ID_WATER 4
      #define CHILD_ID_GAS 5
      
      #include <SPI.h>
      #include <MySensor.h>  
      #include <DHT.h>  
      
      #define HUMIDITY_SENSOR_DIGITAL_PIN 5
      #define LIGHT_SENSOR_ANALOG_PIN A2
      #define FLAME_SENSOR_DIGITAL_PIN 3
      #define WATER_SENSOR_ANALOG_PIN A0
      #define GAS_SENSOR_ANALOG_PIN A1
      
      MySensor gw;
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgLight(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      MyMessage msgFlame(CHILD_ID_FLAME, V_STATUS);
      MyMessage msgWater(CHILD_ID_WATER, V_LEVEL);
      MyMessage msgGas(CHILD_ID_GAS, V_LEVEL);
      
      unsigned long pMillis_Photo = 0;
      unsigned long pMillis_WS = 0;
      unsigned long pMillis_DHT = 0;
      unsigned long pMillis_GS = 0;
      unsigned long pMillis_FS = 0;
      long sCheck_Photo = 60000;
      long sCheck_WS = 60000;
      long sCheck_DHT = 60000;
      long sCheck_GS = 20000;
      long sCheck_FS = 20000;
      int lastLightLevel;
      int lastFlameLevel;
      int lastWaterLevel;
      int lastGasLevel;
      
      void setup(){ 
        gw.begin(NULL, MY_NODE_ID, true);
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        gw.sendSketchInfo("Basement Monitor", "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_FLAME, S_LIGHT);
        gw.present(CHILD_ID_WATER, S_MOISTURE);
        gw.present(CHILD_ID_GAS, S_AIR_QUALITY);
        
        metric = gw.getConfig().isMetric;
      }
      void loop(){
        unsigned long currentMillis = millis();
        
        // Check Temp and Humidity
        if (currentMillis - pMillis_DHT >= sCheck_DHT){
          pMillis_DHT = currentMillis;
          
          float temperature = dht.getTemperature();
          if (isnan(temperature)) {
              Serial.println("Failed reading temperature from DHT");
          } else if (temperature != lastTemp) {
            lastTemp = temperature;
            if (!metric) {
              temperature = dht.toFahrenheit(temperature);
            }
            gw.send(msgTemp.set(temperature, 1));
            Serial.print("T: ");
            Serial.println(temperature);
          }
          
          float humidity = dht.getHumidity();
          if (isnan(humidity)) {
              Serial.println("Failed reading humidity from DHT");
          } else if (humidity != lastHum) {
              lastHum = humidity;
              gw.send(msgHum.set(humidity, 1));
              Serial.print("H: ");
              Serial.println(humidity);
          }
        }
        // Check light level
        if (currentMillis - pMillis_Photo >= sCheck_Photo){
          pMillis_Photo = currentMillis;
          
          //int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
          int lightLevel = analogRead(LIGHT_SENSOR_ANALOG_PIN); 
          Serial.print("L: ");
          Serial.println(lightLevel);
          if (lightLevel != lastLightLevel) {
            gw.send(msgLight.set(lightLevel));
            lastLightLevel = lightLevel;
          }
        }
        // Check Flame
        if (currentMillis - pMillis_FS >= sCheck_FS){
          pMillis_FS = currentMillis;
          // 1=no fire  0=fire
          int flameLevel = digitalRead(FLAME_SENSOR_DIGITAL_PIN);
          Serial.print("F: ");
          Serial.println(digitalRead(FLAME_SENSOR_DIGITAL_PIN));
          if (flameLevel != lastFlameLevel) {
            gw.send(msgFlame.set(flameLevel));
            lastFlameLevel = flameLevel;
          }
        }
        //Check water
        if (currentMillis - pMillis_WS >= sCheck_WS){
          pMillis_WS = currentMillis;
          //under 10 ignore   up to 70 = 1 drop   over 300 = really wet
          int waterLevel = analogRead(WATER_SENSOR_ANALOG_PIN);
          Serial.print("W: ");
          Serial.println(waterLevel);
          if (waterLevel != lastWaterLevel) {
            gw.send(msgWater.set(waterLevel));
            lastWaterLevel = waterLevel;
          }
        }
        // Check gas
        if (currentMillis - pMillis_GS >= sCheck_GS){
          pMillis_GS = currentMillis;
      
          int gasLevel = analogRead(GAS_SENSOR_ANALOG_PIN);
          Serial.print("G: ");
          Serial.println(gasLevel);
          if (gasLevel != lastGasLevel) {
            gw.send(msgWater.set(gasLevel));
            lastGasLevel = gasLevel;
          }
        }
      }
      
      posted in My Project
      micah
      micah