Navigation

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

    afulki

    @afulki

    1
    Reputation
    8
    Posts
    348
    Profile views
    0
    Followers
    1
    Following
    Joined Last Online

    afulki Follow

    Best posts made by afulki

    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      HI, thanks for the prompt reply.

      I'm powering it via the 3.3v pin on an Arduino Nano (which is powered from the USB). I have a capacitor across the RF board (470uF).

      I added the delay(250) after the present, and the 4th completed this time (after about 2-3s).

      posted in Troubleshooting
      afulki
      afulki

    Latest posts made by afulki

    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      I added a lot more debug output and find that it gets stuck in here:

      	while( ! ( get_status()  & ( _BV(TX_DS) | _BV(MAX_RT) ))) {
      		#if defined (FAILURE_HANDLING)
      			if(millis() - timer > 75){
      				errNotify();
      
      posted in Troubleshooting
      afulki
      afulki
    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      I spoke too soon, it's back to not initializing the 4th output, or rather no doing returning from gw.present();

      posted in Troubleshooting
      afulki
      afulki
    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      @BartE

      I added some extra logging (yes even more) and the 2 extra lines are sent during the gw.begin, I think the

      send: 3-3-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
      

      Is telling the gateway about the arduino node (could be wrong still looking through the code).

      Gary

      posted in Troubleshooting
      afulki
      afulki
    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      @sundberg84

      I switched out both the radio and the nano, it seems to be the nano, the new one initialized fine with both radios. As a software guy my first response should have been that it was a hardware issue! 😈

      Thanks for the help!

      Gary

      posted in Troubleshooting
      afulki
      afulki
    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      Hi BartE,

      This is the source, I switched around the relay high low, the name of the sketch and the false on the begin statement. I have no idea where those two extra lines come from, but will try to track them down.

      #include <MySigningNone.h>
      #include <MyTransportNRF24.h>
      #include <MyTransportRFM69.h>
      #include <MyHwATMega328.h>
      #include <MySensor.h>
      #include <SPI.h>
      
      #define RELAY_1  PD3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define NUMBER_OF_RELAYS 4 // Total number of attached relays
      #define RELAY_ON 0  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 1 // GPIO value to write to turn off attached relay
      
      // NRFRF24L01 radio driver (set low transmit power by default) 
      MyTransportNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);  
      //MyTransportRFM69 radio;
      // Message signing driver (none default)
      //MySigningNone signer;
      // Select AtMega328 hardware profile
      MyHwATMega328 hw;
      // Construct MySensors library
      MySensor gw(radio, hw);
      
      void setup()  
      {   
        // Initialize library and add callback for incoming messages
        gw.begin(incomingMessage, AUTO, false);
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Desk Power Relay", "1.0");
      
        // Fetch relay status
        for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
          Serial.print("Init Sensor : ");
          Serial.print(sensor);
          Serial.print(", pin ");
          Serial.println(pin);
      
          // Register all sensors to gw (they will be created as child devices)
          Serial.println("before present...");
          gw.present(sensor, S_LIGHT);
          delay(250);
          // Then set relay pins in output mode
          
          Serial.println("before pinMode...");
          pinMode(pin, OUTPUT);   
          // Set relay to last known state (using eeprom storage) 
          digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
          Serial.println("Sensor configured - OK!");    
        }
      }
      
      
      void loop() 
      {
        // Alway process incoming messages whenever possible
        gw.process();
      }
      
      void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
           // Change relay state
           digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
           // Store state in eeprom
           gw.saveState(message.sensor, message.getBool());
           // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", New status: ");
           Serial.println(message.getBool());
         } 
      }
      
      
      posted in Troubleshooting
      afulki
      afulki
    • RE: gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      HI, thanks for the prompt reply.

      I'm powering it via the 3.3v pin on an Arduino Nano (which is powered from the USB). I have a capacitor across the RF board (470uF).

      I added the delay(250) after the present, and the 4th completed this time (after about 2-3s).

      posted in Troubleshooting
      afulki
      afulki
    • gw.present(sensor, S_LIGHT) - hangs on 4th sensor

      I edited the RelayActuator sketch to include 4 relays, on pins 3 to 6. I was having an issue controlling them so dug further, I can only see 3 of the 4 sensors in MYSController and added some serial debugging to the sketch to pinpoint where things are going wrong.

      This is the output:

      send: 2-2-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
      send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3
      send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
      read: 0-0-2 s=255,c=3,t=15,pt=0,l=1,sg=0:0
      read: 0-0-2 s=255,c=3,t=6,pt=0,l=1,sg=0:M
      sensor started, id=2, parent=0, distance=1
      send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=16,sg=0,st=ok:Desk Power Relay
      send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
      Init Sensor : 1, pin 3
      before present...
      send: 2-2-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
      before pinMode...
      Sensor configured - OK!
      
      Init Sensor : 2, pin 4
      before present...
      send: 2-2-0-0 s=2,c=0,t=3,pt=0,l=0,sg=0,st=ok:
      before pinMode...
      Sensor configured - OK!
      
      Init Sensor : 3, pin 5
      before present...
      send: 2-2-0-0 s=3,c=0,t=3,pt=0,l=0,sg=0,st=ok:
      before pinMode...
      Sensor configured - OK!
      
      Init Sensor : 4, pin 6
      before present...
      

      The code was modified as follows:

        for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
          Serial.print("Init Sensor : ");
          Serial.print(sensor);
          Serial.print(", pin ");
          Serial.println(pin);
      
          // Register all sensors to gw (they will be created as child devices)
          Serial.println("before present...");
          gw.present(sensor, S_LIGHT);
          // Then set relay pins in output mode
          
          Serial.println("before pinMode...");
          pinMode(pin, OUTPUT);   
          // Set relay to last known state (using eeprom storage) 
          digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF);
          Serial.println("Sensor configured - OK!"); 
          Serial.println();   
        } 
      

      On the 4th sensor, it never gets past the present line.

      posted in Troubleshooting
      afulki
      afulki
    • Relay node delays

      I have a serial gateway (Arduino Uno) and two sensor nodes (Arduino Nano 5v), one reporting temperature (working great) and one with a relay board and 4 relays attached, while the board is working I'm seeing delays of 2s to 3os before the relay is activated.

      On the serial monitor attached to the relay control nano , I see the incoming message almost immediately, but not the ack (or what I assume is the ack as I'm new to this).

      Incoming change for sensor:2, New status: 0
      read: 1-1-0 s=0,c=1,t=0,pt=7,l=5,sg=0:17.9
      read: 0-0-2 s=3,c=1,t=2,pt=0,l=1,sg=0:1
      send: 2-2-0-0 s=3,c=1,t=2,pt=0,l=1,sg=0,st=ok:1

      Sometimes I see the read, but no ack and no change on the relay control pin:

      Incoming change for sensor:3, New status: 1
      read: 1-1-0 s=0,c=1,t=0,pt=7,l=5,sg=0:18.0

      Any help would be appreciated.

      posted in Troubleshooting
      afulki
      afulki