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!
  • present() not sending or being received?

    1
    0 Votes
    1 Posts
    451 Views
    No one has replied
  • TEMT6000

    Locked
    3
    1
    0 Votes
    3 Posts
    1k Views
    mfalkviddM
    Original post moved to https://forum.mysensors.org/topic/7150/temt6000/ Locking this topic to avoid confusion and double work.
  • New Sensor Domoticz

    3
    0 Votes
    3 Posts
    1k Views
    A
    I followed the Mq2 Sensor Tutorial, but I'm only out of the kids and not on devices. Instead, for the rain sensor I did not find anything.
  • RGB Leds Light - Mood Light

    6
    0 Votes
    6 Posts
    2k Views
    OliverDogO
    I tried another sketch from https://forum.mysensors.org/topic/6765/rgb-led-strip It worked with HASS but there is no response based on transitions time. /** * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * LED STRIP sketch for Mysensors ******************************* * * REVISION HISTORY * 1.0 * Based on the example sketch in mysensors * 1.1 * fadespeed parameter (send as V_VAR1 message) * HomeAssistant compatible (send status to ack) */ #define MY_NODE_ID AUTO #define MY_DEBUG #define MY_RADIO_NRF24 #include <MySensors.h> #define CHILD_ID_LIGHT 1 #define SN "LED Strip" #define SV "1.1" MyMessage lightMsg(CHILD_ID_LIGHT, V_LIGHT); MyMessage rgbMsg(CHILD_ID_LIGHT, V_RGB); MyMessage dimmerMsg(CHILD_ID_LIGHT, V_DIMMER); byte red = 255; byte green = 255; byte blue = 255; byte r0 = 255; byte g0 = 255; byte b0 = 255; char rgbstring[] = "ffffff"; int on_off_status = 0; int dimmerlevel = 100; int fadespeed = 0; #define REDPIN 6 #define GREENPIN 5 #define BLUEPIN 3 void setup() { // Fix the PWM timer. Without this the LEDs will flicker. TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00); // Output pins pinMode(REDPIN, OUTPUT); pinMode(GREENPIN, OUTPUT); pinMode(BLUEPIN, OUTPUT); } void presentation() { // Send the Sketch Version Information to the Gateway sendSketchInfo(SN, SV); present(CHILD_ID_LIGHT, S_RGB_LIGHT); } void loop() { static bool first_message_sent = false; if ( first_message_sent == false ) { Serial.println( "Sending initial state..." ); set_hw_status(); send_status(); first_message_sent = true; } } void receive(const MyMessage &message) { int val; if (message.type == V_RGB) { Serial.println( "V_RGB command: " ); Serial.println(message.data); long number = (long) strtol( message.data, NULL, 16); // Save old value strcpy(rgbstring, message.data); // Split it up into r, g, b values red = number >> 16; green = number >> 8 & 0xFF; blue = number & 0xFF; send_status(); set_hw_status(); } else if (message.type == V_LIGHT || message.type == V_STATUS) { Serial.println( "V_LIGHT command: " ); Serial.println(message.data); val = atoi(message.data); if (val == 0 or val == 1) { on_off_status = val; send_status(); set_hw_status(); } } else if (message.type == V_DIMMER || message.type == V_PERCENTAGE) { Serial.print( "V_DIMMER command: " ); Serial.println(message.data); val = atoi(message.data); if (val >= 0 and val <=100) { dimmerlevel = val; send_status(); set_hw_status(); } } else if (message.type == V_VAR1 ) { Serial.print( "V_VAR1 command: " ); Serial.println(message.data); val = atoi(message.data); if (val >= 0 and val <= 2000) { fadespeed = val; } } else { Serial.println( "Invalid command received..." ); return; } } void set_rgb(int r, int g, int b) { analogWrite(REDPIN, r); analogWrite(GREENPIN, g); analogWrite(BLUEPIN, b); } void set_hw_status() { int r = on_off_status * (int)(red * dimmerlevel/100.0); int g = on_off_status * (int)(green * dimmerlevel/100.0); int b = on_off_status * (int)(blue * dimmerlevel/100.0); if (fadespeed >0) { float dr = (r - r0) / float(fadespeed); float db = (b - b0) / float(fadespeed); float dg = (g - g0) / float(fadespeed); for (int x = 0; x < fadespeed; x++) { set_rgb(r0 + dr*x, g0 + dg*x, b0 + db*x); delay(100); } } set_rgb(r, g, b); r0 = r; b0 = b; g0 = g; } void send_status() { send(rgbMsg.set(rgbstring)); send(lightMsg.set(on_off_status)); send(dimmerMsg.set(dimmerlevel)); }
  • Linker error with new class for gateway

    3
    0 Votes
    3 Posts
    868 Views
    S
    Ok now I have found the proper place to include the missing .cpp files to generate the .o files. In the MySensor.h are all necessary .cpp files from the /core folder #if defined(MY_GATEWAY_LINUX) #include "drivers/Linux/EthernetClient.h" #include "drivers/Linux/EthernetServer.h" #include "drivers/Linux/IPAddress.h" #endif #include "drivers/PubSubClient/PubSubClient.cpp" #include "core/MyGatewayTransportMQTTClient.cpp" #include "core/MySmartSleep.cpp" #include "core/MySleepNode.cpp
  • Excessive NACK

    6
    0 Votes
    6 Posts
    3k Views
    alexsh1A
    @mpp 90-95% percent of my NACKs were solved by: changing radio installing or changing capacitor changing the radio power supply
  • Mysensor Ethernet gateway message definition

    3
    0 Votes
    3 Posts
    744 Views
    F
    @mfalkvidd Thank you. This will help a lot
  • NRF5 Read Back Protection

    4
    2 Votes
    4 Posts
    1k Views
    AnticimexA
    I agree. In general, security mechanisms other than OTA/message related (signing/encryption) should be part of the bootloader, since that is the area where absolute control can be enforced on what to execute (fw validation, etc).
  • Lightning report - any idea ?

    9
    0 Votes
    9 Posts
    2k Views
    wallyllamaW
    The project you linked to uses a feature of the atmega to speed up the a/d sample rate, leaving little processing for other work. It also sends a 512 byte payload, whih is nice for graphing, but Im guessing you'd like a count of lightning, strength, and distance. This one would give strength and count. If I were doing this, I'd use 2 arduinos, 1 as a detector, 1 to parse the data and act as the mysensors node. Look through the apu docs. There is probably a reasonable data type to send the processed data to domoticz or what ever you like. If I were really doing this, I would look for a more robust detector using discrete components. And connect it to an arduino/mysensors node. This one may work. (Maybe more complicated to build) http://www.techlib.com/electronics/lightningnew.htm An old am radio tuned to an unused frequency, could be connected to an arduino analog pin with some resistors and capacitors, and sampled at 9600 samples/sec or less and could be done with 1 arduino.
  • Changing setIndication behavior

    led setindication blink
    1
    0 Votes
    1 Posts
    624 Views
    No one has replied
  • Change valuename send to Controller

    4
    0 Votes
    4 Posts
    918 Views
    gohanG
    Well, mysensors is kind of a transport of information that is then presented to the user by the controller, so it is more a user interface business to present the data the way you like :)
  • RS485 Gateway on Raspberry Pi

    5
    2
    1 Votes
    5 Posts
    11k Views
    kduinoK
    Hi, @admins an advice about the MY_NODE_ID in the how to for the rs485 section would be helpful. I think, there are at least the double of the people trying for hours until they give up. Only some of them take the efforts to register and login here to get useful information... By kduino
  • Problem with Rpi mqtt gateway

    18
    0 Votes
    18 Posts
    3k Views
    rozpruwaczR
    yes, I understand that, I have a masters degree in electronics ;) but rpi has 1A capable buck converter on 3.3V rail so the question is how much current consumes the PA+LNA nrf module so it may not fit into the power budget ?
  • 0 Votes
    7 Posts
    2k Views
    V
    @Yveaux , ohk! BTW, Is there any Repetition check and discard function in the library or atleast a way to do that?
  • MYSBootloader node doesnt connect to gateway

    4
    0 Votes
    4 Posts
    962 Views
    V
    Upon further investigation of the TransportMessage function it looks like GW has been configured with MY_REPEATER_FEATURE = ON! Is it normal? Shouldnt this be false for a gateway sketch? Or does this mean that the MYSBootloader.hex file on the new node has this Repeater feature on? @hek, Your thoughts... Am i prodding in the right direction or am off-track completely?
  • Ota progress checking

    2
    0 Votes
    2 Posts
    896 Views
    martinhjelmareM
    @mtiutiu I made something like that here: https://forum.mysensors.org/topic/4923/ota-firmware-updating-is-too-slow/13
  • help to sketch. motion sensor with ack

    5
    0 Votes
    5 Posts
    2k Views
    R
    @gohan @scalz @Boots33 thanks my friends for help:rose:
  • Adding a local RCSwitch to a serial gateway crashes it

    8
    0 Votes
    8 Posts
    3k Views
    L
    OK newest update: my gateway stop working at all today. I did not even get any reactions on the serial port. So I tried to reprogram it => no reaction either. I had to manually reflash the bootloader and load the normal gateway sketch (without the 433Mhz stuff again). So I guess there is some kind of overflow somewhere caused by the code. The normal gateway sketch runs without any problems. No idea where the error is yet.
  • 0 Votes
    3 Posts
    865 Views
    S
    Excellent, thanks, just what I needed to know :)
  • Sensor "persistence"?

    26
    0 Votes
    26 Posts
    5k Views
    I
    One more thing :simple_smile: , this is the Arduino Mini schematics if someone needs it (not very easy to find): [image: 1496905611962-arduino_mini_schematics-resized.jpeg]

22

Online

11.7k

Users

11.2k

Topics

113.0k

Posts