Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
H

HarryDutch

@HarryDutch
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store
About
Posts
40
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Automatic stairs lighting +MySensors
    H HarryDutch

    @aivaredze Great project. Absolutely great video! Love it. One question: how did you manage to hide the cables between your shield and the led strips? Maybe some pictures?

    My Project

  • 💬 Automatic stairs led lighting arduino shield
    H HarryDutch

    Great video!!!!

    OpenHardware.io led arduino mysensors automatic stairs

  • [SOLVED] Sleep dont run
    H HarryDutch

    @mar.conte A shot in the dark but have you tried to pull down pin 3 in order to prevent this pin is floating? Connect pin 3 to ground with a 10K resistor.

    Troubleshooting

  • [SOLVED] Sleep dont run
    H HarryDutch

    @mar-conte
    What happens if you change your sleep function like this:

    sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), HIGH,0);

    Troubleshooting

  • New MS node creates lots of random sensors, as well as actual sensors [Domoticz]
    H HarryDutch

    Domoticz > Settings > uncheck "Accept new Hardware Devices". Don't forget to click Apply Settings.

    Troubleshooting

  • Looking for simple/clean Code example for sleep() external interrupt.
    H HarryDutch

    I think the sketch you need is here .

    General Discussion

  • [Solved] Strange behavior Sleep() function and interrupts in MyS library 2.1.1
    H HarryDutch

    @tekka Yes! This works. Thanks for your help. I'm still confused why my test script worked with 2.0.0. and not with 2.1.1. Thanks again.

    Bug Reports

  • [Solved] Strange behavior Sleep() function and interrupts in MyS library 2.1.1
    H HarryDutch

    @Yveaux I'm using my own pcb's. Nothing special. It has the ATMEGA328p (8 Mhz) and the nrf radio. The hardware worked with MyS library 2.0.0. Using Arduino 1.8.1. Board UNO 8 Mhz 3.3v.

    Bug Reports

  • [Solved] Strange behavior Sleep() function and interrupts in MyS library 2.1.1
    H HarryDutch

    After upgrading the MySensors library from 2.0.0 to 2.1.1 I noticed that the sleep function with interrupts was working different than before. Have a look at the simple test sketch below . In 2.0.0 the loop is called only once after an interrupt. In 2.1.1 the loop is called twice before the sleep function becomes active. Below you have the serial log for 2.0.0 and 2.1.1. for 2 interrupts. Is this a bug or do I need to change some settings or use a different code?

    //Test sleep function and interrupt in library 2.1.1 and 2.0.0
    
    #define MY_DEBUG 
    
    #include <SPI.h>
    #define MY_RADIO_NRF24
    #include <MySensors.h>
    byte countInterrupt;
    void isr() {}
                                                                                      
    void setup(void) {
      pinMode(3, INPUT_PULLUP); // intterupt 1
      attachInterrupt(digitalPinToInterrupt(3), isr,FALLING); 
    }
    
    void loop() {
      sleep(1,FALLING,0);
      Serial.print("interrupt ");
      Serial.println(countInterrupt++);
      wait(1000);
    }
    

    Serial log 2.0.0 (this one works ok).

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=2)
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-2 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=2)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-2 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    TSP:MSG:SEND 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-2 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    TSP:MSG:READ 0-0-2 s=255,c=3,t=6,pt=0,l=1,sg=0:M
    Request registration...
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
    TSP:MSG:READ 0-0-2 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=2, parent=0, distance=1, registration=1
    ****************** Start first interrupt *************************************
    interrupt 0
    ***************** Start second interrupt *************************************
    interrupt 1
    

    Serial log 2.1.1

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    4 TSM:INIT
    4 TSF:WUR:MS=0
    12 TSM:INIT:TSP OK
    14 TSF:SID:OK,ID=2
    16 TSM:FPAR
    51 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2060 !TSM:FPAR:NO REPLY
    2062 TSM:FPAR
    2099 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2277 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    2283 TSF:MSG:FPAR OK,ID=0,D=1
    4106 TSM:FPAR:OK
    4106 TSM:ID
    4108 TSM:ID:OK
    4110 TSM:UPL
    4116 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    4122 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    4128 TSF:MSG:PONG RECV,HP=1
    4132 TSM:UPL:OK
    4134 TSM:READY:ID=2,PAR=0,DIS=1
    4143 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    4151 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    4159 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    4171 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    4184 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    4190 MCO:REG:REQ
    4194 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    4202 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    4208 MCO:PIM:NODE REG=1
    4210 MCO:BGN:STP
    4212 MCO:BGN:INIT OK,TSP=1
    4214 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255
    4220 MCO:SLP:TPD
    4222 MCO:SLP:WUP=1
    ********************* Start first interrupt ********************************
    interrupt 0
    5226 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255
    5230 MCO:SLP:TPD
    5232 MCO:SLP:WUP=1
    interrupt 1
    6234 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255
    6238 MCO:SLP:TPD
    6240 MCO:SLP:WUP=1
    ********************* Start second interrupt *******************************
    interrupt 2
    7243 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255
    7247 MCO:SLP:TPD
    7249 MCO:SLP:WUP=1
    interrupt 3
    8251 MCO:SLP:MS=0,SMS=0,I1=1,M1=2,I2=255,M2=255
    8255 MCO:SLP:TPD
    
    Bug Reports

  • i2c Lightning Sensor +
    H HarryDutch

    @gohan Maybe this one?
    http://www.ebay.com/itm/EMP-sensor-detector-module-for-lightning-detection-/302051777514?hash=item4653b05bea:g:L8UAAOSwLnBX2sVY

    My Project

  • PCB design with nRF24L01 and Arduino Pro Mini
    H HarryDutch

    @RaPo You can zip your .brd and .sch files and upload the zip file.

    Hardware

  • PCB design with nRF24L01 and Arduino Pro Mini
    H HarryDutch

    @Raghavendra-Prasad Looks like interference between the radio module and and the pcb. Could also be a GROUND problem with your pcb (it works when you're touching the antenna).

    First: remove the nrf from your pcb and reconnect with some jumper wires. Make sure the radio module is outside the pcb. If it works you have to redesign your pcb in such a way that the antenna is outside the pcb.

    You could also try to shield your nrf (search the forum).

    If it's still not working could you post your EAGLE files? (board and circuit file).

    Success

    Hardware

  • First Sensor project, Steep learning curve.
    H HarryDutch

    @lozzer65 I'm very curious where you bought the radio with the proper IC and components!

    General Discussion

  • PCB and 3D print companies
    H HarryDutch

    I have used seeedstudio.com for PCB's and laser cutting. They also do 3D printing. No complaints so far.

    Enclosures / 3D Printing

  • Codebender on ipad hiding code
    H HarryDutch

    @mfalkvidd
    When you open YouTube itself then look at the uppper right corner where you should see 3 dots. Tapping these dots will give you the all available options.

    General Discussion

  • Codebender on ipad hiding code
    H HarryDutch

    @mfalkvidd
    In Youtube you have an option to enable/disable Youtube links to open in Chrome.

    General Discussion

  • Codebender on ipad hiding code
    H HarryDutch

    @mfalkvidd
    Use Chrome on your iPad and your problem is solved!

    General Discussion

  • Sensor pins
    H HarryDutch

    @Lee-Groom

    Have a look at MyConfig.h. If you have "#define WITH_LEDS_BLINKING" then D4, D5 and D6 are used for blinking the status led's. Could maybe explain your problem.

    Hardware

  • Domoticz and heater
    H HarryDutch

    @sundberg84 , @jlehtinen

    I've solved this problem with a LUA script in Domoticz. The script copies the values of temperature and humidity to a TEXT sensor (as a string). In the Arduino sketch (you need the MySensors development branch) the string is split in 2 separate values (Strings). Works like a charm.

    LUA script:

    
       tempString = ""
       stringReturn = ""
       sensor = '103OutsideTempHum'
       tempString = otherdevices_svalues[sensor]
    
       sep = ";"
       i=1
    
       for str in string.gmatch(tempString, "([^"..sep.."]+)") do
          stringReturn = stringReturn .. str .. "#"
          i = i + 1
       end
    
    commandArray = {}
    
       time = os.date("*t")
       if ((time.min % 5)==0) then--run script every 5 minutes
       commandArray[1] = {['UpdateDevice'] = 77 .. '|0|' .. tostring(stringReturn)} -- 77 = idx of TEXT sensor in Domoticz
       end
    
    return commandArray
    
    

    Arduino sketch:

    
    #include <SPI.h>
    #include <TFT_ILI9341.h>
    #include <MySensor.h> 
    
    #define MY_RADIO_NRF24
    #define CHILD_ID_TEXT 1
    #define CHILD_ID_BUTTON 2
    
    #define MIN_V 2600
    #define MAX_V 3200
    
    #define sclk 13  // Don't change
    #define mosi 11  // Don't change
    #define cs   17
    #define dc   16
    #define rst  15  // you can also connect this to the Arduino reset
    
    TFT_ILI9341 tft = TFT_ILI9341();
    
    void Button() {}
    
    int interrupt;
    String tempSensor;
    byte batteryPcnt;
    
    MyMessage msgTemp(CHILD_ID_TEXT, V_TEXT);
    MyMessage msgButton(CHILD_ID_BUTTON, V_STATUS);
    
    void presentation() 
    {
      sendSketchInfo("103 TEST", "1.0");
      present(CHILD_ID_TEXT, S_INFO);
      present(CHILD_ID_BUTTON, S_BINARY);
    } 
    
    void setup()
    { 
      Serial.begin(9600);
      pinMode(4, OUTPUT);
      digitalWrite(4, HIGH);
      
      pinMode(3, INPUT_PULLUP); // int 1 used by button
     
      attachInterrupt(digitalPinToInterrupt(3), Button,FALLING);
    }
    
    
    void loop() 
    {
      if(interrupt == 1)
      {  
        send(msgButton.set(1));  
        request(CHILD_ID_TEXT, V_TEXT);
        batteryPcnt = min(map(readVcc(), MIN_V, MAX_V, 0, 100), 100);
        sendBatteryLevel(batteryPcnt);
        wait(500);
        Screen();
        
        send(msgButton.set(0));
      }
      
      digitalWrite(rst, LOW);
      digitalWrite(4, HIGH);   
      wait(10);
    
      interrupt = sleep(1,FALLING);
    }
    
    void receive(const MyMessage &message) 
    {
      if (message.sensor == 1) 
      {
        tempSensor = message.getString();
      } 
      wait(200);
    }
    
    //====== Show screen after hitting button ==============================
    void Screen() 
    {
      digitalWrite(4, LOW);
      wait(10);
      tft.init();
      tft.setRotation(2);    
      
      char c_tmp[6];
      char c_hum[6];
    
      int sepIndex1 = tempSensor.indexOf('#');
      int sepIndex2 = tempSensor.indexOf('#',sepIndex1+1);
      String tmp = tempSensor.substring(0,sepIndex1);
      String hum = tempSensor.substring(sepIndex1+1,sepIndex2);
      
      tft.fillScreen(ILI9341_BLACK);
      wait(5);//don't touch this!!
      tft.setTextSize(1);
    
      tft.fillRoundRect(5, 5, 230, 180, 10, ILI9341_WHITE);
      tft.setTextColor(ILI9341_BLUE);
      tmp.toCharArray(c_tmp, 6); 
      tft.drawCentreString(c_tmp,120,50,8);
    
      tft.fillRoundRect(5, 190, 230, 90, 10, ILI9341_WHITE);
      tft.setTextColor(ILI9341_BLACK);
      tft.setCursor(10,200,4);
      tft.print("Humidity "); 
      tft.setTextColor(ILI9341_BLUE);
      tft.setCursor(120,200,4);
      hum.toCharArray(c_hum, 6); 
      tft.print(c_hum); tft.print(" %");
      tft.setCursor(200,245,4);
      tft.print(batteryPcnt); 
      wait(15000L); 
    }
    
    long readVcc() {
      // Read 1.1V reference against AVcc
      // set the reference to Vcc and the measurement to the internal 1.1V reference
      #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
        ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
      #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
        ADMUX = _BV(MUX5) | _BV(MUX0);
      #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
        ADMUX = _BV(MUX3) | _BV(MUX2);
      #else
        ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
      #endif                 
     
      delay(2); // Wait for Vref to settle
      ADCSRA |= _BV(ADSC); // Start conversion
      while (bit_is_set(ADCSRA,ADSC)); // measuring
     
      uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
      uint8_t high = ADCH; // unlocks both
     
      long result = (high<<8) | low;
     
      result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
      return result; // Vcc in millivolts
    }
    
    
    Domoticz

  • MySensors Network at a High School Farm
    H HarryDutch

    Wow! What a great project. It's on the top of my list now. Thanks!!

    My Project
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular