So I decided to jump in to serial communication.  Why not?  I have a ublox LEA-5H-0-009 GPS Receiver and a GS407 break out board from I connected the red (3.3v) and the black (gnd) from the GPS to the netduino.  There is a TXO and RXI pin and a GPIO pin on the GPS break out board (BOB).  I admit, I had to google a lot.. I mean a LOT to figure this one out.  Eventually I found a great article from with 99.9999% of the solution. 15.35.28

I learned a lot about serial communication from reading Bob’s article.  In summary, what I learned is that I can use D0 and D1 on my netduino as a serial port COM1.  D0 is COM1 IN or RX and D1 is COM1 OUT or TX.  The last piece of the puzzle was the GPIO pin on the GPS.  Clueless me had no idea what to do with the GPIO pin.  After reading his blog, it seems that is used to turn on and off the power.

Here are a few better views of the connections.  Ignore the IC chip and the three axis sensor on the project board. 15.35.38 15.35.28

When I first connected the device I was getting nothing from it because the TX and RX were flipped.  Then, I started getting bytes from the serial port but they were poorly formatted and I could not convert them to UTF.  This caused errors when using the System.Text.UTF8Encoding.UTF8.GetChars(buffer); code.  As it turns out the baud rate needed to be 9600 and I had it at 4800.  After that fix I was set and I was getting NEMA messages.

It does not look like it is picking up a signal yet but that is my next step.  Get the messages decoded and get the device to lock on a few satellites.

Here is the code I used which I got from Bob’s post and tweaked a bit as I was running into issues decoding the bytes because of the baud rate issue.

So the Variable Resistor (POT) was cool and really easy.  So there is another sensor in the box which should work pretty much the same way.  The thermometer also has a red, black, and white wire so this tells me it works the same way.  Analog circuit based thermometers are called thermistors which mean they are variable resistors that change the impedance based on a temperature.  So my code should look the same as my Day 1’s blog entry.

I added a debug statement to output the actual thermometer value.  I quickly noticed that my room temperature reading was a 422 or 424.

The output window looked like this:

So breathing on the thermometer yielded about a 500 reading.  So there was a 78 point difference, the LED was blinking slower as the temperature went up but not noticeably.  So enter some math to make the spread more apparent.  I decided on a simple algorithm, take the value from the thermometer, subtract 422 to get the difference and multiply by 10.  I figure this would generate a more obvious change in blink rate.

I added the System.Math.Abs() method call to ensure that I did not pass a negative number to the Thread.Sleep() method call.  The code looks like this and flashes faster as the temperature nears room temperature and slower as it gets warmer.

My friend Todd stuck four red boxes in the trunk of my car and told me I needed to master embedded programming against one of the three boards in the boxes: Netduino, Arduino, and a FEZ Panda II.  This is the beginning of my endeavors into embedded programming.  I have tinkered with electronics in the past but could not quote any of the electrical laws.  I have been programming for 15 years though most of that with .NET / C# since it was in pre-beta so this should be pretty simple.  I decided to blog my learning process in case another electrically challenged developer finds him(her)self in the same position as me.

My first blind project I decided to tackle is blinking an LED on the netduino board with a delay controlled by a variable resistor (knob).

So I grabbed an E-BLOCK POT VARIABLE RESISTOR which has 3 wires: red (positive), black (negative), and white.  The red and the black were pretty obvious.  I hooked the red up to the 3.3v on the netduino’s power block and the black to ground. 


The white I figured was the output.  This is clearly an analog device so I figured I should hook up the white to the Analog 0 (zero) pin on the netduino.

I saw some articles on flashing the LED on the board and that seemed pretty simple so I just needed to figure out how to get the resistance value from that white wire.  I quickly found the AnalogInput class and with some intellisense I found out that the constructor took a Cpu.Pin value to read the analog input.  Further object browsing showed me a higher level class supplied in the netduino SDK that humanizes the Cpu.Pin enums.  The SecretLabs.NETMF.Hardware.NetduinoPlus.Pins.GPIO_PIN_A0 pin looked like the one I wanted.

Next I found the OutputPort class that let me play with the LED.  I passed SecretLabs.NETMF.Hardware.NetduinoPlus.Pins.ONBOARD_LED to the constructor there and this lets me set the LED on and off.

Executing the code resulted in the video below.  As I turn the knob of the POT the value read from the analog input changes thus changing the value input into the Thread.Sleep() method. So the LED flashing is relative to the amount of resistance on the variable resistor.

The final product, I showed the wife and she was not that impressed 😉