💬 MySensors InCan double light switch





  • I would really want to try and build this, but I don't have a clue how to get started. I'm not afraid to solder the pieces to the board, but I have never ordered a board before. Where should I go, and what files do I need?

    I check pcbaway, but the site is pretty overwhelming for me 🙂



  • I think I am one step further now. For Seeed Studio, I renamed the files (see below). I am not sure though about the "edge cuts". But when I check the viewer in Seeed Studio, I guess the PCB looks okay, except that I am missing one DRL file. The -NPTH.DRL is not used for the design. Is this normal?

    I renamed the files to this:

    MySensors_InCan-B.Cu.GBL
    MySensors_InCan-B.Mask.GBS
    MySensors_InCan-B.SilkS.GBO
    MySensors_InCan-Edge.Cuts.GKO
    MySensors_InCan-F.Cu.GTL
    MySensors_InCan-F.Mask.GTS
    MySensors_InCan-F.SilkS.GTO
    MySensors_InCan-NPTH.DRL
    MySensors_InCan-PTH.DRL

    Gerber viewer looks like this:

    alt text

    So where is MySensors_InCan-NPTH.DRL ??



  • @rolandow
    DRL files contains information about drilling holes in PCB.
    There can be 2 types of holes at PCB:

    • Plated Through Hole is a hole that has been plated and connects the top layer of the board with the bottom layer. This is in file -PTH.DRL
    • Non Plated Through Hole is just hole. This is in file -NPTH.DRL

    In this project ALL holes are PTH type, so file -NPTH is just empty.

    I never ordered PCB in China, but i'm pretty sure that you can simply upload the same ZIP file with all Gerber files that you downloaded from openhardware.io and they will accept it. There are no need for renaming files.



  • 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!



  • 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



  • 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?



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



  • @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.



  • @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,



  • @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



  • @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.



  • @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?



  • 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 🙂



  • @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



  • @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/



  • @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?



  • @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.



  • 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



  • @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



  • 0_1578145496304_incan bottom.png
    0_1578145511022_incan ok.png



  • This post is deleted!


Suggested Topics

  • 8
  • 89
  • 116
  • 1
  • 2
  • 196
  • 13

52
Online

11.4k
Users

11.1k
Topics

112.7k
Posts