Building a Windows Phone controlled Wi-Fi Gadgeteer Image Streaming Robot
- Posted: Aug 10, 2012 at 6:00 AM
- 7,146 Views
- 4 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Today's Hardware Friday project is another cool project from Marco Minerva, Friend of the Blog. This project brings so many things together that it could have been called the Kitchen Sink project...
I have upgraded the .NET Gadgeteer Robot I described in the post Constructing a Bluetooth controlled Robot, replacing the Bluetooth Module with Wi-Fi and adding a camera to stream images. The result is a Robot that can be controlled by a Windows Phone application, with which it is also possible to show captured images.
Let’s start seeing the new Gadgeteer application, that uses the following modules connected to a FEZ Spider Mainboard:
- USB ClientDP;
- WiFi RS21, to allow connections to the device;
- Multicolor LED, to indicate device status;
- OLED Display, to show the IP Address of the device;
- Motor Driver L298 to control rover movements;
- Camera, to capture images.
You can see the result in following screenshot.
From hardware to the phone app, it's all covered, including the challenges he faced.
Getting and showing image streaming, instead, require a bit more work. First, we use RestSharp, a library that simplifies the process of making requests via HTTP and processing responses in an asynchronous way. But then, we have a problem: Windows Phone doesn’t support BMP format, that is used by .NET Gadgeteer camera module. So, we need a way to load images in this format and convert them in a format that Windows Phone can handle (i.e., in PNG or JPEG). For this task, we’ll use ImageTools, that is available on http://imagetools.codeplex.com.
But there is another problem: if we try to read images that come from .NET Gadgeteer camera module with ImageTools, the height property is always negative. So, the read operation causes an exception. To solve this issue, I have downloaded the source code of ImageTools and applied a little hack to the library, in order to take the positive value of height. Doing so, the image is read correctly, but it appears flipped. This is the reason for which I have applied a ScaleTransform tranformation on image object in XAML, so that it is shown in the right direction. Of course, a better approach is to modify the code that reads the bitmap, but for the moment this solution is acceptable. As always, you can find the modified version of ImageTools library in the ZIP file that comes with this article.
And of course the source is available, both used inline to explain how he built it;
As well as a the complete Visual Studio Solutions (click through for the download, at the bottom of the post).
If you're ready to create your own Wi-Fi networked and Windows Phone controlled robot head on over to the post, grab the projects and get building!