Go Down

Topic: RFC for Arduino Control Bus (ACB) (Read 617 times) previous topic - next topic

freeborn

After searching for a while I found that MODBUS is a good system. But it is not perfect for arduino, so I decided to create a new protocol called it Arduino Control Bus or ACB which work similar to MODBUS. The system communicate via RS485 with ASCII format only makes it easy to monitor and very cost effective. This system may be applied in various projects such as Building Automation System, Process Controller or just simple household monitoring etc.

The protocol for both MASTER/SLAVE as followings

MASTER
Code: [Select]

Control Bus is fixed length(depend on ptype or arduino board) communication via RS485 using ASCII only.
Packet format (MASTER) for UNO, Duemilanove type 0 or 1
- start byte using *
- slave id use 3 bytes
- ptype use 3 bytes
- digital data use 11 bytes, each byte will be 1 or 0(zero) in ASCII, ignore data when READ
- end byte using ;
sample data :
*00100011111111111; = (ptype = 0)read all analog and digital from slave number 1
*00100000000000000; = (ptype = 0)read all analog and digital from slave number 1
(last 11 digits before ; are ignored because READ only)
*00100111111111111; = (ptype = 1)read all analog and set all digital pins to HIGH from slave number 1
(DO NOT recommend to use digital pin 13 for read and write if connect to LED on board)
TERM of variable :
PTYPE is type of devices that may be different depend on type of arduino board and how to use pins on each board.
ptype 0 - 100 are reserved for UNO or Duemilanove and 101 - 255 for MEGA or DUE
The following are samples of ptype for UNO, Duemilanove
type 0 = all analog and digital pins are for READ
type 1 = all analog pins for READ and all digital pins for WRITE
...
type 51 - 100 reserved for custom type
The following are samples of ptype for DUE, MEGA
type 101 = all analog and digital pins are for READ
type 102 = all analog pins for READ and all digital pins for WRITE
...
type 201 - 255 reserved for custom type
ID is device number for a slave which can be 1-999 and number 0(zero) reserve for broadcasting only.
***DO NOT BROADCAST when you need response from slaves because only one device can response at a time***
***BROADCASTING will be silence WRITE (write without response therefore you need to query again to make sure everything OK)***
BAUD is speed in bps(bit per second) for communication, default is 19200.
enablePin is the pin that toggle communication between send and receive (default is 2).


SLAVE
Code: [Select]

Control Bus is fixed length(depend on ptype or arduino board) communication via RS485 using ASCII only.
Packet format (SLAVE) for UNO, Duemilanove type 0 or 1
- start byte using -
- slave id use 3 bytes
- ptype use 3 bytes
- analog use 18 bytes, each pin use 3 bytes total 6 pins
- digital data use 11 bytes, each byte will be 1 or 0(zero) in ASCII, ignore data when READ
- end byte using ;
sample data :
-00100011122210120212309910101010101; -> read all analog and digital from slave number 1
-00100111122210120212309911111111111; -> read all analog and set all digital pins to HIGH from slave number 1
(DO NOT recommend to use digital pin 13 for read and write if connect to internal LED)


This protocol is designed as simple as possible, hopefully it will be useful for someone who plan to implement central(local or even remote) control system.

more details at http://www.thainetbeans.com/arduino/acb/acb.php

any suggestion is welcome.

Thanks

Go Up