The Netduino and Arduino are inexpensive (about $30-$35) small single-board computers that have allowed lots of regular people to create devices containing an embedded computer. If you’ve never heard of them, you probably don’t care about the rest of this article.
I recently got one of the new Netduinos, and have been playing with it. I’d previously done half a dozen Arduino projects, so I was interested in the differences. I have to say, I was very impressed with it, but there are differences you should know about before you jump into using a Netduino.
Before We Even Start
The slugline for the Netduino is that it is like an Arduino, only using C# and .NET for programming. That’s accurate, but there’s more to it. Current Arduinos have the ATmega328, or its USB-supporting cousin, the ATMega8U2. These are fairly simple 8-bit processors, running at 16MHz. The Netduino has an Atmel 32-bit ARM7 processor running at 48MHz, similar to the processor in many laptop computers. It has a much larger program space (128K, not including the .NET runtime, vs. 32K for everything on Arduino), and a much larger RAM space (60K vs. 2K). The Netduino itself, the schematic, layout and code, is entirely open-source.
The Netduino board is the same size and shape as an Arduino board. It has the same sockets for shields labled the same way, the same power connector, and a USB connector. The USB connector is the mini size like many cell phones use, rather than the full size one on the Arduino Duemilanove and Uno. (This is an improvement, as shields rest dangerously on top of the metal USB connector.) The USB connector is in the center of that end of the board rather than on the left edge. Like the Arduino, the Netduino has a reset button in the same spot, and a power LED (bright white), and an LED on digital output 13 (bright blue) in different board locations than on the Arduino. There is a place to install a 6-pin header at the back of the board, though no header is installed, in the same spot Arduinos have a similar header. The TX and RX monitor LEDs that Arduinos have do not exist on the Netduino.
First, as you might expect, the development environment only runs under Windows. It requires Vista or Windows 7. Like the Arduino, you can set up a complete development environment for free. Unlike the Arduino, it is not all open source, and in order to be legitimate, you will need to register for one component. There are three components you need to install (one is open-source), but once you do that, it works well. You don’t even need to install a device driver (this is done as part of the other installs). You will be working in the Visual Studio 2010 environment, which is pretty bug-free and easy to use, once you get used to it.
Something I don’t hear mentioned is that this setup provides a far superior debugging environment. You can do both emulation and in-circuit debugging, unlike the Arduino environment, which currently doesn’t do either. When I told Visual Studio to debug my program, it downloaded my code onto the board and started running it. I was greatly surprised that when I clicked next to a line of code to set a breakpoint, the code running on the board immediately stopped at the breakpoint, and I could single-step through it, then set other breakpoints and proceed.
I have been programming the Netduino in C#, which is similar to Java in many ways, but you may be able to use Visual Basic as well. Once I got used to doing embedded development in it, I liked C# better than the Arduino language. The Arduino language is a simplified version of C, but almost anyone who uses it ends up needing regular C constructs (like sizeof()), so you get code that is a mix of Arduino and C. C#, like Java, has many constructs that make the code more elegant and easy to read than C. And the .NET micro library is more extensive for some functions than the Arduino standard library. Also, C# delegates are a much cleaner way of setting up handlers for events, a lot of what your code likely will be doing.
A Drop-In Replacement?
The Netduino is not a drop-in replacement. If you will only be doing digital I/O at low current, you probably can get away with using it that way, but there are a variety of differences you need to be aware of. Some of these differences may make it a better fit, and some of them may make it a worse fit. In any case, you don’t want to plug a Danger Shield (for example) into it and turn it on (analog voltages are too high).
|Chip power||Internally, the CPU runs at 3.3V, not 5V like the Arduino, though it uses the same power sources|
|Digital I/Os||Go from 0V to 3.3V, not 5V. It will work with most 5V logic circuits, input and output.|
|Analog Inputs||Must not go higher than 3.3V!|
|PWM Outputs||PWM is often used like an analog output. Since 100% averages to 3.3V instead of 5V, circuits may work differently|
|Libraries||None of the Arduino libraries, which are C and C++ code, will work on the Netduino without modification. If you use a board-specific library, you may have to rewrite it.|
|USB Connector||Uses cell-phone type mini USB connector|
|I/O Current||The pins on the CPU can drive a maximum of 8mA of current, which is less than Arduino|
|CPU||32-bit Atmel ARM, instead of 8-bit ATmega|
|Speed||48MHz instead of 16MHz|
|Program Memory||128K instead of 32K|
|RAM||60K instead of 2K|
|EEPROM||Netduino has none|
|In-circuit debugging||Netduino has it|
|Emulation||Netduino development environment has it|
|Price||As of this writing, while the Arduino Uno has a street price of about $30, the Netduino goes for about $35|
Something interesting you will find if you look at the schematic of the Netduino is that a lot of processor pins aren’t connected to anything! The processor has a lot more I/O capability than it can connect up through the standard Arduino footprint. For that reason, the Netduino guys are working on the Netduino Plus. It still has the Arduino footprint, but on the Netduino Plus board, they have an ethernet connector and a micro SD card slot. (It suddenly becomes clear why they moved the USB connector.) As of this writing, the Netduino Plus is in beta, and not generally available.
If that is not enough for you, there are currently 21 separate development boards you can buy that are based on the .NET micro framework. Most are available from Mouser.
.NET Micro Framework Hardware
If you want to write a more serious program that is larger, requires a faster processor and you want a better debugging environment, the Netduino has a lot to recommend it, and a variety of options if you outgrow it. If you want maximum compatibility with existing Arduino shields and libraries, the Netduino may not be your best option.
Here are some links to get you started on Netduino:
One piece of information that I missed including in my original post is that the USB port works a bit differently on the Netduino from how it does on the Arduino.
The Arduino lets you treat the USB port as a simple serial port, and it is very easy to write code that communicates across it. The Arduino has sorted out how to differentiate between the communication to download a new program and normal communication, and for most applications, it just works the way you want it to.
The Netduino works differently. The much more complicated communications that allow you to run debug commands and break into a running program do not allow this. You can recompile the download package without the debug monitor, which should allow you to do this (I have not tried it), but it is more trouble than working with Arduino for applications where this is important. That said, working with an in-circuit debugger is pretty useful if your code is longer than a few lines of code.
The Netduino Plus has become available in the interim (about $60), and the addition of an Ethernet port and a microSD card slot on the same size board make it appropriate for a broader range of applications. You can get free shipping if you buy it from Secret Labs through the Amazon storefront.
It’s been great to see all the response to this article. Here are some additional book resources you might be interested in.
Expert .NET Micro Framework A couple of years old (2009), with nothing specifically about the Netduino, but a very thorough exploration of software development and the framework on similar devices.
Embedded Programming with the Microsoft .NET Micro Framework Even older (2007) this is Microsoft’s official book on the subject.
Getting Started With Netduino This book is not quite out yet as I write this. It is Make Magazine’s book on the Netduino. It looks to be less deeply technical than the other books, more hobbyist-friendly, and is geared specifically at the Netduino with examples you can do right away.