RS485 Home Automation Network

<back to Paul MacDougal>

Home automation is what really drew me to embedded computing.  I wanted to be able to control my cat feeder and my drip irrigation system and collect data on various things in my house.  I initially looked at Xbee modules.  You can have them wake up periodically and send messages containing I/O pin status.  Programming these modules is difficult, the firmware is buggy, the documentation is incomplete, and they are expensive.  Arduinos are much better documented and have the huge community to find, fix, and document issues.

I made the choice to go with a wired network.  I am not averse to running wires in my walls, attic, and crawl space.  I have already run Cat5 and telephone from most rooms back to my network closet.  Running a few more wires is no big deal to me.  Pete Soper has warned me about induced currents from nearby lightning strikes.  I have not taken any special precautions for this.  We will see how it goes.

I have chosen the MAX483 (datasheet) transceiver for my network.  This is half duplex with a twisted pair for data.  It is supposed to support up to 4000 feet per run.  I am using Cat3 wire with two twisted pairs.  One pair has the A/B for data and the other has Vcc/Gnd for power to the remote nodes.  I use the common RJ14 (6p4c) jacks and plugs.  RJ14 is a straight through cable, so one end looks like +, A, B, Gnd and the other looks like Gnd, B, A, +.  This makes it really easy to plug + into Gnd and vice versa, so I needed to protect against that on the remote nodes.  I created a breakout board for testing the dual RJ14 jack (WM9177-ND).

Master nodes

I have implemented two “master” node varieties.  One is for an Arduino and one is for a Raspberry Pi.  The master node supplies Vcc to the network and is the only node that can transmit at will.  It will poll the remote nodes to collect information from the network.  The Arduino board has pins A and B swapped, so I will not post a pointer to that OSH board.  The Pi board is in fab now.  Once tested, I will post a pointer to it.

Remote nodes

I have implemented one remote node, but have plans for another flavor (multiple temperature sensors).  The one I have done has a N-MOSFET for turning on/off a motor powered by an external power supply.  I use this for my cat feeder and my drip irrigation system.  A shaft position switch is supported.  I am redesigning this node now to use surface mount ATTiny and MAX483 chips.

This is a programmable device.  I use the same node for my cat feeder as my drip irrigation system.  Both require the switching of an external voltage to power a DC motor.  Both use a switch to detect shaft rotation.  Both use extra pins for other functions.  The drip irrigation node also monitors a rain gauge.  The cat feeder monitors if the garage door is open or closed.

Tentative pin assignment (I am reworking this board).

  1. Vcc – 3.3v from the network
  2. PB0 – connected to LED with current limiting resistor to GND
  3. PB1 – connected to SHAFT switch, debounced with .1uf cap
  4. RESET – connected to SW2 for reset
  5. PB2 – connected to gate of N-MOSFET, pulled to GND with 10k
  6. PA7 – available on JP6 pin2
  7. PA6 – available on JP5 pin1, also MOSI for programming
  8. PA5 – available on JP5 pin2, also MISO for programming
  9. PA4 – MAX483 RO, available on JP5 pin3, also SCL for programming
  10. PA3 – connected to SW1, debounced with .1uf cap
  11. PA2 – voltage divider between TOP and BOTTOM resistors for measuring Vbat
  12. PA1 – MAX483 RE-bar and DE
  13. PA0 – MAX483 DI
  14. GND




Other topics to cover

<120 ohm termination>



Leave a Reply

Your email address will not be published. Required fields are marked *

Triangle Embedded Interest Group