RS485 to custom PCB - comms working, relay not clicking - need helps



  • Hi, this may be a long one, but I'm seriously at my whits end and could do with some guidance on how to progress fault finding.

    I've designed a PCB that, whilst looks confusing, is simple enough. It consists of 4 Arduino Pro Minis - 3 of which have MAX485 circuits, plumbed in to an RS485 network (in and out), Off PCB there is a MySensors gateway in to Openhab Instance.
    tinywow_Circuit Diagram_45906714_1.png

    On the whole, everything works - there are over 14 'nodes', arduino pro minis dotted around the network which all communicate properly, including the other 2 working nodes on this PCB. And I do believe that the defective node (#12 - IO_MCU) is communicating correctly, but relays just simply do not pull in.

    • Alarm MCU - Dedicated Arduino for alarm compute - no MAX485 to MySensors - (WORKING)
    • Alarm IO MCU - takes same inputs as above Alarm MCU - but passes them off to MySensors and Openhab (WORKING)
    • WS2812_MCU - independant to alarm is used to control LEDs over OpenHab + MySensors (WORKING)
    • IO_MCU - independant to alarm - is used to give button inputs, PWM controlled outputs and relay outputs. (RELAYS DO NOT PULL IN)

    I'm an electrical Engineer by trade, I've got the relays working on the Alarm MCU, and the circuit is exactly the same for each.

    I think my problem is with the configuration of the Arduino Sketch - maybe something to do with the Analogue pins, output type, or something

    https://pastebin.com/RH2X8Ja9 - Arduino Sketch for the IO_MCU.

    // Dimmer
    Tags bracket the PWM controller output sections

    // Button
    Tags bracket the button input sections

    // Relay
    Tags bracket the relay output sections

    When listening over serial to the node, I can see it is getting comms, presents all its IO - and even received on and off commands for relay children - however, no action on the PCB.

    Similarly Openhab logs give all of the node 12s children as inbox things, I can tie them to items and command them on / off.

     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.2
    
    16 MCO:BGN:INIT NODE,CP=RSNNA---,FQ=16,REL=255,VER=2.3.2
    26 MCO:BGN:BFR
    28 TSM:INIT
    29 TSF:WUR:MS=0
    30 TSM:INIT:TSP OK
    32 TSM:INIT:STATID=12
    34 TSF:SID:OK,ID=12
    36 TSM:FPAR
    61 ?TSF:MSG:SEND,12-12-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    346 TSF:MSG:READ,0-0-12,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    351 TSF:MSG:FPAR OK,ID=0,D=1
    2069 TSM:FPAR:OK
    2070 TSM:ID
    2071 TSM:ID:OK
    2073 TSM:UPL
    2092 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2121 TSF:MSG:READ,0-0-12,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2126 TSF:MSG:PONG RECV,HP=1
    2129 TSM:UPL:OK
    2130 TSM:READY:ID=12,PAR=0,DIS=1
    2152 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2186 TSF:MSG:READ,0-0-12,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2213 TSF:MSG:SEND,12-12-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2
    2247 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2284 TSF:MSG:READ,0-0-12,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2306 TSF:MSG:SEND,12-12-0-0,s=1,c=0,t=4,pt=0,l=0,sg=0,ft=0,st=OK:
    2330 TSF:MSG:SEND,12-12-0-0,s=2,c=0,t=4,pt=0,l=0,sg=0,ft=0,st=OK:
    2355 TSF:MSG:SEND,12-12-0-0,s=3,c=0,t=4,pt=0,l=0,sg=0,ft=0,st=OK:
    2379 TSF:MSG:SEND,12-12-0-0,s=4,c=0,t=4,pt=0,l=0,sg=0,ft=0,st=OK:
    2404 TSF:MSG:SEND,12-12-0-0,s=5,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2427 TSF:MSG:SEND,12-12-0-0,s=6,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2464 TSF:MSG:SEND,12-12-0-0,s=7,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2498 TSF:MSG:SEND,12-12-0-0,s=8,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2521 TSF:MSG:SEND,12-12-0-0,s=9,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2543 TSF:MSG:SEND,12-12-0-0,s=10,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2584 TSF:MSG:SEND,12-12-0-0,s=11,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2627 TSF:MSG:SEND,12-12-0-0,s=12,c=0,t=0,pt=0,l=0,sg=0,ft=0,st=OK:
    2651 TSF:MSG:SEND,12-12-0-0,s=13,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2690 TSF:MSG:SEND,12-12-0-0,s=14,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2718 TSF:MSG:SEND,12-12-0-0,s=15,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2749 TSF:MSG:SEND,12-12-0-0,s=16,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2778 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=11,pt=0,l=4,sg=0,ft=0,st=OK:N012
    2808 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    2814 MCO:REG:REQ
    2845 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2886 TSF:MSG:READ,0-0-12,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2891 MCO:PIM:NODE REG=1
    2893 MCO:BGN:STP
    2912 TSF:MSG:SEND,12-12-0-0,s=1,c=2,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2951 TSF:MSG:SEND,12-12-0-0,s=2,c=2,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    2991 TSF:MSG:SEND,12-12-0-0,s=3,c=2,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    3017 TSF:MSG:SEND,12-12-0-0,s=4,c=2,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    3023 MCO:BGN:INIT OK,TSP=1
    3054 TSF:MSG:READ,0-0-12,s=3,c=1,t=3,pt=0,l=1,sg=0:0
    3090 TSF:MSG:SEND,12-12-0-0,s=3,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=OK:0
    3119 TSF:MSG:SEND,12-12-0-0,s=3,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=OK:0
    3155 TSF:MSG:READ,0-0-12,s=4,c=1,t=3,pt=0,l=1,sg=0:0
    3184 TSF:MSG:SEND,12-12-0-0,s=4,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=OK:0
    3227 TSF:MSG:SEND,12-12-0-0,s=4,c=1,t=3,pt=2,l=2,sg=0,ft=0,st=OK:0
    92765 TSF:MSG:READ,0-0-12,s=16,c=1,t=2,pt=0,l=1,sg=0:1
    99421 TSF:MSG:READ,0-0-12,s=16,c=1,t=2,pt=0,l=1,sg=0:0
    202292 TSF:MSG:READ,0-0-12,s=16,c=1,t=2,pt=0,l=1,sg=0:1
    202394 TSF:MSG:READ,0-0-12,s=16,c=1,t=2,pt=0,l=1,sg=0:0
    203639 TSF:MSG:READ,0-0-12,s=16,c=1,t=2,pt=0,l=1,sg=0:1
    204679 TSF:MSG:READ,0-0-12,s=16,c=1,t=2,pt=0,l=1,sg=0:0
    

    Any and all help is appreciated. I get that this is a big ask, I'm more than willing to give any more data that is required - testing, serial prints etc etc. Just struggling right now.

    Appreciate your time.



  • I see that every relay has an LED associated with it and that the LED should illuminate when the relay is energized.

    Are all the LEDs functioning as expected? Is the I/O that is driving the opt-isolator working as expected?

    Also, you could short pins 3 & 4 of the opt-isolator to see if the relay is working.

    I see 7 relays in the schematic IO-A4, IO-A5, IO-A46, IO-A7 connected to IO-MCU and AL-2, AL-D12, AL-D13 connected to Alarm MCU mini-328. The former four are the relays that are not energizing, right?

    Let's assume the LED and the diode of the opto-isolator have a forward bias of 1.5V, The transistor in the MCU will have 0.1v . This means that the voltage across the 1k resistor is about 2V which means there's 2mA flowing when the output of the MCU is low. Is this sufficient to illuminate the two aforementioned LEDs? I'm pretty sure the forward bias is less. The max current would be 5mA.

    I don't see where in the software that the state of the relays are being initialized because loadState is commented out. You may have to write another program to initialize the EEPROM before first use and then load this code or plan of forcing them as part of your bring up procedure.

    Let us know how the shorting of those pins go.

    OSD



  • Hi OSD, thanks for your input.

    Those are the 4 relays on IO-MCU. I buzzed out the circuit and found that I had an open circuit on the 12v line to the relays.
    Furthermore 2 of the relays indicator LEDs were illuminating, 2 were not.

    I suspect, when I first juiced up the circuit on this MCU, the 2 relays fired, but I'd made the trace too thin for the required current. I wired up some jumper wire on the reverse of the PCB and the 2 relays started working.

    The 2 that remain inoperable?
    https://forum.arduino.cc/t/using-pins-a6-a7-on-pro-mini-compatible/118050
    A6 and A7 can only be analogue inputs, cannot be digitally written to..... - so this part of my PCB is now redundant.

    However, all in all, some good fault finding, found the two issues, and I'm now going away to re-think my PCB trace widths and reading the datasheets more accurately 😉

    Thanks


Log in to reply
 

Suggested Topics

58
Online

11.4k
Users

11.1k
Topics

112.7k
Posts