Difference between revisions of "BioBoard/Documentation/Arduino protocol"

From Noisebridge
Jump to: navigation, search
(Created page with '=The BioBoard Protocol= In order for the Arduino with all its sensors connected to communicate to the outside world, there needs to be an agreement on how that data should look. …')
 
Line 1: Line 1:
 
=The BioBoard Protocol=
 
=The BioBoard Protocol=
In order for the Arduino with all its sensors connected to communicate to the outside world, there needs to be an agreement on how that data should look.  Otherwise, all that
+
In order for the Arduino, with all its cool sensors connected, to communicate to the outside world, there needs to be an agreement on how that data should look.  Otherwise, all that
interesting data would be lost.  Hence, the BioBoard Protocol.
+
great data would be lost.  Hence, the BioBoard Protocol.
  
 
==An Example==
 
==An Example==
 
The best way to explain the details of the protocol is with some examples.
 
The best way to explain the details of the protocol is with some examples.
 
If we want to tell the server that the current temperature is 25.5 degrees C,
 
If we want to tell the server that the current temperature is 25.5 degrees C,
we send the following packet from the Arduino:
+
the Arduino sends the following packet:
 
<code>
 
<code>
 
   @TC:0:25.5$
 
   @TC:0:25.5$
Line 17: Line 17:
 
*After the <b>@</b> character, is a tag for the type of packet.  The tags are typically in all capitals.
 
*After the <b>@</b> character, is a tag for the type of packet.  The tags are typically in all capitals.
 
*If the tag indicates a type of probe or sensor, it is followed by a probe number. This is always an integer.
 
*If the tag indicates a type of probe or sensor, it is followed by a probe number. This is always an integer.
 +
 +
Here is a list of tags that we currently use:
 +
*<b>TC</b> temperature in degrees C
 +
*<b>NIR</b> near-infrared transmission (the range is from 0.00 to 1.00, where 1.0 is full transmission)
 +
*<b>PH</b> pH (the range is from 0.0 [strongest acid] to 14.0 [strongest base])
 +
*<b>DO</b> dissolved oxygen (the range is from 0.00 to 1.00)
 +
 +
==Getting Started==
 +
All protocols need a way to get started.  The BioBoard protocol is no different.
 +
 +
For starters, we first output a packet that is different than any of the other packets.
 +
You'll notice that we also include a version number.
 +
<code>
 +
  !BIOBOARD:0.1
 +
</code>
 +
 +
 +
<code>
 +
  @PROJ:TESTLIQUID5$
 +
</code>
 +
 +
 +
<code>
 +
  @PR:TC:0$
 +
  @PR:NIR:0$
 +
  @PREND$
 +
</code>
 +
 +
<code>
 +
  @TC:0:25.5$
 +
  @TC:0:25.25$
 +
  @TC:0:24.75$
 +
  @TC:0:24.25$
 +
  @TC:0:23.25$
 +
</code>
 +
 +
 +
Finally, the BioBoard protocol is line-oriented, meaning that a newline or carriage return is sent after each packet.  This makes it easier to view the data or to make up sample data in a simple text editor.
 +
Also, the communication speed is 19,200 baud. The Arduino, including older models, can easily handle this speed. Of course, this can be changed,
 +
but it would need to be adjusted on the receiving end as well.
 +
Remember, a protocol is an agreement between two sides of a communication link!

Revision as of 04:09, 4 May 2011

The BioBoard Protocol

In order for the Arduino, with all its cool sensors connected, to communicate to the outside world, there needs to be an agreement on how that data should look. Otherwise, all that great data would be lost. Hence, the BioBoard Protocol.

An Example

The best way to explain the details of the protocol is with some examples. If we want to tell the server that the current temperature is 25.5 degrees C, the Arduino sends the following packet:

 @TC:0:25.5$

TC is the tag for "temperature in degrees C". It is a floating point number (i.e. has a decimal point). Besides that, the rest is really just syntactic sugar. Here are some simple rules:

  • All packets begin with @ and end with $ characters.
  • Fields are separated with a : character.
  • After the @ character, is a tag for the type of packet. The tags are typically in all capitals.
  • If the tag indicates a type of probe or sensor, it is followed by a probe number. This is always an integer.

Here is a list of tags that we currently use:

  • TC temperature in degrees C
  • NIR near-infrared transmission (the range is from 0.00 to 1.00, where 1.0 is full transmission)
  • PH pH (the range is from 0.0 [strongest acid] to 14.0 [strongest base])
  • DO dissolved oxygen (the range is from 0.00 to 1.00)

Getting Started

All protocols need a way to get started. The BioBoard protocol is no different.

For starters, we first output a packet that is different than any of the other packets. You'll notice that we also include a version number.

 !BIOBOARD:0.1


 @PROJ:TESTLIQUID5$


 @PR:TC:0$
 @PR:NIR:0$
 @PREND$

 @TC:0:25.5$
 @TC:0:25.25$
 @TC:0:24.75$
 @TC:0:24.25$
 @TC:0:23.25$


Finally, the BioBoard protocol is line-oriented, meaning that a newline or carriage return is sent after each packet. This makes it easier to view the data or to make up sample data in a simple text editor. Also, the communication speed is 19,200 baud. The Arduino, including older models, can easily handle this speed. Of course, this can be changed, but it would need to be adjusted on the receiving end as well. Remember, a protocol is an agreement between two sides of a communication link!