Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. sineverba
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by sineverba

    • RE: ๐Ÿ’ฌ Battery Powered Sensors

      @Sebex I run all my nodes with 2xAA rechargable NiMh (or 1 x LifePo4) with Si7021.

      1. Use MiniCore bootloader (https://github.com/MCUdude/MiniCore)
      2. Set BOD at 1.8V for NiMh
      3. Set speed @8Mhz ๐Ÿ™‚

      Enjoy your 1 or 2 years node life at transmit every 5 minutes.

      PS Remove the LED and the regulator, of course ๐Ÿ˜‰

      PPS I use spare AtMega328p on custom PCB board, but same result with a couple of Nano without regulator.

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson Last time. Please.
      REMOVE
      WHITELISTING
      FROM
      YOUR
      SKETCH

      Clear EEPROM and paste here output of debug. No other.

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson Don't need all copy and paste, enough link :).

      Btw, before move to Home Assistant, where is the output of debug of MySensors?

      sudo mysgw -d

      Of course, you need before stop service.

      Resetting the node, what you get in debug?

      When ALL ok, move to HomeAssistant.

      And remember, after check that debug is ok...

      sudo make install && sudo systemctl enable mysgw.service && sudo systemctl start mysgw.service

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson This is the serial OF GATEWAY. Not your Arduino. You need to put serial of GATEWAY.

      Please, first of all, DONT' USE WHITELISTING. And pay attention: if you enabled it, remove it and:

      1 - clear eeprom
      2 - flash eeprom with keyes
      3 - reload sketch (without whitelisting)

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ NRF24 to RFM69 adapter

      @alowhum thank you ๐Ÿ™‚

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ NRF24 to RFM69 adapter

      Oh, you are right. I will edit the description. My "prerequisites" - overall for battery powered sensors node - is to have the node at 3v3 (or less). This is the reason because I never thought to level converter ๐Ÿ™‚
      Thank you for nice work ๐Ÿ™‚

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson only one word. Try. Really, you are lost in 1 cm of water. Try. And if it doesn't work, open your topic, showing exactly your sketches and what have you done.

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson And, last all, you can use the mysensors debug options. Try. Try. Try! This is the best option offered to you to learn. Try!
      At max, nothing works ๐Ÿ˜‰

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson

      Let's summarize. Last time.

      1. compile gateway with weak security (make your research, also in my github guide, there is ๐Ÿ˜‰ )
      2. create the 3 keyes for gateway
      3. set the 3 keyes for gateway.
      4. clean your EEPROM arduinos with the sketch present in my guide and in examples of library
      5. set the keyes in EEPROM arduinos.

      Stop. End. Fin. Fine. These steps are MANDATARY. You NEED to do.

      You will have in EEPROM the keyes (arduino) and in gateway.

      From now, you select:

      a) Do I need security? Perfect, in sketch arduino add #define bla bla bla on top with security and other stuff.
      b) Do I NOT need security? Perfect, in sketch arduino DON'T ADD #define bla bla related to security.

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson you need to setup gateway with weak security.

      You need generate keyes and set in gateway.

      You need to personalize nodes with the sketch and set keyes on Arduino EEPROM.

      From now, you have two ways: Your node need security? Set use security bla-bla on top with other define(s).

      Don't Need security? Don't define use security.

      Simpler than ever.

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson you can use a special flag define to "downgrade/reduce" security MY_WEAK_SECURITY

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson no need to remove. Simply, in your sketches, don't use signing at all.

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson

      Too many ack lost and slow communication. And other that I don't remember.

      That line on the sketches means that you need add on the node that you want whitelist the serial of gateway.

      You got serial gateway on the steps for 2.2.0.

      You have it.

      You don't need to put anything in no file with 2.2.0. In my guide is NOT mentioned. In my guide, at the bottom, there is the final "set keyes" with only a line OR you can set them everytime you get them.

      Please, take your time to read 1, 2, 3 times before type anything. I think it is very clear, and every step is write down for you.

      ๐Ÿ˜‰ Enjoy ๐Ÿ™‚

      PS Don't offend, I want help you, 'cause I used a bit of times before getting security working. And I used so many time write down a guide. But you need to read and follow carefully

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson You use RFM69(H/W/HW). So I. My hint is remain with 2.2.0. I got so many issues with 2.3.0 and RFM that I reverted to 2.2.0 in 1 minute.

      HMAC is not LAN MAC, is HMAC got from MYsensors gateway. Same for other 2 keyes.

      I think that in long explain on my guide you have all info to get your keyes. I follow my same guide everytime I need to reinstall mysensors / domoticz / an entire PI. It is fully tested ๐Ÿ™‚

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Security & Signing

      @pepson see here for 2.2.0 and on left menu for 2.3.0

      https://github.com/sineverba/domapi/wiki/MySensors-2.2.0-Security-and-signin

      posted in Announcements
      sineverba
      sineverba
    • RE: Mysensors 2.2.0: need to force restart of nodes if controller or gateway are not available. How to do?

      @gohan do u mean bootloader? Optiboot with BOD @1.8 with AA and @2.7 with LifePo4

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Mysensors 2.2.0: need to force restart of nodes if controller or gateway are not available. How to do?

      @eric007 Yes, Im sure at 100%. No more transmit. Also if I heat sensors with my Hands (and After 6h the temp surely changed a bit). I think that wd reset is called internally by MyS. If controller and gateway are live, I have no issues. So I think (also answering to @gohan ) that It is not an issues....

      posted in Troubleshooting
      sineverba
      sineverba
    • Mysensors 2.2.0: need to force restart of nodes if controller or gateway are not available. How to do?

      Hi to all! My environment: Domoticz on RPI3 + Battery LIfePo4 nodes (temp/hum, baro etc). Preamble: all nodes with RFM69W and HW on the gateway. All is very stable from +3 months, no restart, all works as charme.

      From a couple of week I have issues with domoticz that hangs (I will need to solve, but this is another story).

      I need, absolutely, to force the nodes to check if uplink (gateway/domoticz) is "alive", if not, sleep and repeat for infinite, until I can restart Domoticz.

      In effect my nodes for the moment have this logic: try send for 30 times, if cannot receive an ACK delay 5000. I have watchdog at 2 sec, so of course the node restart. For same strange obscure reason, node hangs instead when Domoticz off.

      TL;DR:

      Currently, this is my sketch: https://pastebin.com/raw/0qWBn6iQ

      I found this instructions:

      https://www.mysensors.org/apidocs/group__RoutingNodeSettingGrpPub.html#ga7117d6c2ab335ad8a03caae3ef2c46e7

      If I did understand right, can I at the start of the sketch for node add simply:

      #define MY_TRANSPORT_SANITY_CHECK true
      #define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS 10 * 60 * 1000ul

      To check every 10 minutes the transport?

      1. What will be happening if transport is not ready? It will go to sleep? Eg. Node sleeping. Awaking after 10 minutes, tryng to transmit and No uplink available. It will be restart continuously? Is it possible to put in sleep for example 10 minutes and retry and go on?

      2. I cannot understand the purpose of:

      MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 10000 Timeout (in ms) to re-establish link if node is put to sleep and transport is not ready.

      (got here https://www.mysensors.org/download/sensor_api_20 )

      Thank you

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: RFM69 new driver delay

      @pepson said in RFM69 new driver delay:

      Finally
      In my opinion on MySensors 2.2.0 all my sketches (switch relay and cover ) works better. With no problem. NO PROBLEM.
      Cover works perfect and switch works perfect without any timeout and delay. ANd all node works without REPEATER.
      My opinion is that in version 2.3.0 something not working correct with radio RFM69HW.
      Maybe for sensors which send data from time to time is ok , but for cover which transfer data when cover is roll, it is problem... and gateway can not recived all data when node send position cover. Maybe developer read this thread and can do any changes to correct it.

      RFM69W / HW user here. I can confirm that V 2.3.0 on both nodes and PI has some broken. My nodes, stable for 3+ months, with new version they have issues. In detail, they cannot get ACK. In my sketch, I check for ACK when transmitting, to force the watchdog or no. NO ACK received (1 every 20/30) ๐Ÿ˜ž

      And my nodes are "perfect". LifePo4 or AA, someone feeded directly, RPI3 with 2.5a... And I repeat, no issues in 3+ months from switching from NRF to RFM.

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ MySensors Gateway for Raspberry PI

      @mfalkvidd I'm Sorry. For error I did confuse "official" page with OpenHardware project for double gateway. Sorry ๐Ÿ˜–

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ MySensors Gateway for Raspberry PI

      @mfalkvidd said in ๐Ÿ’ฌ MySensors Gateway for Raspberry PI:

      @sineverba instructions are aligned with the current stable version. We would confuse people mightily if the instructions did not work with stable.

      You write use development. ATM development doen't have anymore the -d flag ... But not a big problem at the end

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      Background: I use signing software on some nodes + whitelisting on a node (of course only PI serial is on the whitelist).

      With current --development branch (I think 2.3.0alpha) I cannot anymore set my previous personalized flags on gateway RPI3.

      In detail, with current master (2.2.0) I can do:

      sudo mysgw --set-soft-hmac-key=F618D4[...]848992B
      sudo mysgw --set-soft-serial-key=26[...]9
      sudo mysgw --set-aes-key=EC7[...]CEB4
      

      WIth development I did see only the --get[...] flags and cannot set anymore. Can you confirm?

      How can I set my previous values for signing?

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ MySensors Gateway for Raspberry PI

      Oh, also, need to re-write the instructions. In --development branch nowadays there is no option "-d" default start in debug mode... Just to help you wuth mantain instructions aligned

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ MySensors Gateway for Raspberry PI

      Wonderful project... I did re-create on Eagle. First radio (RFM) works very well. Second instance, I got a wonderful... "Can't open SPI device: /dev/spidev1.0". After editing the boot/config.txt, need to reboot? Thank you very much

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: Can please someone check if my schema for RFM69 is right?

      @sundberg84 said in Can please someone check if my schema for RFM69 is right?:

      @sineverba - 1 rule of debugging, remove as much as possible.
      Can you try to use a 3.3v MCU directly with your breakout board? That way you can eliminate that the problem might be level shifting and work down the wiring to a minimum?

      sure golden rule.
      It works. Now it works. Directly on a 3v3 mini. Removed all level shifter. Now it works.
      Thank you for the support!

      posted in Hardware
      sineverba
      sineverba
    • RE: Can please someone check if my schema for RFM69 is right?

      @sundberg84
      MCU side very spaghettish...... of course I'm using 2xlogic converter (every one has only 4 gates).

      Btw, this is the picture:

      Level shifter schema (only UNO + level shifter, the antenna is ofc connected as my breakboard)

      alt text

      alt text

      I did try Powerlab library, no result at all.

      I'm trying to communicate PI1 with amplified + sma antenna and Arduino with not amplified. This last one I did try with small antenna, a 17cm wire and finally a SMA 3db. No test went well.

      These are the PI1 logs:

      Apr 13 22:38:59 INFO  Starting gateway...
      Apr 13 22:38:59 INFO  Protocol version - 2.3.0-alpha
      Apr 13 22:38:59 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,VER=2.3.0-alpha
      Apr 13 22:38:59 DEBUG TSF:LRT:OK
      Apr 13 22:38:59 DEBUG TSM:INIT
      Apr 13 22:38:59 DEBUG TSF:WUR:MS=0
      Apr 13 22:38:59 DEBUG TSM:INIT:TSP OK
      Apr 13 22:38:59 DEBUG TSM:INIT:GW MODE
      Apr 13 22:38:59 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
      Apr 13 22:38:59 DEBUG MCO:REG:NOT NEEDED
      Apr 13 22:38:59 DEBUG Listening for connections on 0.0.0.0:5003
      Apr 13 22:38:59 DEBUG MCO:BGN:STP
      Apr 13 22:38:59 DEBUG MCO:BGN:INIT OK,TSP=1
      Apr 13 22:39:06 DEBUG New connection from 127.0.0.1
      Apr 13 22:39:06 DEBUG GWT:TSA:C=0,CONNECTED
      

      And this is the UNO log:

      16 MCO:BGN:INIT NODE,CP=RPNNA---,VER=2.2.0
      25 TSM:INIT
      26 TSF:WUR:MS=10000
      28 RFM69:INIT
      29 RFM69:INIT:PIN,CS=10,IQP=2,IQN=0
      33 RFM69:PTX:LEVEL=5 dBm
      35 TSM:INIT:TSP OK
      38 TSM:FPAR
      39 RFM69:SWR:SEND,TO=255,RETRY=0
      49 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2058 !TSM:FPAR:NO REPLY
      2060 TSM:FPAR
      2062 RFM69:SWR:SEND,TO=255,RETRY=0
      2079 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4087 !TSM:FPAR:NO REPLY
      4089 TSM:FPAR
      4091 RFM69:SWR:SEND,TO=255,RETRY=0
      4110 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6117 !TSM:FPAR:NO REPLY
      6119 TSM:FPAR
      6120 RFM69:SWR:SEND,TO=255,RETRY=0
      6141 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8150 !TSM:FPAR:FAIL
      

      These are the first antennas on not-amplified that I did test:

      https://it.aliexpress.com/item/10PCS-433MHZ-Helical-Antenna-for-Arduino-Remote-Control/32658843549.html?spm=2114.13010708.0.0.HUeKNs and this is new antenna on gateway / amplified radio (and now also on the NOT amplified:)

      https://it.aliexpress.com/item/1-pz-433-Mhz-Antenna-Sma-Maschio-Connetcor-3dbi-Gomma-Antenna-11-cm/32840921136.html?spm=2114.13010708.0.0.9l4abn

      On the evening, I will try with ESP8266, so I can eliminate that logic converters and try directly with 3v3...

      My thought is that antenna are not 433 (but they are clever labeled as 433)

      posted in Hardware
      sineverba
      sineverba
    • Can please someone check if my schema for RFM69 is right?

      Hi,
      I did print a PCB for breakout for the RFM69HW/W.

      They cannot communicate.

      They are powered, init'd but they don't communicate.

      GND are both Layer top and layer bottom, not rastend for clarity, but all GND are wired. Oh, I did not soldered the caps, but of course the path is not broken.

      Could you please see if my schema is right? If I did some mistake on wiring?
      Thank you!
      alt text

      Ratnested

      alt text

      posted in Hardware
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ In Wall AC/DC Pcb (with Relay) for MySensors (SMD)

      @sundberg84 sorry for question. i'm tryng to understand the scope for the SSR Relay. Can you explain me? Is it for some kind of safe or is it governable from the Atmega? Thank you!

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      Hi to all,
      tonight I made update from 2.2.0 RC2 to 2.2.0 (stable) on my Raspberry PI3.
      It is a live system (my heater control).

      By the way the update is very simple.

      First of all, backup or better CLONE your PI.

      1 - Disable the daemon with

      sudo systemctl stop mysgw.service && sudo systemctl disable mysgw.service
      

      2 - Make a copy of the MySensors folder ( I made a copy with the name of version coming, so...)

      cp -r MySensors MySensorsX.X.X(rc2)/
      

      (the slash at the end means "It's a folder!"

      3 - Remove the MySensors folder

      sudo rm -r MySensors
      

      4 - Git the "new" MySensors folder && configure it as usual. Remember to activate the daemon and see on Domoticz (for example) the gateway with new version ๐Ÿ™‚

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      @anticimex @wes Can I please ask how to update? I mean, the right command to type.
      I have the folder "MySensors" on documents of my user in Pi:

      /home/sineverba/MySensors

      Of course I have all installed and perfectly working now (I'm on the 2.2.0 rc2).

      I need also to relaunch the ./config command?

      Thank you to both and all!

      posted in Announcements
      sineverba
      sineverba
    • RE: Wrong instructions on gateway for personalizer?

      @anticimex With the "&&" you are basically launch 3 instructions with one row. It is the same thing that you launch first command and press enter. Wait for compute, type 2nd and press enter and so on...

      So, do you confirm they are out of alignment? If yes, I open the bug on github.

      Thank you!

      posted in Development
      sineverba
      sineverba
    • RE: [security] Migrating from library version 2.1 to 2.2

      @anticimex Ah, I did not know, cause I'm in 2.2.0 rc2 (when something works... don't touch it! ๐Ÿ˜„ )

      posted in Development
      sineverba
      sineverba
    • Wrong instructions on gateway for personalizer?

      Sorry for title not very clear.

      I have gateway and nodes with version 2.2.0 rc2.

      I set security and signing on it with:

      sudo mysgw --set-soft-hmac-key=CA425435D5765F2A96B97A10B38 && sudo mysgw --set-soft-serial-key=B821E72AB && sudo mysgw --set-aes-key=FC50FB78398514EA
      

      The answer from PI for SOFT HMAC KEY is:

      The next line is intended to be used in SecurityPersonalizer.ino:
      #define MY_SOFT_HMAC_KEY	0XCA,0X42,0X54,0X35,0X5F,0X2A,0XB,0X38
      

      But in security personalizer we have

      #define MY_HMAC_KEY

      And I use exactly this last one. Missing the "soft" from personalizer or wrong PI or am I totally wrong?

      posted in Development
      sineverba
      sineverba
    • RE: [security] Migrating from library version 2.1 to 2.2

      @alowhum

      I did have same issues, with new version, when was in testing stage.

      Try at the top of sketch add these:

      #define MY_DISABLE_SIGNAL_REPORT
      #define MY_SPLASH_SCREEN_DISABLED
      

      You save a lot of space. All my nodes are on ATMEGA328 and no space issues. Max node with signing + encryption + relay + temp uses 67% of space

      posted in Development
      sineverba
      sineverba
    • RE: Recommendation for PCB fab?

      @neverdie i did not understand..... allpcb ship to me in 1 or 2 day, and shipment take 3 day. I order monday, i receive friday (on italy).... they did augment also the time fabrication?

      Do you have a machine to print pcb??? ๐Ÿ˜„ where are you from??? ๐Ÿ˜„

      posted in General Discussion
      sineverba
      sineverba
    • RE: Recommendation for PCB fab?

      @neverdie Yes ๐Ÿ˜ž Fortunately shipment is very, very fast and free (for the moment) ๐Ÿ˜ž

      posted in General Discussion
      sineverba
      sineverba
    • RE: Why a node installed from several days try find parent?

      @mfalkvidd I did introduce both on "difficult" node and after 24h NO NACK anymore.... Thank you very much!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Why a node installed from several days try find parent?

      @mfalkvidd For email probably solved. I re-saved my option and now seems working.

      Thank you for the link. Sorry, I did not understand... I did see the link. Do I need to set both:

      #define MY_PARENT_NODE_ID 0
      #define MY_PARENT_NODE_IS_STATIC
      

      Or only the second one (MY_PARENT_NODE_IS_STATIC) ? 'Cause I see for first one (MY_PARENT_NODE_ID ) default is AUTO, but I know that gateway is 0.

      Thank you very much

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Why a node installed from several days try find parent?

      @mfalkvidd Thank you, I did not notice it. Is there a flag to set the ID parent static and not request it never? I imagine for lost signal (51 is placed not so near to the gateway).

      PS OT: I did not receive anymore the email of answer to my topic. I have email notification enabled and email are not neither in spam....

      posted in Troubleshooting
      sineverba
      sineverba
    • Why a node installed from several days try find parent?

      Hi to all,
      I'm using a RPI3 with Domoticz. Gateway is installed in Pi itself and I'm using version 2.2 RC2 (branch development).

      I have, in particular, a node that sleeps continuously and every 10 minutes send Temp, Hum and voltage level and resleep and so on.

      I have active security and signing and weak_security (this is my configure, to understand:

      ./configure --my-gateway=ethernet --my-transport=nrf24 --my-rf24-irq-pin=18 --my-rf24-channel=83 --my-leds-err-pin=12 --my-leds-rx-pin=11 --my-leds-tx-pin=7 --my-leds-blinking-inverse --my-signing=software --my-signing-request-signatures --my-signing-weak_security --my-signing-debug
      

      I did enable traffic led and noticed some red light.

      I did enable debug and this is the output:

      mysgw: TSF:MSG:SEND,0-0-23-23,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:18.7
      mysgw: TSF:MSG:READ,23-23-0,s=0,c=1,t=1,pt=7,l=5,sg=0:71.0
      mysgw: TSF:MSG:ACK REQ
      mysgw: SGN:SGN:NREQ=23
      mysgw: TSF:MSG:SEND,0-0-23-23,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:71.0
      mysgw: TSF:MSG:READ,23-23-0,s=2,c=1,t=38,pt=7,l=5,sg=0:2.70
      mysgw: TSF:MSG:READ,23-23-0,s=255,c=3,t=0,pt=1,l=1,sg=0:62
      mysgw: GWT:RFC:C=0,MSG=0;0;3;0;18;PING
      mysgw: GWT:RFC:C=0,MSG=0;0;3;0;18;PING
      mysgw: TSF:MSG:READ,51-51-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysgw: TSF:MSG:BC
      mysgw: TSF:MSG:FPAR REQ,ID=51
      mysgw: TSF:PNG:SEND,TO=0
      mysgw: TSF:CKU:OK
      mysgw: TSF:MSG:GWL OK
      mysgw: SGN:SGN:NREQ=51
      mysgw: !TSF:MSG:SEND,0-0-51-51,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      mysgw: GWT:RFC:C=0,MSG=0;0;3;0;18;PING
      mysgw: TSF:MSG:READ,51-51-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysgw: TSF:MSG:BC
      mysgw: TSF:MSG:FPAR REQ,ID=51
      mysgw: TSF:CKU:OK,FCTRL
      mysgw: TSF:MSG:GWL OK
      mysgw: SGN:SGN:NREQ=51
      mysgw: !TSF:MSG:SEND,0-0-51-51,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      mysgw: GWT:RFC:C=0,MSG=0;0;3;0;18;PING
      

      With the help of log parser, I got

      Sent Message
      Sender: 0
      Last Node: 0
      Next Node: 51
      Destination: 51
      Sensor Id: 255
      Command: INTERNAL
      Message Type:I_FIND_PARENT_RESPONSE
      Payload Type: P_BYTE
      Payload Length: 1
      Signing: 0
      Failed uplink counter: 0
      Status: NACK (OK=success, NACK=no radio ACK received)
      Payload: 0
      

      Now, in my knowledge, why gateway (node 0) try to find the parent (???) from node that at that moment is sleeping? Or I do not understand the working flow?

      This is also the relevant part of sketch transmitting to the gateway (the node has watchdog enabled):

      [...]
      void sendTemperatureToGateway(float temperature) {
      
        // if temperature is different from previous or we are other the max reads
        if (temperature != last_temperature || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
      
          last_temperature = temperature;
          // Reset no updates counter
          nNoUpdatesTemp = 0;
          // add the offset (if any
          temperature += SENSOR_TEMP_OFFSET;
          // send the msg
          // send(msgTemp.set(temperature, 1));
      
      
          bool transmission_was_ok = false;
          int i = 0;
          do {
        
            transmission_was_ok = send(msgTemp.set(temperature, 1) , true);
            i++;
            wait(150);
          
            if ( i > 30 ) {
            
              delay(5000); // this delay will call watchdog!
                
            }
              
          } while (transmission_was_ok == false);
      
      
          
          
        } else {
          // Increase no update counter if the temperature stayed the same
          nNoUpdatesTemp++;
        }
            
      }[...]
      

      Thank you very much!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Raspberry Pi2 GPIO interface for NRF24L01+

      @sineverba @GertSanders sorry for quote, I did implement the IRQ on PI gateway on pin 18. Are you sure is it 20 as in description?

      Of course I did print exactly your PCB and connected (with 5V with regulator and power from the 2x5V from PI) as described, but not the IRQ.

      How could I test if IRQ is right and works?

      Have a nice day!

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Arduino Atmega Bootloader Uploader

      Hi to all,
      added schematics and board!

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: Signing too heavy for Atmega328 on branch-development. Looking for hints

      @anticimex OK, much more clear! In effect, I can enable request signature on the gateway. So, ALL nodes need to sign their message, also in the case that we did set on gateway "weak security".

      So, what do you mean with "[...]then your gateway should require signatures from that sensor[...]" is following:

      • if applied on a node, only that node require signature
      • if applied on a gateway, ALL sensors in network need to send with a signature.

      And, for enable signature, we need enable the signing also. So we return at the problem of heavy sketch (but, in reality, with the flags posted here the sketch is very very light now! https://www.mysensors.org/apidocs-beta/group__memorysavings.html )

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Signing too heavy for Atmega328 on branch-development. Looking for hints

      @anticimex Sorry, maybe I'm not clear. I mean, is it secure to have enabled:

      • signing
        -whitelisting

      But NO signature request on a node that need to be secured?

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Signing too heavy for Atmega328 on branch-development. Looking for hints

      @mfalkvidd Fantastic! 58% of occupied space with DEBUG ENABLED and 31% with debug disabled. I did import the adafruitsi7021 library and watchdog.

      I did disable the splash screen and the signal report!

      Thank you!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Signing too heavy for Atmega328 on branch-development. Looking for hints

      @anticimex said in Signing too heavy for Atmega328 on branch-development. Looking for hints:

      @sineverba yes, you can set weak security only on gateway and if you do, you can leave some nodes without signing or encryption enabled. You can also only set the require signatures flag on a specific node and omit it on the gateway. Just be aware that any node not having the request flag, will accept unsigned messages.

      Thank you. Is it secure to have a node without signature but with whitelisting enabled? It seems right to me, but what on your experience?

      posted in Troubleshooting
      sineverba
      sineverba
    • Signing too heavy for Atmega328 on branch-development. Looking for hints

      Hi to all and happy new year!
      I did buy a new RPI3 and I now using itself with a NRF24 PA (ethernet setup gateway).

      I did notice that with branch-development (2.2 rc2) signing is simply... too heavy for atmega328.

      For the nodes that need to be secured (and are powered from wall and not from battery, as the heater relay) I could try the Atmega1284 or nodemcu, but I would mantain also the simplest nodes only with temperature sensors with the atmega328 (and this nodes of course don't need security at all).

      I have some question, that cannot solve reading the forum:

      1 -
      On RC2 if we enable the signing on gateway, need to enable on every node. I'm aware for the flag "MY_SIGNING_WEAK_SECURITY".

      Where need enable this flag? Only on gateway? Only on node? On both? And with this enabled can I remove the signing from some node and leave signing on others?

      2
      "Request signature flag". Is it possible to enable ONLY on secured node and not on gateway? So I can leave the nodes that don't need security free from this flag. What the real scope of requesting a signature? In effect for one or two nodes I would have only the WHITELISTING (and I know that to have whitelist we need enable signing), so it can accept only from my gateway. In effect, I can live without the signature..... or no?

      3
      Using the ./congigure cleans totally previous configure options? Or is better delete also some file (e.g. there is a file .dat created, I don't remember the exact location but if I'm not wrong it mantain all configuration. If I remove it before ./configure is ok to have a perfect new clean installation or no?)

      Thank you very much for the support and for the help!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      @ghiglie Thank you, I did see that was for 2.1.1. Just playing with them!

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      Hi to all,
      I'm testing an ethernet gateway on RPI3, with nrf24 + 1 node with a relay.

      I want introduce security and signing. On Arduino gateway / node no problem at all, but, how to do on the RPI3 as gateway?

      I would get / create / set a software serial on PI itself and whitelisting it on the node, after I will introduce the AES Key and signing.

      Cannot find in documentation how do it on PI3. Thank you very much!

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      Was my fault!
      **When copy and past command from word, for example, pay attention that software doesn't substitute the single "-" with a "-" longer. ๐Ÿ˜ต

      I have a word with all commands, to replicate installation very fast. Was my fault (errr... Word fault.... but you understand). Have a nice day!

      Hi,
      I cannot go over the initialization of command.

      RPI3 + Amplified antenna by GertSander (https://www.openhardware.io/view/17/Raspberry-Pi2-GPIO-interface-for-NRF24L01). Power from 5v/3A and power for antenna taken from both 5V via the 3.3v stepper down.

      RPI3 is new, has about 12h (got yesterday).

      Yesterday it did work at first attempt. Today I would replicate so I did delete the uSD and restart over. No way to get the gateway on work.

      I did try 3 amplified antenna + 2 normal. No way.

      I did enable from raspi-config the SPI (and only it).

      It hangs on second line of output.

      These are the logs:

      sineverba@raspberrypi:~/MySensors $ ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020
      [SECTION] Detecting target machine.
        [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=armv7l.
      [SECTION] Detecting SPI driver.
        [OK] SPI driver detected:BCM.
      [SECTION] Detecting init system.
        [OK] init system detected: systemd.
      [SECTION] Saving configuration.
      [SECTION] Cleaning previous builds.
      [OK] Finished.
      sineverba@raspberrypi:~/MySensors $ make
      gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o
      g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
      g++ -MT build/drivers/Linux/noniso.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/noniso.cpp -o build/drivers/Linux/noniso.o
      g++ -MT build/drivers/Linux/GPIO.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/GPIO.cpp -o build/drivers/Linux/GPIO.o
      g++ -MT build/drivers/Linux/SPIDEV.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SPIDEV.cpp -o build/drivers/Linux/SPIDEV.o
      g++ -MT build/drivers/Linux/Print.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/Print.cpp -o build/drivers/Linux/Print.o
      g++ -MT build/drivers/Linux/EthernetClient.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/EthernetClient.cpp -o build/drivers/Linux/EthernetClient.o
      g++ -MT build/drivers/Linux/compatibility.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/compatibility.cpp -o build/drivers/Linux/compatibility.o
      g++ -MT build/drivers/Linux/SerialPort.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SerialPort.cpp -o build/drivers/Linux/SerialPort.o
      g++ -MT build/drivers/Linux/Stream.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/Stream.cpp -o build/drivers/Linux/Stream.o
      g++ -MT build/drivers/Linux/interrupt.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/interrupt.cpp -o build/drivers/Linux/interrupt.o
      g++ -MT build/drivers/Linux/SerialSimulator.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SerialSimulator.cpp -o build/drivers/Linux/SerialSimulator.o
      g++ -MT build/drivers/Linux/SoftEeprom.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/SoftEeprom.cpp -o build/drivers/Linux/SoftEeprom.o
      g++ -MT build/drivers/Linux/EthernetServer.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/EthernetServer.cpp -o build/drivers/Linux/EthernetServer.o
      g++ -MT build/examples_linux/mysgw.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c examples_linux/mysgw.cpp -o build/examples_linux/mysgw.o
      gcc -MT build/drivers/BCM/bcm2835.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/bcm2835.c -o build/drivers/BCM/bcm2835.o
      g++ -MT build/drivers/BCM/BCM.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/BCM.cpp -o build/drivers/BCM/BCM.o
      g++ -MT build/drivers/BCM/SPIBCM.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/SPIBCM.cpp -o build/drivers/BCM/SPIBCM.o
      g++ -MT build/drivers/BCM/Wire.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/Wire.cpp -o build/drivers/BCM/Wire.o
      g++ -MT build/drivers/BCM/RPi.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_LINUX_SERIAL_PTY=\"/dev/ttyUSB020\" -DMY_LINUX_IS_SERIAL_PTY  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/BCM/RPi.cpp -o build/drivers/BCM/RPi.o
      g++ -pthread  -o bin/mysgw build/drivers/Linux/log.o build/drivers/Linux/IPAddress.o build/drivers/Linux/noniso.o build/drivers/Linux/GPIO.o build/drivers/Linux/SPIDEV.o build/drivers/Linux/Print.o build/drivers/Linux/EthernetClient.o build/drivers/Linux/compatibility.o build/drivers/Linux/SerialPort.o build/drivers/Linux/Stream.o build/drivers/Linux/interrupt.o build/drivers/Linux/SerialSimulator.o build/drivers/Linux/SoftEeprom.o build/drivers/Linux/EthernetServer.o build/examples_linux/mysgw.o build/drivers/BCM/bcm2835.o build/drivers/BCM/BCM.o build/drivers/BCM/SPIBCM.o build/drivers/BCM/Wire.o build/drivers/BCM/RPi.o
      sineverba@raspberrypi:~/MySensors $ sudo ./bin/mysgw โ€“d
      [sudo] password for sineverba:
      mysgw: Starting gateway...
      mysgw: Protocol version - 2.2.0-rc.2
      
      posted in Announcements
      sineverba
      sineverba
    • Atmega328+Pro Mini+Nano bootloader uploader

      Hi to all!
      Want to share one of my project.

      https://www.openhardware.io/view/544/Arduino-Atmega-Bootloader-Uploader

      This is an Arduino shield to burn bootloader to the 3 different elements of family: an Atmega328, a Pro Mini and finally a Nano.

      It is fully tested and working. I'm very happy with this for burn Optiboot on the nodes of my house.

      I hope it will help someone.

      Have a good day!

      posted in My Project
      sineverba
      sineverba
    • RE: Recommendation for PCB fab?

      @neverdie Limited 50mm x 50mm at 5$, 100x100 15$. So, for small pcb price is same. For bigger, price is insane bytheway including DHL ship. From China to Italy, 3 days. Fantastic!

      posted in General Discussion
      sineverba
      sineverba
    • RE: Raspberry Pi2 GPIO interface for NRF24L01+

      HI, in your list I read "IRQ 20". Don't need to be 18 instead? Thank you btw for the project. Just soldered and waiting for RPI3!

      posted in OpenHardware.io
      sineverba
      sineverba
    • RE: Software signing troubles swapping NRF24s radios and / or Arduinos [Sketches and pics inside]

      @Anticimex Thank you! You confirm me that need 2 sketch version for relay. 1 sketch only with relay, to debug, full production with the temperature. SO i can debug.

      What do you think instead about point 1 and 3 ? 1 was swapping antennas and 2 was about swapping UNO / Nano.

      Happy holidays!

      PS Did not received email notification for post answer but it is enbled ๐Ÿ˜ž

      posted in Troubleshooting
      sineverba
      sineverba
    • Software signing troubles swapping NRF24s radios and / or Arduinos [Sketches and pics inside]

      Happy Xmas to all forum users!
      I need your help to focus and solve my troubles about NRF24, signing and Arduinos (UNO and nanos).

      Previously I did start another discussion about this, opening a new one 'cause I did collect other infos and I would restart the discussion from zero.

      Preamble > My environment

      ** Controller + Gateway **
      Domoticz as controller on a Raspberry PI2 + Arduino UNO as gateway + NRF24L01+ PA/LNA. Antenna is powered from a socket getting 5V from PI Gpio and converted to 3V3. PI itself is powered with a charger 5V / 2A. UNO has write in EEPROM a fixed software serial from the security personalizer sketch and shares the same AES KEY for all nodes.

      Current image of setup:

      alt text

      ** Nodes **
      I have 4 nodes with SI7021, custom PCBs, battery powered without boosters. NO signing, no security. They works perfectly.

      Software: they have a software serial and share the same AES KEY with all other nodes.

      3 of them have NRF24 black, I think counterfeit, but with 47uF caps on 3v3 and gnd. 1 of them has another type of NRF24, "red aliexpress version", with 47uF caps like others.

      This is the "red" version:

      alt text

      Heater commander relay node
      As name says, it's a node with a SI7021 + relay (based on secture actuator) that poweron the heater. It is on a custom PCB.

      Software: has a software serial and share the same AES KEY with all other nodes.

      alt text

      You can see DOUBLE caps on it. Cap on the antenna + caps on the PCB (47uF + 0.1uF). Powered from a 5V / 2A Samsung charger (you can see the AMS converting the 5V to 3v3 and TPs, voltage are perfect) it works perfectly with UNO gateway.

      That antenna was for testing solder, before mount on the wall. Now it has this kind of antenna:

      alt text

      It has security and whitelisting. Only because I don't want that another familty with mysensors could poweron my heater ๐Ÿ˜„ .

      The big troubles

      1 - If I swap the Antennas (BLACK LNA on relay node and GREEN on the gateway), security doesn't work. Period. Node relay wait for infinite for the nonce from gateway. I have 2x green and 4x black. I did try ALL antenna in every combination. No possibility to work.

      The log is:

      19544 Nonce requested from 0. Waiting...
      24549 Timeout waiting for nonce!
      

      2 - Sketch for Relay is a bit "fat". Uses 85% of memory. Cannot "put to diet". If I enable DEBUG + DEBUG SIGNING, it wait for infinite for

      2134 Waiting for GW to send signing preferences...
      

      The issues goes away when I comment both DEBUG or only the DEBUG_SIGNING. So, for debugging, need to remove the library for SI7021 and it's functions. Not very handly.

      3 - Yesterday I did change the UNO with a NANO (on the gateway). Used same antenna and same power shield (5V from PI > 3v3 to antenna). Security signing stop working. After some restart of relay secure node, got the signing working. Of course, I did personalized with same serial software of the UNO and the AES KEY. From an hardware view, I did "swap" an ATMEGA328 with another with same, same, same configuration. No reason to break the environment.

      For the moment (12h) all works, with the NANO. I cannot explain reason for relay node to make about 30/40 reset before re-start.

      So, now my questions.

      1. This is the GATEWAY UNO/NANO sketch. Based on the (looooong) preamble, is it right?

      TL;DR:

      • 1 gateway, software signing + software serial + aes key
      • 4 temperature nodes without security
      • 1 relay node with security
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE_SIGNING //!< Enable signing related debug prints to serial monitor
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      
      #define MY_RF24_CHANNEL 125
      
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      
      #include <MySensors.h>
      #include <avr/wdt.h>
      
      void setup()
      {
        // Setup locally attached sensors
        wdt_enable(WDTO_2S);
      }
      
      void presentation()
      {
        // Present locally attached sensors
      }
      
      void loop()
      {
        // Send locally attached sensor data here
        wdt_reset();
      }
      

      2 - This is the RELAY secure sketch, reporting the temp and relay state. It is a bit fat, use 85% of resource and cannot enable DEBUG_SIGNING without removing the SI7021 library. Is it possible to put to diet? ๐Ÿ™‚

       * DEFINE MYSENSORS SECTION
       */
      //#define MY_DEBUG                    // Enable Basic Debug
      //#define MY_DEBUG_VERBOSE_SIGNING    // Enable Signing Debug
      #define MY_RADIO_NRF24
      #define MY_RF24_CHANNEL 125
      #define MY_TRANSPORT_WAIT_READY_MS (5000)
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x3B,0xF4,0x61,0xDF,0x1E,0x97,0xB1,0x2D,0xEC}}} // corretto!!!
      #define MY_NODE_ID 4               // Default ID
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      #define MY_WITH_LEDS_BLINKING_INVERSE
      #define MY_DEFAULT_ERR_LED_PIN 16
      #define MY_DEFAULT_TX_LED_PIN 15
      #define MY_DEFAULT_RX_LED_PIN 14
      
      #define MY_BAUD_RATE 57600
      
      /*
       * Relay section
       */
      #define RELAY_ON     1  // If logic of relay is inverted, invert here
      #define RELAY_OFF    0  // If logic of relay is inverted, invert here
      
      /**
       * PIN section
       */
      #define PIN_RELAY     4
      
      /**
       * Include libraries
       */
      #include <MySensors.h>
      #include "Adafruit_Si7021.h"
      #include <avr/wdt.h>
      
      /**
       * Define section.
       * 
       *    // NAME
       */
      #define SKETCH_NAME       "Termostato - I2C+Relay"
      #define SKETCH_VERSION    "2.2"
      
      //  CHILD ID
      #define CHILD_ID_TEMP     0
      #define CHILD_ID_HUM      1
      #define CHILD_ID_RELAY    2
      
      // initialize the sensor
      Adafruit_Si7021 sensor = Adafruit_Si7021();
      
      bool is_first_start = true;
      // offset of temperature
      float temperature_offset = -1.5;
      // the max temperature, after which automatically shutdown
      float max_temperature = 23;
      
      // storing for millis
      unsigned long previous_millis = 0;      // will store last time loop was executed
      // constants won't change:
      const long interval = 120000;            // interval at which to make the loop (milliseconds)
      // finally simply wait
        // 1000 millisecondi = 1 sec
        // 1000 * 30 sec = 30000 = 30 sec
        // 1000 * 60 sec = 60000 = 1 minuto 
        // 60000 * 2 = 120000 milli = 2 minuti
        // 60000 * 5 = 300000 millisecondi = 5 minuti
        //wait(120000);
        //wait(1000);
      
      #define MAX_RETRY_SEND_BEFORE_DELAY 30 // after this try, it will call delay
      
      /**
       * Mysensors message
       */
      // Initialize temperature message
      MyMessage msg_temperature(CHILD_ID_TEMP , V_TEMP);
      // Initialize humidity message
      MyMessage msg_humidity(CHILD_ID_HUM , V_HUM);
      // Initialize relay message
      MyMessage msg_relay(CHILD_ID_RELAY , V_STATUS);
      
      /**
       * Presentation.
       * 
       * Presents the child to the controller
       * 
       * @since 1.0
       * 
       */
      void presentation() {
      
        // send sketch name
        sendSketchInfo(SKETCH_NAME , SKETCH_VERSION);
        // Present all sensors to controller.
        // TEMPERATURE
        present(CHILD_ID_TEMP, S_TEMP);
        // HUMIDITY
        present(CHILD_ID_HUM , S_HUM);
        // RELAY
        present(CHILD_ID_RELAY , S_BINARY);
        
      }
      
      /**
       * Our Setup
       * 
       * @since 1.0
       */
      
      void setup() {
      
        // enable Watchdog to 2 seconds
        wdt_enable(WDTO_2S);
      
        // send a serial output to advice
        Serial.println("================================");
        Serial.println("=====>>>> Start sketch <<<<=====");
        Serial.println("================================");
        
        // Initialize relay
        initializeRelay();
      
        // Initialize sensor
        sensor.begin(); // si7021
        
      }
      
      /**
       * Relay initialization
       * 
       * @since 1.0
       */
      void initializeRelay() {
      
        pinMode(PIN_RELAY , OUTPUT);
        digitalWrite(PIN_RELAY , RELAY_OFF);
        
      }
      
      
      /**
       * Our loop
       * 
       * @since 1.0
       * 
       */
      void loop() {
      
        // check to see if it's time to execute the loop; that is, if the difference
        // between the current time and last time we executed the loop is bigger than
        // the interval at which you want to make the loop.
        unsigned long current_millis = millis();
      
        if ( (current_millis - previous_millis >= interval) || ( is_first_start == true ) ) {
      
          Serial.println("Time to do our loop!");
      
          // false the is_first_start;
          is_first_start = false;
      
          // update previous millis
          previous_millis = current_millis;
        
          // get the temperature from sensor
          String type = "temperature";
          float temperature = getDataFromSensor(type);
      
          if ( temperature >= max_temperature ) {
      
            digitalWrite(PIN_RELAY , RELAY_OFF);
            Serial.println("Temp is over, shutdown the relay");
            
          } else {
      
            Serial.println("Temp is not over");
            
          }
      
          if ( temperature < 100 ) {
            sendDataToGateway(type , temperature);
          }
          
          // get the humidity from sensor
          type = "humidity";
          float humidity = getDataFromSensor(type);
          // send hum to gateway
          if ( humidity < 100 ) {
            sendDataToGateway(type , humidity);
          }
        
          // send relay data to the gateway
          sendRelayToGateway();
      
        }
        
      
      }
      
      /**
       * Get the data from sensor
       * 
       * @param string the type of request for sensor
       * 
       * @return float the temperature
       * 
       * @since 1.0
       */
      float getDataFromSensor(String type) {
      
        float data;
        if ( type == "temperature") {
      
          data = sensor.readTemperature();
      
          Serial.print("Temp read direct from sensor is ");
          Serial.println(data);
      
          data = data+temperature_offset;
      
          Serial.print("Temp after apply offset is ");
          Serial.println(data);
      
        } else {
      
          data = sensor.readHumidity();
          
        }
        Serial.print("The read of ");
        Serial.print(type);
        Serial.print(" is ");
        Serial.print(data);
        Serial.print(", so returning is ");
        Serial.println(data);
        return data;
        
      }
      
      /**
       * Send relay state to the gateway
       * 
       * 
       * @since 1.0
       */
      void sendRelayToGateway() {
      
        bool current_state = digitalRead(PIN_RELAY);
      
        //current_state = !current_state; // delete if NOT inverted
      
        if (current_state == 1) {
      
          current_state = RELAY_ON;
          
        } else {
      
          current_state = RELAY_OFF;
          
        }
      
        //send(msg_relay.set(current_state) , true);
        bool transmission_was_ok = false;
        int i = 0;
        do {
      
          transmission_was_ok = send(msg_relay.set(current_state) , true);
      
          Serial.println("Send RELAY to the gateway.");
          Serial.print("Variable i is ");
          Serial.println(i);
          Serial.print("Variable transmission_was_ok value is ");
          Serial.println(transmission_was_ok);
          i++;
          wait(150);
        
          if ( i > MAX_RETRY_SEND_BEFORE_DELAY ) {
          
            delay(5000); // this delay will call watchdog!
              
          }
            
        } while (transmission_was_ok == false);
        
        
      }
       
      
      /**
       * Send the data to the gateway
       * 
       * @param string the type of data to send
       * @param float the data to send
       * 
       * @since 1.0
       */
      
      void sendDataToGateway(String type , float data) {
      
        bool transmission_was_ok = false;
        int i = 0;
        do {
      
          if ( type == "temperature" ) { 
          
            transmission_was_ok = send(msg_temperature.setSensor(CHILD_ID_TEMP).set(data,1) , true);
      
          } else {
      
            transmission_was_ok = send(msg_humidity.setSensor(CHILD_ID_HUM).set(data,1) , true);
            
          }
      
          Serial.print("Send data to the gateway, the type sending is ");
          Serial.println(type);
          Serial.print("Variable i is ");
          Serial.println(i);
          Serial.print("Variable transmission_was_ok value is ");
          Serial.println(transmission_was_ok);
          i++;
          wait(150);
        
          if ( i > MAX_RETRY_SEND_BEFORE_DELAY ) {
          
            delay(5000); // this delay will call watchdog!
              
          }
            
        } while (transmission_was_ok == false);
        
      }
      
      /**
       * Receive function from gateway
       * 
       * @since 1.0
       */
      void receive(const MyMessage &message) {
      
        /*Serial.println("-------------- DEBUG receive() ---------------");
        Serial.print("message.type value is ");
        Serial.println(message.type);
        Serial.println("------------------------------------------");
        Serial.print("message.getCommand() value is ");
        Serial.println(message.getCommand());
        Serial.println("------------------------------------------");*/
      
        if ( message.isAck() ) {
      
          /*if ( message.type == V_STATUS ) {
      
            Serial.println("Relay state transmitted");
            
          }
      
          if ( message.type == V_TEMP ) {
      
            Serial.println("Temperature transmitted");
            
          }*/
          
        }
      
        if ( !message.isAck() ) {
      
          if ( message.type == V_STATUS) {
        
            if (  message.getCommand() == 1 ) {
        
              bool received_state = message.getBool();
              Serial.print("We did receive a new value. Received_state value is ");
              Serial.println(received_state);
        
              if ( received_state == 1) {
        
                digitalWrite(PIN_RELAY , RELAY_ON);
                
              } else {
        
                digitalWrite(PIN_RELAY , RELAY_OFF);
                
              }
              
            }
            
          }
      
        }
      
      }
      

      Thank you and again Merry Xmas!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex

      I'm investigating on this issue.

      1. I'm on channel 125 (last one, the more free channel on my house).

      2. I have a node on a custom printed pcb with atmega328@8MHZ and an Amplified Antenna. This node is feeded via a LM11173v3 from a 5V 2A samsung charger. This node also has a 100uF near the VCC/GND of antenna.

      3. I have a PI2 + Arduino UNO (genuine!) with an amplified antenna with socket module. The amplified antenna is feeded via the socket module from 5V of PI.

      4. I did clear the EEPROM of Gateway, reloaded the personalization sketch and the Gateway Sketch.

      5. I did load the range finder sketch test from @Boots33 located here: https://forum.mysensors.org/topic/4567/repeater-node-problems/17

      RESULT WITHOUT THE SIGNING ENABLED:

      0 MCO:BGN:INIT NODE,Cโธฎ=RNNNA--,VER=2.1.1
      4 TSM:INIT
      4 TSF:WUR:MS=0
      12 TSM:INIT:TSP OK
      14 TSF:SID:OK,ID=6
      16 TSM:FPAR
      51 TSF:MSG:SEND,6-6-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      712 TSF:MSG:READ,0-0-6,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      718 TSF:MSG:FPAR OK,ID=0,D=1
      2060 TSM:FPAR:OK
      2060 TSM:ID
      2062 TSM:ID:OK
      2064 TSM:UPL
      2068 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      2084 TSF:MSG:READ,0-0-6,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      2088 TSF:MSG:PONG RECV,HP=1
      2093 TSM:UPL:OK
      2095 TSM:READY:ID=6,PAR=0,DIS=1
      2099 TSF:MSG:SEND,6-6-0-0,โธฎ=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
      2107 Waiting for GW to send signing preferences...
      2138 TSF:MSG:READ,0-0-6,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      2144 Received signing presentation, but signing is not supported (message ignored)
      2154 TSF:MSG:SEND,6-6-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
      2164 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      2185 TSF:MSG:READ,0-0-6,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      2195 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=OK:Range Finder
      2207 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
      2217 TSF:MSG:SEND,6-6-0-0,s=0,c=0,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
      2224 MCO:REG:REQ
      2230 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=26,โธฎt=1,l=1,sg=0,ft=0,st=OK:2
      2244 TSF:MSG:READ,0-0-6,s=255,c=3,t=27,pt=1,l=1,sg=0:1
      2248 MCO:PIM:NODE REG=1
      2252 MCO:BGN:INIT OK,TSP=1
      2256 TSF:MSG:SEND,6-6-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:0
      0
      3266 TSF:MSG:SEND,6-6-0-0,s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=OK:1
      1
      

      And it goes to "infinity" to 20 and restart. NO missing 1 send in about 30 minutes.. Very happy with this.
      After, I did enable the Signing Personalization:

      /**
       * rangeTester
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE_SIGNING
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x3B,0xF4,0xDD,0xDF,0x1E,0x97,0xB1,0xFB,0xEC}}}
      
      #define MY_RF24_CHANNEL 125
      
      #include <SPI.h>
      #include <MySensors.h>  
      
      #define CHILD_ID_LIGHT 0
      
      unsigned long WAIT_TIME = 1000; //  time between reads (in milliseconds)
      
      MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      
      void presentation()  {
      
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Range Finder", "1.0");
      
        // Register all sensors to gateway (they will be created as child devices)
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        
      }
      
      void loop() {
        
       for (int i=0; i<20; i++) {
         send(msg.set(i));
         Serial.println(i);
         wait(WAIT_TIME);
       }
        
      }
      

      It is a disaster... This is the LOG:

      โธฎ0 MCO:BGN:INIT NODE,CP=RNNNAS-,VER=2.1.1
      4 TSM:INIT
      4 TSF:WUR:MS=0
      12 TSM:INIT:TSP OK
      14 TSF:SID:OK,ID=6
      16 TSM:FPAR
      16 Will not sign message for destination 255 as it does not require it
      59 TSF:MSG:SEND,6-6-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      1032 TSF:MSG:READ,0-0-6,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      1038 Skipping security for command 3 type 8
      1042 TSF:MSG:FPAR OK,ID=0,D=1
      2068 TSM:FPAR:OK
      2068 TSM:ID
      2070 TSM:ID:OK
      2072 TSM:UPL
      2074 Skipping security for command 3 type 24
      2080 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      2097 TSF:MSG:READ,0-0-6,s=255,c=3,t=25,pt=1,l=1,sg=0:1
      2103 Skipping security for command 3 type 25
      2107 TSF:MSG:PONG RECV,HP=1
      2109 TSM:UPL:OK
      2111 TSM:READY:ID=6,PAR=0,DIS=1
      2115 Signing required
      2117 Whitelisting required
      2119 Skipping security for command 3 type 15
      2127 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0103
      2134 Waiting for GW to send signing preferences...
      2162 TSF:MSG:READ,0-0-6,s=255,c=3,t=15,pt=6,l=2,sg=0:0101
      2168 Skipping security for command 3 type 15
      2172 Mark node 0 as one that require signed messages
      2179 Mark node 0 as one that do not require whitelisting
      2185 Skipping security for command 3 type 16
      2191 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=0,st=OK:
      2197 Nonce requested from 0. Waiting...
      7202 Timeout waiting for nonce!
      7204 !TSF:MSG:SIGN FAIL
      7206 Skipping security for command 3 type 16
      7213 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
      7221 Nonce requested from 0. Waiting...
      12226 Timeout waiting for nonce!
      12228 !TSF:MSG:SIGN FAIL
      14231 Skipping security for command 3 type 16
      14239 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=0,ft=1,st=OK:
      14245 Nonce requested from 0. Waiting...
      14282 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=0:CDD8E3A6EF6862ABE47C625626385D9C43B17DF5EED6C19A8C
      14295 Skipping security for command 3 type 17
      14299 Nonce received from 0.
      14303 Proceeding with signing...
      Message to process: 060066030BFF52616E67652046696E646572
      Current nonce: CDD8E3A6EF6862ABE47C625626385D9C43B17DF5EED6C19A8CAAAAAAAAAAAAAA
      HMAC: 2FBD5D7E220EB6B33DDC59893EE33081AB9C3A6069BA1DBB0DBC9C52B354AE9D
      Signature in message: 01BD5D7E220EB6B33DDC59893E
      14477 Message โธฎigned
      14485 Message to send has been signed
      14491 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=11,pt=0,l=12,sg=1,ft=0,st=OK:Range Finder
      14499 Skipping security for command 3 type 16
      14510 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
      14518 Nonce requested from 0. Waiting...
      19523 Timeout waiting for nonce!
      19525 !TSF:MSG:SIGN FAIL
      19529 Skipping security for command 3 type 16
      19535 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=OK:
      19544 Nonce requested from 0. Waiting...
      24549 Timeout waiting for nonce!
      24551 !TSF:MSG:SIGN FAIL
      24553 MCO:REG:REQ
      24555 Skipping security for command 3 type 26
      24563 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=26,pt=1,l=1,sg=1,ft=1,st=OK:2
      24592 TSF:MSG:READ,0-0-6,s=255,c=3,t=16,pt=0,l=0,sg=1:
      24598 Skipping security for command 3 type 16
      SHA256: C88B09B24FEE7C0C5CA06C1C70DB958B075D545BCED7A42C4E00000000000000
      24633 Skipping security for command 3 type 17
      24647 TSF:MSG:SEND,6-6-0-0,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:C88B09B24FEE7C0C5CA06C1C70DB958B075D545BCED7A42C4E
      24659 Transmitted nonce
      24788 TSF:MSG:READ,0-0-6,s=255,c=3,t=27,pt=1,l=1,sg=1:1
      Signature in message: 01C615639AAE6055592C7394379A9FD7A448D9BAAE6D8057
      Message to process: 00060E231BFF01
      Current nonce: C88B09B24FEE7C0C5CA06C1C70DB958B075D545BCED7A42C4EAAAAAAAAAAAAAA
      HMAC: 955CF8A12B90E36B4D42B321FFD79586AFEED8566A0162025D1DD3A826393EDD
      SHA256: 80C615639AAE6055592C7394379A9FD7A448D9BAAE6D80572ADFBC1FA45A61E3
      24993 MCO:PIM:NODE REG=1
      24999 MCO:BGN:INIT OK,TSP=1
      25004 Skipping security for command 3 type 16
      25012 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
      25018 Nonce requested from 0. Waiting...
      25083 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:098D99FFD443EF2C0D37320ACE0BC0E4B57FFAF6A5705FC2EC
      25096 Skipping security for command 3 type 17
      25100 Nonce received from 0.
      25102 Proceeding with signing...
      Message to process: 0600164117000000
      Current nonce: 098D99FFD443EF2C0D37320ACE0BC0E4B57FFAF6A5705FC2ECAAAAAAAAAAAAAA
      HMAC: A7147AC2A73D5C389A437078A9F2D022528FED7B2431DA3226B05C3C616039B7
      Signature in message: 01147AC2A73D5C389A437078A9F2D022528FED7B2431DA
      25278 Message signed
      25284 Message to send has been signed
      25292 TSF:MSG:SEND,6-6-0-0,s=0,c=1,t=23,pt=2,l=2,sg=1,ft=0,st=OK:0
      0
      26298 Skipping security for command 3 type 16
      26316 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
      26322 Nonce requested from 0. Waiting...
      26378 TSF:MSG:READ,0-0-6,s=255,c=3,t=17,pt=6,l=25,sg=1:79101C63451593B1924BD221797435507AB7AC59C55558D365
      26388 Skipping security for command 3 type 17
      26394 Nonce received from 0.
      26396 Proceeding with signing...
      Message to process: 0600164117000100
      Current nonce: 79101C63451593B1924BD221797435507AB7AC59C55558D365AAAAAAAAAAAAAA
      HMAC: 11D124CC8BA9369358F58569ACBC78ABE57B21C64FA46FCA9E4DCEAEF4042933
      Signature in message: 01D124CC8BA9369358F58569ACBC78ABE57B21C64FA46F
      26570 Message signed
      26578 Message to send has been signed
      26589 TSF:MSG:SEND,6-6-0-0,s=0,c=1,t=23,pt=2,l=2,sg=1,ft=0,st=OK:1
      1
      27596 Skipping security for command 3 type 16
      27602 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=OK:
      27611 Nonce requested from 0. Waiting...
      32616 Timeout waiting for nonce!
      32618 !TSF:MSG:SIGN FAIL
      2
      33622 Skipping security for command 3 type 16
      33632 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=OK:
      33638 Nonce requested from 0. Waiting...
      38643 Timeout waiting for nonce!
      38645 !TSF:MSG:SIGN FAIL
      3
      39649 Skipping security for command 3 type 16
      39659 TSF:MSG:SEND,6-6-0-0,s=0,c=3,t=16,pt=0,l=0,sg=1,ft=1,st=OK:
      39665 Nonce requested from 0. Waiting...
      

      Sometimes it signs, often no. Could be that ACK // timeout for nonce is too fast?

      =================== UPDATE ?======================================

      I did just swap from this radio

      alt text

      To this << edited >> radio.... with plastic and aluminium to shield it...

      alt text

      I would say victory.... now nonce is coming istantly.....

      ================= NEW UPDATE ============================

      I did swap the radio from node and gateway. Gateway with black and node with shielded. No issue, no issue. Probabily the shielded doesn't like Arduino or simply doesn't love the jumpers and works like a charme with a pcb.... don't know, in aliexpress they have so many positive feedback.....

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex

      I'm looking and investigating for this issue.

      My network of sensors is located at channel 125, by the way I did notice new troubles when Wifi of ADSL is under heavy load.

      I did use two different scanner, and this is the output.

      alt text

      And other scanner

      alt text

      I don't know if my choice to move the radio to channel 125 is ok. In effect, on the node with relay/actuactor, I have also the traffic light. When wifi is under heavy load, I can see the red led blinking. No red when no wifi is used.

      On another website (http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo) I did read the hint to move the radios to channel 108.

      What do you think about?

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex I did forget a step. I did reinstall the personalization also, but after 20/30 mins, all stop works.

      I could try also the 2.2.0rc. Do I need every node and gw on same release or can I mix nodes and gw between 2.1.1 and 2.2.0 ?

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      A small update.
      1 - I did delete the library and re-downloaded from Github
      2 - I did clear the EEPROM of gateway
      3 - I did clear the EEPROM of a new Atmega328 (for relay / actuactor)
      4 - I did reinstall the Gateway sketch and the sketch for the relay heater, with signing.

      ..... it works......

      Yes, too many changes all together..... And fortunately I did receive today the PCBs for it, so in next days I will solder it on a firm base and not on breadboard.....

      After 30 min, no working anymore...... ๐Ÿ˜ž ๐Ÿ˜ž Fake alarm.... maybe some trouble with breadboard, maybe oxyde.... I will test in some day on PCB.

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Raspberry Pi Gateway

      @Woeka There is (on Arduino Gateway) a function named "DEFINE INVERSE BLINK". Try to search for same for PI....

      posted in Announcements
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex No, I'm running the 2.1.1 on all nodes and gw.

      In this moment I did re-enable the signature and signing software section on the gateway (but not in nodes, no nodes have signing enabled). All works. I can confirm.

      For the 2 (whitelisting) I did enable only on the node that require signature, i.e. the relay node. Not in gw, not in no others nodes.

      For the 3, maybe I was not clear. I did mean if I did have the possibility, on receive function, as following pseudo code:

      if (message.getSenderSerial() == 0X01,0XAA, 0XBB) {
      
          Serial.println("We did receive this message from our gateway... we can proceed");
         
      }
      
      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex
      I'm re-studying the API and specifically the signature / signing section.

      I did not understand something. I don't want open a new thread, ask here. If necessary, I will open a new one.

      My questions (and thank you in advance for your time and time for all readers!)

      From this page: https://www.mysensors.org/apidocs-beta/group__SigningSettingGrpPub.html#gaf75e26bdb90edd1230100ef160786e78

      1. MY_SIGNING_REQUEST_SIGNATURES
        It says "If used for a gateway, gateway will by default require signatures from ALL nodes[...]".
        I did enable this on the gateway (Arduino UNO).
        Q: In my network I have 2 nodes that transmit temp, hum and battery (atmega328). No signing at all in the sketch(es). Why they works without the SIGNING?

      2. MY_SIGNING_NODE_WHITELISTING
        I do not understand the explain. In effect, in my relay node (the only one of 3 nodes that did have the signing software enabled) I did have also:

      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      //#define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x3B,0xF4,0xF4,0xDF,0x1E,0x97,0xB1,0x2D,0xEC}}}
      

      What's a verifyng node cited on the explain? Another one node of my network is acting as a bridge beetween both?

      1. You did mention that I could sniff the address of trasmitting (of the gateway). I did not find nothing on the library... Could you help me to perform this "sniff"? This is my receive function atm:
      /**
       * Receive function from gateway
       * 
       * @since 1.0
       */
      void receive(const MyMessage &message) {
      
        if ( !message.isAck() ) {
      
          if ( message.type == V_STATUS) {
        
            if (  message.getCommand() == 1 ) {
        
              bool received_state = message.getBool();
              Serial.print("We did receive a new value. Received_state value is ");
              Serial.println(received_state);
        
              if ( received_state == 1) {
        
                digitalWrite(PIN_RELAY , RELAY_ON);
                
              } else {
        
                digitalWrite(PIN_RELAY , RELAY_OFF);
                
              }
              
            }
            
          }
      
        }
      
      }
      
      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex so, we return to the whitelisting ๐Ÿ˜ž ...

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex If i live at 4th floor of a Palace and the family at 3rd use MySensor, on same Channel also (!), Is there the possibility that their Heather commands could be read and interpretated from mine ? (Or viceversa).... Thank you!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex ok, I Will investigate more and more.

      Question: if I leave the Heather without signing, or a generic relay, someone "malicious" how could "play" with my relay? Need to have a portable controller and gateway and sniff when I poweron or poweroff the relay itself tto have the node in his controller?

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @Anticimex I did see Your similar answer on another thread. I am in accord with you, but my / our nodes was working flawless from month.... I Will try also swapping radios, maybe a power failure that has broken them? But no Power failure in about 6 month in my home....

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Software signing suddenly stop working

      @brendanl as PHP developer, It is INCREDIBLE that a perfect working software, WITHOUT updates, suddenly crash. But It is. For now, I did disable the signing. Do you have inserted other nodes in the network? Changed some radio? I don know whats the failure. I did redownload library from github and tonight I Will reinstallare. I Will update the thread ASAP.

      posted in Troubleshooting
      sineverba
      sineverba
    • Software signing suddenly stop working

      Hi to all,
      I have a RPI2 as Controller, with an UNO as Gateway connected via USB, version 2.1.1, with a NRF amplified.

      I have 3 nodes in home.

      2 are temp / hum battery, no signing at all.

      1 is the heater control, with a relay attached for the heater.

      This node is feeded with a Samsung 5V/2A.

      All network did work for last 6 month. Tonight, suddenly, the heater node lost communication, or better, did not receive command for the relay.

      I did attach a FT232 and I did see on serial "SIGN FAIL". A quick research on forum, I did comment the MY_SIGNING_REQUEST_SIGNATURES

      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      //#define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x3B,0xF4,0xF4,0xDF,0x1E,0x97,0xB1,0x2D,0xEC}}}
      

      on both gateway and nodes and.... all work like a charme.

      The node is an Atmega328 on breadboard @8MHZ, with amplified NRF, + screen + relay, as I did say.

      Now, for the moment it will be without security, but, just to understand, if someone on the neighborhood would "play" with my node, he could do it?

      I don't need security for a heater, but I would like only to have the WHITELISTING feature.

      IN next days I will investigate what could have done this issues, after about 6 month of small others issues but, of sure, no issues about the signing.

      Another question, I did update several time ago the library from Arduino update. Do you hint to delete totally from the folder, re-download and reinstall? Or the library on the official repository is the same?

      Thank you for your effort.

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Issues between Wifi (router) and NRF24L01

      It seems that moving to last channel all nodes and gateways solved my trouble.

      In this moment wifi is under heavy load (upload several video from several phones and tablet) and traffic leds never light the infamous red... neither nodes lost their gateway ๐Ÿ™‚ ๐Ÿ™‚

      posted in Hardware
      sineverba
      sineverba
    • RE: Issues between Wifi (router) and NRF24L01

      Thank you to all for your efforts. I will try the @Boots33 methods and sketches, moving by @gohan method further away the NRFs channel from the wifi.
      Unfortunately I cannot move the PI (and gateway) far from the router, but I am very sure that the issues are for the wifi, when it is under heavy load.
      I know also that breadboard jumper are not the best cables to connect these antennas (waiting for custom pcb to remove them...) and they can create other issues.
      This is, btw, my current placing:

      alt text

      So, I hope that moving the channels will give me max stability.
      I will update the post with next tests.
      Have a nice day!

      OT: @Yveaux I want that box! Is it available from some place??? What is there inside? Arduino?

      posted in Hardware
      sineverba
      sineverba
    • Issues between Wifi (router) and NRF24L01

      Hi guys,
      I have an Arduino gateway very close to the wifi router (about 10 cm). The Arduino has a NRF24L01 PA LN (amplified) version. This antenna is feeded via the Raspberry 2 (that acts as controller of Domoticz).
      So, I don't think power is a trouble (clean energy from Raspberry, not using that poor USB cable). Energy taken from the 5V and using the socket for the antennas that step down the voltage to 3.3:

      alt text

      The antenna is the version from Aliexpress (CDEByte: https://it.aliexpress.com/item/E01-ML01DP5-Ebyte-2-4GHz-20dBm-2100m-nRF24L01-SPI-Wireless-transceiver-module/32638720689.html?spm=a2g0s.9042311.0.0.dT6b9h ) But I also did try the "standard black" version.

      On a node far about 5 meters, I have the same amplified antenna (it's a barebone atmega, antenna is powered from a 2A 5V supply powered down to 3.3V with LD1117T (so, clean energy to the amplified version).

      On the amplified version I did not use any capacitors.

      My issues are when a PC wifi connected download very big files and Wifi is stressed. The nodes lost theyr parent.

      If wifi is no used / light load, no issues.

      I have same issues if I use normal version (not amplified) with 4.7uF caps on the VCC and GND.

      I did try also move the wifi channel to #12, without any advantage.

      So, I would ask you:

      1. What channel do you hint for wifi OR NRF?

      2. I'm trying to search a good sketch to test the NRFs between 2 simple Arduino, to measure trip, delay and test with different capacitors and / or with different shield. Can you hint me some sketch?

      Thank you very much

      posted in Hardware
      sineverba
      sineverba
    • RE: Do I need to implement the IRQ on future PCBs for nodes?

      @hek thank you. For atmega 328 only D2 and D3 are available, all' right?

      posted in Development
      sineverba
      sineverba
    • Do I need to implement the IRQ on future PCBs for nodes?

      Hi,
      the title say all...
      I have fun designing PCB for nodes. But, as title, do I need to implement the IRQ for them?

      And, if yes, for the ATMEGA328 and NRF24 radio, what PIN are available for it? 'Cause, for example, I have a node very populated (interrupt, reset, tx leds, 2 sensors, 1 relay, etc etc) so many Atmega PINs are not available.

      Thank you very much!

      posted in Development
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Serial Gateway

      @zboblamont ok. I did not know cause I have a PI1. Btw, what about serial port name and out of the box working? Or need some edit on PI config?

      Edit: I did read your answer late ๐Ÿ˜‰

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Serial Gateway

      @zboblamont ok, and PI can safely Power It with his radio? If right Remember, max of PI are 50mA .... From a GPIO.....

      Another question, please, what the port serial name? Pi recognises It out of the box?

      posted in Announcements
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Serial Gateway

      @zboblamont It is a 3.3v 8mhz. So do you mean use It connected via GPIO of PI? How do you power It?

      posted in Announcements
      sineverba
      sineverba
    • RE: [solved] RS485 nodes stop sending data after some hours or days

      @rejoe2 said in RS485 nodes stop sending data after some hours or days:

      @sineverba All nodes are ATMega32 based, running at 16MHz, 5V, Chinese Arduino clones. GW is FTDI-based Nano, Node_1 is a CH340G-Nano, the others are pro micros. Communication is via LC-Tech RS485 modules.

      When I checked the states some minutes ago, situation was as follows: Node_2 sent last messages around 4:30pm, Node_4 had been reset at around the same time (no watchdog defined), but no pir messages were sent when entering the room, so it seemed to be offline. Node_3 was alive, voltage A+B: around 0.03V.

      So now I pulled off the LC-Tech module on Node_2 and put power on again on Node_1. I'll see, if and when this one will go offline. If this leads also to no clear conclusions, I will think about first adding some caps on 5V or changing the 12V power supply.

      Or is it necessary to completely remove also the modules when there's no power to them?

      Should I try to use an older board definition (GW's with board defs starting from 1.6.13 had some reboot troubles until version 1.6.18 or so; this is pretty unfunny shooting in the dark....)
      Other ideas or recommendations?

      Hi,
      just to share, I will do also a post in some day. I did get the 96h-no stop configuration. Well, with some stop, but no trouble on re-start.
      Power-feed node: optiboot 6.2 with 2.7V bod.
      Battery feed nodes: optiboot 6.2 with 1.8 bod.
      Watchdog on startup at 2S
      3 try on startup and go in loop.

      If no ack received for 3 times, on every single send (e.g. getting the link, sketch name, temp, relay state, et cetera), delay for 5 sec. << this delay does the "magic". Watchdog restarts the node(s) and loop again.

      I did test disconnecting the serial Arduino as gateway for 1h and / or mantaining rebooting push button for 20 minutes (my poor finger ๐Ÿ˜„ )

      As soon as gateway is on, in several minutes all nodes are alive and transmitting. I did try also remove/put radio on nodes while live. They reconnect as charme.

      So, I would force all your nodes to do a deep restart if some trouble occours. Just my 2 cents....

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Building a Serial Gateway

      Is it possible to use an Arduino Mini Pro instead of a UNO? I did try with a Mini + FTDI232 (the red card) but cannot see nothing on PI serial. Thank you!

      posted in Announcements
      sineverba
      sineverba
    • RE: Node with DS18B20+Relay dies, also with watchdog

      @Yveaux thank you. But, why whatchdog is never fired , also without a wtd_reset() in my loop?

      I did setup 2 sec, never reset It, but my atmega finish the loop without problem, never resetting itself ....

      posted in Development
      sineverba
      sineverba
    • RE: [solved] RS485 nodes stop sending data after some hours or days

      @rejoe2 I did not understand one thing: what uCU are you using? Atmega328 barebones? If yes... what the setup of BOD?
      Tonight I did re-bootload my faulty node with BOD @2.7V. Seems more stable, after about 7h. Just to say... an idea....

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: [solved] RS485 nodes stop sending data after some hours or days

      @rejoe2 said in RS485 nodes stop sending data after some hours or days:

      [...]
      Now there's someone reporting nodes "dying" also with the same combination of attached hardware... [...]

      Yes. Same combination of sensor. I did not understand totally your entire setup (sorry, I'm a bit noob ๐Ÿ™‚ ) , but we have same sensors combination.

      I will swap the temp with a STH31 and - more important - the barebone Atmega with an Arduino Mini 3.3V. I will update asap.

      Good luck for your investigating. Really interested ๐Ÿ™‚

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Node with DS18B20+Relay dies, also with watchdog

      @rejoe2 Thank you, at least for your sharing.... There is an error in your link, right link is:

      https://forum.mysensors.org/topic/7454/rs485-nodes-stop-sending-data-after-some-hours-or-days

      (I think that forum has changed a bit your link)....

      Btw, tonight the node is still die 2 times. I'm re-arranging it with a Mini. I will update asap.

      PS Remain my doubt: how watchdog is implemented inside main functions of MySensors.....

      posted in Development
      sineverba
      sineverba
    • Node with DS18B20+Relay dies, also with watchdog

      Hi to all,
      I have a node with Atmega 8Mhz that sends temperature and receive on/off for relay. It is powered from wall with a charger and a breadboard power. 3.3v for Atmega (without XTAL) and 5V for the relay. So relay is not powered from Atmega, Atmega give only the "consensus".

      alt text

      Sometimes it did hang. So, I did try to add watchdog. This morning on my wakeup I did find it die.
      First of all, I need to say you that relay was poweroff for about 2h (I have last temp report about at 00:02 (it did hang from 00:.02 and 00:07, so), relay instead was off from the 22:00), so no interference from it and node was only reading temp every 5 minutes and reporting it to the Domoticz.

      No more light status blinking (and no responding to the controller). I have at the end of the loop a function that light a led status for 10ms, pause 4990ms (total 5 sec) and repeat this instruction. At the end, restart the loop. So, I have a visual feedback if node is live.

      I did note that adding watchdog, also without reset, the watchdog itself is not fired, also with very small times. So I imagine that several Mysensors call "interfere" with watchdog. I can only fire the watchdog if - with a false returning send instruction - I call the "delay" base instructions (you can see it in my code).

      My logic: retry to send for max 4 times. If 4th time is false (the send), introduce delay. Watchdog is fired ("finally") and restart coming.

      This is the code. Please, someone can help me to render it more stable? I have no idea where it hangs, because is it not connected on the PC but it is "headless".

      Thank you in advance!

      /**
       * Sketch for a relay + termostat.
       * 
       * In test from 27/09/2017
       * 
       * 
       * @version 2.1
       * 
       */
      
      /**
       * DEFINE MYSENSORS SECTION
       */
      //#define MY_DEBUG                    // Enable Basic Debug
      //#define MY_DEBUG_VERBOSE_SIGNING    // Enable Signing Debug
      #define MY_RADIO_NRF24
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x3B,0xF4,0x61,0xDF,0x1E,0x97,0xB1,0x2D,0xEC}}}
      #define MY_NODE_ID 10               // Default ID
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      #define MY_WITH_LEDS_BLINKING_INVERSE
      #define MY_DEFAULT_ERR_LED_PIN 16
      #define MY_DEFAULT_TX_LED_PIN 17
      #define MY_DEFAULT_RX_LED_PIN 18
      
      /**
       * Include libraries
       */
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DallasTemperature.h>
      #include <OneWire.h>
      #include <avr/wdt.h>
      
      /**
       * Define section.
       * 
       *    // NAME
       */
      #define SKETCH_NAME       "Termostato+Relay"
      #define SKETCH_VERSION    "2.1"
      
          //  PIN
      #define PIN_DS18B20       2
      #define PIN_RELAY         3
      #define PIN_LED_STATUS    19
      
          //  CHILD ID
      #define CHILD_ID_TEMP     0
      #define CHILD_ID_RELAY    1
      
          //  RELAY SECTION
      #define RELAY_ON          1   // if inverted, invert here
      #define RELAY_OFF         0   // if inverted, invert here
      
          //  WAITs TIMES
      #define WAIT_LOOPS        60  // The status led flashes ON 10 ms and OFF 4990 ms == 5000 ms of loop. 5000 * WAIT_LOOPS = number of cycles before new read. 60 == 5 minutes
                                    // 12 here means 1 minute. 12 * 5000 ms = 60 sec = 1 minute
                                    // 60 here means 5 minutes. 60 * 5000 ms = 300 sec = 5 minutes
      
      
      /*
       * One Wire Section
       */
      OneWire oneWire(PIN_DS18B20); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
      
      /**
       * Mysensors message
       */
      // Initialize temperature message
      MyMessage msg_temperature(CHILD_ID_TEMP , V_TEMP);
      // Initialize relay message
      MyMessage msg_relay(CHILD_ID_RELAY , V_STATUS);
      
      /**
       * Before class
       */
      void before() {
        // Startup up the OneWire library
        sensors.begin();
      }
      
      /**
       * Presentation.
       * 
       * Presents the child to the controller
       */
      void presentation() {
      
        // send sketch name
        sendSketchInfo(SKETCH_NAME , SKETCH_VERSION);
        // Present all sensors to controller.
        // TEMPERATURE
        present(CHILD_ID_TEMP, S_TEMP);
        // RELAY
        present(CHILD_ID_RELAY , S_BINARY);
        
      }
      
      /**
       * Our Setup
       */
      
      void setup() {
      
        wdt_enable(WDTO_2S);
        Serial.println("Start sketch");
      
       // SETUP LED STATUS
          // Set the LED STATUS as OUTPUT and shutdown it.
        pinMode(PIN_LED_STATUS , OUTPUT);
        digitalWrite(PIN_LED_STATUS , LOW);
      
        // SETUP RELAY
          // Set the RELAY PIN as OUTPUT and LOW
        pinMode(PIN_RELAY , OUTPUT);
        digitalWrite(PIN_RELAY , RELAY_OFF);
      
        // initialize sensors
        sensors.setWaitForConversion(false);
        
      }
      
      
      /**
       * Our loop
       */
      void loop() {
      
        // send the relay state to controller
        sendRelayStateToController();
      
        // executed the reading
        loopTemperature();
        
        // light the status led... so wait
        lightLedStatus();
      
      }
      
      /*
       * Send the state of relay to controller.
       * 
       * @since 2.1
       */
      void sendRelayStateToController() {
      
        Serial.println("-------------- DEBUG sendRelayStateToController() ---------------");
      
        bool current_state = digitalRead(PIN_RELAY);
      
        //current_state = !current_state; // delete if NOT inverted
      
        if (current_state == 1) {
      
          current_state = RELAY_ON;
          
        } else {
      
          current_state = RELAY_OFF;
          
        }
      
        Serial.print("current_state value is ");
        Serial.println(current_state);
      
        bool transmission_was_ok = false;
        int i = 0;
        do {
      
          transmission_was_ok = send(msg_relay.set(current_state) , true);
          
          Serial.print("Variable i is ");
          Serial.println(i);
          Serial.print("Variable transmission_was_ok value is ");
          Serial.println(transmission_was_ok);
          i++;
      
          if ( i > 3 ) {
      
            delay(5000); // this delay will call watchdog!
            
          }
          
          
        } while (transmission_was_ok == false);
      
        Serial.println("------------------------------------------------------------");
        
      }
      
      /**
       * Loop temperature.
       * Executed inside loop()
       * 
       * @since 2.0
       */
      void loopTemperature() {
      
        // Fetch temperatures from Dallas sensors
        // we need sensors.requestTemperatures() to NO BLOCK THE THREAD!!!
        sensors.requestTemperatures();
        float temperature = readTemperature();
        Serial.println("-------------- DEBUG loopTemperature() ---------------");
        Serial.print("Temperature is now ");
        Serial.println(temperature);
        Serial.println("------------------------------------------------------");
      
        sendTemperatureToController(temperature);
        
      }
      
      /************************************************/
      /****       VARIOUS FUNCTION TO SUPPORT     *****/
      /************************************************/
      
      /**
       * Receive function
       * 
       * @since 2.0
       */
      void receive(const MyMessage &message) {
      
        Serial.println("-------------- DEBUG receive() ---------------");
      
        Serial.print("message.type value is ");
        Serial.println(message.type);
        Serial.println("------------------------------------------");
        Serial.print("message.getCommand() value is ");
        Serial.println(message.getCommand());
        Serial.println("------------------------------------------");
      
        if ( message.isAck() ) {
      
          if ( message.type == V_STATUS ) {
      
            Serial.println("Relay state transmitted");
            
          }
      
          if ( message.type == V_TEMP ) {
      
            Serial.println("Temperature transmitted");
            
          }
          
        }
      
        if ( !message.isAck() ) {
      
          if ( message.type == V_STATUS) {
        
            if (  message.getCommand() == 1 ) {
        
              bool received_state = message.getBool();
              Serial.print("received_state value is ");
              Serial.println(received_state);
        
              if ( received_state == 1) {
        
                digitalWrite(PIN_RELAY , RELAY_ON);
                
              } else {
        
                digitalWrite(PIN_RELAY , RELAY_OFF);
                
              }
              
            }
            
          }
      
        }
      
        Serial.println("--------------------------------------------");
      }
      
      /**
       * Read the temperature from DS18B20
       * 
       * @since 2.0
       */
      float readTemperature() {
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = millisToWaitForConversion(sensors.getResolution());
        wait(conversionTime);
      
        // Read temperatures and send them to controller 
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(CHILD_ID_TEMP):sensors.getTempFByIndex(CHILD_ID_TEMP)) * 10.)) / 10.;
      
        return temperature;
        
      }
      
      /**
       * Get the millis to wait before reading based on resolution.
       * 
       * @since 2.0
       */
      
      int16_t millisToWaitForConversion(uint8_t bitResolution) {
        switch (bitResolution) {
          case 9:
          return 94;
          case 10:
          return 188;
          case 11:
          return 375;
          default:
          return 750;
        }
      }
      
      /**
       * Send the temperature to controller
       * 
       * @since 2.0
       */
      
      void sendTemperatureToController(float temperature) {
      
       if (temperature != -127.00 && temperature != 85.00) {
      
          bool transmission_was_ok = false;
          int i = 0;
          do {
        
            transmission_was_ok = send(msg_temperature.setSensor(CHILD_ID_TEMP).set(temperature,1) , true);
            
            Serial.print("Variable i is ");
            Serial.println(i);
            Serial.print("Variable transmission_was_ok value is ");
            Serial.println(transmission_was_ok);
            i++;
        
            if ( i > 3 ) {
        
              delay(5000); // this delay will call watchdog!
              
            }
            
            
          } while (transmission_was_ok == false);
          
          
        } else {
      
          delay(5000); // this call the watchdog!
          Serial.println("-------------- DEBUG sendTemperatureToController() ---------------");
          Serial.println("! ERROR reading temperature");
          Serial.println("------------------------------------------------------");
          
        }
        
      }
      
      /**
       * Light the LED status
       * 
       * @since 2.0
       */
      void lightLedStatus() {
      
        int k = 0;
      
        for ( k = 0; k < WAIT_LOOPS; k++) {
          
          digitalWrite(PIN_LED_STATUS,HIGH);
            wait(10); // 5 * 1000 millisends = 5 seconds;
          digitalWrite(PIN_LED_STATUS,LOW);
            wait(4990);
          
        }
        
      }
        
      }
      
      posted in Development
      sineverba
      sineverba
    • How to implement whatchdog for Arduino Serial Gateway

      Hi to all!
      I would implement a watchdog on the Arduino Serial Gateway connected on my PI.

      You know that gateway sketch basically... does nothing in loop or in setup. It is blank.

      Is sufficient put a watchdog of 1/2 seconds on setup, reset on loop and "forget"?

      I mean...

      
      
      // Enable debug prints to serial monitor
      //#define MY_DEBUG
      
      //#define MY_DEBUG_VERBOSE_SIGNING //!< Enable signing related debug prints to serial monitor
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Set LOW transmit power level as default, if you have an amplified NRF-module and
      // power your radio separately with a good regulator you can turn up PA level.
      #define MY_RF24_PA_LEVEL RF24_PA_HIGH
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      
      // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
      #if F_CPU == 8000000L
      #define MY_BAUD_RATE 38400
      #endif
      
      // Enable inclusion mode
      //#define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      //#define MY_INCLUSION_BUTTON_FEATURE
      
      // Inverses behavior of inclusion button (if using external pullup)
      //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
      
      // Set inclusion mode duration (in seconds)
      //#define MY_INCLUSION_MODE_DURATION 60
      // Digital pin used for inclusion mode button
      //#define MY_INCLUSION_MODE_BUTTON_PIN  3
      
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Inverses the behavior of leds
      //#define MY_WITH_LEDS_BLINKING_INVERSE
      
      /*
       * SECURITY // SIGNING SECTION
       */
      
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      
      #include <MySensors.h>
      #include <avr/wdt.h>
      
      void setup()
      {
        // Setup locally attached sensors
       // activate watchdog
       wdt_enable(WDTO_2S);
      }
      
      void presentation()
      {
        // Present locally attached sensors
      }
      
      void loop()
      {
        // Send locally attached sensor data here
        // reset watchdog
      wdt_reset();
      }
      
      posted in Development
      sineverba
      sineverba
    • RE: Is my battery drain correct? (Atmega bare @8Mhz + SI7021 + nrf)

      @Nca78

      Thank you for your answer! I wil test and I will update, if any...

      For the capacitors, yes, I use 40V rated. What's your hint on select them? Thank you another time ๐Ÿ™‚

      posted in Hardware
      sineverba
      sineverba
    • RE: Issue with Arduino + NRF24L01 + Raspberry when current in home goes "low"

      @sundberg84 said in Issue with Arduino + NRF24L01 + Raspberry when current in home goes "low":

      @sineverba - what @gohan said.
      There is something called a watchdog which can either be in the software or you can have a external component that is connected to the arduino reset pin. The arduino needs to ping the timer and if the arduino hangs and stops pinging the timer it will send a signal and reset the arduino.

      I did try to introduce Watchdog in my script. But... Arduino is not re-booted, if I use a function with wait inside. Is it normal?

      This is the function that prevent watchdog to reset the board....

      
      /**
       * Light the LED status
       * 
       * @since 2.0
       */
      void lightLedStatus() {
      
        int k = 0;
      
        for ( k = 0; k < WAIT_LOOPS; k++) {
          
          digitalWrite(PIN_LED_STATUS,HIGH);
            wait(10); // 5 * 1000 millisends = 5 seconds;
          digitalWrite(PIN_LED_STATUS,LOW);
            wait(4990);
          
        }
        
      }
      
      
      
      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Issue with Arduino + NRF24L01 + Raspberry when current in home goes "low"

      Thank you to both. I will test and I will update ๐Ÿ™‚

      posted in Troubleshooting
      sineverba
      sineverba
    • Is my battery drain correct? (Atmega bare @8Mhz + SI7021 + nrf)

      Hi to all,
      I have a barebone Atmega328 @8MHZ reading every 10 minutes a SI7021 temp+hum and battery voltage with "secret voltmeter" workaround (no external voltage divider). Is it feeded directly from 2XAA and if last reading is not equal to previous, send to the gateway, otherwise no.

      It sends battery, % battery, temp and hum.

      I did also printed the pcb with oshpark but I did wrong the footprint for sensor. The rest is ok!

      By the way, I did read on my tester 10microA when sleep, and ~17milliA when transmitting (~2/3 seconds). For 1500mAH, battery calculator says about 1.5year with battery (http://oregonembedded.com/batterycalc.htm)

      But, after 24h, I did note a loss of 0.05V on battery (reported on Domoticz). From 3.09V to 3.04V, from yesterday at 18:00 to today at 18:00.

      I am worried that it seems too high the discharge!

      Thank you for your answer!

      PS this is first prototype of PCB...

      alt text

      posted in Hardware
      sineverba
      sineverba
    • RE: Issue with Arduino + NRF24L01 + Raspberry when current in home goes "low"

      @sundberg84 said in Issue with Arduino + NRF24L01 + Raspberry when current in home goes "low":

      @sineverba - watchdog timer?

      Ehm... sorry.. what do you mean? (I know what is watchdog, but I did not understand you).... thank you!

      posted in Troubleshooting
      sineverba
      sineverba
    • RE: Some issues about uplink available or no

      Thank you... But isTransportReady seems true also if I leave the Arduino Gateway with reset pushed forever. ONly get false when I disconnect the power from Arduino.

      I'm thinking to use the receiveTime method. But, if controller (and gateway) are down, what the value returned from receivedTime?

      On another words, how can I check if time is returning? Because with gateway shutdown on Serial I did not read nothing from that function (instead of time).

      Thank you!

      posted in Troubleshooting
      sineverba
      sineverba
    • Some issues about uplink available or no

      Hi to all!
      Sometimes I have issues in home with gateway, that hangs until next restart.

      The nodes (several only transmitting temp/hum) seems hangs, they don't interest if I did restart or no the gateway//controller.

      I would implement some check of uplink available on the sketchs, on the loop. If uplink is available, transmit, if not, recheck.

      But... I don't know how to implement this check.

      Can you help me with this?

      My pseudocode could be:

      void loop() {
          bool is_available_uplink;
          is_available_uplink = getUplinkState();
          if (is_available_uplink) {
              // do stuff
          }
      }
      
      bool getUplinkState() {
      
          bool is_uplink_available = false;
         
          // check here the uplink
          return is_uplink_available;
      
      }
      

      Thank you to all!

      posted in Troubleshooting
      sineverba
      sineverba
    • Issue with Arduino + NRF24L01 + Raspberry when current in home goes "low"

      Hi to all,
      I have some issues in home power. I live in Italy and base voltage is 220V.
      When I use a big load, as washer dinner, washing machine or electric oven, voltage goes from 220/221V to 210V (sigh).

      Home is not mine, I live in rent.

      PC, Tv and Raspberry are feeded via UPS, that reacts very well to this voltage peak. Arduino is connected and powered via USB from the PI itself, and Arduino has NRF24L01 connected, trasmitting with other (battery) powered Atmega.

      The trouble is that sometimes this peaks render the Arduino (original R1) instable, and I need to restart the PI+Arduino itself or wait for the big user ending. ๐Ÿ˜ข

      Is there something that I can do (other than ask to the owner to call his technicians)? I think to know also the issues. The watt meter is distant from the home (about 100 meters) and the cables are not so-big, from meter to the home itself. But it is not my home, cannot act directyle.

      Thank you very much!

      posted in Troubleshooting
      sineverba
      sineverba
    • Atmega sleeping: power consumption lesser with 10uF capacitor

      Hi to all,
      background: spare Atmega328 @8MHZ / 3.3v, BOD disabled.

      2XAA feed about 2.70 when full charge. Voltage divider to read them, power to a booster to 3.3v.
      Sleeping for all time, every 10 minutes read a SI7021 and sends volt+temp+hum to gateway via NRF24L01 (time, about 5 seconds).

      So, all is powered via the booster.

      This is the schema, ready to print the PCB:

      alt text

      f I remove the 10uF capacitor placed near the batteries, power consumption when sleep is about 1mA.

      Too high for a powered battery!

      WIth that cap, power consumption on sleep is 78uA (microAmpere).

      Is it normal and... is it ok???

      Thank you very much!

      posted in Hardware
      sineverba
      sineverba
    • RE: ๐Ÿ’ฌ Battery Powered Sensors

      Hi to all!
      I have a issue reading of voltage on pin A0 of an ATMEGA 328 barebone mounted on a breadboard.

      This is the image

      alt text

      The purple pin goes to A0.

      The rail on the bottom coming direct from batteries, with a multimeter I read that they have 2.73V. On monitor serial, % of battery is about 1-2% and voltage reading is about... 0.004 and floating about 0.004 - 0.010 ....

      Can I imagine an issue with pin A0 itself? I have about 10 Atmega spares ๐Ÿ™‚ and I will test another one... but thinking about this issue.

      I did try also removing the 0.1uF cap, without any change.

      The reading function is the same of this sketch.

      Thank you very much!

      posted in Announcements
      sineverba
      sineverba
    • RE: Unable to get relay status from Domoticz

      @gohan Totally not updated. I did upload just now the @boots33 sketch in synch and it works. So it is my fault... But I cannot find!

      I re-start from fresh (err.. from boots sketch).

      posted in Development
      sineverba
      sineverba
    • RE: Unable to get relay status from Domoticz

      Ok,
      I don't know if it is necessary to open a new post.

      I imagine now it's a problem of Domoticz.

      I did change all my logic. NOw on startup and every X minutes, the node send to the Domoticz the status of relay, to mantain it in sync.

      Errrr...... the status is received but not displayed correctly ๐Ÿ˜ฅ

      I attach an image to explain better.

      alt text

      Domoticz is last update version, this is the current sketch:

      /**
       * Sketch for a relay + termostat.
       * 
       * In test from 11/08/2017
       * 
       * TERMINARE SE UPLINK NON รจ DISPONIBILE
       * 
       * @version 2.0
       * 
       */
      
      /**
       * DEFINE MYSENSORS SECTION
       */
      #define MY_DEBUG                    // Enable Basic Debug
      //#define MY_DEBUG_VERBOSE_SIGNING    // Enable Signing Debug
      #define MY_RADIO_NRF24
      #define MY_SIGNING_SOFT
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #define MY_SIGNING_REQUEST_SIGNATURES
      #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x3B,0xF4,0x61,0xDF,0x1E,0xFF,0xFF,0xFF,0xEC}}}
      #define MY_NODE_ID 10               // Default ID
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      #define MY_WITH_LEDS_BLINKING_INVERSE
      #define MY_DEFAULT_ERR_LED_PIN 16
      #define MY_DEFAULT_TX_LED_PIN 17
      #define MY_DEFAULT_RX_LED_PIN 18
      
      /**
       * Include libraries
       */
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      /**
       * Define section.
       * 
       *    // NAME
       */
      #define SKETCH_NAME       "Termostato+Relay"
      #define SKETCH_VERSION    "3.0"
      
          //  PIN
      #define PIN_DS18B20       2
      #define PIN_RELAY         3
      #define PIN_LED_STATUS    19
      
          //  CHILD ID
      #define CHILD_ID_TEMP     0
      #define CHILD_ID_RELAY    1
      
          //  RELAY SECTION
      #define RELAY_ON          0   // if inverted, invert here
      #define RELAY_OFF         1   // if inverted, invert here
      
          //  WAITs TIMES
      #define WAIT_LOOPS        1  // The status led flashes ON 10 ms and OFF 4990 ms == 5000 ms of loop. 5000 * WAIT_LOOPS = number of cycles before new read. 60 == 5 minutes
      //#define WAIT_RETURN       1500  //  Milliseconds to wait for returns from gateway
      
      
      
      /*
       * One Wire Section
       */
      OneWire oneWire(PIN_DS18B20); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
      
      /**
       * Mysensors message
       */
      // Initialize temperature message
      MyMessage msg_temperature(CHILD_ID_TEMP , V_TEMP);
      // Initialize relay message
      MyMessage msg_relay(CHILD_ID_RELAY , V_STATUS);
      
      /**
       * Before class
       */
      void before() {
        // Startup up the OneWire library
        sensors.begin();
      }
      
      /**
       * Presentation.
       * 
       * Presents the child to the controller
       */
      void presentation() {
      
        // send sketch name
        sendSketchInfo(SKETCH_NAME , SKETCH_VERSION);
        // Present all sensors to controller.
        // TEMPERATURE
        present(CHILD_ID_TEMP, S_TEMP);
        // RELAY
        present(CHILD_ID_RELAY , S_BINARY);
        
      }
      
      /**
       * Our Setup
       */
      
      void setup() {
      
        // SETUP LED STATUS
          // Set the LED STATUS as OUTPUT and shutdown it.
        pinMode(PIN_LED_STATUS , OUTPUT);
        digitalWrite(PIN_LED_STATUS , LOW);
      
        // SETUP RELAY
          // Set the RELAY PIN as OUTPUT and LOW
        pinMode(PIN_RELAY , OUTPUT);
        digitalWrite(PIN_RELAY , RELAY_OFF);
      
        // initialize sensors
        sensors.setWaitForConversion(false);
        
      }
      
      
      /**
       * Our loop
       */
      void loop() {
      
        // send the relay state to controller
        sendRelayStateToController();
      
        // executed the reading
        loopTemperature();
        
        // light the status led... so wait
        lightLedStatus();
        
      }
      
      /*
       * Send the state of relay to controller.
       * 
       * @since 3.0
       */
      void sendRelayStateToController() {
      
        Serial.println("-------------- DEBUG sendRelayStateToController() ---------------");
      
        bool current_state = digitalRead(PIN_RELAY);
      
        
      
        if (current_state == 1) {
      
          current_state = RELAY_ON;
          
        } else {
      
          current_state = RELAY_OFF;
          
        }
      
        Serial.print("current_state value is ");
        Serial.println(current_state);
        send(msg_relay.set(current_state) , true);
      
        Serial.println("------------------------------------------------------------");
        
      }
      
      /**
       * Loop temperature.
       * Executed inside loop()
       * 
       * @since 2.0
       */
      void loopTemperature() {
      
        // Fetch temperatures from Dallas sensors
        // we need sensors.requestTemperatures() to NO BLOCK THE THREAD!!!
        sensors.requestTemperatures();
        float temperature = readTemperature();
       
      
        sendTemperatureToController(temperature);
        
      }
      
      /************************************************/
      /****       VARIOUS FUNCTION TO SUPPORT     *****/
      /************************************************/
      
      /**
       * Receive function
       * 
       * @since 2.0
       */
      void receive(const MyMessage &message) {
      
        
      
        if ( !message.isAck() ) {
      
          if ( message.type == V_STATUS) {
        
            if (  message.getCommand() == 1 ) {
        
              bool received_state = message.getBool();
              Serial.print("received_state value is ");
              Serial.println(received_state);
        
              if ( received_state == 1) {
        
                digitalWrite(PIN_RELAY , RELAY_ON);
                
              } else {
        
                digitalWrite(PIN_RELAY , RELAY_OFF);
                
              }
              
            }
            
          }
      
        }
        
       
      
        Serial.println("--------------------------------------------");
      }
      
      /**
       * Read the temperature from DS18B20
       * 
       * @since 2.0
       */
      float readTemperature() {
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = millisToWaitForConversion(sensors.getResolution());
        wait(conversionTime);
      
        // Read temperatures and send them to controller 
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(CHILD_ID_TEMP):sensors.getTempFByIndex(CHILD_ID_TEMP)) * 10.)) / 10.;
      
        return temperature;
        
      }
      
      /**
       * Get the millis to wait before reading based on resolution.
       * 
       * @since 2.0
       */
      
      int16_t millisToWaitForConversion(uint8_t bitResolution) {
        switch (bitResolution) {
          case 9:
          return 94;
          case 10:
          return 188;
          case 11:
          return 375;
          default:
          return 750;
        }
      }
      
      /**
       * Send the temperature to controller
       * 
       * @since 2.0
       */
      
      void sendTemperatureToController(float temperature) {
      
        if (temperature != -127.00 && temperature != 85.00) {
      
          send(msg_temperature.setSensor(CHILD_ID_TEMP).set(temperature,1));
          digitalWrite(MY_DEFAULT_ERR_LED_PIN , LOW);
          //Serial.println("-------------- DEBUG sendTemperatureToController() ---------------");
          //Serial.println("No error on send temperature");
          //Serial.println("------------------------------------------------------");
          
        } else {
      
          // light the error led fixed!
          digitalWrite(MY_DEFAULT_ERR_LED_PIN , HIGH);
          //Serial.println("-------------- DEBUG sendTemperatureToController() ---------------");
          //Serial.println("! ERROR sending temperature");
          //Serial.println("------------------------------------------------------");
          
        }
        
      }
      
      /**
       * Light the LED status
       * 
       * @since 2.0
       */
      void lightLedStatus() {
      
        int k = 0;
      
        for ( k = 0; k < WAIT_LOOPS; k++) {
          
          digitalWrite(PIN_LED_STATUS,HIGH);
            wait(10); // 5 * 1000 millisends = 5 seconds;
          digitalWrite(PIN_LED_STATUS,LOW);
            wait(4990);
          
        }
        
      }
      
      
      
      posted in Development
      sineverba
      sineverba
    • RE: Unable to get relay status from Domoticz

      @gohan I know, but I would to not use the EEprom and I would also learn and understand where is my error / why cannot get the state... ๐Ÿ™‚

      posted in Development
      sineverba
      sineverba
    • RE: Unable to get relay status from Domoticz

      @gohan to mantain them in sync after a power failure.

      But you did put me on right way. I could simply put the relay off on Arduino start and send off to Domoticz.

      Every 5 minutes I could send the corrent state ti Domoticz (Imagine a gateway Power failure instead).

      In this mode I delegate all logic to Domoticz, when the relay need to be on or off....

      posted in Development
      sineverba
      sineverba
    • RE: Unable to get relay status from Domoticz

      @Ben-Andrewes request return every time "1". This is not the state of relay in Domoticz . The following state from Domoticz is "0", either if in Domoticz relay need to be on or off ....

      posted in Development
      sineverba
      sineverba