Simple One Dimensional Routing in TinyOS 2.x /2.10

Program listing: Routing in one dimension
OS: TinyOS 2.10/ TinyOS 2.x
Tools used : none
Assumptions: You are able to understand BlinkToRadio example from Tinyos tutorials.
Concept used: TX_POWER is set when sending a data to do multiple node transmission in a small room testbed. ( If you want to use it, you need to include the following in the AppC
components CC2420PacketC;
App.CC2420Packet->CC2420PacketC;
)

When a packet is received, it check for the target. If target is not current node, it compares its own id with target. Nexthop id is chosen accordingly.

Running the program:
1)Modify the BlinkToRadio application in receiving packets and include the routing decision.
2) Write a test program. Fuse it to say nodeid 10. Try to send data to 14 and 3. For 14 it should hop right. For 3 it should hop left.


void sendMessage(uint8_t data, uint16_t nodeid)
{

if (!busy) {
BlinkToRadioMsg* btrpkt =
(BlinkToRadioMsg*)(call Packet.getPayload(&pkt, sizeof(BlinkToRadioMsg)));
if (btrpkt == NULL)
{
return;
}
btrpkt->nodeid = nodeid;
btrpkt->counter = data;
call CC2420Packet.setPower(&pkt,MY_TX_POWER);
//routing decision
if(nodeid
{
//send left
if (call AMSend.send(TOS_NODE_ID-1,
&pkt, sizeof(BlinkToRadioMsg)) == SUCCESS)
{
busy = TRUE;
}
}
else

{
//send right
if (call AMSend.send(TOS_NODE_ID+1,
&pkt, sizeof(BlinkToRadioMsg)) == SUCCESS)
{
busy = TRUE;
}
}
}
}


// The Header file is modified to get desired output
//Transmission power is set to two. This will help to run the program in actual mote with multiple hops in a small room.

#ifndef BLINKTORADIO_H
#define BLINKTORADIO_H

enum {
AM_BLINKTORADIO = 6,
TIMER_PERIOD_MILLI = 250,
MY_TX_POWER=1
};

typedef nx_struct BlinkToRadioMsg {
nx_uint16_t nodeid;
nx_uint16_t counter;
} BlinkToRadioMsg;

#endif

If you could implement this, try to do it for 2 dimension.

11 comments:

kavya said...

Gireesh,
i c ur works r amazing. currently i am working on wireless sensor n/w using motes.. i would appreciate if you could give ur mail id so i could contact u if need be.

thnx
kavya

Gireesh said...

@kavya,
Great to hear that you are also working in wsn.
Posting my mail id here can invite spam to my inbox. You can find it. It is same as my personal blog's link
regards

Kuldeep Yadav said...

Thanks for ur kind help

in the one dimensional routing article u use following

if(nodeid
{
//send left

can u tell me whre the parantheses ends which starts just after "if" ,

secondly ,when we simulate multiple nodes using avrora,we got to see many printed infromation in hexa,can we get any distiction what exactly are those.plz refer some tutorial of avrora which can explain multinode simulation.

2.do u hv code for any other routing algo?

thanks in advance

Abhishek Goyal said...

Hi please let me know the command to print in avrora.I am working on TinyOS using avrora. Waiting for your reply. Thanks in advance

Gireesh said...

@abhishek
i dont understand what is meant by "print"
coz there is no visual display in any motes

Abhishek Goyal said...

Actually i do not have real motes.I want to print some text for the flow control and value of some variables.like we print in C using printf.I want to know the command in avrora.

Abhishek Goyal said...

In my application in TinyOS i am using dbg command.IS there any provision display any message in avrora after running.Please tell me the command. My application is stuck.Kindly help me.Thanks.

Sarang Deshpande said...

if(nodeid lessthan TOS_NODE_ID)
{
//send left

Is it the same .... i mean there should be TOS_NODE_ID.

tushar said...

hey Gireesh,
great work!!i m currently working on Rssi based algos in tinyos..and i had a question..is there a way to export the rssi values generated on screen using RssiDemo onto something like openoffice or gedit??

tushar said...
This comment has been removed by the author.
Anonymous said...

I am doing project on multihop communication and for that I am using "MultihopOscilloscope". But I also want to print the route followed that is the id's of the mote through which packet is being forwarded to the base therefore I will be highly thankful for your assistance.
Mote used: Telosb