Skip to content

Development

Discuss Arduino programming, library tips, share example sketches and post your general programming questions.
1.5k Topics 13.5k Posts

Subcategories


  • 56 578
    56 Topics
    578 Posts
    HJ_SKH
    Hi2All! Surprising is here. After about 24hours I refresh HA and suddenly my motion sensor was integrated. There is also second entity > battery : 0 , have to look deeper into that for understanding. Need to change little in the sketch, because don't want every short time 'no movement' so only when there is motion and maybe once a hour indication sensor is alive. Meantime I found 3 other good threats: https://forum.mysensors.org/topic/11200/finally-progress-evidence-based-radio-testing-method-and-capacitors https://forum.mysensors.org/topic/1664/which-are-the-best-nrf24l01-modules/27 https://forum.mysensors.org/topic/9550/build-a-reliable-power-supply-chain Very usefull for me also finally progress because of lacking time in the past. Great jobs are done here! Thanks for this all of you guys or girls!
  • Testing a sensor with sleep

    mega sleep
    7
    0 Votes
    7 Posts
    2k Views
    CrankyCoderC
    Ok I got it to work. I misunderstood how the interrupts worked. Got it now. The culprit was the if statement detecting if the state changed. Since the state was being maintained while sleep, it wasn't firing when I pushed the button. Thanks for everyones help!!
  • Is this completely wrong?

    3
    0 Votes
    3 Posts
    1k Views
    xydixX
    Thank you. That will get it right. But now I get the delay when the door open. I guess I need a pull down resistor for this to work. 4.7k? 10k? I guess it's the internal pull up that consumes power? Another thing. I changed digitalWrite = HIGH (original example) to Pinmode INPUT_PULLUP in my first sketch Wich option is best if I want low power consumption?
  • push buttons / only 1 state

    5
    0 Votes
    5 Posts
    1k Views
    CrankyCoderC
    Thank you. New to mysensors still so I didn't know if there was a "framework" method :) thanks again!
  • MySensors Newbie Questions

    5
    0 Votes
    5 Posts
    1k Views
    CrankyCoderC
    awesome!! thank you!
  • Battery powered PIR and temp/humid sensor

    22
    0 Votes
    22 Posts
    8k Views
    alexsh1A
    @tomkxy it is a few mA while sleeping. This means that it has to be modified (no VDO and no LED) - consumption drops to a reasonable 160uA or even below.
  • Smartsleep implementation

    10
    1 Votes
    10 Posts
    5k Views
    martinhjelmareM
    @abmantis It seems related, but I haven't looked deeper into why. I guess this ought to be addressed in the PR so that the counter is increased +1 always. But we should find the cause first.
  • how to get data from controller?

    7
    0 Votes
    7 Posts
    2k Views
    alexsh1A
    @AWI yes I spoke to Rob about it some time ago. V_VAR is good enough for my needs. I just do not see why one would want more
  • SoilMoistSensor will not compile for Arduino Due

    3
    0 Votes
    3 Posts
    1k Views
    hekH
    https://github.com/mysensors/Arduino/issues/119
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Conceptual security question

    15
    0 Votes
    15 Posts
    2k Views
    AnticimexA
    @tomkxy The concept of whitelisting I have developed is to protect from the case when someone actually obtained your key. Typically by stealing a node with a personalized ATSHA onboard or even one with soft signing. According to Atmel, it is not possible to extract the HMAC key from an ATSHA but it is from a software based node. For this reason, my recommendation is to never use soft signing for nodes "outside". Now, although it is not considered possible to extract the HMAC key from an ATSHA, the attacker can still use it as it is already personalized for you. So he can just flash whatever and be able to send valid signatures. However, if you enforce whitelisting on your network, then the receiver of signed messages has to keep a list where each node is listed, and with each node a unique serial. That serial is salted into the signature by the sender and therefore not sniffable. But the attacker will be able to determine the serial from the node stolen. But using that info, he will not be able to deduce the serial of other nodes in the system that you also have decided to accept. So if you detect that a node has been stolen, you remove it from your whitelist, and the attacker will then have to guess both the nodeId and the serial of a node in your whitelist table. The nodeId can be sniffed, but the serial cannot. And therefore I do not under any circumstance allow the serial to be easily accessible by any means.
  • MySensors gw;

    5
    0 Votes
    5 Posts
    1k Views
    alexsh1A
    @hek This is pity. This means that I am going to loose a lot of historical information unless I want to manually copy and paste values in the DB. At least it makes an order - one id per node.
  • Global variables without compile again

    4
    0 Votes
    4 Posts
    934 Views
    AWIA
    @Dave-Dan A simple solution would be to create a basic 'test' switch "V_STATUS" for each node.
  • [v1.5 API] parentNodeId AUTO?

    3
    0 Votes
    3 Posts
    950 Views
    NuubiN
    Ahh, thanks! I have ack set to false (the last installed sensor version), so this rules out the search function, I assume!
  • where to change code for NRF24L01

    6
    0 Votes
    6 Posts
    3k Views
    B
    @Maurizio-Collu I've had it running by using the pin layout as described in the wiki site in my previous post. Of course I had to change the CS(N) pin in MyConfig.h (CS-pin to 53). Don't forget to put it back to original if you're using it on other arduino types !! As far as I can remember (it was more that a year ago when I tried this) that was the only change needed to get it working. See table below; use Mega2560 with RF24 library. [image: 1465043303981-pins.jpg] Hope this helps. Boozz
  • #define MY_LEDS_BLINKING_FEATURE question

    2
    0 Votes
    2 Posts
    824 Views
    alexsh1A
    Ok, I discovered that the correct variable is #define MY_DEFAULT_ERR_LED_PIN x but MyConfig.h is still using #define MY_DEFAULT_ERR_LED x. This is Development version as of 04/06/2016
  • Light sensor with battery level problem

    5
    0 Votes
    5 Posts
    1k Views
    B
    @derksuh Ok, but it still needs your code to find a place within the loop if I'm not mistaken? I'm not a c-programmer, so now and then I'm somewhat confused by the code of others. I learn by doing, which is now and then a process of copy-paste and at other moments analysing how others did it. BR, Boozz
  • Combining Multiple sensors - Reed switch not working

    5
    0 Votes
    5 Posts
    2k Views
    rhuehnR
    thanks @fets have I specified the wait time at the wrong location? In the sketch below, everything works, BUT the PIR triggers 0 over and over and over again..... #define MY_GW_ID 50 // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensor.h> #include <DHT.h> #include <Bounce2.h> //Constants #define SKETCH_NAME "3 in 1 Sensor" #define SKETCH_VERSION "1.0" #define CHILD_ID_TEMP 11 // Child id for Temperature #define CHILD_ID_HUM 10 // Child id for Humidity #define CHILD_ID_MOT 2 // Child id for Motion #define HUMIDITY_SENSOR_DIGITAL_PIN 7 // Where is my DHT22 data pin connected to #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway) #define CHILD_ID_SW 3 // Child id for Reed Switch #define BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch #define RELAY_1 4 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 1 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay int node_id=50; // What is my node id MySensor gw; Bounce debouncer = Bounce(); int oldValue=-1; DHT dht; //Store last values float lastTemp = 0 ; float lastHum = 0 ; ; boolean lastTripped = false ; boolean metric = true; boolean gwsend = true; // to determine if data has to be sent MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgMot(CHILD_ID_MOT, V_TRIPPED); MyMessage msgsw(CHILD_ID_SW,V_TRIPPED); void setup() { gw.begin(NULL,node_id,false); gw.wait(5); dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); // Send the Sketch Version Information to the Gateway gw.sendSketchInfo("3 in 1 Sensor", "1.0",true); // - NEW Setup the button pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); // - NEW Setup the button END pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID_HUM, S_HUM,"Garage Humidity"); gw.present(CHILD_ID_TEMP, S_TEMP,"Garage Temperature"); gw.present(CHILD_ID_SW, S_DOOR,"Garage Door"); metric = gw.getConfig().isMetric; } void loop() // Read Reed switch value { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { // Send in the new value gw.send(msgsw.set(value==HIGH ? 1 : 0)); oldValue = value; } // Read Temp - Humidity Value { delay(dht.getMinimumSamplingPeriod()); 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); } { // Read digital motion PIR value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); gw.send(msgMot.set(tripped?"1":"0")); // Send tripped value to gw } } } Thanks
  • [BETA 2.0] Manual node id

    2
    0 Votes
    2 Posts
    1k Views
    scalzS
    hello. at the beginning of your sketch, you can add #define MY_NODE_ID x where "x" is your node id. If this line is commented, or not present, then it's auto mode.
  • Default RF24 PA level and data rate in latest dev branch...

    2
    0 Votes
    2 Posts
    2k Views
    AWIA
    @Mark-Swift default settings are in MyConfig.h and setting is "MAX" * @def MY_RF24_PA_LEVEL * @brief Default RF24 PA level. Override in sketch if needed. */ #ifndef MY_RF24_PA_LEVEL #define MY_RF24_PA_LEVEL RF24_PA_MAX #endif
  • How to use the Selector switch with mysensors

    1
    0 Votes
    1 Posts
    954 Views
    No one has replied

22

Online

11.7k

Users

11.2k

Topics

113.0k

Posts