Slashdot Mirror


Adam Dunkels on Embedded Sensor Networks

tl writes "netzstaub has posted an extensive interview with Adam Dunkels, a computer scientist working in the field of wireless sensor networks and author of the open source lwIP and uIP embedded TCP/IP stacks, the Contiki OS, and the Protothreads library. The interview touches on protothreads, sensor networks, TCP/IP, Contiki, and embedded software development. Many Slashdot readers probably remember the tiny Contiki OS from previous articles where, not surprisingly, clustering has been discussed. From reading the interview, it seems Contiki clusters now have come true."

31 comments

  1. Contiki clusters? by cmburns69 · · Score: 4, Funny

    "...Contiki clusters have come true"

    A cluster of contiki boats? Wouldn't that be called a navy?

    --
    Online Starcraft RPG? At
    Dietary fiber is like asynchronous IO-- Non-blocking!
    1. Re:Contiki clusters? by Mikkeles · · Score: 1
      That's not a contiki;

      this is a kon-tiki!

      --
      Great minds think alike; fools seldom differ.
  2. Article tesxt by Sadiq · · Score: 3, Informative

    Interview with Adam Dunkels

    I discovered Protothreads through a link in Chris Double's weblog on Saturday. This is a fascinating tiny library, written by Adam Dunkels, a researcher at the Swedish Insitute of Computer Science. The Protothreads library implements user-level in threads in portable ANSI C in a mere 20 lines of code, and each thread uses only 2 bytes of RAM! While having a few important limitations, this comes in handy for a lot of problems, especially when writing single-threaded network servers (using Protothreads, you don't have to use state machines to do protocol handling). While checking out Protothreads, I stumbled across the very interesting link list that Adam Dunkels compiled while writing his library. From there, I got hooked and browsed the rest of Adam's website.

    He has written two incredible TCP/IP stacks aimed at embedded systems. The first one, uIP, is targeted at 8bit microcontrollers, and has a very low RAM usage (it runs with as few as 128 bytes RAM for full TCP/IP support). The development version of uIP uses Protothreads to offer a BSD-style socket interface while maintaining its low RAM usage. The second stack, lwIP, is targeted at bigger embedded systems, and offers a BSD-style API.

    Adam is a computer scientist working in the field of sensor networks, which are a part of the research field of ubiquitous computing. Sensor networks consist of a myriad of little embedded systems gathering environmental data through a set of sensors. However, the real value of sensor networks stems from the communication between all these systems. As Adam put it, "the nodes are interchangeable: it is the data generated by the sensors that are the primary interest". Besides uIP, which he uses as a mean to communicate between the sensor nodes, Adam works on Contiki, an embedded operating system. Contiki allows the dynamic loading of code on sensor nodes, which proves to be very useful when deploying sensor networks.

    I emailed Adam a few questions about his software, embedded programming and sensor networks. He was very kind to provide exhaustive and very interesting answers. Enjoy the interview :)

    Protothreads

    These first three questions are about Protothreads, the minimal threading library Adam has written for his embedded platforms. Protothreads are inspired by coroutines, which can be sort of implemented in C using a neat little trick.

    Question: Adam, what was your motivation to write protothreads?
    Answer: The driver behind the development of protothreads was many years of writing event-driven code. After a while, one sees the need to have a nicer abstraction than finite state machines. Ordinary threads have many of the good properties of such an abstraction, but they have two problems: the RAM overhead is prohibitive on systems with very small memory resources ---the typical target system for uIP---, and they require a fair amount of platform specific code. As I wanted to keep both uIP and Contiki as portable as possible, this was definitely a problem.

    After thinking long and hard about this, as well as reading lot of papers on the subject of concurrency, the protothreads concept dawned on me. Very simple, yet powerful. Very little RAM overhead and possible to
    implement in pure C. Perhaps the nicest thing is the extremely small size of the implementation. With all comments removed, the entire library can be reduced to 20 lines of code (that goes into a header file, no less!).

    Question: What kind of software uses Protothreads currently?
    Answer: Currently, the Contiki OS and the development version of the uIP TCP/IP stack are using protothreads. Among other things, they are used to implement a network API called "protosockets", which are similar to the BSD socket API but based on protothreads. This means that they can be used without underlying full multithreading, which subsequently means less RAM overhead.

    Question: What kind of software do you think will use Protothreads in the future?
    Answer: I

    --
    SysWear - Geek T-shirts (UK/Europe)
    1. Re:Article tesxt by Anonymous Coward · · Score: 0

      God, stop being a karma-whore. The articles been up for 20 minutes and it only has 5 comments, including this one. No one wants to read about remote cluster boat packaging whatevers, and the story blurb is so link-heavy you can't even tell which part is the "news". You re-posting that crap here is just sad.

    2. Re:Article tesxt by Anonymous Coward · · Score: 0

      Ah, how nice.... want some cheese with that whine?

      Nothing worng with what the original poster did. Boy, you must be having a sad, mad, and bad day.

    3. Re:Article tesxt by Anonymous Coward · · Score: 0

      I clicked the link to the extensive intervju and it is slashdoted already so I much appreciate that someone posted the text.

      If you are worried that someone is trying to steal your carma points then... ...well thats just sad.

    4. Re:Article tesxt by Anonymous Coward · · Score: 0

      A cluster of contiki boats? Wouldn't that be called a navy?

      What a sad day on slashdot when a two line stupidity gets a score of 5 for being funny, while this monumental essay gets 3 for being informative. Something is wrong with our moderators.

    5. Re:Article tesxt by Anonymous Coward · · Score: 0

      Do you want us to call an waaaaabulance for you? If you were a dog, would you be a chawaaaaawaaaaa?

    6. Re:Article tesxt by Storlek · · Score: 1

      From my point of view, the most interesting thing with uIP in theCubeSat kit is the extremely small packet buffer that is used. The RAM footprint for the entire uIP stack is as small as 128 bytes, where something like 96 bytes was used for the packet buffer. I never thought that such a small RAM configuration would ever be used in my pants. In their system, however, the space-to-earth communications link is not fast enough to warrant a larger buffer anyway.

      Strange enough as it is that someone would post the article text for a story that hasn't even had thirty comments, it's even stranger that no one's noticed and modded this down as the troll it is.

      You failed it, moderators.

      --
      Bears don't normally eat things that talk and move backwards.
  3. Cool... by Alwin+Henseler · · Score: 4, Funny
    Now with these tiny embedded sensor networks embracing TCP/IP support, you can hack up worms that don't only infect those numerous Windows boxes, or your cellphone, fridge, toaster or coffee-maker, but also your toilet, smoke detector or temperature sensors embedded in the walls of your home?

    Damn! Isn't there anything in this world safe from TCP/IP packets? Back in the old days, people would respect them, and only allow full-featured computers & OS'es to exchange them. What's becoming of this world, I ask you?

    1. Re:Cool... by Nik13 · · Score: 1

      Ever since I've seen the LG fridge (with built in computer) that's pretty much what I've been thinking too (and not in a funny way).

      It may be far off still (I've seen more appliances coming out with computers like that - a LG microwave recently), but eventually, we may have to visit some "toaster update" site every once in a while, update your AV and firewall for it...

      And that's hoping it doesn't get beyond that, which wouldn't surprise me seeing the ridiculous convergence we see lately in phones and what not. I can almost see people buying toasters that play games sort of like their nokia phone does - and some free/sponsoder games would come bundled with spyware "for toaster edition" (perhaps a jam company interested in some stats? who knows where it will stop...) </tinfoilhat>

      Ok, the spyware issue may be pushing it, but I'm sure we'll see such devices coming out, and some people will buy them even if they seem to do nothing useful (for the sake of coolness or whatever).

      I sold 3 of my older PCs last year (down to 5 "only" now), mostly because I was sick and tired of having to "admin" them all (update stuff mostly). I *don't* want a network full of such embedded networked devices to look after by myself. If it comes down to that, I'd pay extra to have some sort of automatic update service.

      --
      ///<sig />
  4. Slashdotted already by adeydas · · Score: 1, Informative

    Mirror to Adam Dunkel's homepage.

  5. Protothreads source? by Lisandro · · Score: 1

    I'm very interested in the Protothreads library sourcecode mentioned in the article - the whole 20 lines of it! Yet, the site is slashdotted and Google doesn't seem able to find it...

    Does anyone know where i could check it out?

    1. Re:Protothreads source? by Anonymous Coward · · Score: 1, Informative

      http://contiki.sourceforge.net/html/a00207.html

    2. Re:Protothreads source? by Rattencremesuppe · · Score: 3, Informative

      You find it in the contiki CVS.

    3. Re:Protothreads source? by Lisandro · · Score: 1

      You = the man...

    4. Re:Protothreads source? by Anonymous Coward · · Score: 0

      ...and so are you!

  6. Read the coroutine article by renoX · · Score: 3, Informative

    The article give a link to an article describing a trick to implement coroutines in C, I found it quite enjoyable to read:
    http://www.chiark.greenend.org.uk/~sgtatham /corout ines.html

    It is nice for a change to read about an "ugly trick" which is used to increase readability!

    1. Re:Read the coroutine article by jericho4.0 · · Score: 1
      linkified

      A very interesting read. The Dunkels interview is also very good, this guy seems to be doing some very interesting things.

      --
      "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
  7. Imagine... by NuclearDog · · Score: 1, Funny

    Imagine a beowulf^H^H^H^H^H^H^Hcontiki cluster of those things!

    Oh... wait...

    --
    This statement is forty-five characters long.
  8. Local weather webcam by Anonymous Coward · · Score: 1, Insightful

    I would like to see a local weather collaboration system.
    If we could have cheap weather stations and webcams staring at the sky, linked together with users multiple users per town then MythTV could not only say if today will have some rain, but could verify if I can bike to the train station without getting wet.

    The sensor network of webcams could track and predict individual clouds and rainfall as a the wind pushes a raining cloud across the sensor network of multiple webcam equipped homes.

    1. Re:Local weather webcam by Anonymous Coward · · Score: 0

      Great idea, but I don't think 8-bit microcontrollers running contiki are really suitable for image analysis!

    2. Re:Local weather webcam by Chaostrophy · · Score: 1

      I've long thought this would be a great idea, get the local TV (or other) broadcasters to push it, and distribute cheap sensors that you plug into your computer, and then use the network to process the data, thus giving you very high resolution forcasting for any urban area.

      --
      Plato seems wrong to me today
  9. Sensor Network Hallucinations? by macemoneta · · Score: 1

    The article and references are, of course, Slashdotted. Are sensor networks subject to hallucinations? That is, are they secure enough to prevent false input (intentional or otherwise)?

    --

    Can You Say Linux? I Knew That You Could.

    1. Re:Sensor Network Hallucinations? by ucdoughboy · · Score: 0

      The fact that each node in the network is low bandwidth and low processing power makes it very challenging to implement security. There has been encription schemes developed but its challening to build strong encryption without incuring unacceptable overhead. And even with strong encryption the network is susecptable DOS attacks since you could just flood the network with junk msgs.

  10. uIP by cachimaster · · Score: 0, Interesting

    That piece of software is great, it uses a lot of interesting tricks to work in such small memory footprint. Adam itself helped me to implement it on mi own pet OS Picix , for te PIC18 microcontrollers, and works very well. It almost fills a 10Base-T card, and the processor is only 8 bit and 40 mhz!

  11. Why not by jerometremblay · · Score: 1

    Anything with an input can be fed junk.

  12. Sadiq's post contains some misprints by Anonymous Coward · · Score: 0
    For example, in the original article:
    I never thought that such a small RAM configuration would ever be used in a real system.
    In Sadiq's post:
    I never thought that such a small RAM configuration would ever be used in my pants.
  13. Trivia! by isecore · · Score: 1

    I actually met Adam while he was in high-school. One of my childhood friends was in the same high-school class as he was.

    We arranged what we called a "hack" (essentially a more fun LAN, long before the LAN-scene came to be) where we assembled a shitload of computers at someones house and did all kinds of goofy stuff (programming, graphics, music, pranks, etc) and had a blast for 2-3 days at a time.

    This guy is probably a bona-fide genius. I remember him lugging his C64 there, and he decided to show us one of the cool demos that he had coded. Unfortunately he couldn't find the disk containing the demo, so he sat down and started writing the demo-code in hex from what he remembered of it! After about 20 minutes of typing he had finieshed it, and showed us a working demo-effect of a cube on fire. Really cool!

    This was probably back in early '96 or so.

    --
    I enjoy large posteriors and I cannot prevaricate.