|Getting Started with the Internet of Things|
Author: Cuno Pfister
Publisher: O'Reilly, 2011
Aimed at: Beginners
Pros: Explains the NetDuino approach
Cons: Not suitable for beginners
Reviewed by: Harry Fairhead
A book about using the Netduino Plus and the .NET Micro Framework to connect devices to the internet. Is this a good way to go?
This is all about getting embedded devices onto the internet. Specifically it is about using the Netduino Plus board to manage sensors and transfer the data to the web. It is important that you notice this point at the outset.
The Netduino makes use of the .NET Micro Framework so you are going to have to program in C#. It is an open source project and it makes a good alternative to the standard Arudino. I happen to think it's good but there are people who think that its simpler to stay with the original Arudino and its C-like language rather than move to a the more powerful and more complex NetDuino.
Also notice that the book doesn't use the low cost basic Netduino but the Plus version which comes with networking hardware built in and this costs somewhere in the region of $60. An alternative would be to use a basic model and an internet "shield" but the costs would be about the same. All in all the Netduino Plus is a good choice and is packed with extras - just make sure you realize that the projects described have a slightly higher startup cost than usual.
The book starts off with some basic ideas building up to the Hello World of all embedded coding - i.e. flashing an LED. By the end of Chapter 2 you have setup the development environment and written two short programs. However many aspects of what you are doing aren't really explained. If you don't understand what is going on before you start then it is unlikely that you are going to get any help with mastering either programming or electronics. At best the introduction is suitable for an Arduino programmer moving to Netduino.
Chapter 3 gets a bit deeper with a light switch example. You are given the program before the hardware involved is explained or even introduced. The ideal of a pullup or pulldown resistor is introduced along with the symbol for a resistor. Finally there is a box explaining the idea of positive or negative logic - i.e. does an open switch correspond to true. You can see that the technical level is up and down and the presentation is all over the place.
The next example makes matters worse in that it is likely to confuse any beginner over what a voltage divider is all about. The box at the end is the final straw. It explains that a potentiometer is like a voltage divider with two resistors and that the potentiometer allows you to change one of the resistors... Of course a potentiometer changes the position of the movable connection and so changes the ratio of the two resistances while keeping the total resistance unaltered. Ok I know it is a small point but it is typical of the casual attitude taken to explaining the electronics side of the task.
The hand-drawn schematics and layouts are nice and they lend an air of simplicity to the descriptions. However, overall they are not enough for the beginner to follow what is going on.
Part II of the book moves on to look at networking and HTTP in particular. After a quick look at principle we move on in Chapter 5 to see how Pachube works. While I'm a fan of Pachube starting out by explaining how to use it is a strong and arguably unjustified bias. Chapter 6 is a hello Pachube world program and it serves to show how HTTP works in practice when you have a server already set up. This is really the only justification for starting with Pachube - i.e.. to avoid having to describe the client and the server side of the task at the same time. However, by this point the example code is getting long and explanations thinner.
The next three chapters shows how to perform HTTP requests using raw sockets for efficiency and the Pachube example is reworked using sockets.
Part III moves on to look at how to create an HTTP server - i.e. the other side of the interaction. Of course the problem with writing a server that is supposed to be accessible on the public net is that most will go through a NAT router and/or firewall. What this means is that while the device might be accessible on the local network it isn't going to be on the public network because of the lack of a routable connection. The author doesn't really discuss this problem in any detail and doesn't discuss the range of possible solutions - port mapping and VPN, for example. Instead the solution presented is to use a relay in the form of Yaler - the author's own software. This you can download, including the source code, and use but it isn't open source and their might be a commercial version in the future. OK, but the reader should realize that there are other solutions and writing your own relay is a fairly trivial project. Finally writing a "server" that uses a relay isn't really writing a server, although to be fair the author's code library that works with Yaler does follow the conventional HTTP server class structure.
Chapter 13 Going Parallel opens a can of worms. One of the big differences between Netduino and Arduino is that, being based on the .NET Micro Framework and having a powerful processor, it supports threads. Shock horror! Threads are difficult to get right at the best of times and they are often banned, along with interrupts of any kind, in any embedded device that needs to be robust and error free. OK, accepting that you are going to use threading and asynchronous programming then you need a lot more than this chapter to make sure you do it right. Read the chapter, understand the dangers of race hazards and deadlocks and then go and find out more. Don't build any device that has a serious task that makes use of threading unless you know what is going on.
Running in the background of all of the chapters on creating a server is the philosophy of REST. This is the reason that so much time is spent explaining the way GET and PUT and so on work. While a REST-like API is always a good idea, the author doesn't really justify the use of the full REST philosophy which many would argue is just a step too far, especially so for embedded processing. We finally get to a discussion of REST in the final chapter along with other odds and ends.
The final verdict on this book has to be that it is quite good in places but it is not for the complete beginner either to programming or hardware. If you have some background in Arduino techniques then the book does explain some of the differences between it and the Netduino which is something of a different world. The important things to realize before you buy this book is that it is a very specific - i.e. Netduino Plus, C#, Pachube, Yaler, REST and so on - take on the topic.
|Last Updated ( Friday, 24 June 2011 )|