Tuesday, April 15, 2014

Controlling a Netduino Robot with BlueTooth

For our April meeting, we will be controlling our Home-Built robot with a Windows Phone device, this should fun so hang on!

We will be using this Bluetooth Module


And the following USB Serial Port Adapter


First thing we need to do is configure our BlueTooth Module.

1) Power your Bluetooth Module with your Netduino

VCC –> +5V (Netduino)
GND –> GND (Netduino)


2) Connect your BlueTooth module to your FTDI Serial Adapter

FTDI  Netduino   BlueTooth Module
TX                          RX
RX                          TX

3)  Open up Device Manager, and identify the serial port that is associated with your FTDI adapter, in my case it’s COM16, yours will probably be something like COM4.  A good way to identify your adapter is to unplug, then plug it back in.  The one that disappears and reappears is probably the one you want to look at.

3) Download and start RealTerm

4) Configure the initial baud rate of 9600 on the “Port” tab, then press “Change” and “Open”


5) Confirm that your port is open and the correct baud rate is set at the bottom of the screen


6) If all that looks good, then we can start to configure our BlueTooth module, commands need to be sent very quickly.  The best way to do this is open up Notepad or some other mechanism where you can enter text and then cut and paste it.

a) Open Notepad
b) Type AT
c) Copy those two characters on to the clip board by highlighting them and hit CTRL-C
b) Right mouse click in the terminal area in RealTerm, and click on “Paste to Port”
c) If all goes well you should see OK


7) Once you know you are connected, enter the text AT+NAMEXXXXXX in notepad, where XXXXX is the name how you want to identify the bluetooth device.  No CRLF at the end.   Then copy those characters and paste them into RealTerm.

8) Then set the PIN by doing the same thing with AT+PINXXXX where XXXX is the 4 digit PIN used to pair with the device. IMPORTANT NOTE: If you use a PIN code like 1234, or 0000 your phone may try to auto-pair with that value.  To get it to work successfully in your app you will need to enter a more non-traditional code, and then manually enter the PIN code via BlueTooth settings.

9) Once you have completed your screen should look very similar to the following.  Your settings will automatically be saved to the device and you can continue by connecting it to your Netduino.


Connect the BlueTooth module to Netduino

10) Now you need to connect your BlueTooth module to your Netduino, you can remove the wires from the USB FDTI and connect them to the Netduino.  See PDF here for a better view of your Netduino

BlueTooth Module  Netduino COM1
RX                              PIN 1 (TX) - D1
TX                              PIN 0 (RX) – D0
VCC                           +5V (from before)
GND                           GND (from before)

11) Next up is to connect to your BlueTooth device from your Windows Phone 8.  You will have to use an actual device, not a simulator.  Hopefully you know how to do this, but click on Settings->BlueTooth, make sure it’s turn on, and find the name of your bluetooth module.  Make sure you enter a PIN code, if it automatically pairs you may have used a known PIN such as 0000 or 1234, try something different in step #8 above.

12 After you have paired your device, download the following Windows Phone 8 application and make sure you can compile it and run it on your device.  Make sure you change the name of the device in MainPage.xaml.cs to match the name of our BlueTooth Device


13) Then download the .cs file that has the code, to insert into your .NET Microframeworks project, the code is very straight forward, just cut and paste the appropriate parts into your application.  Also, just populate the code in your project to make the inputs from your phone actually do something.


At this point, your little app should be ready to run!



14) Next download the Windows Phone 8 project.



Friday, March 28, 2014

.NET Microframeworks Group and Windows Phone/Windows Store Apps

In our continuing serious on building an autonomous vehicle, in April we will let you robot start talking to the real world!

On April 15, I’ll be doing a session on demonstrating how to remotely control and talk to your robot from a Windows Phone and Windows Store application by adding a Bluetooth module to you robot.  And then setup some very basic protocols to control your robot with a Windows Phone and Windows 8 application. 

You'll be able to get the Bluetooth device from Amazon: 


To use this Bluetooth module, you'll need to configure it, to do so, you'll need some sort of USB to Serial Port Connector such as:


You can sign up at:



Thursday, March 20, 2014

Last Mile Tip #3 – Beware of the Boring Stuff

You know how it is when you are building your application, you have the key features you need to build to make your app come to life.  In a lot of cases these key features are something new and challenging.  If you’re like most developers you are motivated by doing something new and challenging so you start on those parts of the app.  Then after you put a little time into it, things start coming together, problems start getting solved.but as you do that, there are a number of small less exciting things that need to be done to complete the app.  You know how to do it, or it really doesn’t seem that exciting so you say to yourself, yeah, I know how to do that, once I get the primary functionality in the app working I’ll come back and add in that “forgotten password” feature or that regular expression on the email address feature, or something like that.  Sound familiar?

