Difference between revisions of "4E Network"

From SlugWiki
Jump to: navigation, search
m
Line 1: Line 1:
As the number of planned projects increased, it became clear that we needed a set of standards which would allow them to communicate with a central computer and each other. It is not practical to have a separate computer, separate wiring, and a separate communications protocol for every project. The 4E network will allow all the projects to share these things.
+
==Introduction==
 +
As the number of planned projects increased, it became clear that we needed a set of standards which would allow them to communicate with a central computer and each other. It is not practical to have a separate computer, separate wiring, and a separate communications protocol for every project.
  
The network will use RS485 serial. This standard was chosen because it allows for multiple nodes to be connected to a single cable run. It is also extremely easy to interface with serial on computer and a PIC.
+
The 4E network uses full duplex RS485 serial in a star topology. Each device has a dedicated line back to a central node: a Portmaster 2e serial port server.
  
Each PIC will be its own node, so a project may have multiple nodes. For example, [[Bemix]] version 3 will have one node for each bathroom. On the other hand, a single node may be associated with multiple projects. The control panel will provide a physical interface to most 4E projects.
+
==Wiring==
 +
Each bathroom recieves 2 cat 3 cables, one for signal and one for power. The signal cable is pinned as shown below
  
Each node will have a unique address and will filter incoming data and only listen to packets that are addressed to it.
+
{| border="1"
 +
|-
 +
| Green with white
 +
| Tx+
  
The 4E network will most likely be full duplex, meaning that a node can transmit and recieve at the same time. It is unclear whether it is better to have the computer poll each node or to implement some collision avoidance system.
+
|-
 +
| White with green
 +
| Tx-
  
See [[4E_Network_Notes]] for technical details.
+
|-
 +
| Orange with white
 +
| Rx+
  
Check out more [[projects]] going on around 4e.
+
|-
 +
| White with orange
 +
| Rx-
  
[[Category:Projects]]
+
|-
 +
| Blue with white
 +
| Left audio
 +
 
 +
|-
 +
| White with blue
 +
| Audio ground
 +
 
 +
|-
 +
| Brown with white
 +
| Right audio
 +
 
 +
|-
 +
| White with brown
 +
| Audio ground
 +
|}
 +
 
 +
For the power cable, all colored wires are +12V and all white wires are ground.
 +
 
 +
==Server Hardware==
 +
The portmaster serial port server is accessed through telnet:
 +
*administrative-port 23
 +
*serial port 0-port 6000
 +
*serial port 1-port 6001
 +
* ...
 +
*serial port 30-port 6030
 +
 
 +
==4E Network Protocol==
 +
===Packet Format===
 +
All data sent over the 4E network is encapsulated in packets. The packet format is outlined below:
 +
*header code (2 bytes) = escape character + header character
 +
*header (3 bytes)
 +
*data (variable length)
 +
*end code (2 bytes) = escape character + end character
 +
where:
 +
*escape character = '\'
 +
*header character = 'H'
 +
*end character = 'E'
 +
 
 +
The header contains three 1 byte fields:
 +
*'''destination address:''' This allows the server to route packets from one client to another.
 +
*'''source address:''' This allows one client to respond to a request made by another client.
 +
*'''port:''' This tells the device what type of data to expect and how to processes it.
 +
 
 +
Note: If the escape character needs to be transmitted in the data block, two should be transmitted instead.
 +
 
 +
===Data and Ports===
 +
Currently, only three ports will be implemented:
 +
*31 - debug
 +
*32 - ping
 +
*64 - Bemix
 +
 
 +
Other possible ports include:
 +
*EEPROM - for storing data that is currently hardcoded but shouldn't be
 +
*programming - so the PICs can download their own software
 +
*cocoa pot
 +
*other projects
 +
 
 +
==Addresses==
 +
Each device, including the server, is a assigned a unique address.
 +
* 0 = unused
 +
* 1 = server
 +
* 92 = unused
 +
* 255 = broadcast, all devices listen
 +
 
 +
==How to control Bemix==
 +
When a Bemix client is booted, it sends a packet to the server containing "Bemix v3.0" over the debug port.
 +
 
 +
===Touch Switch Output===
 +
The Bemix clients will send an ASCII number 1 through 5, corresponding to the 5 touch switches. The PIC can be programmed to send a single packet when a switch is touched or a continuous stream (at adjustable repeat rate) when it is touched.
 +
 
 +
Example: touch switches 1 and 5 are touched on device 70 which is programmed to tell device 1 (the server)
 +
<pre>
 +
'\' 'H' 01 70 64 1 '\' 'E'
 +
'\' 'H' 01 70 64 5 '\' 'E'
 +
</pre>
 +
 
 +
===Touch Switch Recalibration===
 +
