Getting Started With NetDuino

After my previous foray into Arduino and XBee, I was hoping to be able to use Node.js as the “on-the-metal” OS of sorts for running the Atmel microcontroller. Unfortunately, Node.js (in it’s default configuration) is too big to run in the memory and program storage constraints of the Arduino uController. Not wanting to write my control applications in Arduino Sketch or C, I decided to switch over to using NetDuino as the central controller hub of my real world control project. This is the story of getting started down that path.

I already have a copy of Visual Studio 2010 Professional, which is more than enough to start writing NetDuino projects, but I did need to get the latest version of the .NET Micro Framework. As of this writing, that is version 4.2 RTM, available here on Microsoft’s CodePlex site.

I didn’t realize it, but I would need an SDK for the Netduino Plus itself – found that on the Netduino website here. They suggest installing the .NET Micro Framework 4.1, but I had already installed 4.2 so I decided to throw caution to the wind and try it anyway.

  • Project->New->Micro Framework->Netduino Plus – give it some name that you will inevitably regret later
  • Open program.cs, add some code like:
  • while(true)
    {

    }

    Ok, I did a whole bunch of stuff that I will document later, but I have a Netduino acting as central controller and an Arduino acting as a remote controller attached to some irrigation valves. I have a web server running on the Netduino and a simple web interface for turning my irrigation valves on and off. That’s my big accomplishment for the day.

Getting started with Arduino and Xbee (Part 2)

When we left our hero last, he was in rapture pressing the ‘H’ and ‘L’ keys and seeing an LED on a small electronic device turn on and off. We won’t deign to judge him based on what causes him rapture, but we will continue to explore this miracle of the keys and the lights. See Getting Started with Arduino and XBee (Part 1) for the beginning of this story.

The next step for me was to see if I could get two independent Arduinos talking to each other over XBee. At this point we had one connected to the computer and one running independently. So what was it going to take to make this happen? I would have to have the PhysicalPixel sketch running on the receiver (sender and receiver are arbitrary, but we will go with it) and some kind of sending sketch running on the sender (Duh!). The sender would send an ‘H’ upon some input from the user. That would mean I would have to have both Arduinos with XBee shields running independently. I ran into a bit of a problem here. I didn’t have a second USB cable to power both Arduino’s, so a quick trip to the Home Depot next door was in order.

Two XBees Talking

Two XBees Talking

Before I shot off to Home Depot, a quick perusal of my electronic kit bag turned up a 9V power adapter. Now Arduinos work swimmingly with inputs anywhere between 7V and 12V, so a 9V connected to VIN and GND would do the trick nicely. So at Home Depot I picked up a tiny USB hub and some 9V batteries. See previous post on why I needed a USB hub. Hooking everything up gave me what you see in the above picture. With PhysicalPixel running on the left, and a modified StateChangeDetection running on the right, I was able to send ‘H’, ‘L’ from the right Arduino to the left Arduino upon pressing a switch connected to GPIO2. The on-board LED on Arduino on the left would turn on and off in response to these ‘H’s and ‘L’s. This is what is called success, I now had two Arduinos talking to each other without the intervention of the mother computer. It was time for them to fly, but before they could fly, I needed to upgrade their OS’s. I wanted something a little more communicative and inter-operable than the Arduino sketch language – it was time to introduce Node.js. See the upcoming post on Arduino, XBee and Node.js for more fun and frivolity.

UPDATE: I had thought that projects like node-arduino and NoDuino were actually ports or cross compilations of the Node.js environment to the Arduino, but it turns out I was mistaken. They are, instead, ways to control your Arduino from the host computer using Node.js. Not what I wanted at all. I was hoping to have Node.js running natively on the Arduino like an OS. And, well, despite my few hours spent digging around I couldn’t find specs on the footprint of a typical Node.js compiled core. Seeing as it incorporates the Google V8 Engine, however, I’m not holding out very little hope that it will fit in the Arduino’s 32KBof flash storage, 2KB of memory and 1KB of EEPROM. Even the Netduino’s specs seem a little low, although the new Netduino GO might be just enough. Guess I’ll just have to ramp up development on my new Physical Computing Platform or Real World Computer.

UPDATE 2: I will be revisiting my desire to run Node.js as an “operating system” on these micro controllers. I may instead switch over to Netduino technology and use the .NET Micro framework.