Relay Control Board

Discussion in 'The Projects Forum' started by tal041482, Sep 5, 2013.

  1. tal041482

    Thread Starter New Member

    Sep 5, 2013
    3
    0
    All, Im looking at a project to control appx 200 relays on different boards located about 300 feet apart

    for example see the attached file

    is this possible with micro controllers?

    Im hoping to use cat5 cable between the devices all though something like rs485 although that's optional


    Ideas would be appreciated on how to do this.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,509
    2,369
    Maybe explore a Modbus option?
    Max.
     
  3. JohnInTX

    Moderator

    Jun 26, 2012
    2,341
    1,022
    A CAN-equipped microcontroller (see PIC18F4685) would provide a built-in protocol that is very robust. Assign message filters so that each board has its own set of COB-IDs, 1 for each relay. In the 1 byte data field of the CAN message a 1 or 0 turns it on/off or use one COB-ID for one board with bit mapped relay control. I like one ID/relay.

    A standard CAN driver chip (see MCP2551) would work fine with CAT-x cabling.

    In your diagram, the main board and each of the relay boards would have a CAN uC on it. Relays would be controlled by the main board sending CAN messages to the slaves. The slaves could automatically reply confirmation or the main would send a remote frame (request to read data from a slave board) to verify relay status, etc.

    The star topology you show would work. A multi drop bus would work as well. Either way, some care in terminating the lines should be taken. Not a big deal.

    You could also use uCs with built in ethernet controllers but I've always used CAN for stuff like this.

    Have fun.
     
    Last edited: Sep 6, 2013
  4. JDT

    Well-Known Member

    Feb 12, 2009
    658
    85
    As you only want the data to go in one direction - from the controller to the relays, you could look at the DMX protocol.

    Normally used to control up to 512 stage lighting dimmers on one "universe" (cable). Instead of using each byte as an analog level, you could have a threshold - example less than 127 = relay off, greater than 127 = relay on.

    I only mention this as there are lots of examples, and micro-controller code out there, so most of the work has already been done for you! In fact you can buy DMX to relay modules - ready made.

    If you think a whole byte per relay is a bit wastefull, you could send a serial string of only 25 bytes where each bit controls a single relay. Easy to do with a few PICs. Each of the slave boards could have a micro-controller that counts the incoming bytes. When if gets to the one it's interested in, reads and controls the relays. Simple!!
     
  5. tal041482

    Thread Starter New Member

    Sep 5, 2013
    3
    0

    SIMPLE!! i love it.. all though simple for one is not simple for another, Besides im not looking for just simple what im looking to do is learn a little bit while i go I will defiantly look into the dmx stuff though as someone from work uses it and also recommended it to me

    Im also looking to do this as low in cost as possible Witch is why im trying to stay away from aurdino after looking at the boards it seems kind of expensive.

    Thanks for the idea' Im going to look into it.
     
  6. tal041482

    Thread Starter New Member

    Sep 5, 2013
    3
    0

    Ok so if im understanding this,

    There would be one Of the "expensive" PIC18F4685 on the main board and that would handle the "program and talk to the other boards directly and the other board would contain a MCP2551 and the MCP2551 could control the relays on the board? if im reading propperly the mcp2551 could not actually control the relays i would need something else to do the relay control? or am i missing something, It looks like this is the way i want to go i just have to figure out how to make it work.

    Thanks!!!
     
  7. JohnInTX

    Moderator

    Jun 26, 2012
    2,341
    1,022
    Each slave board would also require a microcontroller with a CAN controller AND a CAN driver (18F4685 plus MCP2551) Each slave's uC runs firmware that decodes CAN messages from the master and switches relays accordingly. The slaves could easily use a smaller CAN PIC and the master too most likely. Probably the smallest memory with enough pins for the relays would be the place to start looking. If this sounds like something that would work we can make some specific recommendations.

    EDIT: Take a look at the PIC18F25K80-I/P and MCP2561-I/P Driver as examples of a CAN microcontroller / driver pair to be used on each board. 1-25 pricing is < $3.00 for both. As Max and JDT have said, there are other ways as well and getting a CAN-based uC system up and running is a bit of a learning curve if you are not already up on such things but the payoff is a bulletproof implementation with all of the protocol / communication issues thought out for you. The differential signalling of the CAN drivers solves many noise problems and they include protection against ESD damage from transients hitting the bus.

    Have fun!
     
    Last edited: Sep 8, 2013
  8. JDT

    Well-Known Member

    Feb 12, 2009
    658
    85
    What are you proposing to actually set which relays are off or on? I mean: what kind of "Operator Interface" are you going to use?

    This may decide what system to use.

    For example: you could use a computer as your interface. Or you could have a panel with 200 switches.

    If you used a computer, this might be a good reason to learn a programming language like VB.net (which can be downloaded for free). Your program will present a nice display and output the data to a serial port. Then design a remote relay board with a serial input, micro-controller, DIP switch to set the byte number and relays. I would use one of the low-end PIC devices.

    If you used 200 switches, you would have to multiplex them into a micro-controller and use this to generate the serial data (or DMX).

    If you use a fairly low baud rate on your serial (say about 1200bd) you can easily do 300ft. If you only send 25 bytes this takes a fraction of a second. Then wait 1 second before sending again. The remote relay boards use this pause as a signal to start counting bytes again.
     
Loading...