In a lot of cases, you get the primary functionality and think you are ready to ship and then all those little extra boring tasks need to be completed.  Hopefully you read my earlier post on making lists, if you do this as you go, once you get to this point you won’t be fooling yourself in thinking, just one more thing and I can submit, you’ll have a relatively complete list of work and should be able to gauge the effort ahead of you.  As I also mentioned in that earlier post, sometimes when you come across that sort of thing, you should just shift gears a little and knock out some of the smaller items.  It may not seem exciting at the time, but will dramatically shorten your final to-do list.  Another thing that I found helpful is to start reusing assets from other projects, ideally this would be in the form of a common library you use among all your mobile projects, but even just the cut-and-paste refactoring method is better than redeveloping the wheel each time.  Also where possible if you can use an existing application frameworks they may already have dealt with a considerable number of those boring yet necessary tasks.

Last but not least, just being aware of the fact that as a typical developer you are probably deferring all the “boring” tedious development tasks as you go might be enough to change your behavior and make your last mile go a little quicker. 


Saturday, March 15, 2014

Last Mile Tip #2 – Start Using Your App as Soon as Possible

No, I don’t mean testing on your emulator.  I mean use your app in the real world as a real user would.  In software engineering terms this concept is called “Dog-Fooding”.

This is one of my top big tips that I have and is also related to something else I’ve learned about creating apps, if you are just creating an app you aren’t going to be using in your day-to-day activities or a game you wouldn’t enjoy playing, you may want to consider the premise of your app and try to find something that is a better match. 

So assuming it’s an app you will indeed use, or a game you enjoy playing, as soon as reasonably possible get it off your development machine and onto your phone or tablet you use on a daily basis and USE THE APP!  I can’t stress this enough, once you start using the app, you’ll find little things that don’t really make sense or are obviously broken but you just never come across during development.  You’ll have to trust me on this one, but for a fitness app I’m building right now, I’m using it every time I get exercise and it’s really surprising how quickly I’m moving through the last mile.


Last Mile Tip #1 – Just “Knock-Out” or Keep a List of the “Easy Stuff”

As you are building your app, there are many times that you come across something that needs to be done, but seems so easy it’s really a distraction of getting the primary functionality done.

Of course you don’t want to be pulled in too many directions while you’re building a large app, but these “Little/Easy Tasks” can really add up or uncover some other major work you don’t realize that you’ll need to do.

My strategy for dealing with these sorts of things is if they are easy and I think I’ll be able to get done in under 5 minutes, I’ll just go ahead and try to complete.  These aren’t things that you know you’ll have do like “Create A Forgot Password Feature”, this is stuff like “Need a clearer icon for XYZ” or “Add validation for emails addresses to sign up screen”.  If I know it will take a little while but I still consider it some of the “Easy Stuff” I’ll get to once everything else is done, I put in a list.  Of course there are lots of tools out there to help with this, but if you just want to get started, create a simple Misc.txt or Todo.txt as a text file in your solution or project. 

Obviously you can get fairly advanced how you compile and organize our lists, but get started, today, I mean right now on the application you are working on.  If you come across something easy you want to defer, write it down, you’ll be surprised how quickly this list adds up.

Bonus points for keeping this under revision control with the rest of your source files.


Last Mile Tips

We have a very exciting event coming this spring for Windows Phone that I’ll share more about in the future.  However in preparation for this, I’m going to be compiling and releasing a set of “Last Mile Tips” to help you release your Windows Phone or Windows Store Apps quicker and easier.

If you’ve ever written any sort of mobile application, you know that it’s pretty easy to get to the 90% mark of being done, right?  Isn’t it?  That’s the fun part where you get stuff working and the app starts to come alive.  During that 90% you come across a number of things that are just easy and will get done relatively quickly so you just skip them and continue on with the fun part of making progress and making your app come alive.

Then what happens?  You hit the last 10% and BOOM!  Death by a thousand cuts, you spend the next 90% of your time on the project finishing up those “last simple and easy things”.  If this has happened to you, welcome to the club, you’re not alone!

I certainly don’t have all the answers here to tame the last mile, but I do have a number of things that have worked.  Join me over the next few months as I share my experience as well as things I’m learning as I make a concerted to solve this last mile problem.

As we go forward, if you have any tips or tricks that you use, just add them as a comment and I might just add them as post (giving you credit of course).

Stay tuned, things are about to get exciting!


Sunday, March 9, 2014

A “Bug” in my Software

As a beer drinker, I’ve discovered Home Brewing over the past couple of years.  As a hardware hacker I needed to combine my love for beer with my love for hardware. 

After finding out how much of PITA it is to bottle my home brew, being the lazy I’ve gotten into Kegging and have this awesome kegerator. 



As an hardware/software engineer I couldn’t resist the urge to create little board to control the temperature of my kegerator.


In case anyone cares about the board…the two blue terminals on the left take in 120VAC on one set.  The other set provides switched 120VAC to control the compressor and thus the temperature on the kegerator.  The white component directly to the right of the terminals is a 120VAC to 9V converter, the black box on top of it is a relay and the smarts on this board is an Electric Imp on the top right.  The little gold terminals at the bottom are where a thermostat is connected as well as a serial output for a display.  Contact me if anyone wants the eagle files, it’s actually pretty easy to assemble.

This board has a 4x20 LCD character display on it as shown in the picture below (inside a 3D printed case).  As you can see the display looks terrible, a considerable number of rows are no longer lighting.



Upon closer examination, there is a “Bug” that somehow got into side the display and looks like it screwed it up :) poor guy…