Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. OpenHardware.io
  3. 💬 MySensors InCan double light switch

💬 MySensors InCan double light switch

Scheduled Pinned Locked Moved OpenHardware.io
mysensorshlk-pm01relaylightin-wallswitchacdcnrf24l01
24 Posts 8 Posters 2.5k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rolandow
    wrote on last edited by
    #5

    Thank you for your reply. I did rename the files, and then I could view the design. I do understand now why the other drill file wasn't selected. I ordered 10 pieces and am very excited about it.

    Another thing I was wondering; could I leave out 1 relay if I only need one? I only have single switches at the moment. Even if I'd install double switches, the second switch would probably be a 'virtual' switch that isn't connected to a relay anyways.

    Great project!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stormy
      wrote on last edited by
      #6

      Obviously you can skip one relay.
      If you skip relay REL2 you can also skip D2,T2,R3,R4.
      If you skip relay REL1 you can skip D1,T1,R1,R2

      1 Reply Last reply
      0
      • А Offline
        А Offline
        Андрей Лезьёв
        wrote on last edited by
        #7

        Hey. I also started to build this radio switch. I have issues with the Atmega firmware. The fuses shown in the description are designed for an external crystal oscillator. Tell me, what are the best fuses to write?

        S 1 Reply Last reply
        0
        • А Андрей Лезьёв

          Hey. I also started to build this radio switch. I have issues with the Atmega firmware. The fuses shown in the description are designed for an external crystal oscillator. Tell me, what are the best fuses to write?

          S Offline
          S Offline
          stormy
          wrote on last edited by
          #8

          @андрей-лезьёв Yes, You are right. I fixed the mistake in the description.
          Valid values are: low_fuses=0xE2 high_fuses=0xD2 extended_fuses=0x06

          magpernM 1 Reply Last reply
          1
          • S stormy

            @андрей-лезьёв Yes, You are right. I fixed the mistake in the description.
            Valid values are: low_fuses=0xE2 high_fuses=0xD2 extended_fuses=0x06

            magpernM Offline
            magpernM Offline
            magpern
            wrote on last edited by magpern
            #9

            @stormy I have soldered one of these together. I hooked it up to a USBAsp and with AVRDUDE burned the fuses. When it reads the fuses back the extended fuses are not set, the others are.
            Then I try and burn a bootloader. And it says "cannot set SCK period". And from this point on, I can no longer identify the MCU with AVRDUDE, and even less set the fuses again.
            Any ideas?
            I'm fairly sure there are no solder bridges. I have checked it several times, and even measured it.

            avrdude.exe: set SCK frequency to 1500000 Hz
            avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
            avrdude.exe: error: program enable: target doesn't answer. 1 
            avrdude.exe: initialization failed, rc=-1
                         Double check connections and try again, or use -F to override
                         this check.
            
            
            avrdude.exe done.  Thank you.
            

            EDIT: Fixed the problem

            The problem was that I had "Arduino Mini" as board in Arduino IDE, and it probably changes the fuses to "use external crystal" when burning bootloader. I desoldered the chip replaced it with a new one, selected "Atmega328p (8MHz internal clock)" as board and burned that bootloader. Now chip is responding.

            EDIT 2: Diode any diode 0805/SOD-80
            A 0805 diode will not fit on the footprint. I ordered 0805, and they will not even touch the pcb pads. Fortunately I had some 1N4148 (through hole) and if I cut them really short, they could fit.
            So for future builders, go with a SOD-80

            EDIT 3: The radio
            For future revisions of the pcb, add some 0.5mm space between the radio and the Hi-link. It is really tight fit today. Almost to close together.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stormy
              wrote on last edited by
              #10

              @magpern

              1. About "cannot set SCK period":
                It is common problem. You are probably using Chinese USBAsp clone.
                To remove this warning you need to update firmware in your programmer.
                Here is article how to do this. http://www.kondzio.info/elektronika/152-aktualizacja-programatora-usb-asp.html
                The article is in polish, but i hope with google translator you will be able to undestand.

              2. Diode any diode 0805/SOD-80
                You can use 0805, just use little bit more tin for soldering. But you are right - SOD-80 is preffered.

              3. The radio
                I know about it, but it is really no more space on PCB for do this.
                And I think make PCB bigger to add free space is not good idea.

              Best regards,

              magpernM 1 Reply Last reply
              0
              • S stormy

                @magpern

                1. About "cannot set SCK period":
                  It is common problem. You are probably using Chinese USBAsp clone.
                  To remove this warning you need to update firmware in your programmer.
                  Here is article how to do this. http://www.kondzio.info/elektronika/152-aktualizacja-programatora-usb-asp.html
                  The article is in polish, but i hope with google translator you will be able to undestand.

                2. Diode any diode 0805/SOD-80
                  You can use 0805, just use little bit more tin for soldering. But you are right - SOD-80 is preffered.

                3. The radio
                  I know about it, but it is really no more space on PCB for do this.
                  And I think make PCB bigger to add free space is not good idea.

                Best regards,

                magpernM Offline
                magpernM Offline
                magpern
                wrote on last edited by magpern
                #11

                @stormy Yes, it is a chinese USPasp clone, but I think it is working now. Atleast I could upload a bootloader (i think) and I can use a FTDI to upload a sketch.

                But, I can only upload a sketch once. Directly after the bootloader, I can upload a sketch, but on next atempt it will not accept a new sketch.
                Do I have the wrong bootloader? What bootloader should I use? I just selected "Board: ATmega328p (8 MHz internal clock" and pressed "Burn bootloader" (with the USBAsp)
                Switched cables to a FTDI device, pressed "Upload"
                All works fine.
                Press "Upload" again, and nothing will be sent to the device. But, if I "Burn bootloader" again, I can upload a new sketch.

                There is no DTR, is that a problem?

                EDIT: Manual reset makes it possible to upload sketch multiple times
                I connected the RESET from the ISP to ground and released it right before the upload starts

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  stormy
                  wrote on last edited by
                  #12

                  @magpern
                  About USBasp:
                  It is only warning, USBasp clones are working well.
                  But they have very old firmware, so upgrade is recommended.

                  About uploads:
                  You need to do manual reset to upload sketch.

                  magpernM 1 Reply Last reply
                  0
                  • S stormy

                    @magpern
                    About USBasp:
                    It is only warning, USBasp clones are working well.
                    But they have very old firmware, so upgrade is recommended.

                    About uploads:
                    You need to do manual reset to upload sketch.

                    magpernM Offline
                    magpernM Offline
                    magpern
                    wrote on last edited by
                    #13

                    @stormy Did you have any problems with the code? I have the Sensbender Gateway. It can read other devices fine, your device it can not read. The gateway reacts to it sending data, but the logs say the device gets no response.
                    I have posted a separate thread about it in Troubleshooting, but it would be nice to know if you have some idea too?

                    I have triple checked everything twice for shorts. There are none. The diodes however got hot as hell and so did the Hi-link, probably from shorting the reset. I have removed the diodes for now. I will get new once (of the correct footpriint) tomorrow. ). For now I run every thing from the USB port of the computer, so no 230V yet)

                    Is anything not standard? The Crypto chip is on A4, instead of A3, is there anything else? Bootloader and serial works fine. I can run the SecurityPersonalizer and that works fine.
                    I have tried to connect a 47uF to the radio, but still no dice.
                    I have tried the stock example of RelayActuator but that does not work either.

                    I just get the from the device

                    516950 TSM:INIT
                    516956 TSM:INIT:TSP OK
                    516960 TSM:FPAR
                    516962 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                    518971 !TSM:FPAR:NO REPLY
                    518973 TSM:FPAR
                    518975 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                    520986 !TSM:FPAR:NO REPLY
                    520988 TSM:FPAR
                    520990 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                    523001 !TSM:FPAR:NO REPLY
                    523003 TSM:FPAR
                    523005 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                    525017 !TSM:FPAR:FAIL
                    525019 TSM:FAIL:CNT=7
                    525021 TSM:FAIL:DIS
                    525023 TSF:TDI:TSL
                    

                    and this from gateway

                    0;255;3;0;9;661854 TSF:MSG:GWL OK
                    0;255;3;0;9;662240 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                    0;255;3;0;9;663828 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                    0;255;3;0;9;663829 TSF:MSG:BC
                    0;255;3;0;9;663829 TSF:MSG:FPAR REQ,ID=255
                    0;255;3;0;9;663829 TSF:CKU:OK,FCTRL
                    0;255;3;0;9;663829 TSF:MSG:GWL OK
                    0;255;3;0;9;664143 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                    0;255;3;0;9;665804 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                    0;255;3;0;9;665804 TSF:MSG:BC
                    0;255;3;0;9;665805 TSF:MSG:FPAR REQ,ID=255
                    0;255;3;0;9;665805 TSF:CKU:OK,FCTRL
                    0;255;3;0;9;665805 TSF:MSG:GWL OK
                    0;255;3;0;9;666046 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                    

                    Is there anything one can measure with a scope or something?

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rolandow
                      wrote on last edited by
                      #14

                      I haven't started on my project yet, so I am glad to read some more information here.

                      @stormy: could you please add a bit of documentation and/or links to (english) documentation about how to put the bootloader on the atmel? Personally I haven't done this before; my Arduino's already had the right bootloader. I would like to know what the recommended uploader would be (maybe with a link or picture?) and what the recommended procedure would be to upload this.

                      Thanks for opening my eyes about this @magpern :-)

                      magpernM 1 Reply Last reply
                      0
                      • R rolandow

                        I haven't started on my project yet, so I am glad to read some more information here.

                        @stormy: could you please add a bit of documentation and/or links to (english) documentation about how to put the bootloader on the atmel? Personally I haven't done this before; my Arduino's already had the right bootloader. I would like to know what the recommended uploader would be (maybe with a link or picture?) and what the recommended procedure would be to upload this.

                        Thanks for opening my eyes about this @magpern :-)

                        magpernM Offline
                        magpernM Offline
                        magpern
                        wrote on last edited by magpern
                        #15

                        @rolandow To burn a bootloader you need an ISP. I have used a cheap Chinese clone like this one
                        0_1564575276379_20190731_100612.jpg.
                        I have used Arduino IDE to burn the bootloader, but you can use other things too, like AVRDUDE.
                        A word of warning when using the Arduino IDE is that it also sets the fuses. So, you have to select the correct board type when you set the bootloader with this program (or change the fuses in the boards.txt file).
                        I bricked two atmega328 before I realized this.
                        In this post you can read a little about the flashing, or atleast it has links to other pages.

                        You can probably skip the bootloader all together and just upload the sketch with the ISP instead, but you wont be able to upload with serial in that case.

                        After the bootloader, you can upload with a FTDI. I also use a cheap clone like this one
                        0_1564575794038_20190731_100802.jpg
                        I also use the Arduino IDE to upload the sketch, just select the correct serial/com port in the IDE.

                        The "InCan double light switch" does not auto-reset when upload starts, so you have to reset it manually. The white/yellow cable is connected to RESET on the ISP connector, and after I choose Upload in Arduino IDE and the build output in the IDE window is finished I touch the white/yellow cable to GND on the FTDI device, and the leds on the FTDI starts blinking.

                        Device is now programmed.

                        Good to think off is that the crypto chip is connected to A4, instead of A3. So if you use this and run the personalizer sketch, you have to set

                        #define MY_SIGNING_ATSHA204_PIN A4
                        

                        in the sketch

                        Also, the original code for this device is not compatible with the MySensors development branch, but can easily be adopted, just comparing to the default MySensors RelayActuator sketch

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          stormy
                          wrote on last edited by
                          #16

                          @magpern

                          No, a have no problems with sketch.
                          It looks like some problems with radio communication.

                          Diodes are only for protection transistor from reverse voltage spikes. Diodes never should be even warm. Something is wrong. You can test this without diodes.

                          47uF for radio is C6, you do not need to add next one.

                          @rolandow
                          There are a lot of manuals on the internet.
                          For example:
                          https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
                          https://www.circuito.io/blog/atmega328p-bootloader/
                          https://www.instructables.com/id/Burning-the-Bootloader-on-ATMega328-using-Arduino-/
                          https://www.instructables.com/id/How-to-Burn-the-Arduino-BootLoader-on-to-a-AtMega3/

                          magpernM 1 Reply Last reply
                          0
                          • S stormy

                            @magpern

                            No, a have no problems with sketch.
                            It looks like some problems with radio communication.

                            Diodes are only for protection transistor from reverse voltage spikes. Diodes never should be even warm. Something is wrong. You can test this without diodes.

                            47uF for radio is C6, you do not need to add next one.

                            @rolandow
                            There are a lot of manuals on the internet.
                            For example:
                            https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
                            https://www.circuito.io/blog/atmega328p-bootloader/
                            https://www.instructables.com/id/Burning-the-Bootloader-on-ATMega328-using-Arduino-/
                            https://www.instructables.com/id/How-to-Burn-the-Arduino-BootLoader-on-to-a-AtMega3/

                            magpernM Offline
                            magpernM Offline
                            magpern
                            wrote on last edited by
                            #17

                            @stormy said in 💬 MySensors InCan double light switch:

                            @magpern

                            No, a have no problems with sketch.
                            It looks like some problems with radio communication.

                            It was. I used the default channel and apparently it was too noicy. Changed to another channel and it worked fine!

                            Diodes are only for protection transistor from reverse voltage spikes. Diodes never should be even warm. Something is wrong. You can test this without diodes.

                            Somehow, when powered by 5V from the FTDI, the device got hot. The Hi-link maybe did not like to get power from the FTDI? The diodes got super hot, and so did the Hi-link. I removed the diodes and could continue. Today, I tried 230V. It didn't work, the thermo fuse was busted, probably from the overheating earlier.
                            I shorted the fuse (temporarily) and everything worked fine. Hi-link was still alive and supplied 5 Volts
                            And this brings me to my question...

                            What kind of range do you get with this device? And how accurate is it?
                            I tried 50 centimeters from the gateway and got a fairly decent hit rate on the on/off from domoticz.
                            I moved the device to about 3-4 meters, and maybe got 50% hit rate. It was almost line of sight.
                            If I toggle the on/off from Domotics, with 3 seconds apart, I got like 10% hit rate, maybe every 10th click toggled the relay.
                            Placing it inside a wall sounds like a "no go" if almost line of sight doesn't work 100%.

                            What is your experience?

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              stormy
                              wrote on last edited by
                              #18

                              @magpern:
                              It should never be hot. The thermal fuse should not be hot. Something is wrong with your module.

                              About range:
                              With module mounted inside wall (in in-wall can, below wall switch) it works fine about 10 meters from gateway.
                              Currently I have 5 modules working well for 6 months.
                              The only one problem I have is with poor quality Hongfa mini relays - some of these sometimes get sticky contacts and I need to remove wall switch and knock into relay. I changed relay to NPA-AS5 and problem gone.

                              I do not know how to advice you.
                              I suspect that there is some problem with your module - first try check why it is hot?
                              Or you live in very noise environment.

                              1 Reply Last reply
                              0
                              • I Offline
                                I Offline
                                insectteam
                                wrote on last edited by
                                #19

                                Hello !

                                I know that some time has passed but the problems with the heating diodes may be due to the wrong location in the drawings - they are there the opposite than they should be !!! (they should be directed to the inside with minuses as shown in the schematic and on the drawings they are outside) - I had the same thing until I checked

                                I also designed the housing for 3D printing - if Stormy is interested I can send it for sharing2_1578002815693_op20191224_112454_HDR.jpg 1_1578002815693_op20191224_112425_HDR.jpg 0_1578002815692_op20191224_112140_HDR.jpg

                                magpernM 1 Reply Last reply
                                0
                                • I insectteam

                                  Hello !

                                  I know that some time has passed but the problems with the heating diodes may be due to the wrong location in the drawings - they are there the opposite than they should be !!! (they should be directed to the inside with minuses as shown in the schematic and on the drawings they are outside) - I had the same thing until I checked

                                  I also designed the housing for 3D printing - if Stormy is interested I can send it for sharing2_1578002815693_op20191224_112454_HDR.jpg 1_1578002815693_op20191224_112425_HDR.jpg 0_1578002815692_op20191224_112140_HDR.jpg

                                  magpernM Offline
                                  magpernM Offline
                                  magpern
                                  wrote on last edited by
                                  #20

                                  @insectteam I did not understand what you mean about the diods. Could you please clarify or show with pictures?
                                  I have not used the device since it does not feel saft to put in an enclosure if the diods burns hot.
                                  And also, please share your stl files for the enclosure, here or on thingiverse

                                  1 Reply Last reply
                                  0
                                  • I Offline
                                    I Offline
                                    insectteam
                                    wrote on last edited by
                                    #21

                                    0_1578145496304_incan bottom.png
                                    0_1578145511022_incan ok.png

                                    1 Reply Last reply
                                    0
                                    • I Offline
                                      I Offline
                                      insectteam
                                      wrote on last edited by
                                      #22
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • Jiří JanekJ Offline
                                        Jiří JanekJ Offline
                                        Jiří Janek
                                        wrote on last edited by
                                        #23

                                        I know this is quite an old project and, furthermore, my question is maybe silly but... I expect I could use this switch to pull up/close the window blinds but can I also connect a simple reed contact to some pins as a sensor, whether the window is closed or opened? I only need the information, whether the contact is on or off, sent to MySensors gateway...

                                        1 Reply Last reply
                                        0
                                        • OldSurferDudeO Offline
                                          OldSurferDudeO Offline
                                          OldSurferDude
                                          wrote on last edited by
                                          #24

                                          The author has done some good work ensuring good design practices; trace separation, fuses, etc. but I don't see any extra I/O brought out on this particularl switch. You would have to carefully solder to the chip itself, and modify the code a bit.

                                          You could use magnetic switches. Put a magnet on the blinds and the switch in window sill.

                                          The author notes that this is not an Arduino, but uses the same chip that the Arduino uses. The author doesn't explain how the chip is programmed. This method could have been used.

                                          It may be just as easy to use an RF Nano with a little power supply. This suggestion is not nearly as robust as the author's. For example, these power supplies have gotten bad reviews mainly because the mains power traces are too close together. I justify using them because in all likelihood a failure will pop the power supply and probably the Nano, too, noting that these are cheaper than the fuses you would put in to protect them. I am fully aware of the risks involved in doing this, and you should be, too (eg. burning down your house).

                                          -OSD

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular