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!
  • IR Sensor only reading every other button press

    7
    0 Votes
    7 Posts
    39 Views
    skywatchS
    @kiesel You are welcome! - We are all here to learn! :) As to my code, here is the thread with the problems I had and how I fixed them.... https://forum.mysensors.org/topic/10936/vs838-ir-receiver-led-anyone-got-it-working-with-mys?_=1582743282787 I am still tinkering around the edges and I expect a final version to be about a week away. It is mostly getting it all the way I want it now! ;)
  • Battery: pro mini @ 1mhz vs booster

    30
    0 Votes
    30 Posts
    184 Views
    NeverDieN
    @kiesel said in Battery: pro mini @ 1mhz vs booster: @zboblamont How do I know whether a booster introduces noise? I think so far I have been lucky with my three nodes because they work as expected. Or I don't know what to look for... If you wanted to play it safe (aka defensive programming), you could use your booster to charge a capacitor that's large enough to provide interim power, turn off the booster prior to doing your radio communications, and then turn the booster on again when you're done with tx/rx. That would effectively remove your booster from the equation as an interference source. Also, some boosters have a pass-through, so you can use your regular battery voltage for as long as it's high enough, and then when it no longer is, enable your booster, if that's what you want to do. Here's an example of one: https://www.openhardware.io/view/285/33v-Boost-Converter-with-Pass-Through For instance, CR2032's can have quite a voltage dip after volunteering some current, so this would be one way to keep wringing a useful voltage out of such a battery after its voltage may have temporarily dropped too low. Some of the ARM MCU chips include boost converters that can boost from as little as 0.5v....
  • no matching function for call to 'present(int, mysensors_data_t)'

    2
    0 Votes
    2 Posts
    27 Views
    mfalkviddM
    @maos present wants S_SOMETHING, not V_SOMETHING.
  • Handling NACKs in the gateway

    gateway
    9
    0 Votes
    9 Posts
    122 Views
    electrikE
    Exactly. Better to ask then waste many hours 😏
  • script to convert serial to mqtt?

    9
    0 Votes
    9 Posts
    82 Views
    K
    @Gerard-van-Seventer I am using appdaemon for my automation and I wouldn't want to install node red just for the conversion. Or are there automations that node red can that appdaemon can't?
  • Small RS485 network - questions.

    4
    0 Votes
    4 Posts
    69 Views
    F
    Actually I have to disagree with @rejoe2 about: Will my network work without controller (only gateway + nodes)? With an Ethernet gateway it is entirely possible. One more thing. If you are interested in building RS485 network, maybe you should have a look at my project. Earlier today I created a post about it on this forum. Here it is :)
  • multiple buttons on one analog pin arduino

    5
    0 Votes
    5 Posts
    3k Views
    T
    Hello first of all, excuse me for my english, i'm french. I try to use the sketch with the 10 relays, but nothing works on the buttons. I tried with several resistance values using "analogread" to read the real values, but when I enter the values in the table nothing happens at the relay levels. P.S: the relays work with jeedom. can you give me the procedure to follow to properly "configure" the sketch? cordially
  • Wireless nRF24L01+ sniffer for MySensors

    omg sniffer wireshark nrf24l01+
    108
    5 Votes
    108 Posts
    70k Views
    A
    @Yveaux Thanks very much for all your help. I hooked up the IRQ pin to the Arduino pin 2 as you suggested and it’s working fine now.
  • Drawbacks to using a pro mini as a serial gateway?

    6
    0 Votes
    6 Posts
    43 Views
    electrikE
    No just the Rx, TX and power should be enough.
  • Need some help!

    2
    0 Votes
    2 Posts
    25 Views
    skywatchS
    @amasterp1322 You will need to provide much more data I'm affraid. Where in the world is 'the project'? What type of sensors have you chosen or do you need help with this too? What are you measuring the moisture of and to what level of accuracy do the measurements need to be? What kind of distance is there between the sensors, relay, power source? Does everything have to be water resistant or waterproof? Is this an indoor or outdoor project? How are the sensors going to send data? What are the sensors sending the data to? What relay is involved and how was it specified? What is the relay activating and will you be following the electrical codes for your country/area? I suspect this is a greenhouse watering system, but you haven't actually defined the project so maybe you can give it some more thought to help us help you.
  • send() after receive()

    sleep smartsleep
    7
    1 Votes
    7 Posts
    96 Views
    H
    From what I understood, the solution from @tmandel was meant to revoke sleep based on incoming message. I needed to delay sleep due to messages waiting in the outgoing queue. At the end, I just got my fork of MySensors and added additional extern callback to MySensorsCore.cpp/_sleep just after the pre-sleep wait(MY_SMART_SLEEP_WAIT_DURATION_MS). The callback is then implemented in my source, where I check whether the oubound queue is empty. If not, MY_SLEEP_NOT_POSSIBLE is returned and the queue is flushed immediately in the next loop(). It may be crude but... hey, it keeps my flowers watered. Many thanks for the advice and the direction provided!
  • Debug log date time format

    3
    0 Votes
    3 Posts
    25 Views
    M
    @electrik Thank you
  • Arduino pro mini, rfm69 with 2 Reed switches on interrupts?

    8
    0 Votes
    8 Posts
    58 Views
    S
    Just a thought. I would personally go for one child ID/sensor. "There is uncollected mail" indicator. Set it to true when small door is tripped, and set to false when big door in open.
  • 2 Arduinos talk to each other over RS485

    4
    0 Votes
    4 Posts
    58 Views
    K
    https://github.com/MajenkoLibraries/ICSC Examples are there too. ( MySensors uses this code for 485 transport layer too ) Or another very simple example: https://circuitdigest.com/microcontroller-projects/rs485-serial-communication-between-arduino-uno-and-arduino-nano
  • Which battery measurement to use?

    7
    0 Votes
    7 Posts
    454 Views
    S
    power consumption wise resistor-less method and running directly from LiFePo4(rechargeable 2.8-3.6V) or LiSoCl(3.6v non rechargeable) battery is best. Unless you remove regulator and USB/rs232 chip it's all wasting your time. @mfalkvidd said in Which battery measurement to use?: But if you get a "good" booster, the battery life will be more limited by the self-discharge of the battery than by the power usage of the node. Same goes for the non-boosted variant. Depending on battery chemistry, LiSoCl will last 15 years. with carefully designed MyS node you can get 10 years on single AA LiSoCL battery. Something like power meter pulse counter transmitting once every kWh.
  • how to post a new sensor sketch?

    5
    0 Votes
    5 Posts
    2k Views
    Michiel van der WulpM
    I gave some remarks on the code, which were processed. If there is a feeling that adding the HeatIndex complicates the example, maybe this example should be a separate file, named "DhtHeatIndexSensor"?
  • Watchdog not watchdogging?

    28
    0 Votes
    28 Posts
    3k Views
    J
    I've manualy removed the call for watchdog reset from function void doYield(void) and I can see my user watchdog timer working again... This will probably affect some deep sleep and waking processes - that I do not care about in my cases... I used RadioHead library before, which is much more library in sense of composable part and I was very happy with it's long term stability... Now I'm trying MySensors and it's quite unstable comparing to RadioHead... If it had software signing, I'd definitely use RadioHead... Let's see if enabling user WDT will fix the unstabilities...
  • MySensors on MSP430 + NRF24L01

    2
    4 Votes
    2 Posts
    722 Views
    H
    WOW, nice work
  • Problem with dimmable LED actuator with encoder

    17
    0 Votes
    17 Posts
    3k Views
    I
    Hi, i have similar problem with domoticz and mysensors. Firstly, i can't get current dim level from domoticz on startup. Secondly if i start arduino and controll it over domoticz only, dimming and on/off works. If i turn the rotary knob, domoticz commands won't work. In serial monitor i see that new dim value has been received: Serial.print("Fading level: "); Serial.println(dimValue); but output doesn't change. If i turn knob on rotary, value in domoticz changes. I removed eeprom writes and rotary button. Only dims to off/on or domoticz commands off/on. Domoticz 4.10171, Mysensors 2.3.1, ide 1.8.10 // Enable debug prints to serial monitor #define MY_DEBUG #define MY_RADIO_RF24 #define MY_NODE_ID 10 #define MY_REPEATER_FEATURE #define MY_TRANSPORT_WAIT_READY_MS 10 //ajaviide ms, kuni läheb tööle ilma serverita #include <MySensors.h> #include <Encoder.h> #define KNOB_ENC_PIN_1 5 // Rotary encoder input pin 1 #define KNOB_ENC_PIN_2 4 // Rotary encoder input pin 2 #define SEND_THROTTLE_DELAY 500 // Number of milliseconds before sending after user stops turning knob #define CHILD_ID_Light 1 #define SN "DimmableLED" #define SV "1.1" #define LED_PIN 3 // Arduino pin attached to MOSFET Gate pin #define FADE_DELAY 10 // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim) int dimValue; int fadeTo; int fadeDelta; bool changedByKnob = false; bool sendDimValue = false; unsigned long lastFadeStep; unsigned long sendDimTimeout; //char convBuffer[10]; static int16_t currentLevel ; // Current dim level... MyMessage dimmerMsg(CHILD_ID_Light, V_DIMMER); MyMessage lightMsg(CHILD_ID_Light, V_LIGHT); Encoder knob(KNOB_ENC_PIN_1, KNOB_ENC_PIN_2); /*** Dimmable LED initialization method */ void setup() { // Pull the gateway's current dim level - restore light level upon node power-up request( CHILD_ID_Light, V_DIMMER); // wait(3000); } void presentation() { // Register the LED Dimmable Light with the gateway present(CHILD_ID_Light, S_DIMMER ); sendSketchInfo(SN, SV); } /*** Dimmable LED main processing loop */ void loop() { // Check if someone turned the rotary encode checkRotaryEncoder(); // Fade light to new dim value fadeStep(); } void receive(const MyMessage &message) { if (message.type == V_STATUS || message.type == V_PERCENTAGE) { // Retrieve the power or dim level from the incoming request message fadeTo = atoi( message.data ); // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on] fadeTo *= ( message.type == V_LIGHT ? 100 : 1 ); // Clip incoming level to valid range of 0 to 100 fadeTo = fadeTo > 100 ? 100 : fadeTo; fadeTo = fadeTo < 0 ? 0 : fadeTo; //startFade(); Serial.print("New light level received: "); Serial.println(fadeTo); if (!changedByKnob) knob.write(fadeTo << 1); //### need to multiply by two (using Shift left) // Cancel send if user turns knob while message comes in changedByKnob = false; sendDimValue = false; // Stard fading to new light level startFade(); // // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value... // send(lightMsg.set(dimValue > 0)); // // // hek comment: Is this really nessesary? // send( dimmerMsg.set(dimValue) ); } } void checkRotaryEncoder() { long encoderValue = knob.read() >> 1 ; //### Divide by 2 (using shift right) if (encoderValue > 100) { encoderValue = 100; knob.write(200); //### max value now 200 due to divide by 2 } else if (encoderValue < 0) { encoderValue = 0; knob.write(0); } if (encoderValue != fadeTo) { fadeTo = encoderValue; changedByKnob = true; startFade(); } } void startFade() { fadeDelta = ( fadeTo - dimValue ) < 0 ? -1 : 1; lastFadeStep = millis(); } // This method provides a graceful none-blocking fade up/down effect void fadeStep() { unsigned long currentTime = millis(); if ( dimValue != fadeTo && currentTime > lastFadeStep + FADE_DELAY) { dimValue += fadeDelta; analogWrite( LED_PIN, (int)(dimValue / 100. * 255 ) ); lastFadeStep = currentTime; Serial.print("Fading level: "); Serial.println(dimValue); if (fadeTo == dimValue && changedByKnob) { sendDimValue = true; sendDimTimeout = currentTime; } } // Wait a few millisecs before sending in new value (if user still turns the knob) if (sendDimValue && currentTime > sendDimTimeout + SEND_THROTTLE_DELAY) { // We're done fading.. send in new dim-value to controller. // Send in new dim value with ack (will be picked up in incomingMessage) send(dimmerMsg.set(dimValue)); // Send new dimmer value and request ack back sendDimValue = false; } }```
  • I am in need of some programming help.

    5
    0 Votes
    5 Posts
    185 Views
    skywatchS
    @bc123 Read and understand the posting rules here. I know this is your first post here... but how is that? How did you find your last 'programmer' for mys if not here> Just curious. Post code in code tags (as per the instructions) - i.e. choose the </> in the options above. Then paste 'your' code (if the original code is under any NDS or copyright then you do so at your own risk). Pictures of the wiring, as installed and wiring diagrams. Oh, and a full spec of what you expect and how it is all supposed to work would be a good start. Seasons greetings all the same to you.! ;) I'm off to drink more alcohol than any sane person would.... :) - Apparently it is 'that' time of year.

9

Online

11.7k

Users

11.2k

Topics

113.0k

Posts