Getting Started with TinyOS-The Basics

The first thing an outsider needs to get familiar with is the structure of the program while coding in TinyOS. The official TinyOS tutorial does a great job of making all these basics clear, but I just thought we’d include this post as a token post in order to maintain some sort of order 😛 Feel free to check out the official post and all of their tutorials:

Every-time you start a new project “xyz”, you’ll need at least 4 files.

  1. Makefile
  2. file
  3. file
  4. xyz.h file

Laksh has hosted all of our projects on github and I’ll keep referring to the relevant folders so that you could try out the codes as well. For instance we’ve called these skeletal files “null files” and you could have a look at them to understand the basic structure for any TOS project.

A Makefile tells the compiler which flags to set and tells it where your main configuration file is present ( We mainly use the Makefile to also declare the buffer size for the printf commands we use in our projects. One can also set the power level for communication for static range scenarios here. file contains your main code where you also declare all the interfaces of the mote (in our case, UC-Berkeley or TelosB or MicaZ) that you’ll be using. is your main configuration file and interfaces your main code with the hardware modules like LEDs, timers, radio module, sensors etc. 

The header file is used to declare which channel you’ll be using for communication and also in most of our applications the structure of the message packet that each mote shall be sending. By default, the maximum packet size that one can send is 28 bytes but it can be modified to upto 127 bytes by changing the header file.

That’s it for this post, we’ll keep updating this space with more posts which’ll sort of act as a timeline of the experiments/projects we did till now in this field in the hope that it might be of use to anybody trying to work on similar projects using TinyOS.


My experiments with a 50mm prime lens

Happy Diwali!
I just celebrated Diwali back home on the 3rd with my family and other than the usual good food, lights and festive atmosphere associated with this festival, this time around, I had my camera and  the awesome 50mm prime lens to look forward to. 😀

In case you aren’t familiar, Diwali, celebrated on a new moon night, is the festival of lights and arguably the biggest festival in Northern India. The whole city is lit up with oil lamps and led strips and the night itself is celebrated with suppressed booms of fireworks becoming an integral part of the soundscape.

I used my Nikon D5100 with the 50mm f/1.8D for the most part of the night and came up with some good shots which I’m happy with. I’m still getting used to the manual focusing, so please pardon minor blurs 😛 But I sure did have a lot of fun clicking portraits, bokeh, fireworks and even something equivalent of steel-wool photography which I tried to do using sparklers or ‘phooljhadi’s as we call them here.

I really hope I keep practicing so that I can improve my photography with this lens to improve the focusing, framing and choice of depth of field of shots; basically the three main things I feel are important with respect to this nifty-fifty.

P.S.: I’m still too lazy to look up and copy the EXIF for each one of these and I didn’t want something like that to delay this post any further, let me know if  you want them for any particular shot.

Setting up TinyOS on Linux

The first step in our journey through the wondrous lands of Wireless Sensor Networks with TelosB and Micaz proved to be the most irritating and cumbersome one (for a linux n00b like me at least, I struggled for a fortnight with the setup -_- ).

Long story short, here’s the entire procedure given by Sachin.

This is what we follow for a fresh install, we are by no means saying this is the simplest or the only way to install TinyOS in Ubuntu, but we are kind of claiming its the most robust way we’ve come across.
Here’s the breakdown:
[For other people not to familiar with Linux, don’t copy the ‘$’ symbol, that just indicates you’re typing in terminal 😛 Ctrl+Alt+T to open terminal quickly by the way.]

Remove previously installed *-tinyos packages:

  • $ sudo dpkg -P `dpkg -l nesc ‘*tinyos*’ | grep ^ii | awk ‘{ print $2 }’ | xargs`
  • $ sudo apt-get clean

Edit sources.list:

Close the opened file. Now, back in terminal, use these commands

Rename the extracted tinyos directory tinyos-main and copy it into your home folder

Now, set up the tos environment

  • $ sudo gedit .bashrc

Add these lines to the end of the opened file :
[ ‘#’ is used to initiate comments]

  • # Here we setup the environment
  • # ‘<your_username>’ should be replaced with your own username
  • # like in my case its ‘sj’ so my ‘<your_username>’ is ‘sj’
  • # variables needed by the tinyos
  • # make system
  • export TOSROOT=“/home/users/<your_username>/tinyos-main“
  • export TOSDIR=”$TOSROOT/tos”
  • export CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java
  • export MAKERULES=”$TOSROOT/support/make/Makerules”
  • export PYTHONPATH=$PYTHONPATH:$TOSROOT/support/sdk/python
  • echo “setting up TinyOS on source path $TOSROOT”

Close the file.
Restart terminal.

You’re done! 😀

Check your TinyOS install by:

  • $ cd ~/tinyos-main/apps/Blink
  • $ make telosb

The code should compile successfully and at the end of the compilation, the result would be similar to that of writing a tos-image.


Reverse Lens Macro Photography

I really wanted to try my hand at macro photography a while ago but was really not too keen on buying a new lens.
This technique is something I came across last year and have had a lot of fun exploring. I use a reversing ring with my standard kit 18-55mm lens with Sony NEX 5K.

Here’s a small look into the technique:

These are some of my favourite shots that I’ve managed to capture over time using this technique. Note that I haven’t provided the EXIF because it isn’t stored with the photos since the lens contacts aren’t connected to the camera while clicking the photos.


I’ll keep adding new photographs that I manage to click using this technique here in the future.

Music Intro

I’ll be sharing videos of my performances or covers here along with any posts I want to make about stuff I’m working on or any new drum exercises I find 🙂
My kit:
Mapex Q Standard Rock 5 pc kit

Sabian B8-14″Hi-hats, 16″Crash, 20″ Ride

Mapex P710TW Double bass pedals

Sonor DP472 Double bass pedals