SADUM Installation

Project files

Download the project files Sadum Zip

Sensor Network

First make sure you have the TinyOS installed on your system.

After unzipping the Project file, you will find inside TinyOS/apps folder, two folders: SadumSinkNode and SadumNetworkNode.

SadumSinkNode

Inside this folder your can find all the files correspondent to the sink node. The sink node must be connected to the Gateway. To compile this use the following commands:

make <Platform>

or if you installed through the installation found here

tinyosmake <platform>

then to install it on the node type this:

make <Platform> reinstall,<Node_ID> <programmer>,<communication_port>

or

tinyosmote <Platform> <node_ID> <USB_Port>

The <Node_ID> field for the sink node must always be 0, the <programmer> can be mib510 or mib520, and the <communication_port> must be the communication path in which the programmer is connected to, ex: /dev/ttyUSB0 , ... .

SadumNetworkNode

Inside this folder you have all the files for the network nodes.

For this nodes use the commands applied for the sink node.

The <Node_ID> field for this nodes must always be different that 0 and different from each other.

Inside this folder you have a script called sadumgen.sh, that helps you generate a file to be compiled and installed in a node (excluding the sink node).

Run the script, inside the SadumNetworkNode folder, like this:

./sadumgen.sh <file>

The <file> field is a file that contains commands to generate the program to be compiled.

Inside this file you insert the commands to add components to the nodes.

Components are functionalities that the nodes will have, and will be available in the interface. This functionalities are for example Leds, Radio, Sensor or Constants.

The file should have one command per line. like this:

RadioReceive
int8
RedLed
GreenLed
YellowLed
timermilli
Int16

Next are the available commands:

CommandDiscriptionImage
TimerMilli or timermilli or TIMERMILLIMilli seconds timertimer.png: 198x102, 4k (January 04, 2017, at 09:21 AM)
Leds or leds or LEDS8 bit leds controller, each bit sets an ledleds.png: 97x102, 4k (January 04, 2017, at 09:29 AM)
RedLed or redled or REDLEDSets the Red Led with a Boolean valueredled.png: 97x52, 2k (January 04, 2017, at 09:29 AM)
GreenLed or greenled or GREENLEDSets the Green Led with a Boolean valuegreenled.png: 97x52, 2k (January 04, 2017, at 09:29 AM)
YellowLed or yellowled or YELLOWLEDSets the Yellow Led with a Boolean valueorangeled.png: 97x52, 2k (January 04, 2017, at 09:29 AM)
Trigger or trigger or TRIGGEROutputs the value at its input, each time it receives a Boolean valuetrigger.png: 143x72, 4k (January 04, 2017, at 09:28 AM)
Not or not or NOTNot logic gatenotgate.png: 142x62, 3k (January 04, 2017, at 09:29 AM)
And or and or ANDAnd logic gateandgate.png: 142x62, 3k (January 04, 2017, at 09:30 AM)
Or or or or OROr logic gateorgate.png: 142x62, 4k (January 04, 2017, at 09:29 AM)
Temp or temp or TEMPReads the temperature sensortemperaturesensor.png: 98x42, 2k (January 04, 2017, at 09:30 AM)
Photo or photo or PHOTOReads the light sensorlightsensor.png: 128x52, 3k (January 04, 2017, at 09:28 AM)
16to8Component or 16to8component or 16TO8COMPONENTConverts Int16 values to Int816to8converter.png: 153x52, 3k (January 04, 2017, at 09:28 AM)
Sounder or sounder or SOUNDERMakes a beep soundbuzzer.png: 97x52, 2k (January 04, 2017, at 09:30 AM)
RadioReceive or radioreceive or RADIORECEIVEReceives data from other nodes in the networkreceiver.png: 190x102, 4k (January 04, 2017, at 09:28 AM)
RadioSend or radiosend or RADIOSENDSend data to other nodes in the networksender.png: 179x102, 4k (January 04, 2017, at 09:28 AM)
Bool or bool or BOOLBoolean inputbooleanconstant.png: 157x37, 2k (January 04, 2017, at 09:28 AM)
Int8 or int8 or INT8Int8 constant inputint8constant.png: 98x47, 2k (January 04, 2017, at 09:28 AM)
Int16 or int16 or INT16Int16 constant inputint16constant.png: 118x47, 2k (January 04, 2017, at 09:28 AM)
ArithemeticInt8 or arithemeticint8 or ARITHEMETICINT8Performs arithemetic operations on Int8 valuesarithemeticint8.png: 182x72, 4k (January 04, 2017, at 09:30 AM)
ArithemeticInt16 or arithemeticint16 or ARITHEMETICINT16Performs arithemetic operations on Int16 valuesarithemeticint16.png: 182x72, 4k (January 04, 2017, at 09:29 AM)
RelationalInt8 or relationalint8 or RELATIONALINT8Performs relational operations on Int8 valuesrelationalint8.png: 182x72, 4k (January 04, 2017, at 09:29 AM)
RelationalInt16 or relationalint16 or RELATIONALINT16Performs relational operations on Int16 valuesrelationalint16.png: 182x72, 4k (January 04, 2017, at 09:28 AM)
Chart or chart or CHARTSends data to the Gateway, that is shown in the interfacechart.png: 127x62, 2k (April 03, 2017, at 07:24 PM)

