Special thanks for the feedback and comments. Please continue supporting this small effort of mine to tinyos community.
As I promised in last post, here is the first step to analyze the RSSI values from a mote. In order to understand concept of base station and how things are done in real world, the following tutorial may help you.
As usual, sample code is provided at the end
Assumptions:
1) You have done up to the previous post, radio communication using cthreads. If not, please have a look at it. We are using the same program here for further analysis with a base station.
2) The username is "test"
3) You have eclipse installed and running.
4) You know how to add CLASSPATH for custom jar library
Before we begin, a small note on base station. Base station in real time can be a sophisticated node with high transmission range or a normal mote connected to computer. In either way, it act as a sink for data collection. That means, every application you develop using WSN needs to run the base station.
With this, here we begin.
Part 1: Making program ready for SerialForwarder
- Copy the folder BaseStation from /opt/tinyos-2.1.0/apps to /home/test/Serial
- Take shell and navigate to ~/Serial
- Compile the program. "make mica2"
- Convert the main program to avrora compatible format convert-avrora build/mica2/main.exe base.od
- Move the base.od to parent folder. mv base.od ../
- Copy the sender.od from previous example to Serial folder
- Instead of our previous post step, command for avrora is different here. " avrora -simulation=sensor-network -seconds=160.0 -monitors=serial,real-time -platform=mica2 -nodecount=1,1 base.od sender.od"
- This will give a display "Waiting for serial connection on port 2390..."
Part 2: Opening a new project in Eclipse and adding TinyOS library
- Open a new java project in Eclipse
- Copy the following code
Running Program
- Add java library path for suport for TinyOS serialforwarder
- Compile.
- Run the serialforwarder
- Modify the entry in serialforwarder to "network@localhost:2390"
- Start Server
- Now the counter will be running for "packets received"
- With out closing the serialforwarder, go back to eclipse and run the Listen
- Observe the output.
For those who are done with this.
Please have a look at Octopus project
If you are able to run the code from Octopus in avrora, it's a good sign!!!
Cheers
Download java code
Links you may be interested in