Administrative note: 6 more weeks of school, and I should be able to get back to a regular blogging schedule, I’ve just been running out of time lately!
I’ve always had an interest in having computers and the real-world talk to each other. However, to do this has always been notably difficult. You had to be pretty hardcore with C/C++ and Assembler – which are both not-fun (for me). This notion of standalone code running on a small computer-board (not hooked to a PC) is often referred to as "embedded programming", and it’s always been complicated.
Interface boards and Phidgets:
Well, my "gateway drug" into this idea started when Jamie introduced me to www.Phidgets.com. Phidgets gives you an "interface board" that you hook to a computer, and off that interface board, you can have input sensors, output controllers, displays, etc. Note though that these interface boards need to be connected to a computer in order to work (assuming you don’t use the SBC they sell).
This idea can certainly be very useful, the developer can fully-utilize the power of the .NET Framework and make some pretty cool gadgets. I mean for input sensors, you can get pretty much anything you can imagine: temperature sensor, accelerometer, GPS, water flow meter, etc, etc – it’s endless. These analog sensors cost anywhere from a few dollars to perhaps a hundred, and can hook up to most of these types of devices.
So again, this is almost a limitless idea – the hardware is cheap, you can use the .NET Framework, but the one downside is that this interface board and the sensors are tethered to a computer, where all the logic runs. So even if you did create a little device with some sensors – it would need to be connected to a nearby computer to work.
But what if you could have the power of the .NET Framework, but have it self-contained on a tiny board? What if you could create a little gadget that worked with input sensors and output controllers – but didn’t need to be tethered to a computer? Enter the .NET Micro Framework!!
What is the .NET Micro Framework:
I don’t have a deep understanding of this, so I’ll explain all of this, as I currently understand it. I’m sure someone will correct me if I misspeak! The .NET Micro Framework (NETMF) is like a super-tiny operating system and framework that you can write programs against with C#. The NETMF runs on a handful of devices by a few different vendors. For example, I started off with a FEZ Panda from www.ghielectronics.com for like $39. It’s super-tiny – I also got an enclosure/case for it too for like $12.
The actual FEZ Panda board is smaller than credit-card/Dunkin Donuts card-sized – and it can run off of USB power (while you are writing and debugging apps) – or later can run off a 12V power supply when deployed to the field.
So let me try to put all of this together – you install some software and SDK’s, you then use Visual Studio 2010 to write applications that you can test/debug in a software emulator OR actually deploy to one of these devices. Later, when you plug in the power to this device, it boots up and launches your program – no external computer needed, your application RUNS on this little board.
Well imagine for example you want to measure how much water you use in your house. You could get a NETMF board, an enclosure, a power supply, and a water flow analog sensor ($10). You could then write a NETMF app that reads the sensor data and offers it over the network for example. You could even create something like how an IP camera works too – where you host a mini web server to display the information too, all running off this little board. Put another way, imagine down by your well pressure tank you have a box like above, plugged in with a 12V power supply, and a little pair of wires that come out of it and connect to a water flow meter. From your computer upstairs, you could connect wirelessly with WCF, via TCP, or via a webpage that is hosted on this little board!
The potential here is limitless – and super-cheap! The board, case, power supply, and sensor would be around $80-90, plus perhaps another $89 for a wireless add-on for this board (and there is plenty of room inside the case for that too).
Taking it to the next level:
But wait, it doesn’t stop there – not even close! The board above is a bare-bones board. It has the NETMF on it, it has a 72MHz processor and around 200KB of usable storage – and that’s pretty much it. You can add-on all sorts of things to it, but out of the box – that’s it. This board supports up to 6 analog inputs too (e.g. sensors).
"Shields" are other boards that can sit on top of boards like this, that do specialized things. For example, there are shields for ethernet, wireless, for display, for expansion, etc. There are also expansion modules that are small boards that you don’t physically mount to this board – but would mount somewhere else in your enclosure.
So what if you did want to take things to the next level? Well, you can piece together all the parts, and put something together a la carte – or you can buy more higher-end boards that have these things built-in. For example, the FEZ Cobra – it has:
- Similar 72MHz processor
- Around 15MB of usable storage
- Support for TFT touch screen
- Full TCP/IP stack with support for up to 128 connections
- Onboard 10/100 ethernet
- Onboard 4-bit SD card slot
- Onboard piezo speaker so you can have the board make a sound
So with a board like this, you can get up to a 7" touch screen and run WPF-like applications (see here for an example: http://www.innobedded.com/product.html), hook up a wireless extension – and you can have a standalone device that runs off 12V power, and has a touchscreen interface. For this, this is going to run you much more – perhaps around $400 or so, including wireless, a 3.5" touch screen, and an enclosure – but depending on your needs, that still isn’t a big expense.
So what’s next?
For me – I don’t know. I find this whole topic very interesting. I am lucky enough to work with a lot of really smart people, including my manager who used to "real" embedded programmer (like with C/C++ and Assembler) – and his perspective and translation of this new NETMF world has been really valuable. I want to continue to learn the NETMF, as there are many things that are different or missing (like String.Format()!!!). I’ll post up here if I can do something interesting. I’ve also learned that embedded programming, the mindset, is quite different from what I’ve done my whole career. WIth this code, it’s closed, highly-specialized, you don’t need to worry about or write for reusability – it’s all about performance, efficiency, and simplicity – which is different for me. In fact, one of Ed’s quotes:
"It’s really easy to make a complicated system and it’s very difficult to make a simple system" –Ed Tornick
Meanwhile, if you were curious about the state of the .NET Micro Framework or wanted a crash-course, hopefully this helps. This is truly a new level for this branch of technology – it has never been easy/easier for a regular developer to make embedded devices, but now you can do it using the tools you know and already have, and by buying some pretty inexpensive hardware – the sky is the limit!