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!
  • Anyone ever look into ezbl (aka easy booloader) on a PIC?

    1
    0 Votes
    1 Posts
    247 Views
    No one has replied
  • ESP8266 MQTT Client Node ID

    8
    0 Votes
    8 Posts
    1k Views
    mfalkviddM
    @msolo "adding" that would risk breaking a lot of stuff, but you're welcome to try. https://www.mysensors.org/download/contributing has some useful information if you want to work on it.
  • Encryption and replay attack

    3
    0 Votes
    3 Posts
    353 Views
    rozpruwaczR
    @lood29 encryption is not authentication, these are different things
  • Mysensor usb gateway serial problem

    7
    0 Votes
    7 Posts
    488 Views
    D
    @kimot yes I know this is an error but I wanted to read the value from pin 4. this example worked for me (RelayActuator) I wanted to use this ordinary switch to control the rest of the program. that's all I need at the moment
  • 0 Votes
    2 Posts
    273 Views
    mfalkviddM
    @matkor it is currently not possible. https://github.com/mysensors/MySensors/issues/1312 suggests a solution but there has been no forward progress lately.
  • ESP8266 Gateway with AP mode instead of hardcoded ssid etc

    7
    0 Votes
    7 Posts
    523 Views
    K
    But if you move ( or sold ) your gateway to different network, what seems as reason for selecting SSID and password, you still need recompile your code due to different IP of your controller.
  • A stupid question...

    3
    0 Votes
    3 Posts
    374 Views
    Sergio RiusS
    I was not sure about it, and the paranoia took control.
  • MY_DEBUG_OTA results in compile errors

    9
    0 Votes
    9 Posts
    538 Views
    A
    @mfalkvidd Thank you - MY_DEBUG_VERBOSE_OTA_UPDATE does look like it's exactly what I was looking for. Further looking into the code here though, it would seem that it gets defined automatically if we define MY_DEBUG. Turn it around, when we define MY_DEBUG, we should see verbose FOTA (+ Core, Transport and Gateway) information in the serial log output. I'll attempt some more testing tonight to see what I can see.
  • Control temperature of double white LED stripes

    9
    2
    2 Votes
    9 Posts
    800 Views
    mfalkviddM
    Yes, let’s see if we can get @martinhjelmare ’s opinion.
  • 0 Votes
    8 Posts
    1k Views
    GardenShedDevG
    ok, so I figured it out... and just recording my observatios and fix in the hope it helps others or me if I forget :) @yveaux and @zboblamont said to use the MyS sleep() function which can handle interupts on pins 2 & 3. For me this is too limitiing as I am using 4 pins. What I needed was something simple for a rapid build. When I intially built the node a month ago I read up on the MyS sleep function, realised that it couldnt handle more than 2 pins for interupts and opted to go down the route of interupts as laid out on www.gammon.com.au. After a little more reading I then implemented the AVR sleep function, so far so good or so I thought - move fwd to my problem. While everything was working well: scene controller HW built - check, Software created - check, Enclosure printed - check, hooked up to home assitant - check, WAF (very important) - check, ...the node wasnt actaully sleeping DOH! Upto this point I had spent less than 6 hours in dev and implementation time.... So heres the problem, after a lot of reading over the last 36 hours I found a post that states MyS library only implements interupts for pins 2&3 on the pro mini - it doesnt implement interupt groups such as PCINT1 (A0-A5) etc AND the node cannot be woken up via interupt if it is not done via pins 2&3. @electrik posted a link to his excellent sketch that hacks the core code a little - as I was looking into this method I stumbled on a post by @freynder that implements a 'dirty hack' here which forces the node to wake up on interupt when using the MyS sleep() function. This then led me to a post on a 6/8 button controller here. These two posts have be pivotal in fixing my problem. Thank you @electrik for triggering the thought process that lead to a simple solution :) @yveaux and @zboblamont you where both correct I need to use the MyS sleep() function which I have now implemented alongside the external interupt library form the 6/8 button controller link and the added the two lines of code as per the 'dirty hack' My node now reads 18mA when active (transmitting) and when sleeping it is less than 0.5mA - which is the limitation of my equipment! @zboblamont to answer your Q about node setup, I have a pro mini and with both the power led and regulator removed as per the MySensors hack for battery nodes - however the transmit led is still connected which will draw extra current when transmitting, which I am ok with for the moment lol thank you to all that have contributed !! heres the schematic of the controller: [image: 1562240086946-scene-controller-resized.jpg] and an updated extract of the code #define MY_DEBUG true // Enable debug prints #define MY_RADIO_NRF24 // Enable and select radio type attached #define MY_NODE_ID 7 // >>>>>>>>Set the node ID manually - this must be set the mysensors.h call<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #include <MySensors.h> #include <OneButton.h> // https://github.com/mathertel/OneButton #define EI_NOTEXTERNAL // External interrupts managed by built-in routines #include <EnableInterrupt.h> // Pin-change interrupts #define MIN_V 1.9 // Minimum Battery Voltage #define MAX_V 3.1 // Max Battery Voltage #define CHILD_ID_BUTTON1 1 #define CHILD_ID_BUTTON2 2 #define CHILD_ID_BUTTON3 3 #define CHILD_ID_BUTTON4 4 #define CHILD_ID_BATTERY 5 #define CHILD_ID_ADC 6 #define SN "Scene Controller" #define SV "0.4" #define BUTTON4 A1 // Interput pin and button definitions #define BUTTON1 A2 #define BUTTON3 A0 #define BUTTON2 A3 OneButton button4(BUTTON4, true); // Setup a new OneButton on pin A1. OneButton button1(BUTTON1, true); // Setup a new OneButton on pin A2. OneButton button3(BUTTON3, true); // Setup a new OneButton on pin A0. OneButton button2(BUTTON2, true); // Setup a new OneButton on pin A3. int SendDelay = 500; // Time to wait before sending data over the radio int BATTERY_SENSE_PIN = A5; // Define battery sense pins int oldBatteryPcnt = 0; //int batteryCounter = BATTERY_REPORT_CYCLE -1; // counter for battery update //int reportCounter = FORCE_TRANSMIT_CYCLE -1; // counter for the loop and forcing updates unsigned long StartTime = 0; // sleep startime variable unsigned long SleepWaitTime = 10000; // Time to wait before going to sleep 10 seconds unsigned long Sleep_Time = 86400000; // 86400000 Sleep for 24 hours int MessageA = 0; // Button Message Values 0- no value int MessageB = 1; // up int MessageC = 2; // down int MessageD = 3; // toggle on/off MyMessage msgButton1(CHILD_ID_BUTTON1, V_SCENE_ON); MyMessage msgButton2(CHILD_ID_BUTTON2, V_SCENE_ON); MyMessage msgButton3(CHILD_ID_BUTTON3, V_SCENE_ON); MyMessage msgButton4(CHILD_ID_BUTTON4, V_SCENE_ON); MyMessage msgBattery(CHILD_ID_BATTERY, V_VOLTAGE); MyMessage msgADCValue(CHILD_ID_ADC, V_VOLTAGE); /* #################################################### # # # Presentaion # # # #################################################### */ void presentation() { sendSketchInfo(SN, SV); wait(SendDelay); // Send the sketch version information to the gateway present(CHILD_ID_BUTTON1, S_SCENE_CONTROLLER); wait(SendDelay); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_BUTTON2, S_SCENE_CONTROLLER); wait(SendDelay); present(CHILD_ID_BUTTON3, S_SCENE_CONTROLLER); wait(SendDelay); present(CHILD_ID_BUTTON4, S_SCENE_CONTROLLER); wait(SendDelay); present(CHILD_ID_BATTERY, S_MULTIMETER); wait(SendDelay); present(CHILD_ID_ADC, S_MULTIMETER); wait(SendDelay); // metric = getControllerConfig().isMetric; } /* #################################################### # # # Void Setup # # # #################################################### */ void setup() { analogReference(INTERNAL); Serial.begin(115200); // Setup the Serial port. see http://arduino.cc/en/Serial/IfSerial Serial.println("Starting..."); delay(10); button1.attachClick(click1); // Button 1 functions. button1.attachDoubleClick(doubleclick1); button1.attachLongPressStop(longPressStop1); button2.attachClick(click2); // Button 2 functions. button2.attachDoubleClick(doubleclick2); button2.attachLongPressStop(longPressStop2); button3.attachClick(click3); // Button 3 functions. button3.attachDoubleClick(doubleclick3); button3.attachLongPressStop(longPressStop3); button4.attachClick(click4); // Button 4 functions. button4.attachDoubleClick(doubleclick4); button4.attachLongPressStop(longPressStop4); enableInterrupt(BUTTON1,Int_vect,CHANGE); enableInterrupt(BUTTON2,Int_vect,CHANGE); enableInterrupt(BUTTON3,Int_vect,CHANGE); enableInterrupt(BUTTON4,Int_vect,CHANGE); } /* #################################################### # # # Void Loop # # # #################################################### */ void loop() { if((millis() - StartTime) >= SleepWaitTime) // Wait for some time before going to sleep { Serial.println("Sleeping...."); delay(10); sleep(Sleep_Time); // Sleepy Time :) // WAKE UP HERE _wokeUpByInterrupt = INVALID_INTERRUPT_NUM; //dirty hack wake up routine - clear interupt StartTime = millis(); Serial.println("Awake..."); int battery_read; // call function - Send the battery status battery_read = SendBattery(); } button1.tick(); // Check the push buttons: button2.tick(); button3.tick(); button4.tick(); delay(10); } /* #################################################### # # # Interupt Service Routine # # # #################################################### */ void Int_vect() // handle pin change interrupt for A0 to A5 here { //Serial.println("--**-INTERRUPT-**--"); //debug _wokeUpByInterrupt = 0xFE; // Dirty hack to get out of MySensors sleep loop }
  • Daikin heatpump controller, no IR

    2
    1
    0 Votes
    2 Posts
    405 Views
    K
    https://github.com/Arnold-n/P1P2Serial
  • Easiest way to enable/disable MySensors on running node?

    10
    0 Votes
    10 Posts
    932 Views
    F
    @alowhum: Perhaps something like boolean sendWithPermission(MyMessage &msg) { // Check permission and send here if (connecting_allowed){ send(msg); } }```
  • Receive queued mensajes after sleep

    3
    1 Votes
    3 Posts
    439 Views
    electrikE
    You're not sleeping at all now. After sleep, you can request the current value of the sensor with request(). It depends on the controller if the request function is available. You can use sleep(600000); see also https://www.mysensors.org/download/sensor_api_20#sleeping. You are not distinguishing to which child you receive the V_STATUS in receive(). So you should check message.sensor in your if statement also
  • Raspberry Pi/Motieno - Serial or Ethernet Gateway?

    3
    0 Votes
    3 Posts
    492 Views
    P
    Thank you! That actually does clear it up. I already have a Home Assistant instance which is different than the Pi that is going to use the Hat. Since it is separate, I am making it more difficult on myself. However, like you said, the Hat will be a serial gateway and I will have code on the Pi that reads and parses the serial API data. Then it is up to me get that to Home Assistant. Since my initial use case is to monitor a number of BME280s, I can publish the data to MQTT. Then HA or Node Red can use it. I appreciate your response.
  • MYSBootloader and PlatformIO

    2
    1 Votes
    2 Posts
    426 Views
    franz-unixF
    :grinning: Found a solution! It is quite easy with the custom board features of PlatformIO. I wrote a brief tutorial here. Tested with a Pro Mini 8 MHz 3.3V and FTDI programmer. Unfortunately I don't have here a 16 MHz 5V devices to test
  • MySensors + RN2483 LoRa

    3
    0 Votes
    3 Posts
    494 Views
    N
    I have tried my possible best creating the API for RN2483... Can some help me out with the code and driver?
  • Help about "Low memory available, stability problem may occur"

    2
    0 Votes
    2 Posts
    323 Views
    alowhumA
    Should be fine. It's impossible to day for certain without looking at your code to see how much ram you will be using in the main loop. Just test it. If it works, it works. If it still works next week, it really works.
  • NRF24l01 Sensor_id aleatory

    11
    0 Votes
    11 Posts
    619 Views
    M
    Stupid..... mygateway1-in / 3/0/1/0/1, to publish ..... I'm going to study the library gradually, so far I think top
  • Lux sensor (BH1750) sending battery level (V)

    12
    0 Votes
    12 Posts
    978 Views
    bgunnarbB
    @mfalkvidd Yep, this is a great way of introducing errors that will be nearly impossible to find!:grinning:
  • Could we use Gitpod to compile new firmware?

    3
    0 Votes
    3 Posts
    683 Views
    Paul RobertsonP
    @mfalkvidd True. I have just started using Gitpod and the attraction is that all the libraries are already in place and up to date. Just edit one file and then push a 'button' and you have the firmware ready to go...

7

Online

11.7k

Users

11.2k

Topics

113.0k

Posts