The touch switch may be recalibrated by disabling it then reenabling it. This is done by sending a packet containing "D" followed by "E" over the Bemix port:
 +
<pre>
 +
'\' 'H' 70 01 64 'D' '\' 'E'
 +
'\' 'H' 70 01 64 'E' '\' 'E'
 +
</pre>
 +
 
 +
===Ping===
 +
Bemix clients will respond to a packet over the pinging port with an empty packet over the same port.
 +
 
 +
Example: server pinging device 70 and its response
 +
<pre>
 +
'\' 'H' 70 01 32 '\' 'E'
 +
'\' 'H' 01 70 32 '\' 'E'
 +
</pre>
 +
 
 +
One possible use of pinging is to build a routing table by sending a pinging each serial port to map serial port numbers to device addresses.
 +
 
 +
==To Do==
 +
* Fix bugs with reception
 +
* Store PIC's address in EEPROM, be able to send an address and data pair and have PIC write it to EEPROM
 +
* Make devices listen to address 255
 +
 
 +
==PIC Code==
 +
See [[Bemix PIC code]].
 +
 
 +
==See Also==
 +
*[[4E Network]]
 +
*[[Bemix Notes]]
 +
*[http://portmasters.com portmasters.com]
 +
 
 +
[[Category: Projects]]

Revision as of 02:20, 5 February 2006

Introduction

As the number of planned projects increased, it became clear that we needed a set of standards which would allow them to communicate with a central computer and each other. It is not practical to have a separate computer, separate wiring, and a separate communications protocol for every project.

The 4E network uses full duplex RS485 serial in a star topology. Each device has a dedicated line back to a central node: a Portmaster 2e serial port server.

Wiring

Each bathroom recieves 2 cat 3 cables, one for signal and one for power. The signal cable is pinned as shown below

Green with white Tx+
White with green Tx-
Orange with white Rx+
White with orange Rx-
Blue with white Left audio
White with blue Audio ground
Brown with white Right audio
White with brown Audio ground

For the power cable, all colored wires are +12V and all white wires are ground.

Server Hardware

The portmaster serial port server is accessed through telnet:

  • administrative-port 23
  • serial port 0-port 6000
  • serial port 1-port 6001
  • ...
  • serial port 30-port 6030

4E Network Protocol

Packet Format

All data sent over the 4E network is encapsulated in packets. The packet format is outlined below:

  • header code (2 bytes) = escape character + header character
  • header (3 bytes)
  • data (variable length)
  • end code (2 bytes) = escape character + end character

where:

  • escape character = '\'
  • header character = 'H'
  • end character = 'E'

The header contains three 1 byte fields:

  • destination address: This allows the server to route packets from one client to another.
  • source address: This allows one client to respond to a request made by another client.
  • port: This tells the device what type of data to expect and how to processes it.

Note: If the escape character needs to be transmitted in the data block, two should be transmitted instead.

Data and Ports

Currently, only three ports will be implemented:

  • 31 - debug
  • 32 - ping
  • 64 - Bemix

Other possible ports include:

  • EEPROM - for storing data that is currently hardcoded but shouldn't be
  • programming - so the PICs can download their own software
  • cocoa pot
  • other projects

Addresses

Each device, including the server, is a assigned a unique address.

  • 0 = unused
  • 1 = server
  • 92 = unused
  • 255 = broadcast, all devices listen

How to control Bemix

When a Bemix client is booted, it sends a packet to the server containing "Bemix v3.0" over the debug port.

Touch Switch Output

The Bemix clients will send an ASCII number 1 through 5, corresponding to the 5 touch switches. The PIC can be programmed to send a single packet when a switch is touched or a continuous stream (at adjustable repeat rate) when it is touched.

Example: touch switches 1 and 5 are touched on device 70 which is programmed to tell device 1 (the server)

'\' 'H' 01 70 64 1 '\' 'E'
'\' 'H' 01 70 64 5 '\' 'E'

Touch Switch Recalibration

The touch switch may be recalibrated by disabling it then reenabling it. This is done by sending a packet containing "D" followed by "E" over the Bemix port:

'\' 'H' 70 01 64 'D' '\' 'E'
'\' 'H' 70 01 64 'E' '\' 'E'

Ping

Bemix clients will respond to a packet over the pinging port with an empty packet over the same port.

Example: server pinging device 70 and its response

'\' 'H' 70 01 32 '\' 'E'
'\' 'H' 01 70 32 '\' 'E'

One possible use of pinging is to build a routing table by sending a pinging each serial port to map serial port numbers to device addresses.

To Do

  • Fix bugs with reception
  • Store PIC's address in EEPROM, be able to send an address and data pair and have PIC write it to EEPROM
  • Make devices listen to address 255

PIC Code

See Bemix PIC code.

See Also