The BAZ485 Network

Introduction

The BAZ485 Network is a low cost RS485 network for basic automation of home devices based on the PIC Microcontroller.

The network its self is an RS485 network that runs at 9600 baud. Each packet on the network is a fixed 10 bytes.
The network implements a collision detection and recovery system so that packets are rarely lost.

Each node on the network is a small device based on a PIC Microcontroller and can perform a variety of tasks.
These nodes can have up to 8 interfaces that can be Binary, Level or Stream inputs or outputs. The node interface configuration is determined by the node type and version. These values are set at the time of assembly for each node.
The node type is transmitted with every heartbeat so all other devices can determine what interfaces a node has.

Network Protocol

The network protocol used is a fixed length (10 bytes) packet with the following format:

  • Address

    • If the packet is originating from the Connector; the address byte is the node to which the packet is destined.
    • If the packet is originating from a node; the address byte is the node from which the packet is originating.
    • The following values are reserved:
      • 0x00 is reserved for the connector.
      • 0xFE is reserved for unconfigured nodes.
      • 0xFF is reserved for broadcast packets.
  • Type

    • The type byte describes what data is contained within the packet.
  • Data

    • The data bytes are determined by the type of the packet. Any unused bytes are set to 255.
  • Checksum

    • The Checksum is a simple sum of all the other bytes in the packet with the overflow ignored.

There are two major types of packet that are specified by bit 7 of the type byte.
The remaining bits of the type byte specify the exact purpose of the packet. These types are described here.

Collision Detection and Recovery

This part of the implementation has not been heavily tested.

Collisions should be avoided by the nodes waiting for an extended period (22 bits worth) of idle network before transmitting.
With this mechanisum in place the only possiblility of a collision is if two nodes starting to transmit at exactly the same time.

Any collisions that do occur are handled in the following way:


In the above diagram the red lines show a bit that is being written and the green lines show a bit that is being read.

The Collision is detected by Node B trying to transmit a recessive (high) bit when Node A is transmitting a dominant (low) bit.
When the collision is detected on the network; Node B that detects the collision will switch into receive mode and continue to receive the current byte
and remaining bytes of the current packet that is being transmitted by Node A. Once this packet has been received Node B will retry the transmission
of the failed packet after the required length (22 bits worth) of idle network.

With this procedure there should be very little packet loss on the network.
If a lot of collisions occur at the same time there is a potential for the node's transmit buffers to become full and packets to be lost (never transmitted).

The Connector

The connector is a system of connecting the BAZ485 network to the Ethernet xAP network.
In the long term I see this device being implemented on an embedded processor and confirured entirly via the xAP network.

Currently though it is implemented in two parts:

PIC RS485 to RS232 Conenctor

This device connects the BAZ485 network to an RS232 port of a PC.
All RS485 functions (e.g. collision detection and Checksum calculation) are performed on this device.

PC xAPpliction

This is a software application that runs on the PC that the connector is connected to and translates the BAZ485 packets into xAP Messages.
This also maintains the associations between BAZ485 device UIDs and xAP addresses.

For a more detailed explanation of the connector please click here.

The Nodes

Each node is identified on the network by its UID (between 1 and 254).

!!! To be Continued !!!

Disclaimer

Whilst every care has been taken in the construction of this website, the views and ideas expressed herein are those of the author and acknowledged contributors.
No responsibility can be taken for any errors or ommisions, or any consequences arising from such.

The devices described on this website are intended as "Building Blocks" for you to build your own customised Home Automation system.
Where possible I will endeavour to provide support to constructors who run into difficulties with these devices.
If you have any ideas for improving the design or have ideas for new devices, feel free to E-Mail me (enquiries at bazautomation dot com).



Last Updated: 25th July 2005
Copyright © by BAZAutomation.com All Right Reserved.