"SerialPower I" Software Examples & Network Stacks
"Combining power delivery and
bi-directional communications between intelligent nodes
using just two interchangeable wires"
Version 4.0 for Picaxe M2/X2
Basic Network Stacks
A minimum "SerialPower" network configuration consists of a master node and a slave node. This section describes the main network stacks required.
- Master Node Software: -
A master node is application independent and the master node software is therefore the same for any application. The following link is available for the master node software as implemented on a Picaxe-08M2, it may be adapted towards a different M2 type controller as well: Master Node Network Stack
- Slave Node Software: M2 variants -
A basic network stack for a M2-based slave node is available that implements a simple "dummy" process which registers itself to the master node as a sending process. In this way a slave node can be tested in a very simple way, since with a correctly functioning slave node the master node will generate timeslots for this dummy process (in case of several slave nodes: take care that each dummy sending process on each slave node gets a different, unique ID). The following link is available for the basic slave node network stack as implemented on a Picaxe-08M2: Slave Node Network Stack
- Slave Node Software: X2 variants -
A basic network stack for a X2-based slave node is available that implements a simple "dummy" process which registers itself to the master node as a sending process. In this way a slave node can be tested in a very simple way, since with a correctly functioning slave node the master node will generate timeslots for this dummy process (in case of several slave nodes: take care that each dummy sending process on each slave node gets a different, unique ID). The following link is available for the basic slave node network stack as implemented on a Picaxe-20X2: Slave Node Network Stack
A number of simple, tested examples are available. Main goal is to illustrate the programming of the slave nodes for typical applications. The example code has been tested on a true two-wire network implementation. Therefore, the example code uses this particular network setting as well and you may need to alter that for your particular application! All examples on this page are described in detail in the Architecture Document, Chapter 10.
Hint: Compare the example codes below in order to quickly locate the application dependent code parts in the slave node software. This comparison will help you to code your application much faster. Furthermore it reveals that a large part of the slave node software is actually application-independent.
- Example S1 -
In this example a switch at the slave node is read. Every time it is pressed a LED at the slave node is lit and a message is prepared that calls a master node process to flash the master node LED. Thus a simple application is available to demonstrate bidirectional communication between processes at a master and a slave node.
Example S1 is treated in detail in Chapter 10.1 of the Architecture Document.
The example code can be found here: Example S1 (slave node switch + master node LED response).
- Example T1 -
This example shows a very common use of a slave node, namely as a sensor that continuously measures and reports values to the network. In this example two DS18B20 digital temperature sensors are read and their values transmitted (in a single network message) to a display process (located on another slave node). Note that the application software takes care of the fact that certain commands like READTEMP take a relatively long time to execute and therefore need to be treated as "atomic" operations using SerialPower's deSynch and reSynch routines.
Example T1 is treated in detail in Chapter 10.2 of the Architecture Document.
The example code can be found here: Example T1 (temperature sensing & reporting).
- Example T2 -
EXample T2 is a direct extension in that the process that implements the temperature sensing is enabled by sending it a tenoerature threshold value. Only after a defined threshold value is exceeded the tenperatures will be reported. Furthermore the threshold may be varied in time; a process synchronization method is used to guarantee that any threshold chnage is accounted for properly by the temperature sensing and reporting process
Example T2 is treated in detail in Chapter 10.3 of the Architecture Document.
The example code can be found here: Example T2 (temperature sensing & reporting based on variable threshold value).
This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 4.0 license in order to support non-commercial, public-domain applications, and to allow application builders to take intellectual ownership of their derived work as well:
To view a copy of this license, you may press on the logo. or send a letter to
171 Second Street, Suite 300,
San Francisco, California, 94105, USA.
In short form (me, my = holder of copyright):
- You may use, adapt, and distribute this work
- You must give credit to me when using this code in your application
- If you use my code commercially, I want my share
- You may share your adapted code (now with you as holder of copyright) on the condition that the same license conditions are applied
In order to acknowledge Jurjen Kranenborg (i.e. not the copyright holder of any derived work) as the architect of the original network concepts, I would highly appreciate that you include the following (or similar) statement in all derived works (code, webpages, docs, etc.):
The SerialPower network architecture was originally developed by Jurjen Kranenborg.
PICAXEŽ products are developed and distributed by Revolution Education Ltd
Unit 2 Bath Business Park, Foxcote Ave, Bath, BA2 8SF, UK. PICAXEŽ is a registered trademark licensed by Microchip Technology Inc.
Contact: jurjen CURLY_A kranenborg PUNKT org
SerialPower Links ...
- Architecture description -
A full, detailed description of the network concept can be found in the
SerialPower Architecture PDF , which includes a User Guide for application development.
- Built by others ... -
- Chuck Bigham's research network
- Other ...
- Hardware -
A description of the three possible network hardware configurations is presented at the hardware configuration page
- Examples page -
Tested example software (as well as the basic master and slave network stacks) can be found via the following software link
- @ PICAXE Forum -
- Main entry on the Picaxe Forum regarding SerialPower (in "User Projects - Communication") which contains a detailed discussion on the message comcept used and its interpretation.