NodeJS and NPM installation

The Gateway and the Server both use NodeJS JavaScript framework and the NPM package manager for NodeJS, so first you have to install it.

It can be installed in two ways.

If the Gateway/Server will run on an UDOO or a Raspberry Pi platform, go to the UDOO folder inside the Project folder and run the installudoo.sh or the installudooprecompiled.sh

The first script will take longer to install.

If the Gateway/Server will run on a computer, go inside the Project file and type:

make installNodeAndNPM

Gateway

Installation

To install go inside the Project folder and type:

make all

Configuration

Go inside the Gateway folder and change the file: gateway.json

Inside this file you can configure a few parameters related to the Gateway.

serveraddress: Server IP
serverport: Server port
baudrate: Baudrate of the Sink Node
password: Password of the Gateway on the interface
bits: Parity bits of the Sink Node
delimiterStart: Serial Communication Start Byte
delimiterEnd: Serial Communication Stop Byte
deviceport: Path to the Serial Communication between the Gateway and the Sink Node

In most cases, you just have to change the serveraddress and the deviceport parameters. The first is the IP is the Server IP to which the Gateway will connect. For the second parameter put the full pass to the serial port like: "/dev/ttyUSB1"

Inside the Gateway folder you can also change the gateway_info.json file.
In this file you can change the title and the Gateway description that will be displayed in the interface.

title: Gateway Title
description: Gateway Description
Run

To run go inside the Gateway folder and type:

node gateways.js

After the Gateway initialization you should see the Sink Node blinking, if this does not happen it means that you do not have the Serial communication ports permission.

To change the permission type:

sudo chmod 666 <Serial_Port_Path>

or if you are using the USB type:

tinyosusbpermission

Server

Installation

To install go inside the Project folder and type:

make all

and then go Inside the Server folder and type:

gulp deploy

Configuration

Go inside the Server/public/javascript folder and change the file: client_to_server_connection.json, and change:

server_ip: Server IP

The server_ip is the IP of the Server, to which the Interface will connect.

Note: each time you change this run gulp all command.

After the server is initialized go to a browser and in the link insert your Server IP.

If everything is correct you will see something like this:

OpenningView.png: 1249x940, 48k (January 04, 2017, at 11:26 AM)

Adding New Components

To add new components is not difficult, but its a process some how long. Its a process of trail and error.

TinyOS

New components must be added to TinyOS/apps/SadumNetworkNode/lib folder. Add a new folder in with a lower case name. Then go to the Makefile in TinyOS/apps/SadumNetworkNode/ folder, open it and add a new line of PFLAGS with the new created folder name, like:

PFLAGS += -Ilib/<Name_of_the_new_folder>

After this inside the new folder, create two files named with the new component type with the suffix C and P. You can see examples of other components inside TinyOS/apps/SadumNetworkNode/lib folder.

After the new name is defined, go and add a new switch case in the sadumgen.sh file inside the folder TinyOS/apps/SadumNetworkNode/, to the casePrint function, like this:

@@"Demultiplexer"|"demultiplexer"|"DEMULTIPLEXER") echo "Demultiplexer component found"

		echo "			${COMPONENTSPREFIX}Demultiplexer${COMPONENTSUFFIX}${COMPONENT}$2;" >> SadumNodeApp.nc
		COMPONENTNAME="${COMPONENT}$2"
		printwiring $COMPONENTNAME
		;;@@

Change the highlighted words with the new name. After this, the new component can be added in a file, and be generated with the sadumgen.sh script.

After understanding how a component works (check examples inside TinyOS/apps/SadumNetworkNode/lib), its time to define the new component enum type, and add it to the ComponentType enum, in the file SadumGenericComponent.h inside the TinyOS/apps/SadumNetworkNode/lib/sadumgenericcomponent folder. If the new component has more than four ports, a new enum type must be added to the NumOFPorts, inside the same file.