Windows GUI/Controller for MySensors


  • Admin

    @Anticimex ~yup 🙂


  • Admin

    @tekka said:

    I will add the manual sensor adding to the feature requests.

    Great, thanks!

    As for the variables, I don't think I was clear in what I was asking. The variable is a MySensors variable. It just doesn't look like it's picked up by the MYSController. I am doing a horrible job describing this but here is that I see in the log file:

    50	10/02/15 7:30:16.689	luup_log:27: Arduino: Request: 1;2;2;0;24;Front Yard <0x308de680>
    50	10/02/15 7:30:16.689	luup_log:27: Arduino: Requesting status for: 1;2 <0x308de680>
    50	10/02/15 7:30:16.690	luup_log:27: Arduino: Request status for Variable1 <0x308de680>
    50	10/02/15 7:30:16.690	luup_log:27: Arduino: Sending: 1;2;1;0;24;8 <0x308de680>
    

    I'm not seeing the '8' in the MYSController though. Hopefully that makes a little more sense.

    Thanks again for all the hard work!



  • @tekka said:

    @mvader please upload the entire log file to check a few things. Also, if the node is next to (or too close) you will get RF interferences (this has been observed for the large antenna and max tx power).

    EDIT: before I forget, also upload the log from the node - this will help to elicit the problem...

    I have to do more testing over the weekend, but i updated my gateway to 1.5, as my nodes where 1.5 but gate was 1.4, the 1st one i tried, worked without issue.
    dont know if it was a fluke/lucky or updating to 1.5 on the gateway solved my issue.. i'll post more as i test more nodes



  • This post is deleted!

  • Admin

    @petewill said:

    As for the variables, I don't think I was clear in what I was asking. The variable is a MySensors variable. It just doesn't look like it's picked up by the MYSController. I am doing a horrible job describing this but here is that I see in the log file:

    50	10/02/15 7:30:16.689	luup_log:27: Arduino: Request: 1;2;2;0;24;Front Yard <0x308de680>
    50	10/02/15 7:30:16.689	luup_log:27: Arduino: Requesting status for: 1;2 <0x308de680>
    50	10/02/15 7:30:16.690	luup_log:27: Arduino: Request status for Variable1 <0x308de680>
    50	10/02/15 7:30:16.690	luup_log:27: Arduino: Sending: 1;2;1;0;24;8 <0x308de680>
    

    I'm not seeing the '8' in the MYSController though. Hopefully that makes a little more sense.

    The controller receives messages from the GW but does not intercept messages sent from other controllers (due to the architecture). Similarly, messages sent with MYSController won't appear in Vera.

    But this leads me to an interesting idea...let's see 🙂



  • looking for some help with OTA and a sensebender board.
    if i manually reset the board, then it will take the OTA and that works fine.
    however, that's the only way i can get it to work.
    it doesn't respond to a reboot command (I assume this is because it's sleeping)
    and even if i select the battery/sleeping option, when a transmission does come in, it doesn't reset or start an OTA.
    the only way so far is to physically PF the device and then the OTA works.
    what am i missing?
    thanks!

    EDIT: so this does seems to work.. i spent all morning trying to come up with hack-y ways to get this to work.
    using the default sensebender sketch the OTA wait time is set to 300 milli seconds. which is like .3 seconds.
    i changed that 3000 (3 seconds) set the FW and waited for the next transmission..boom off it went (the OTA).
    so for anyone running into this issue. try this solution.
    I cant imagine 3 seconds vs .3 seconds is going to make a huge difference in battery life.



  • Looking for help to interpret log data after an OTA update. I am just learning, and successfully OTA'ed a simple DS18B temperature sketch to a node using MysController. Now I am trying to OTA an DHT22 node (the example sketch in 1.5 version, no changes to it.) The firmware OTA seems to go fine, but the Pro Mini never seems to start. Below is the log, I have bolded the log entries I don't understand. As shown, the first bold section comes right after the OTA. The second 16 minutes later is because I pushed the reset button on the pro mini. Any help understanding the log entry is appreciated.

    10/5/2015 7:04:01 RX 2;255;4;0;2;820001000200
    10/5/2015 7:04:01 TX 2;255;4;0;3;8200010001000C94AE010C94AE010C94ED020C94AE01
    10/5/2015 7:04:01 RX 2;255;4;0;2;820001000100
    10/5/2015 7:04:01 TX 2;255;4;0;3;8200010000000C9486010C94D11A0C94FE1A0C94AE01
    10/5/2015 7:04:01 RX 2;255;4;0;2;820001000000
    10/5/2015 7:04:01 INFO BL version=257
    10/5/2015 7:04:01 INFO Send FW info to node 2: type=82, version=1, blocks=0x0570, CRC=0x9AEC
    10/5/2015 7:04:01 TX 2;0;4;0;1;820001007005EC9A
    10/5/2015 7:04:01 RX 2;255;4;0;0;820001007005EC9A0101

    10/5/2015 7:07:23 RX 24;1;1;0;0;60.5
    10/5/2015 7:07:23 RX 24;2;1;0;1;59
    10/5/2015 7:11:41 RX 24;1;1;0;0;60.5
    10/5/2015 7:11:41 RX 24;2;1;0;1;59
    10/5/2015 7:13:24 RX 23;0;1;0;1;55.7
    10/5/2015 7:15:59 RX 24;1;1;0;0;60.5
    10/5/2015 7:15:59 RX 24;2;1;0;1;59
    10/5/2015 7:18:27 CHILD New child discovered, node id=23, child id=1
    10/5/2015 7:18:27 RX 23;1;1;0;0;63.0
    10/5/2015 7:18:27 RX 23;0;1;0;1;55.9
    10/5/2015 7:20:14 INFO BL version=257
    10/5/2015 7:20:14 INFO Send FW info to node 2: type=82, version=1, blocks=0x0570, CRC=0x9AEC
    10/5/2015 7:20:14 TX 2;0;4;0;1;820001007005EC9A
    10/5/2015 7:20:14 RX 2;255;4;0;0;820001007005EC9A0101

    10/5/2015 7:21:50 TX 2;0;3;0;13;0
    10/5/2015 7:23:32 RX 23;0;1;0;1;56.0
    10/5/2015 7:24:26 RX 24;3;1;0;24;78


  • Admin

    @tekka said:

    The controller receives messages from the GW but does not intercept messages sent from other controllers (due to the architecture). Similarly, messages sent with MYSController won't appear in Vera.

    But this leads me to an interesting idea...let's see 🙂

    Oh, sorry. I thought it did. I can see my light (relays) messages when turning on/off with my Vera but maybe that's the ACKs?


  • Admin

    @novicit The bold section is the bootloader sending/requesting the current node configuration. Did you set a static node ID in your sketch?



  • @tekka Thank you for your response. The sketch does not have a static ID - the line is "gw.begin();" So it should receive a node ID. I had MysController set to "AutoID" and it successfully issued the next free ID, which was 2. How would I test further to see why it does not begin execution. (I am using ethernet gateway with authentication, but the configuration is set to 'false', so a node not asking for Atsha response does not get one. Other non-atsha nodes work fine-as shown in the log. Don't know if this would make a difference.)



  • @tekka, In thinking about your question .... As the sketch begins execution after OTA'ing, it then asks for a node id to be issued (even though it has received one from the MysController) - and since I am using an ethernet gateway (& Domoticz) which does not automatically issue a node ID, the pro mini just sits there and waits for a node id? Would it then work if I put in a static node ID, even if it is different than the one issued by Myscontroller? And the node then adopts the static ID. ??



  • @tekka I tried 2 new nodes with static id assigned [gw.begin(incomingMessage, 21, false);] and [gw.begin(NULL, 23, false);] ---- still same frozen response.

    10/5/2015 17:18:46 TX 3;255;4;0;3;1400010000000C9486010C94D81A0C94051B0C94AE01
    10/5/2015 17:18:46 RX 3;255;4;0;2;140001000000
    10/5/2015 17:18:47 INFO BL version=257
    10/5/2015 17:18:47 INFO Send FW info to node 3: type=14, version=1, blocks=0x0570, CRC=0xE30B
    10/5/2015 17:18:47 TX 3;0;4;0;1;1400010070050BE3
    10/5/2015 17:18:47 RX 3;255;4;0;0;1400010070050BE30101
    10/5/2015 17:20:32 RX 1;0;1;0;0;19.5

    and:

    10/5/2015 16:59:29 TX 2;255;4;0;3;1400010000000C9486010C94D11A0C94FE1A0C94AE01
    10/5/2015 16:59:29 RX 2;255;4;0;2;140001000000
    10/5/2015 16:59:29 INFO BL version=257
    10/5/2015 16:59:29 INFO Send FW info to node 2: type=14, version=1, blocks=0x0570, CRC=0x2E9E
    10/5/2015 16:59:29 TX 2;0;4;0;1;1400010070059E2E
    10/5/2015 16:59:29 RX 2;255;4;0;0;1400010070059E2E0101
    10/5/2015 17:00:59 RX 24;1;1;0;0;62.8

    Any idea what the nodes are waiting for?

    I also reset the gateway to see if it sent anything that cleared the freeze, but no response. Hmmm.


  • Admin

    @novicit Can you temporarily use a serial gateway with debug enabled and upload a debug-enabled sketch to see what's going on on both sides? Please post the node and gateway log for further hints.



  • Can I set up Hydroponic Greenhouse automation with MYSController???



  • @tekka just wondering.. is there anywhere a documentation how the OTA works?
    I'm currently trying to write a little perl-script with OTA support and had a hard time misreading the source code of the MYSController and OTABootloader.



  • @tekka, problem solved! I took a debug log from the node per your suggestion and was surprised to get:
    radio init fail
    radio init fail
    radio init fail
    This of course surprised me after it just finished downloading 20kb+. Turns out after I made the first test of OTA which worked fine, my home network automatically synchronized my laptops & desktop. This brought over a copy of myconfig.h which had softspi enabled! (I had been setting up the gateway on a different computer). So when I went to OTA on the second and third nodes it picked up the synched myconfig.h. Ugh, such little strange things that take so much time to find.
    @tekka, my apologies for using some of your time. And my Thanks for your great work and sharing with the community!! Hopefully others will avoid similar mistakes by reading this.


  • Hero Member

    Hi @tekka , I'm trying to create a simple thermostat device and I'm usually using your fantastic controller for prototype testing and debugging. Now I would need the possibility to send setpoint values from the controller and the current version of MYSController does not seem to support the following:

    V_HVAC_SETPOINT_COOL 44 HVAC cold setpoint S_HVAC
    V_HVAC_SETPOINT_HEAT 45 HVAC/Heater setpoint S_HVAC, S_HEATER
    V_HVAC_FLOW_MODE 46 Flow mode for HVAC ("Auto", "ContinuousOn", "PeriodicOn") S_HVAC

    I would greatly appreciate it is these features were implemented to your fantastic controller also.

    Best regards,
    Tomas



  • sorry if this has been asked before.
    but I have a nano with mySbootloader installed and when i look at it in the serial monitor its just all gibberish.
    i tried different speeds, but still the same.
    is it not possible if you have that bootloader installed? or do i need to do something else.?
    thx


  • Admin

    @korttoma is implemented in 0.1.2.284 - release pending


  • Admin

    @mvader this is not related to MYSBootloader. Try doubling the baud rate setting, i.e. 230400....


  • Contest Winner

    @tekka Would it be possible in a future version to have the controller save the detected network nodes? Right know, I have to re-present the nodes in order for them to appear properly in the tree every time MYSController is restarted since it starts up with an empty tree.



  • Hi @tekka , I've gone through the steps in your guide using MQTTGateway as gw sketch.
    When I start my new node (burned with mysbootloader) I only see the repeating message "FIND_PARENT" in MySensor Debug window and "RX 0;0;3;0;9;read: 0-0-255 s=255,c=3,t=7,pt=0,l=0,sg=0:" in the MYSController Debug window.
    The message appears every time the led is blinking on the node (approx every 2 seconds).

    Any idea why it doesn't request node id? Have also tried with AutoID without success.

    Thx!


  • Admin

    @Anticimex is implemented in the upcoming release 🙂


  • Admin

    @rubal MYSController does not support MQTT gw. Please use a different controller or change to a serial/tcp gw.


  • Contest Winner

    @tekka sweet! Any ETA on the next release?


  • Admin

    @Anticimex wanna beta-test? 😉


  • Contest Winner

    @tekka for sure 🙂



  • @tekka - i do 🙂 i use it every day


  • Admin

    @cdr said:

    I changed the channel in the mysensors config.h to 77, this was the reason no node would ever show up since the default mysbootloader uses the default channel 76.

    I think I am running into the same thing. How did you fix this? I have many nodes so switching back to 76 is not a good option for me.



  • @petewill said:

    running into the sam

    You can edit myconfig.h and have te recompile after change.


  • Admin

    @cdr I've never recompiled a bootloader before but when I did some searching it seems that I need the .c file to do this. Maybe I'm missing something and I can recompile the .hex? How did you end up doing it? Thanks!


  • Admin

    I did some more testing and my issue definitely appears to be a result of changing the channel in MyConfig.h. I just built a serial gateway with channel 76 selected and everything worked perfectly. The only problem is I have over 20 nodes located throughout my house so re-uploading the code so they use that channel is not something I'd like to do if I can avoid it. Does anyone know how I can recompile the bootloader so I can change the channel?

    I tried the files @siklosi posted here http://forum.mysensors.org/topic/2319/how-to-make-complie-mysbootloader/7 but it did not work.



  • in firmware_config.csv file what is the first column "type" for? And where do I get "type" codes?


  • Admin

    @niccodemi type can be any numeric value used to identify a specific firmware type - this value (together with FW version and the FW CRC) is used to automatically update the nodes.



  • @petewill did you have any success finding out how to change default channel?



  • I recently switch to RFM69 and I know it's not yet compatible with MYSBootloader. But I can't find information about RFM69 and dualoptiboot support for OTA in MYSController (without a sensebender). Is it possible ? I have to make special config ? Thank !


  • Contest Winner

    @Fabien DualOptiboot is completely radio agnostic. You should not need any custom config to use OTA with DualOptiboot and rfm69. You do need an external flash on your board though.



  • @Anticimex ok but in MYSController is there a way in the GUI for setting the bootloader (DualOptiboot or MYSBootloader) or is ti automatic. I ask this because you have to tell MYSBootloader your are running SenseBender (DualOptiboot).


  • Admin

    @Fabien yes, select "sensebender"...this will do the trick



  • Thank you @tekka I don't test your new bootloader beacuse I think you don't have RFM69 version (perhaps in th future ?)


  • Admin

    @Fabien perhaps, will have to get some RFM69 hardware first...


  • Admin

    @niccodemi said:

    @petewill did you have any success finding out how to change default channel?

    Sorry, don't know how I missed this. No, I haven't. I got sidetracked (kids) and I haven't had a chance to work on it further.


  • Admin

    @niccodemi I just was able to upload the bootloader using the files provided by @siklosi posted here http://forum.mysensors.org/topic/2319/how-to-make-complie-mysbootloader/7. The difference is I used a USBASP (V2.0) instead of an UNO. It worked the first time uploading the blink sketch!! It was a pain getting the USBASP to work on Windows 8.1 but after I got the driver installed (and the wiring connections correct) it worked great. I haven't uploaded any sensor sketches yet but hopefully I'll have time to play with it soon.



  • @petewill thanks, I tried ch77 and it works great.



  • Hi, download link for MYSController is broken. Error on attempt to download. thank you


  • Admin

    @balloonguy Not on my side. Please try again.



  • @tekka thanks for the quick response - i have tried the {http://goo.gl/9DCWNo} with no luck, all i get is a "this page is not available" message. I have tried with different browsers and different pc's - still the same response.
    BTW- Merry Christmas.



  • @balloonguy just tried this link. Everything is working, MYSController.zip file with md5 checksum dfe98f9e7ed6e1c3d5c418a862c23ee0 is downloaded.



  • Hi @tekka

    When editing/adding items to the firmware_config.csv file, what should go in the types column? Could you please explain it?

    Thanks,


  • Admin

    @drock1985 said:

    When editing/adding items to the firmware_config.csv file, w

    The type field is intended for defining a FW type, e.g. a node with a DHT humidity/temperature sensor may be FW type 1, whereas a node with a different sensor FW type 2 and so on...



  • Now that I have sensors that have the correct bootloader I have been able to upload firmware a few times. But now that I have made changed to the sketch and copied the new hex file over I even bumped the version tag in the file. I can't get it to flash. Nothing I do makes it upload the new code? Thoughts?



  • @p0lar are you still able to remotely reboot node?


  • Admin

    @p0lar Please provide MYSController log with DEBUG enabled for further troubleshooting.



  • Yes I can reboot the node. trying to upload dallastemp to it.

    MySensors_20160102-104854.log


  • Admin

    @p0lar I do not see any DEBUG nor bootloader messages. Can you update the GW sketch with DEBUG enabled? Also, what bootloader did you flash?



  • Its turned on in MySensors.h and reuploaded

    MyConfig.h



  • But i dont see anything. UNO ethernet GW with SoftSPI enabled



  • Bootloader on the sensors is the one from your firmware directory. on the GW its the standard arduino one... do I need yours on the GW?


  • Admin

    @p0lar No, GW should have normal (i.e. Arduino) bootloader. However, without DEBUG output it's gonna be hard to diagnose what's wrong - can you double-check your settings and re-upload the GW sketch just to be on the safe side.
    Also, I'd like to see the log during a manual reset (not remote reboot) of your node.



  • Thanks. Ill check that when I get back into town end of this week.



  • Hi @tekka,

    tried now some evenings to change node-id / clear the eeprom. No luck. FW update works always. After reading the bootloader code I expected myscontroller to send a invalid fwrequestresponse packet with special crc for the bootloader commands. Never showed up in the log.
    Myscontroller .282 on Win xp and msbootloader 1.1 on nano. 47uF on nrf. No transmission errors.

    Any ideas where to look next ? Maybe .278 will do the trick ?

    Thanks for your efforts ,
    stebra


  • Admin

    @stebra please post the myscontroller log with gw DEBUG enabled that shows OTA update and ID reassign request.



  • MySensors_20160110-115615_stebra.log

    hi tekka,

    here is the log. Contains:

    [2016-01-10 12:02:26.390 Info] INFO *** Logging START *** // stebra : succesful reboot of node 6 via myscontroller

    [2016-01-10 12:02:59.000 Info] INFO *** Logging START *** // stebra : succesful FW update of node 6 via myscontroller

    [2016-01-10 12:05:35.109 Info] INFO *** Logging START *** // stebra : ID reassign attempt of node 6 to node 12 via myscontroller
    [2016-01-10 12:05:48.328 Info] INFO Send FW info to node 6: type=1E, version=1, blocks=0x0448, CRC=0xA87A // here the behaviour is unexpected for me

    [2016-01-10 12:06:37.437 Info] INFO *** Logging START *** // stebra: Clear eeprom attempt on node 6
    [2016-01-10 12:06:44.812 Info] INFO Send FW info to node 6: type=1E, version=1, blocks=0x0448, CRC=0xA87A // here the behaviour is unexpected for me

    thank you for having a look..



  • stebra_id_reassign_attempt.PNG

    and also a ss for another reassign attempt node 6--> 12.
    FIRMWARE_CONFIG_REQUEST is not answered from myscontroller. therefore no reassign of node id.



  • Maybe I should open a new topic for this, but I cannot flash bootloader, I always get
    Arduino: 1.6.7 (Windows 10), Board: "ATmega328 internal 8Mhz with MYSBootloader"
    ***failed;
    avrdude: verification error, first mismatch at byte 0x0000
    0x3f != 0xff
    avrdude: verification error; content mismatch
    Error while burning bootloader.

    Here is the verbose message

    C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4 -b19200 -Uflash:w:C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader.hex:i -Ulock:w:0xFF:m 
    Reading | ################################################## | 100% 0.01s
    
    avrdude: verifying ...
    avrdude: 1 bytes of lock verified
    avrdude: reading input file "0x06"
    avrdude: writing efuse (1 bytes):
    
    Writing | ################################################## | 100% 0.01s
    
    avrdude: 1 bytes of efuse written
    avrdude: verifying efuse memory against 0x06:
    avrdude: load data efuse data from input file 0x06:
    avrdude: input file 0x06 contains 1 bytes
    avrdude: reading on-chip efuse data:
    
    Reading | ################################################## | 100% 0.01s
    
    avrdude: verifying ...
    avrdude: 1 bytes of efuse verified
    avrdude: reading input file "0xDA"
    avrdude: writing hfuse (1 bytes):
    
    Writing | ################################################## | 100% 0.01s
    
    avrdude: 1 bytes of hfuse written
    avrdude: verifying hfuse memory against 0xDA:
    avrdude: load data hfuse data from input file 0xDA:
    avrdude: input file 0xDA contains 1 bytes
    avrdude: reading on-chip hfuse data:
    
    Reading | ################################################## | 100% 0.01s
    
    avrdude: verifying ...
    avrdude: 1 bytes of hfuse verified
    avrdude: reading input file "0xE2"
    avrdude: writing lfuse (1 bytes):
    
    Writing | ################################################## | 100% 0.01s
    
    avrdude: 1 bytes of lfuse written
    avrdude: verifying lfuse memory against 0xE2:
    avrdude: load data lfuse data from input file 0xE2:
    avrdude: input file 0xE2 contains 1 bytes
    avrdude: reading on-chip lfuse data:
    
    Reading | ################################################## | 100% 0.01s
    
    avrdude: verifying ..
    avrdude: 1 bytes of lfuse verified
    
    avrdude done.  Thank you.
    
    
    avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2009 Joerg Wunsch
    
             System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
    
             Using Port                    : COM4
             Using Programmer              : stk500v1
             Overriding Baud Rate          : 19200
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             ByteDelay                     : 0
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :
    
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
    
             Programmer Type : STK500
             Description     : Atmel STK500 Version 1.x firmware
             Hardware Version: 2
             Firmware Version: 1.18
             Topcard         : Unknown
             Vtarget         : 0.0 V
             Varef           : 0.0 V
             Oscillator      : Off
             SCK period      : 0.1 us 
    avrdude: AVR device initialized and ready to accept instructions
    
    Reading | ################################################## | 100% 0.02s
    
    avrdude: Device signature = 0x1e950f
    avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    avrdude: erasing chip
    avrdude: reading input file "C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader.hex"
    avrdude: writing flash (32722 bytes):
    
    Writing | ################################################## | 100% 0.00s
    
    avrdude: 32722 bytes of flash written
    avrdude: verifying flash memory against C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader.hex:
    avrdude: load data flash data from input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader.hex:
    avrdude: input file C:\Program Files (x86)\Arduino\hardware\arduino\avr/bootloaders/MySensors/MYSBootloader.hex contains 32722 bytes
    avrdude: reading on-chip flash data:
    
    Reading | ################################################## | 100% -0.00s
    
    avrdude: verifying ...
    avrdude: 32722 bytes of flash verified
    avrdude: reading input file "0xFF"
    avrdude: writing lock (1 bytes):
    
    Error while burning bootloader.
    Writing |  ***failed;  
    ################################################## | 100% 0.07s
    
    avrdude: 1 bytes of lock written
    avrdude: verifying lock memory against 0xFF:
    avrdude: load data lock data from input file 0xFF:
    avrdude: input file 0xFF contains 1 bytes
    avrdude: reading on-chip lock data:
    
    Reading | ################################################## | 100% 0.01s
    
    avrdude: verifying ...
    avrdude: verification error, first mismatch at byte 0x0000
             0x3f != 0xff
    avrdude: verification error; content mismatch
    
    avrdude done.  Thank you.
    

    I get same message with both 3.3v and 5v pro mini that is linked in the store.
    I am using Funduino uno as a ips, and I can flash blink f.eks. using uno as isp, but I cannot flash bootloader. This is the step 6 from the instructions that is failing. Any ideas how to fix this? I would really like OTA as my network is slowly growing.
    Thanks for any tips!



  • I think I have flashed MYSBootloader finaly, after ~6hours of trying and reading (persistent guy 🙂 )
    The instructions are for the older version I guess, right board should be copied from MYSController/bootloader/boards.txt, not from this topic post#75. Now I am trying to figure how to flash the sketch, but I guess that is explained somewhere on the topic



  • Just one more question, I didn't find it answered on the topic (maybe too tired), but:
    I have existing network with ethernet gateway and some nodes, and all is working fine. To make it OTA update-able, I need to

    1. i upload ethernet gateway to the Arduino Nano, then flash MYSBootloader on it,
    2. upload some sketch (which?) on Arduino Mini nodes, and then flash MYSBootloader on it, and then I can program it OTA?
    3. Or something else?

    Or did I miss the point completely? 😞



  • so from what I know.
    you DONT need the MYSBootloader on the gateway. just normal arduino bootloader. you DO need the MYSBootloader on ALL the sensors you with to connect to your gateway.
    Do the MYSBootloader first then use this tool to upload the firmware to your sensors OTA


  • Admin

    @dakipro I use the settings mentioned in #75 in Atmel studio, however, AVRDUDE does not support the upper two bits of the lock fuse (therefore the error message 0xFF!=0x3F). Changing the lock bits to 0x3F should do the job.

    And yes, as @p0lar pointed out, only the nodes and not the gateway should have MYSBootloader.



  • HMM i cant build a DEBUG version of the ethernet gateway... even when I try to define it and print hello world it wont... weird.. any ideas?



  • Aha, I get it now. Then I just flash MYSBootloader on the sensor, and attach the radio and it will automatically connect to the gateway (it has some sort of sketch/communication with MySensors built in)? And then I use the MYSController to upload my sketch as described?

    Or how do I upload a initial sketch if I cannot use arduino anymore?

    Btw, I love MYSController, i use it all the time in development as it shows all that is going on with the sensors, thank you very much for developing it!



  • correct. you build the .hex file in arduino studio or whatever and copy it to the MY gui firmware folder and edit the csv file and then reload.

    http://forum.mysensors.org/topic/1066/bootloader/8

    This should help



  • This post is deleted!


  • I thinking I am build a DEBUG version of the GW code. but I dont think the logging is working in the app with my eth GW. am I mising something?

    So. when I build a DEBUG version of the GW code I get this in the serial console hex size=29k so its bigger.

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:71.6
    1;1;1;0;0;71.6
    0;0;3;0;9;read: 2-2-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2;1;1;0;16;0

    the NON DEBUG I get this. hex size = 26k
    1;1;1;0;0;69.8
    1;0;1;0;1;35.0
    1;1;1;0;0;71.6
    1;0;1;0;1;36.0
    1;1;1;0;0;73.4
    1;0;1;0;1;37.0
    2;1;1;0;16;0


  • Admin

    @p0lar said:

    So. when I build a DEBUG version of the GW code I get this in the serial console hex size=29k so its bigger.

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:71.6
    1;1;1;0;0;71.6
    0;0;3;0;9;read: 2-2-0 s=1,c=1,t=16,pt=0,l=1,sg=0:0
    2;1;1;0;16;0

    that looks good 🙂



  • Still nothing in the MySensors Debug tab... and only the NON debug info in the log files. maybe this is a ethernet GW issue? So I get debug info in the Arduino Serial monitor but no debug via TCP?

    [GENERAL]
    VERSION=0.1.2.282

    [COMMUNICATION]
    COM=COM1
    SPEED=4
    IP=10.1.1.200
    PORT=5003
    TCPACTIVE=1

    [STATUS]
    LOGGING=1
    DEBUGGING=1
    SENDMSG=1
    LOGPARSE=1
    AUTOFW=0
    AUTOID=1
    UTCTIME=0
    CLOSECONFIRM=0
    FILTERLOG=1
    SAVENODES=1
    METRICSYSTEM=0



  • @tekka : I tested the ID reassign by hardcoding the functionality in the serial gw sketch. Reboot node 6, wait for FW_CONFIG_REQUEST, answer with FW_CONFIG_RESPONSE.

    Works as expected & described in the MYSBootloader code. Please give me some hint why MYSController does not send the FW_CONFIG_RESPONSE packet with the bootloader commands after the reboot.

    I trigger the reassign via the node´s context menu in the gui, MYSBootloader Commands --> reassign ID. Anything wrong with that ?

    Maybe someone else has an idea what is happening/not happening ? @tekka could you find something in the log file?

    Thanks a lot...



  • Has anyone tested successfully reassigning the node-id with MYSBootloader 1.1 and MYSController 1.2.282 ? Would give me some new motivation to hear it's possible and has been done before. At the very moment I m at a dead end.
    If it is not working for you, I would also appreciate your feedback.


  • Hero Member

    @tekka
    Is the (dev branch) MQTTClientGateway supported by MYSController?

    I'm in the process of moving from Vera and Ethernet GW, to Openhab with MQTTClient gateway and would love to have the OTA functionality your bootloader and controller provides. I looked at this a while back, but ran out of time to play!

    So yeah.. Can MYSController talk with the MQTTClientGateway ( over Ethernet) ?

    Cheers,
    Greg


  • Hero Member

    In answer to my own question... No..it doesnt seem to.. ;-(
    I tried with the IP address of my MQTT client gateway board, and port 5003 ( same port that works for my 1.4 Ethernet GW )
    It says it connects, but no data flows in....

    @tekka @hek - Is it unlikely that the MQTTClient Gateway will be usable with MYSController??

    If not, would this work?

    Have two networks -
    1 for MYSController to perform OTA's using a serial gateway on the PC we typically do sketch changes on.

    2 for normal MySensors operation. When you want to invoke an update, you could send a I_REBOOT command ( MQTT message in my case), which would reboot the node and if i understand correctly, look for an update on the other network channel.

    I guess you would loose all the other functionility of MYSController, but at least we could do OTA.

    Cheers,
    Greg


  • Admin

    @stebra The log looks normal - is the node directly communicating with the gw or via a repeater? Does the clearEEPROM option work?


  • Admin

    @gregl MYSController is currently not supporting MQTT, I'll add it to my feature request w/o ETA.



  • @tekka
    No repeater, clear eeprom via MYSController gui does not work. Clear eeprom via sketch works, node gets new id after reboot.
    My assumption is that MYSController does not respond to the FW_CONFIG_REQU after reboot.



  • @tekka You might not have to. I've been working on Node-Red as a controller and more.

    With my kit, you need Node-Red, node-red-contrib-mysensors , Mosquitto, and some of my flows which I have available ( http://forum.mysensors.org/topic/2802/flow-to-turn-serialgateway-into-mqtt-serialgateway ).

    And it makes this:
    http://forum.mysensors.org/topic/2815/flow-to-turn-serialgateway-with-mqtt-flow-to-ethernetgateway

    The only flaw is that when you first connect MYSController, you need to send a junk topic so that MYSController can receive data. It's a bug/peculiarity with Node-Red, but honestly not a big deal. I'm also working on how to fix even that.



  • @tekka
    Can you verify it works for you? Do you see any response packets with the bl commands in your log?


  • Hardware Contributor

    First time i try OTA. Everything went well until fw update (Pro mini). It sends/recieve like 20-30 packages, and then ends. I need to reconnect Myscontroller and it will start to flow again. I can see there is requests from node on gw led, but nothing comes through in Myscontroller (.282). Using 2.0b ethernet gw. Its just like either GW stops sending to Myscontroller or Myscontroller doesnt accept it. Also getting in domoticz that "MySensors: Connection reset!" Do i need to disconnect Domoticz while I do updates?

    Any clues?

    Edit: Sorry, jepp - needs to disconnect Domoticz and it works... I bet its those new gateway pings from Domoticz killing it.


  • Hardware Contributor

    A quick one: How long does the OTA takes for Blink sketch?

    I press update FW, it start rolling and the node changes status from "fw updating" to "booting" but then goes back to fw updating... have been going like this for a long time now (1000 packages sent/recieved).

    Also - is it possible to upload via fdti with MYSBootloader or you need to use OTA?

    Edit: somethings is not right, its rebooting or starting over again:

    2016-01-16 21:09:41	RX	14;255;4;0;2;0A0001002F00
    2016-01-16 21:09:43	TX	14;255;4;0;3;0A0001002F008083E1EBF0E0808184608083E0EBF0E0
    2016-01-16 21:09:43	RX	14;255;4;0;2;0A0001002F00
    2016-01-16 21:09:45	DEBUG	Undefined firmware/type for node=14
    2016-01-16 21:09:45	INFO	BL version=257
    2016-01-16 21:09:45	INFO	Send FW info to node 14: type=A, version=1, blocks=0x0048, CRC=0xD098
    2016-01-16 21:09:45	TX	14;0;4;0;1;0A000100480098D0
    2016-01-16 21:09:45	RX	14;255;4;0;0;FFFFFFFFFFFFFFFF0101
    2016-01-16 21:09:46	DEBUG	FW update started, node id = 14
    2016-01-16 21:09:46	TX	14;255;4;0;3;0A0001004700E1F30E940000F9CF0895F894FFCFFFFF
    2016-01-16 21:09:46	RX	14;255;4;0;2;0A0001004700
    2016-01-16 21:09:47	TX	14;255;4;0;3;0A0001004700E1F30E940000F9CF0895F894FFCFFFFF
    2016-01-16 21:09:47	RX	14;255;4;0;2;0A0001004700
    2016-01-16 21:09:48	TX	14;255;4;0;3;0A00010046002C020E947000C0E0D0E00E948B002097
    


  • @tekka

    Fortunately a helpful guy gave me your bootloader 1.3 beta, which fixes the problem with nonworking bootloader commands. It seems I was not the first one asking you...

    For all others trying the bootloader commands in bootloader 1.1 : this does not work at all, and you are only wasting your time.

    I would really appreciate if the code for bl 1.3 was on github also. I do not mind if its beta only...

    Below the working debug output for a reassign nodeid 8 --> nodeid 88

    16.01.2016 23:06:46	RX	8;255;3;0;9;0108A000B9F7FFFEDA7221F0001E950F09
    16.01.2016 23:06:48	RX	0;0;3;0;9;read: 8-8-0 s=255,c=4,t=0,pt=6,l=10,sg=0:1E00010048047AA801
    16.01.2016 23:06:48	INFO	BL version=259
    16.01.2016 23:06:48	INFO	Executing bootloader command section
    16.01.2016 23:06:48	TX	8;255;4;0;1;0200580000007ADA
    16.01.2016 23:06:48	RX	8;255;4;0;0;1E00010048047AA80103
    16.01.2016 23:06:48	RX	0;0;3;0;9;send: 0-0-8-8 s=255,c=4,t=1,pt=6,l=8,sg=0,st=ok:02005800000
    16.01.2016 23:06:48	RX	0;0;3;0;9;read: 88-88-255 s=255,c=3,t=7,pt=1,l=1,sg=0:0
    

  • Admin

    @stebra The 1.3 is a closed beta and is not supposed to be distributed (ping @niccodemi). It is not supported in any terms nor should it be used in a productive environment, the compatibility to any library version is not guaranteed.
    Currently, there is ongoing work for MYSBootloader 2.0 and the ETA is tbd, same for the code.


  • Admin

    @sundberg84 Please upload MYSController log with DEBUG enabled.



  • Hello @tekka,

    is the feature 'save nodes' supposed to be working or WIP? With every start of MYSController I get a blank page and have to wait for every sensor to appear. At the moment that's not a big problem for me because of only 3 sensors, but already got a doubled ID once because new sensor requested an ID before the old #1 was recognized.
    Thanks a lot for your work with the controller, it's great.



  • @tekka
    Hi, just found this so downloaded and installed. Went to config to see what was there and selected TCP/IP tab to turn it off as it is not on a network and I only need Serial. The thing locks up and crashes and I have to use Task Manager to end it.

    Is there some way to start it without it trying to access 192.168.0.5?


  • Admin

    @NotTooTechy try setting

    TCPACTIVE=0
    

    in MYSController.ini



  • Hello everyone,

    I am new to the forum, I really appreciate your community.

    I embarked on the adventure of MySensors and naturally, I leaned on OTA. To do so, I followed your tutorial but I have a problem when sending the FW on the node.

    My setup:
    • 1 Arduino Mega with nRF24L01+ which I use serial gateway
    • 1 Arduino mini pro 3.3 volts for 8 mhz node (single sketch that sends a random data every 5 seconds)
    • Arduino IDE 1.6.7
    • MySensors libraries 1.5.3
    • MYSController_0_1_2_282

    The mini pro flashed with the bootloader (MYSBootloader 1.1), I can detect through MYSController application where it is named "Booting: 65 ... - 65 ...", I right click on it and send the skit "blink" .

    Sometimes I manage to push the "blink" directly and other times must be repeated 2-3 times (that's a lot of times, I grant you ). What is troubling is that at that time, I see the LED 13 of the mini pro flashed at a steady pace, but in MYSController, it is always named "booting ..." and to name the sketch "null".

    Afterwards, when I try to put my sketch, it loads but still in a loop with an error when it reaches 100% "FW update on the failed node = 1" and then starts again at 0% and so on.

    I hope you will refer me.

    Thank you.



  • @tekka
    Using the SerialGateway:
    Is there a tutorial at all for using this? I can figure out a lot of stuff, but...

    Is it possible to assign the ID to a new node? I want to group Nodes numerically as in Area-1: = 10,11,12 then Area-2: = 20,21,22,23 etc
    How?



  • Tutorial would be awesome 🙂
    I have a specific case that fails uploading sketch to 3.3v pro mini. I have a combined sketch which works fine if uploaded to 3.3v via cable, sketch also uploads fine OTA on 5v pro mini. When I try to upload sketch to 3.3v it fails eventually. If I upload "blink" from MysController, it uploads and works fine.
    I am suspecting that i am not flashing bootloader properly maybe. This is my boards.txt

    
    ## Arduino Pro or Pro Mini (3V3 & 5V, 16 MHz) w/ ATmega328 MYSBootloader
    ## -------------------------------------------------
    
    
    proMYSBL.name=ATmega328 16Mhz MYSBootloader
    
    proMYSBL.upload.tool=avrdude
    proMYSBL.upload.protocol=arduino
    proMYSBL.upload.maximum_size=30720
    proMYSBL.upload.maximum_data_size=2048
    proMYSBL.upload.speed=115200
    
    proMYSBL.bootloader.tool=avrdude
    proMYSBL.bootloader.low_fuses=0xF7
    proMYSBL.bootloader.high_fuses=0xDA
    proMYSBL.bootloader.extended_fuses=0x06
    proMYSBL.bootloader.unlock_bits=0x3F
    proMYSBL.bootloader.lock_bits=0x0F
    proMYSBL.bootloader.file=MySensors/MYSBootloader.hex
    
    proMYSBL.build.mcu=atmega328p
    proMYSBL.build.f_cpu=16000000L
    proMYSBL.build.board=AVR_UNO
    proMYSBL.build.core=arduino
    proMYSBL.build.variant=standard
    
    
    
    ## Arduino Pro or Pro Mini (3V3 & 5V, 8 MHz) w/ ATmega328 MYSBootloader
    ## -------------------------------------------------
    
    
    
    proMYSBL8.name=ATmega328 internal 8Mhz with MYSBootloader
    proMYSBL8.upload.tool=avrdude
    proMYSBL8.upload.protocol=arduino
    proMYSBL8.upload.maximum_size=30720
    proMYSBL8.upload.maximum_data_size=2048
    proMYSBL8.upload.speed=57600
    proMYSBL8.bootloader.tool=avrdude
    proMYSBL8.bootloader.low_fuses=0xE2
    proMYSBL8.bootloader.high_fuses=0xDA
    proMYSBL8.bootloader.extended_fuses=0x06
    proMYSBL8.bootloader.unlock_bits=0x3F
    proMYSBL8.bootloader.lock_bits=0x3F
    proMYSBL8.bootloader.file=MySensors/MYSBootloader.hex
    proMYSBL8.build.mcu=atmega328p
    proMYSBL8.build.f_cpu=8000000L
    proMYSBL8.build.board=AVR_UNO
    proMYSBL8.build.core=arduino
    proMYSBL8.build.variant=standard
    

    I can burn 5v bootloader with both "boards" from ArduinoIDE using Uno as ISP. And on two 5v I have, OTA works great, it is just 3.3v with larger sketch (sketch is combination of several sensors) that eventually gives

    
    
    14.02.2016 18.00.53	TX	1;255;4;0;3;C900FFFF72057500000101010101731B731B01000000
    14.02.2016 18.00.53	RX	1;255;4;0;2;C900FFFF7205
    14.02.2016 18.01.27	ERROR	FW upload failed for node=1
    14.02.2016 18.01.27	INFO	BL version=257
    14.02.2016 18.01.27	INFO	Send FW info to node 1: type=C9, version=FFFF, blocks=0x0580, CRC=0x6F0D
    14.02.2016 18.01.27	TX	1;0;4;0;1;C900FFFF80050D6F
    14.02.2016 18.01.27	RX	1;255;4;0;0;0A0001004800FFFF0101
    14.02.2016 18.01.27	DEBUG	FW update started, node id = 1
    14.02.2016 18.01.27	TX	1;255;4;0;3;C900FFFF7F05FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    14.02.2016 18.01.27	RX	1;255;4;0;2;C900FFFF7F05
    14.02.2016 18.01.57	ERROR	FW upload failed for node=1
    14.02.2016 18.01.57	INFO	BL version=257
    14.02.2016 18.01.57	INFO	Send FW info to node 1: type=C9, version=FFFF, blocks=0x0580, CRC=0x6F0D
    14.02.2016 18.01.57	TX	1;0;4;0;1;C900FFFF80050D6F
    14.02.2016 18.01.57	RX	1;255;4;0;0;0A0001004800FFFF0101
    14.02.2016 18.01.57	DEBUG	FW update started, node id = 1
    14.02.2016 18.01.57	TX	1;255;4;0;3;C900FFFF7F05FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    14.02.2016 18.01.57	RX	1;255;4;0;2;C900FFFF7F05
    14.02.2016 18.01.57	TX	1;255;4;0;3;C900FFFF7E05FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    
    

    This is the "universal" sketch I am trying to upload, it is a combination of few sensors

    
    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik Ekblad
     * 
     * DESCRIPTION
     * Motion Sensor example using HC-SR501 
     * http://www.mysensors.org/build/motion
     *
     */
    
    // Enable debug prints
    // #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    //Hum
    #include <SPI.h>
    #include <MySensor.h>
    //temp
    #include <DHT.h>  
    //lux
    #include <BH1750.h>
    #include <Wire.h>
    #include <Vcc.h>                                    // library for internal reference Vcc reading
    
    
    // Reference values for ADC and Battery measurements
    const float VccMin          = 1.0*2.5 ;             // Minimum expected Vcc level, in Volts. Example for 1 rechargeable lithium-ion.
    const float VccMax          = 1.0*3.0 ;             // Maximum expected Vcc level, in Volts.
    //const float VccMin        = 2.0*0.6 ;             // Minimum expected Vcc level, in Volts. for 2xAA Alkaline.
    //const float VccMax        = 2.0*1.5 ;             // Maximum expected Vcc level, in Volts.for 2xAA Alkaline.
    const float VccCorrection   = 3.30/3.42 ;           // Measured Vcc by multimeter divided by reported Vcc
    Vcc vcc(VccCorrection);                             // instantiate internal voltage measurement lib
    
    
    const float tempThreshold		= 0.02 ;               // send only if change > treshold (Celcius)
    const float humThreshold		= 0.05 ;               // send only if change > treshold (% RG)
    const float voltageThreshold	= 0.01 ;               // send only if change > treshold (Volt)
    const float luxThreshold		= 1 ;               // send only if change > treshold (Lux)
    
    
    const int heartbeat		= 60 ;                          // heartbeat every hour (x times SLEEP_TIME)
    unsigned long lastHeartbeat = 0 ;
    float lastHumidity		= 0 ;
    float lastTemperature	= 0 ;
    float lastVoltage		= 0 ;
    boolean lastTripped		= false ;
    // flags to indicate if transmission is needed, heartbeat and/or changes > treshold
    boolean txHumidity		= true ;                         // flags to indicate if transmit is needed (time & change driven)
    boolean txTemperature	= true ;
    boolean txLux			= true ;
    boolean txVoltage		= true ;
    boolean txTripped		= true ;
    
    
    
    unsigned long SLEEP_TIME = 30000; 			// Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR		3   	// The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 	// Usually the interrupt = pin -2 (on uno/nano anyway)
    #define HUMIDITY_SENSOR_DIGITAL_PIN 4      	//Humidity
    #define CHILD_ID_PIR    			1		// Id of the PIR sensor child
    #define CHILD_ID_HUM 				2		//Id of the HUMIDITY sensor child
    #define CHILD_ID_TEMP 				3		//Id of the TEMPERATURE sensor child
    #define CHILD_ID_LIGHT 				4		//lux sensor
    #define VOLTAGE_CHILD_ID			7		//battery level
    
    
    MySensor gw;
    DHT dht;
    boolean metric = true;
    
    BH1750 lightSensor;
    
    // Initialize motion message
    MyMessage msgMotion(CHILD_ID_PIR, V_TRIPPED);
    //Initialize temp and hum message
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    //Battery Voltage
    MyMessage msgVolt(VOLTAGE_CHILD_ID, V_VOLTAGE);  // Node voltage
    
    // V_LIGHT_LEVEL should only be used for uncalibrated light level 0-100%.
    // If your controller supports the new V_LEVEL variable, use this instead for
    // transmitting LUX light level.
    MyMessage msgLight(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
    uint16_t lastlux;
    
    void setup()  
    {  
    	analogReference(INTERNAL);                      // use the 1.1 V internal reference for voltage measurement
    	
    	gw.begin(NULL, 104); //message callback thing, nodeid
      	pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
    	dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
    	metric = gw.getConfig().isMetric;
    	lightSensor.begin();
    	
    	// Send the sketch version information to the gateway and Controller
    	gw.sendSketchInfo("MotHumTemLuxBat", "1.0");
    
    	// Register all sensors to gw (they will be created as child devices)
    	gw.present(CHILD_ID_HUM, S_HUM);
    	gw.present(CHILD_ID_TEMP, S_TEMP);
    	gw.present(CHILD_ID_PIR, S_MOTION);
    	gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    	gw.present(VOLTAGE_CHILD_ID, S_MULTIMETER);
    	
    }
    
    
    
    void loop()     
    {    
    	//delay(dht.getMinimumSamplingPeriod()); // will this inrerrupt with the motion sensor?
    
    	// TEMPerature and HUMIdity
    	// first read all sensors before possible transmission (save battery)
    	readTempHum();
    	
      	//PIR
      	boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
      	//Serial.println(tripped);
      	gw.send(msgMotion.set(tripped?"1":"0"));  // Send tripped value to gw 
    
    	readLux();
    	// LUX
    	
    	
    	// read battery Voltage
    	float voltage = vcc.Read_Volts() ;
    	if ( abs(voltage - lastVoltage) >= voltageThreshold ){ // update only if threshold exceeded
    		lastVoltage = voltage ;
    		txVoltage = true ;
    	}
    	
    	sendSensors();
    	
    	//over the air updates, after send and before sleep just listen to messages
    	gw.wait(200);
     
      	// Sleep until interrupt comes in on motion sensor. Send update every  minute. 
      	gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
    }
    
    
    void readLux(void){
    	uint16_t lux = lightSensor.readLightLevel();// Get Lux value
    	
    	//Serial.println(lux);
    	if (lux != lastlux) {
    		if ( abs(lux  - lastlux) >= luxThreshold ){   // update only if threshold exceeded
    			lastlux = lux ;
    			txLux = true ;
    		}
    	}
    	
    }
    
    void readTempHum(void)
    {
        // SHT2x sensor
    	delay(dht.getMinimumSamplingPeriod()); // will this inrerrupt with the motion sensor?
    
        float humidity = dht.getHumidity();
        float temperature = dht.getTemperature();            // save battery by sending changes only & reading SHT first (>50ms)
    	
    	Serial.print("temp: ");
    	Serial.println(temperature);
    	Serial.println(humidity);
    	
    	//if (isnan(temperature)) {
    	//	Serial.println("Failed reading temperature from DHT");
    	//} else if (temperature != lastTemperature) {
    	
    		if ( abs(humidity  - lastHumidity) >= humThreshold ){   // update only if threshold exceeded
    			lastHumidity = humidity ;
    			txHumidity = true ;
    		} 
    		if ( abs(temperature - lastTemperature) >= tempThreshold ){ 
    			lastTemperature = temperature ;
    			txTemperature = true ;
    		} 
    		// Serial.print("SHT_ temp: ");
    //		// Serial.print(temperatureSHT);
    //		 Serial.print(" SHT_ hum: ");
    //		 Serial.println(humidity);
    	//}
    }
    
    
    
    // send to gateway depending on tx.. settings
    void sendSensors()
    {
    	lastHeartbeat++ ;											// update Heartbeatcount every call
    	if ( lastHeartbeat > heartbeat) {							// if heartbeat update all sensors & battery status
    		txTemperature = txHumidity = txVoltage = txLux = true ;
    		gw.sendBatteryLevel(vcc.Read_Perc(VccMin, VccMax, true));
    		lastHeartbeat = 0 ;
    	}
    	if (txTemperature){
    		gw.send(msgTemp.set(lastTemperature, 2));		// Send in deg C
    		txTemperature = false ;
    	}
    	if (txLux){
    		gw.send(msgLight.set(lastlux));								// Send in Lux
    		txLux = false ;
    	}
    	if (txHumidity){
    		gw.send(msgHum.set(lastHumidity, 1));				// Send in %RH
    		txHumidity = false ;
    	}
    	if (txVoltage){
    		gw.send(msgVolt.set(lastVoltage,2));					//send battery in Volt
    		txVoltage = false ;
    	}
    	if (txTripped){
    		gw.send(msgMotion.set(lastTripped?"1":"0"));			// Send tripped value to gw
    		txTripped = false ;
    	}
    }
    
    

    I am using the latest stable version of mysensors on both gateway and when compiling the sketches.

    If someone can test this on 3.3v or can look at the code and perhaps figure out what could be the problem, I would really appreciate it.

    Keep up the great work guys, I am loving the mysensors&co projects!


  • Hardware Contributor

    I'm having some issues with the MYSBootloader, I've uploaded a sketch perfectly with the ISP connection after burning the fuses and bootloader, all using the Arduino IDE. Now when i come to update the sketch using FTDI I can't upload due to a error of:

    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x0a
    

    I'm assuming the timing in my fuses have been incorrectly set. Could anyone shine some light onto this?

    The settings i used were L:0xE2 H:0xD8 E:0x06. The boards.txt reflects this too, its also set to 8Mhz, with a baud rate of 57600.



  • Sorry, just getting around to try to get MYSController setup and I can't seem to get it sorted out to connect to my serial GW that is attached to my VeraLite.

    Here is what I have done to try to get connected:

    1. ssh into Vera and enter this command.
    ser2net -C 5003:raw:0:/dev/ttyACM0:115200
    

    I also tried

    ser2net -C 5003:raw:0:/dev/ttyUSB0:115200
    

    Next I launch MYSController on my PC and in the config window under TCP/IP tab set the IP to the IP of Vera and port to 5003.

    Hit connect and I get the following....

    2/17/2016 13:04:54	INFO	Connected to 192.168.0.108:5003
    2/17/2016 13:04:54	INFO	Unknown message, Msg=
    Port already in use by another process, dc=1
    2/17/2016 13:04:54	RX	
    Port already in use by another process
    

    For those of you have have done this before...any suggestion?


  • Admin

    @samuel235 said:

    Now when i come to update the sketch using FTDI

    I think you are supposed to be uploading the sketches OTA and they won't upload via USB anymore (unless I missed an update, which is possible).


  • Hardware Contributor

    @petewill - You are correct regarding no usb/ftdi uploads. Everything has to be done OTA. I'm using a standard arduino bootloader at the moment, attempting to troubleshoot ftdi with that :).


Log in to reply
 

Suggested Topics

  • 37
  • 6
  • 13
  • 198
  • 9
  • 3
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts