The cart is empty

Wireless Communication

Wireless Hardware

Implementing a wireless network of any sort requires both a hardware and software solution. For the hardware I have chosen the cc1100 module which gives decent range, has a built in antenna and runs at 433 MHz. But the description of the communication mechanism described below could be used with any physical device provided you can get a reliable data stream. I use the packet management on the cc1100 along with automatic crc calculation for the data. This means that I can easily discard corrupt packets without much overhead.

Wireless Protocol

I have researched a bunch of different protocols out the such as 6lowpan, miwi and others. I needed a protocol that is reliable and flexible but at the same time with minimum overhead. I settled for a custom protocol which I call the wattmon protocol. It has an 8 byte packet header with the following fields:

  • src_node_id
  • dest_node_id
  • group_id
  • flags
  • frame_number
  • length

This pretty much takes care of any scenario I could come up with. It is not designed for multi-hop type setups and assumes that every node is within direct communication distance with the wattmon box. In addition, I have defined the following packet flags:

PKT_FLAG_ACK

Packets with this flag will need to be acknowledged with an ACKREP packet back which has a length set to 0 but has the same frame number in its header, along with source and dest nodes flipped. The packet will be automatically retransmitted several times until it marks it as failed.

PKT_FLAG_ACKREP

This is set automatically when a packet requiring an ACK is sent.

PKT_FLAG_MODBUS

This packet type differentiates between modbus encoded packets and standard text packets. When a device receives a modbus flagged packet it will pass it on to the modbus handler, which will perform identical processing on it as if it came in on a serial line. The engine will then push out the response back to the wireless engine.

So essentially with a little extra work I got a reliable communication mechanism that I can use with my existing modbus modules to make them wireless or dual mode. Ideally I would like to leave the modbus port on so every device can be accessed over a cable for easy configuration in case any wireless settings change.

Each modbus wireless device has the following registers specifically for the wireless configuration:

Channel

Wireless channel to use

Group

Group id to use, should be same as wattmon master

Node Id

Node Id of device, same for both cabled and non cabled version

Announce interval

Interval in ms of a period HELLO packet to help keep the wireless system alive and in sync.

Baud rate

Baud rate of wireless transmissions. Default is 4800 bps. Needs to be identical on all devices and wattmon.

I will be making all this information available in a more structured way along with source code examples for people who wish to develop add on wireless modules to their wattmon devices.

Comments | Add yours
  • No comments found
Add comment