Skip to content
  • MySensors
  • 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
S

Sergio_uno

@Sergio_uno
About
Posts
6
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Connected valves for leak prevention system / heating control / garden irrigation system
    S Sergio_uno

    @dbemowsk I like Dave's definition. Something is always better than nothing when you release a project. I can release schematics and photos, and maybe it will help to someone.

    My Project

  • Connected valves for leak prevention system / heating control / garden irrigation system
    S Sergio_uno

    @yveaux Thanks, but I'm not sure it will work for me. We made investment in injection molds and whatnot. I am sure you know the difference in quality between 3d printed hand-made prototypes and injection molded case. I believe this project will be interested to many MySensors users. I offer working design in nice looking custom cases, a complete solution.
    I might be able to share schematics, but not everything. No offence, we need to return money. Meanwhile, you can delete this thread as you wanted.

    My Project

  • Connected valves for leak prevention system / heating control / garden irrigation system
    S Sergio_uno

    @yveaux Hi, do you expect to see firmware or Gerber files + schematic are enough?

    My Project

  • Binary_switch_sleep_sensor sketch does not work
    S Sergio_uno

    Thanks @mfalkvidd. I don't have a gateway and home automation controller. My idea is to run a code on a gateway arduino and use MySensor libraries to transport sensors data to the GW. Will it work without a home automation controller?

    Troubleshooting

  • Binary_switch_sleep_sensor sketch does not work
    S Sergio_uno

    Hi all,

    As a first step with MySensors I decided to a build binary switch sensor. I found that pull-up on Pin 2&3 does not work. And this is because all void setup() section newer executed (I added a marker Serial.println("Setup section reached "); )
    Needles to say that void loop() does not work either.

    Here is the sketch


    #define MY_NODE_ID 123

    // Enable debug prints to serial monitor
    #define MY_DEBUG

    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69

    #include <SPI.h>
    #include <MySensors.h>

    #define SKETCH_NAME "Binary Sensor"
    #define SKETCH_MAJOR_VER "1"
    #define SKETCH_MINOR_VER "0"

    #define PRIMARY_CHILD_ID 3
    #define SECONDARY_CHILD_ID 4

    #define PRIMARY_BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch
    #define SECONDARY_BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch

    #if (PRIMARY_BUTTON_PIN < 2 || PRIMARY_BUTTON_PIN > 3)
    #error PRIMARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
    #endif
    #if (SECONDARY_BUTTON_PIN < 2 || SECONDARY_BUTTON_PIN > 3)
    #error SECONDARY_BUTTON_PIN must be either 2 or 3 for interrupts to work
    #endif
    #if (PRIMARY_BUTTON_PIN == SECONDARY_BUTTON_PIN)
    #error PRIMARY_BUTTON_PIN and BUTTON_PIN2 cannot be the same
    #endif
    #if (PRIMARY_CHILD_ID == SECONDARY_CHILD_ID)
    #error PRIMARY_CHILD_ID and SECONDARY_CHILD_ID cannot be the same
    #endif

    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(PRIMARY_CHILD_ID, V_TRIPPED);
    MyMessage msg2(SECONDARY_CHILD_ID, V_TRIPPED);

    void setup()
    {
    Serial.println("Setup section reached ");
    // Setup the buttons
    pinMode(PRIMARY_BUTTON_PIN, INPUT);
    pinMode(SECONDARY_BUTTON_PIN, INPUT);

    // Activate internal pull-ups
    digitalWrite(PRIMARY_BUTTON_PIN, HIGH);
    digitalWrite(SECONDARY_BUTTON_PIN, HIGH);
    }

    void presentation() {
    // Send the sketch version information to the gateway and Controller
    sendSketchInfo(SKETCH_NAME, SKETCH_MAJOR_VER "." SKETCH_MINOR_VER);

    // Register binary input sensor to sensor_node (they will be created as child devices)
    // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage.
    // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
    present(PRIMARY_CHILD_ID, S_DOOR);
    present(SECONDARY_CHILD_ID, S_DOOR);
    }

    // Loop will iterate on changes on the BUTTON_PINs
    void loop()
    {
    uint8_t value;
    static uint8_t sentValue=2;
    static uint8_t sentValue2=2;

    // Short delay to allow buttons to properly settle
    sleep(5);

    value = digitalRead(PRIMARY_BUTTON_PIN);
    Serial.print("Value pin2= ");
    Serial.println (value);

    if (value != sentValue) {
    // Value has changed from last transmission, send the updated value
    send(msg.set(value==HIGH ? 1 : 0));
    sentValue = value;
    }

    value = digitalRead(SECONDARY_BUTTON_PIN);

    if (value != sentValue2) {
    // Value has changed from last transmission, send the updated value
    send(msg2.set(value==HIGH ? 1 : 0));
    sentValue2 = value;
    }

    // Sleep until something happens with the sensor
    sleep(PRIMARY_BUTTON_PIN-2, CHANGE, SECONDARY_BUTTON_PIN-2, CHANGE, 0);
    }


    This is the copy from Serial monitor. You can see that there is no print "Setup section reached", meaning that is not reached and program stuck somewhere in the #define section

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=123)
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=123)
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 123-123-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    !TSM:FPAR:FAIL
    !TSM:FAILURE
    TSM:PDT
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=123)


    I have Arduino IDE 1.6.9. and updated MySensors library (2.0). The board I tested are arduino UNO and Nano, both behave the same.

    Any suggestions?

    Troubleshooting
  • Login

  • Don't have an account? Register

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