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!
  • nRF24L01+ RF_CH bits

    6
    0 Votes
    6 Posts
    1k Views
    mfalkviddM
    @bakcsa thanks for the nice source. Your observation is in line with the note in MySensors documentation that says the same channels are allowed in Germany.
  • fault tolerance

    3
    1 Votes
    3 Posts
    713 Views
    CrankyCoderC
    @mfalkvidd I will put up a write up on what i did. Including my health check script (which may address some of the other items on how I handle the failures ect) Keepalived with the check script and health script is what I use to keep tabs and it also moves that virtual IP back and forth allowing for the same ip to stay in use and restart the binary when needed
  • SoftwareSerial dropped packages

    4
    0 Votes
    4 Posts
    827 Views
    YveauxY
    @timde your buffer of 9 characters is definitely too small to store a 10 character message. The code will work, but will overwrite the character(s) located after your buffer. Anything can sit there, and it can change over compile iterations, so behavior will be flaky. Switching to string, which re-allocates memory dynamically as characters get added to it, will fix this issue. I guess you added the delay because you are missing characters, right? If so, this is very tricky as it needs to sync to the rate at which new characters come in...
  • 2X WS2182 ONE NODE

    2
    0 Votes
    2 Posts
    556 Views
    gohanG
    Pretty much just duplicate the code regarding the MyMessage object, also in presentation and receive function, just change the Mymessage object name and its child id
  • Not all Relais visible in Domoticz

    9
    0 Votes
    9 Posts
    1k Views
    nagelcN
    Another thing to try. Try changing the button IDs to 6 and 7. You define the button child IDs as 3 and 4. The relays are presented with child ID's 1 through 5 by the loop in Presentation(). So the buttons have the same child IDs as two of the relays. Some sensors can have the same child ID, like temperature and humidity, but I don't know about S_DOOR and S_BINARY. Also, delete this code i suggested. It needs some tweaking and I suspect the issue is really the overlap of the child IDs: static bool startup = true; If (startup) { Send initial value for each switch/relay startup=false; }
  • Direct pairing of two nodes implementation

    7
    3 Votes
    7 Posts
    2k Views
    RFM69R
    I updated a few things, perhaps not all working properly yet, but have put a git page up at https://github.com/dudman8/MysensorsPairNodeLocal Added registering multiply pairings, flashing led to indicate if nodes are in pairing mode etc. Still needs some work though, any feed back :) welcome. Id like to add some messaging so controller could query the nodes and how they are connected, and configure them also from the controller, but don't know yet how to to this with templates and custom buttons etc in mycontroller.
  • Remote password assign

    16
    0 Votes
    16 Posts
    1k Views
    AnticimexA
    @kestutis-mockus I still think it is too complicated for what the basic feature actually provide (which is weak security) and it relies on a atsha which on its own implement stronger security based on personalization, something the entire password feature was designed to circumvent. But if you feel the feature is strongly desired, feel free to file a pr (and maintain) the feature and if it is well designed it can be incorporated in the core. But personally I don't feel it gives enough benefit for being worth the effort of implementation and maintenance. I'd rather focus on development of the next generation security which is designed to replace the current encryption/signing solution in its entirety (the current solution will remain an option for those who prefer it though). But this will be first in mysensors v3.
  • Newbie timer question

    3
    0 Votes
    3 Posts
    581 Views
    YveauxY
    @scottdube If your code is allowed to block during the wait, the implementation can be very straightforward (untested): // ...setup etc... void loop() { static int prevState = LOW; int state = digitalRead(ZwavePin); if (state != prevState) { // ZWavePin state has changed // Determine target state of relay const int pinState = (state == HIGH) ? LOW : HIGH; // Set Fire relay digitalWrite(FirePin, pinState); // Wait some ms delay(5000); // Set Fan relay digitalWrite(FanPin, pinState); // Remember current ZWavePin state to be able to detect changes prevState = state; } } As your description doesn't mention the source of the ZWavePin, it might require debouncing if it is a mechanical switch.
  • Multi relay with two Binary switches

    2
    0 Votes
    2 Posts
    791 Views
    DickD
    @dick said in Multi relay with two Binary switches: I created 2 project where I need 5 relays and 2 buttons. If I put the number of relays on 5, I only see 3 in my Domoticz. The switches are visible in Domoticz without problems. How can I fix the relay issue? // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #include <Bounce2.h> #define RELAY_1 A0 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 5 // 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 #define CHILD_ID_IRBIN 3 #define CHILD_ID_IRBUI 4 #define IRBIN_PIN 3 // Arduino Digital I/O pin for button/reed switch #define IRBUI_PIN 4 Bounce debouncerIRBIN = Bounce(); Bounce debouncerIRBUI = Bounce(); int oldValue_IRBIN = -1; int oldValue_IRBUI = -1; MyMessage msgIRBIN(CHILD_ID_IRBIN, V_TRIPPED); MyMessage msgIRBUI(CHILD_ID_IRBUI, V_TRIPPED); void before() { for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { // Setup the button1 pinMode(IRBIN_PIN, INPUT); debouncerIRBIN.attach(IRBIN_PIN); debouncerIRBIN.interval(5); digitalWrite(IRBIN_PIN, HIGH); // Setup the button2 pinMode(IRBUI_PIN, INPUT); debouncerIRBUI.attach(IRBUI_PIN); debouncerIRBUI.interval(5); digitalWrite(IRBUI_PIN, HIGH); } void presentation() { // Register binary input sensor to gw (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(CHILD_ID_IRBIN, S_DOOR); present(CHILD_ID_IRBUI, S_DOOR); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); } } void loop() { debouncerIRBIN.update(); // Get the update value int valueIRBIN = debouncerIRBIN.read(); if (valueIRBIN != oldValue_IRBIN) { // Send in the new value send(msgIRBIN.set(valueIRBIN == HIGH ? 1 : 0)); oldValue_IRBIN = valueIRBIN; } debouncerIRBUI.update(); // Get the update value int valueIRBUI = debouncerIRBUI.read(); if (valueIRBUI != oldValue_IRBUI) { // Send in the new value send(msgIRBUI.set(valueIRBUI == HIGH ? 1 : 0)); oldValue_IRBUI = valueIRBUI; } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_STATUS) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom 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()); } } Sorry, add my questions two times
  • debug info for radio (rfm69)

    3
    0 Votes
    3 Posts
    931 Views
    copperleafC
    Thanks for the info. That really helped!
  • NOT WORKING: DHT and RELAYS on Ethernet GW

    20
    0 Votes
    20 Posts
    2k Views
    Z
    @rejoe2 said in NOT WORKING: DHT and RELAYS on Ethernet GW: @zachflem said in NOT WORKING: DHT and RELAYS on Ethernet GW: any thoughts? Not sure about if that's still valid, but there had been the recommendation to use ChildID 1 for the first relay. So you may use 3+4 for temp/hum or start with 10, 20 (or whatever you like) as proposed to have room for further relays or other type of switches. Yeah, just re-read it and found the hard define for the IDs of those, and set them to 100 and 101. Now I have the 2 relays defined as 1 & 2 and the Humidity as 100 and Temp as 101. Can see all 4 sensors but only getting a value from the temp sensor.
  • 0 Votes
    10 Posts
    2k Views
    C
    @johnrob I understand wanting to apply the calibration data even though you don't need it. I did the same. The Arduino hardware doesn't support 32 bit calculations, but it can be done in software; it just makes your code bigger.
  • MySensors - Get Temperature value from another node through the Gateway

    36
    0 Votes
    36 Posts
    6k Views
    I
    @Joe13, I am new to DzVents too ... but it is a great opportunity to learn:smile: Have a look into the Domoticz installation folder, can't remember now exactly where but there is a sub-folder with interesting examples, when you start reading these examples you may have a better overall understanding of how DzVents works. Their wiki is also very usefull: https://www.domoticz.com/wiki/DzVents:_next_generation_LUA_scripting Have fun @Joe13 ...
  • Ocr for Arduino or raspberry question

    8
    0 Votes
    8 Posts
    3k Views
    manicfarmerM
    @ecabanas I am pretty sure you can compile OpenCV to run on the PI. I built a machine for my computer vision dev with a good video card so I could use the cuda cores build. Have you worked with any computer vision libraries? You will likely need a decent machine to do the processing. Maybe you could branch and build your own code base designed for the hardware you are considering. My experience is you have to do a lot of threshing of images, converting to gray scale, etc to do what you want. Your project is probably a little ambitious for a starter. You probably want to dl OpenCV and play around with the samples and take a look at some youtube videos for starters.
  • Help in data send to Domoticz

    domoticz dht22 soil moisture
    2
    0 Votes
    2 Posts
    1k Views
    gohanG
    Do some debug on the node and on gateway and check if data is actually sent from the node and received by gateway. Also use wait instead of sleep if you are using it as a repeater and relay actuator.
  • How to get battery volt / percentage message send to mqtt?

    15
    0 Votes
    15 Posts
    2k Views
    M
    @gohan Ok will try that see if I made a fault somewhere
  • Wrong instructions on gateway for personalizer?

    20
    0 Votes
    20 Posts
    2k Views
    AnticimexA
    @gohan don't suggest people hack in MyConfig.h because it's the wrong thing to do.
  • Servo speed

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • RS485 support possible

    3
    0 Votes
    3 Posts
    778 Views
    gohanG
    With dual optiboot you should in theory be able to do OTA as the firmware is transferred over existing communication channel
  • MYSBootloader node contantly resets

    4
    0 Votes
    4 Posts
    975 Views
    T
    @Tekka You steered me in the right direction. Thanks again! I did a search on wdt_reset to get a better idea of what it does and then found posts describing that if something keeps the CPU occupied for a prolonged time that the watchdog can kick in thinking the MCU has stalled/froze. I also understood that the MySensor library will reset the watchdog timer regularly. Looking at my sketch I found that I used delay() at certain points. The five minute sleep was done using wait(). Replacing delay() with wait() throughout the sketch fixed the issue for me! It has not reset overnight where otherwise I would see it reset every 25 seconds or so. Now I will look at the other examples that would reset itself. I'm in good shape now to roll out MYSBootloader and upgrade my nodes to 2.2.0 at the same time.

13

Online

11.7k

Users

11.2k

Topics

113.0k

Posts