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!
  • [SOLVED] Serial Gateway 2.3.1

    4
    0 Votes
    4 Posts
    837 Views
    A
    @mfalkvidd You are absolutely correct. I was using wrong frequency. many thanks, Ally
  • MY_SOFTSPI on Sensebender-Micro Derivate

    3
    3
    0 Votes
    3 Posts
    604 Views
    M
    Hi @scalz , thanks for the rapid reaction. Sure. Let's try this. Here is my code: /* --- Bathroom Environment Data Logging Node --- */ // +-+-+-+-+-+-+-+-+ DECLARATION +-+-+-+-+-+-+-+-+ // --- MYSENSORS DEFINITIONS --- // sketch #define SKETCH_NAME "EnvBad" #define SKETCH_VERSION "1.1" // debug prints #define MY_BAUD_RATE (115200) #define MY_DEBUG #define MY_DEBUG_VERBOSE_RF24 // soft SPI settings #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 12 // (usually at pin 13) #define MY_SOFT_SPI_MISO_PIN 13 //(usually at pin 12) #define MY_SOFT_SPI_MOSI_PIN 11 // NRF24 #define MY_RADIO_NRF24 #define MY_RF24_PA_LEVEL (RF24_PA_HIGH) #define MY_RF24_CE_PIN 9 #define MY_RF24_CS_PIN 10 #define MY_RF24_IRQ_PIN 2 // need to be enabled using the solder jumper at the top side of the PCB // LEDs #define MY_DEFAULT_TX_LED_PIN 6 #define MY_DEFAULT_RX_LED_PIN 5 #define MY_DEFAULT_ERR_LED_PIN 7 #define MY_WITH_LEDS_BLINKING_INVERSE // node ID #define MY_NODE_ID (100) // child IDs #define CHILD_ID_TEMPERATURE (0) #define CHILD_ID_HUMIDITY (1) #define CHILD_ID_LIGHT (2) // --- CONSTANTS --- // pin definitions const uint8_t phResistorEnPin = 4; const uint8_t PHOTO_RESISTOR_PIN = A0 ; // Timing constants const uint32_t ENV_VARS_CHECK_PERIOD_MS = 60UL*1000UL; const uint32_t LIGHT_CHECK_PERIOD_MS = 1UL*1000UL; // --- LIBRARIES --- #include <MySensors.h> #include <SHT3x.h> // temp and humidity sensor // --- Objects SHT3x Sensor; // ------------------------------------------------------------------------ // S E T U P // ------------------------------------------------------------------------ void setup() { Serial.println(F("-- " SKETCH_NAME " " SKETCH_VERSION)); Sensor.Begin(); } // ------------------------------------------------------------------------ // L O O P // ------------------------------------------------------------------------ void loop() { float tSHT; float hSHT; static uint8_t lightLev = 0, lightLevPrev = 200; static uint32_t t1 = millis(), t2 = 0; readPhRest(&lightLev); if ( abs(lightLevPrev - lightLev) >= 2 ) { lightLevPrev = lightLev; send( MyMessage(CHILD_ID_LIGHT, V_LIGHT_LEVEL).set(lightLev) ); } if ( t2 - t1 >= ENV_VARS_CHECK_PERIOD_MS ) { readSHT3x(&tSHT, &hSHT); send( MyMessage(CHILD_ID_TEMPERATURE, V_TEMP).set(double(tSHT), 2 /*#decimals*/) ); send( MyMessage(CHILD_ID_HUMIDITY, V_HUM).set(double(hSHT), 2 /*#decimals*/) ); t1 = t2; } wait(LIGHT_CHECK_PERIOD_MS); t2 = millis(); } // ------------------------------------------------------------------------ // SUB - ROUTINES // ------------------------------------------------------------------------ // ----------------------- presentation -------------------------- void presentation() { Serial.println(F("-- Init MySensors")); sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); Serial.print(F("NodeID: ")); Serial.println(getNodeId()); present(CHILD_ID_TEMPERATURE, S_TEMP, "Bad_Temp"); present(CHILD_ID_HUMIDITY, S_HUM, "Bad_LuFeu"); present(CHILD_ID_LIGHT, S_LIGHT_LEVEL, "Bad_Hell"); } // ----------------------- readSHT3x -------------------------- void readSHT3x(float *_tSHT, float *_hSHT){ Sensor.UpdateData(); *_tSHT = Sensor.GetTemperature(); *_hSHT = Sensor.GetRelHumidity(); Serial.print("Temperature: "); Serial.print(*_tSHT); Serial.write("\xC2\xB0"); //The Degree symbol Serial.println("C"); Serial.print("Humidity: "); Serial.print(*_hSHT); Serial.println("%"); } // ----------------------- readPhRest -------------------------- void readPhRest(uint8_t *_lLevel) { pinMode(phResistorEnPin,OUTPUT); digitalWrite(phResistorEnPin,LOW); *_lLevel = 100 - (uint8_t) ( ( (float)analogRead(PHOTO_RESISTOR_PIN) /10.24 ) + 0.5 ) ; pinMode(phResistorEnPin,INPUT); Serial.print ("PhotoResistor: "); Serial.print (*_lLevel); Serial.println(); } and here my debug print: __ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.0 16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0 26 TSM:INIT 28 TSF:WUR:MS=0 30 RF24:INIT 30 RF24:INIT:PIN,CE=9,CS=10 34 RF24:WBR:REG=0,VAL=14 43 RF24:WBR:REG=3,VAL=3 45 RF24:WBR:REG=4,VAL=95 47 RF24:WBR:REG=5,VAL=76 49 RF24:WBR:REG=6,VAL=37 53 RF24:WBR:REG=16,VAL=115 55 RF24:WBR:REG=29,VAL=4 57 RF24:RBR:REG=6,VAL=0 61 !RF24:INIT:SANCHK FAIL 63 !TSM:INIT:TSP FAIL 65 TSM:FAIL:CNT=1 67 TSM:FAIL:DIS 69 TSF:TDI:TSL 71 RF24:SLP 71 RF24:WBR:REG=0,VAL=12 10074 TSM:FAIL:RE-INIT 10076 TSM:INIT 10078 RF24:INIT 10080 RF24:INIT:PIN,CE=9,CS=10 10082 RF24:WBR:REG=0,VAL=14 10090 RF24:WBR:REG=3,VAL=3 10092 RF24:WBR:REG=4,VAL=95 10096 RF24:WBR:REG=5,VAL=76 10098 RF24:WBR:REG=6,VAL=37 10102 RF24:WBR:REG=16,VAL=115 10104 RF24:WBR:REG=29,VAL=4 10108 RF24:RBR:REG=6,VAL=0 10110 !RF24:INIT:SANCHK FAIL 10115 !TSM:INIT:TSP FAIL 10117 TSM:FAIL:CNT=2 10119 TSM:FAIL:DIS 10121 TSF:TDI:TSL 10123 RF24:SLP 10125 RF24:WBR:REG=0,VAL=12 Moreover, I tried to re-programm an otherwise well-performing node (one with a DIP NRF24) by adding these lines to the program: #define MY_SOFTSPI #define MY_SOFT_SPI_SCK_PIN 13 #define MY_SOFT_SPI_MISO_PIN 12 #define MY_SOFT_SPI_MOSI_PIN 11 ... and i got identical errors. So it really might be a limit of the softSPI to not use the hardware SPI pins. And considering the hint with the manual rewiring: Well, yes, I would consider this for one board but I want to deploy between 15 and 20 of those boards in our flat for varios types of sensors. I guess if software can't fix it I would bite the bullet an order a new PCB pile. Regards....
  • Own action on heatbeat request

    7
    0 Votes
    7 Posts
    1k Views
    N
    @wimd Could you share how you done that? I also want to check if gate is alive (backup-batterypowered node - if mains or gateway died, send me a message). I also use domoticz.
  • Battery powered motor actuator?

    4
    0 Votes
    4 Posts
    728 Views
    mfalkviddM
    @waspie almost. The gateway does not store anything though. Storage is handled by the controller.
  • Issues with MYSBootloader, Anyone a working version?

    1
    0 Votes
    1 Posts
    439 Views
    No one has replied
  • How to compare single characters of received message?

    3
    0 Votes
    3 Posts
    489 Views
    phil2020P
    That works, and is a lot shorter! Thanks
  • Combined motion sensor with battery monitor sketch

    6
    0 Votes
    6 Posts
    858 Views
    G
    @mfalkvidd That looks just what I'm after...Thanks
  • nrf52832 sleep power consumption

    4
    0 Votes
    4 Posts
    684 Views
    O
    @rozpruwacz o really, yeah me I guess 😀. I'm on my phone atm, but a similar sketch should be in my openhardware.io projects. (Have been playing around with it, but those where minor changes)
  • NRF24l01+, EEPROM and shared SPI = brick module ?

    8
    0 Votes
    8 Posts
    1k Views
    rejoe2R
    @oniric said in NRF24l01+, EEPROM and shared SPI = brick module ?: if i wipe my eeprom with 0x0, it might be wrong cause at boot it will think I'm Node_0, my parent is Node_0...) ? This might not be wrong, it is wrong to write zeros, causing the node acting as a GW: Node_0, no further transport over nRF-air required...)
  • Recompiling for different channels

    mysbootloader
    13
    0 Votes
    13 Posts
    1k Views
    rejoe2R
    Seems I'm running out of ideas. If you are sure to have flashed succcessfully the new BL and won't get any sync afterwards to upload any sketch built using that board def, most likely you shoud open an issue in github wrt that. (I myself went the other way round and modified the MYSENSORS modules in FHEM to make use of a second Gateway for flash purposes only - this GW with the standard channel (etc.) settings... Testing is ongoing, but seems to work)
  • Change parent node and resend when no ack received

    2
    0 Votes
    2 Posts
    639 Views
    berkseoB
    @snyfir You can manually write a new parent_id to the variable - _transportConfig.parentNodeId = ; ..This is not the only option
  • 0 Votes
    4 Posts
    960 Views
    Jimy AguirreJ
    @jimy-aguirre I have contacted Tisham the ATM90E26 smart energy chip Arduino library author. He suggest to submit an issue against the library in github to request the softSPI feature support by the library, then I did it, here it is the link. If anyone can write any suggestion or constructive comment on github it is very welcome. Of course if there is any "alternatively solution" to assign the mysensors library softSPI pins to the sensor chip and it works while the radio is connected to the SPI (hardware SPI) I will be happy to test it. Thanks to all.
  • SmartSleep wake up message always get NACK

    18
    0 Votes
    18 Posts
    2k Views
    M
    @mfalkvidd I have applied Tekka007 pull request successfully, all is working correctly now. Thanks !
  • MySensors on sunxi kernel. A10 Cubieboard.

    5
    0 Votes
    5 Posts
    1k Views
    А
    @rozpruwacz thank you! I just try to build and install mainline kernel. for my board. Now a10 supprot ok in mainline.
  • RPI GW as computer/server sensors node.

    4
    0 Votes
    4 Posts
    779 Views
    Sergio RiusS
    I was thinking more on a service that also could monitor temperatures and control power. But for being able to do that, it must be running while the computer is down. And also, should be impossible to use the existing networking. So a complete node would be preferred. I guess the nrf52 dongle could be a nice candidate for this. Inserted on an internal USB port and perhaps also connected to the MB switches and LEDs port.
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    110 Views
    No one has replied
  • Delay after TSF:TRI:TSB

    19
    1
    0 Votes
    19 Posts
    2k Views
    RayneR
    @mfalkvidd Ahhhh, that was it. I was still on 2.3.0 of the esp8266 core. Once I upgraded to 2.4.2 it compiled fine and was able to find gdb_hooks.h. I think I was on the older version due to some compatibility issues I had when I was making a WiFi Jammer for a buddy of mine some time ago. Hey thanks for your help @mfalkvidd . You are the man!
  • Fastled library usage with HA

    4
    0 Votes
    4 Posts
    883 Views
    electrikE
    What do you want to do exactly? I googled "mysensors color picker ws2812" and came across this https://www.domoticz.com/forum/viewtopic.php?t=8039
  • False triggering PIR sensor

    6
    0 Votes
    6 Posts
    2k Views
    TmasterT
    My bet will be the power supply as well. i had one HC-SR501 running from battery for a few months .False triggers? every time sun comes out from a cloud! for outdoor they are crap. Just for you know about power supplies , last project that i build a k type thermometer(for high temperatures) on my fireplace, i feed it with a HLK-PM01 and while I didn't connect negative terminal to the fireplace steel chassis(ground) , it fluctuate a lot during readings, like 20c then 45c,25 etc.. not even with a capacitor.
  • Raspberry pi 3 both Gateway and Controller

    6
    0 Votes
    6 Posts
    3k Views
    alowhumA
    I always do it this way. Using this: https://forum.mysensors.org/topic/9696/i-got-a-plug-and-play-nrf24-shield-for-the-pi-on-aliexpress

11

Online

11.7k

Users

11.2k

Topics

113.0k

Posts