Ironically my first project hasn't used a Netduino yet. I’ve started playing with using XBee units to transmit a remote value of a light sensor, and it turns out the XBee units are based on their own microcontroller that has a reasonable amount of built-in functionality so you sometimes don’t need an additional fully programmable controller. Even more wacky, you configure the things with a variation of the good old Hayes AT command set, something that I’m more than familiar with from my modem days, but that frankly I was hoping to never see again.\\r\\n\\r\\nSo this project has two parts- a remote unit that just uses an XBee transmitter to read the value from a photo resistor, and a second XBee unit that receives the data and interfaces with a PC via USB. For this first attempt I’m using two XBee series 1 units, [two Uartsbee interface units](\"http://www.makershed.com/Uartsbee_V4_Xbee_FTDI_Adapter_p/mkseeed16.htm\") and a breadboard.\\r\\n\\r\\nThe Uartsbee units are pretty convenient to get going at first with the USB interface, but their design as one big flaw. The XBee units themselves aren't compatible with breadboards since their pins have 2mm spacing instead of the .1”/2.54mm spacing that the breadboards use. The Uartsbee device however has its two rows of pins so far apart that if you put it in a breadboard it fills the entire width of the breadboard giving you no room to attach them to anything.\\r\\n\\r\\n![](\"http://www.alexhopmann.com/wp-content/uploads/2012/11/light-sensor.jpg\")\\r\\n\\r\\nMy project was modeled after one in chapter 4 of [Building Wireless Sensor Networks: with ZigBee, XBee, Arduino, and Processing](\"http://www.amazon.com/gp/product/0596807732/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=0596807732&linkCode=as2&tag=lancairtalk-20\")![\"\"](\"http://www.assoc-amazon.com/e/ir?t=lancairtalk-20&l=as2&o=1&a=0596807732\"). For this project I needed to wire the photo resistor to the analog input with connections to ground and +3.3v. However the necessary pins were on opposite sides of the board and I couldn't plug them in to my breadboard. The hack I did was that I configured IO pins 1 & 2 to be digital outputs and set one to low and one to high. That gave me the ground & +3.3v signals that I needed. I just used the USB connector for power, and that way didn't have to attach anything to the other side of the board. I did however have to hookup one additional pin that the book doesn't mention- they didn't show wiring to the vREF and I couldn't get it to work until I saw a reference to that in the [XBee documentation](\"http://ftp1.digi.com/support/documentation/90000982_H.pdf\") and attached +3.3v to vREF (pin 14).\\r\\n\\r\\nNext step was to configure the XBee units. I hooked them both up to USB and ran the XBee X-CTU utility twice. It showed me COM3 and COM4 and I used the terminal mode to hook up to each unit on a distinct port. The only configuration that was really required was on the “remote” unit- I hit it with-\\r\\nATD02 (analog input)\\r\\nATD15 (digital output high)\\r\\nATD24 (digital output low)\\r\\nATIR 3e8 (sample rate every 1000ms)\\r\\nATWR (write configuration)\\r\\n\\r\\nAfter the ATIR command data started showing up on the “PC” side XBee- success!\\r\\n\\r\\nLast step is to write a program to read the data on the PC side. I was really happy to see that the drivers just made the output from the XBee show up as a serial port so I could just use System.IO.Ports.SerialPort to read it. The documentation on the packet formats were a bit confusing so I spent a little time decoding them and I still get packets that are a different size than I expected, but I got the whole thing working- code is below.\\r\\n\\r\\n \\r\\nusing System;\\r\\nusing System.IO.Ports;\\r\\n\\r\\nnamespace XBeeBase\\r\\n{\\r\\n class Program\\r\\n {\\r\\n static void Main(string\[\] args)\\r\\n {\\r\\n SerialPort port = new SerialPort(\\"COM3\\");\\r\\n port.BaudRate = 9600;\\r\\n port.Parity = Parity.None;\\r\\n port.DataBits = 8;\\r\\n port.StopBits = StopBits.One;\\r\\n port.Handshake = Handshake.None;\\r\\n\\r\\n port.Open();\\r\\n\\r\\n try\\r\\n {\\r\\n while (true)\\r\\n {\\r\\n byte\[\] buffer = ReadPacket(port);\\r\\n\\r\\n switch (buffer\[0\])\\r\\n {\\r\\n case 0x83:\\r\\n int sigStr = buffer\[3\];\\r\\n int options = buffer\[4\];\\r\\n int numSamples = buffer\[5\];\\r\\n int chanInd = buffer\[6\] \* 256 + buffer\[7\];\\r\\n int value = buffer\[buffer.Length - 3\] \* 256 + buffer\[buffer.Length - 2\];\\r\\n if (numSamples == 1 && buffer.Length == 13)\\r\\n {\\r\\n System.Console.WriteLine(\\"Read str= \\" + sigStr + \\" opt=\\" + options + \\" len= \\" + (buffer.Length-1) + \\" num= \\" + numSamples + \\" chan=\\" + chanInd + \\" value=\\" + value);\\r\\n }\\r\\n\\r\\n break;\\r\\n default:\\r\\n System.Console.WriteLine(\\"Invalid input \\" + buffer\[0\]);\\r\\n break;\\r\\n }\\r\\n }\\r\\n }\\r\\n finally\\r\\n {\\r\\n port.Close();\\r\\n }\\r\\n }\\r\\n\\r\\n static byte\[\] ReadPacket(SerialPort port)\\r\\n {\\r\\n while (true)\\r\\n {\\r\\n int b = port.ReadByte();\\r\\n if (b != 0x7e)\\r\\n continue;\\r\\n\\r\\n int sizeH = port.ReadByte();\\r\\n int sizeL = port.ReadByte();\\r\\n int size = sizeH \* 256 + sizeL;\\r\\n byte\[\] buffer = new byte\[size + 1\];\\r\\n\\r\\n int pos = 0;\\r\\n while (pos < size + 1)\\r\\n {\\r\\n pos += port.Read(buffer, pos, size + 1 - pos);\\r\\n }\\r\\n\\r\\n // Ignoring the checksum. Ideally we would validate it here.\\r\\n return buffer; \\r\\n }\\r\\n }\\r\\n }\\r\\n}\\r\\n \\r\\n\\r\\nReferences-\\r\\n[Building Wireless Sensor Networks: with ZigBee, XBee, Arduino, and Processing](\"http://www.amazon.com/gp/product/0596807732/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=0596807732&linkCode=as2&tag=lancairtalk-20\")![\"\"](\"http://www.assoc-amazon.com/e/ir?t=lancairtalk-20&l=as2&o=1&a=0596807732\")\\r\\n[XBee documentation from Digi](\"http://ftp1.digi.com/support/documentation/90000982_H.pdf\")\\r\\n[XBee Adapter Kit](\"http://www.makershed.com/product_p/mkad13.htm\") I didn't use this one yet but it looks better than the one I did use for the breadboard unit.\\r\\n[XBee Series 2](\"http://www.makershed.com/product_p/mkdg02.htm\") I used the Series 1 so far for this project but the Series 2 are more flexible.