Okay, it’s true that I’m a little late to Adafruit’s Windows IoT Pack party…but, hey, better late than never, right? So, as stated previously, I set out to create a prototype that would give me the chance to try integrating Windows IoT and Azure. In the spirit of keeping things simple, I just wanted to run a program on the Raspberry Pi (powered by Windows 10 IoT Core) that would poll an Azure web service and react appropriately. Sounds fairly simple, right? Well, for an old dog like me, it took a little longer than expected; in fact, it took the better part of an afternoon.
So, the steps required were:
- Create a SQL Server database within my Azure account, with a test table
- Create an Azure web service and deploy it to my Azure account
- Assemble the Raspberry Pi 2 (i.e., RP2) and the circuit (along with the LED light) for the Blinky project
- Run the Windows IoT dashboard and connect to the running RP2
- Download the Blink project and modify the code so that the pulsing of the LED light would be determined by the results of a call to the Azure web service
- Run a debugged instance of the Blinky project on the RP2 through VS 2015
The first two were easy enough. (In fact, since the Azure Management Portal was redesigned from last year, it’s become even easier than I remembered.) When it came to assembling the RP2 circuit, things started off a little awkward, but after a few moments to recollect faint memories of my EE classes, the circuit finally clicked into place.
However, it started to become a little more difficult when I got to Item #4 and attempted to use the Windows IoT dashboard. First, the RP2 would fluctuate between showing up on the devices list and disappearing from it. (Since the WiFi dongle and the Ethernet cord connected my laptop to the device, connectivity couldn’t have been the issue.) When it did appear, it appeared as a mysterious “minwinpc” device…which, as it turned out, was my RP2. Momentarily, I saw it mentioned as a device with “AJ_” as a prefix, and I learned through further investigation that it’ll assign such a name for you. During one of those fleeting appearances, I recorded the IP address for the RP2 and bookmarked the link that goes to its Management Portal page on the RP2. If I were you, I’d quickly do the same before it disappears (as it is wont to do). The Portal page provides general administration of the device (renaming the device, changing passwords, etc.), but if you want to get down and dirty with it (like changing registry values), it’s best to connect through a Powershell session. If you’re having further troubleshooting issues, this might be the best way to resolve other problems.
After I felt like I had decent connectivity to the running RP2 from my computer, I downloaded the Blinky project, in order to modify the code. However, I was surprised to learn that Microsoft had configured these projects to be early adopters of the Universal Windows Platform (i.e., UWP). On top of requiring the download and install of gigabytes of additional framework libraries, I also had to made slight modifications to my approach for altering the code. (For example, the UWP pushes programmers in general to make asynchronous calls to Windows APIs. There may be workarounds to make synchronous calls, but they’re probably designed purposefully to be cumbersome and undesirable.) I had planned on making calls to the SQL Server database in my cloud, but it also appears that the System.Data.SqlClient namespace is missing by default from UWP. Perhaps it can be added as a NuGet package; I’ll look into it more with future iterations and/or prototypes.
In any case, I changed the Blinky project so that the frequency value for my circuit’s flashing LED light would be occasionally updated by the result returned from my Azure web service; the web service would pull the value from the SQL Server table in my cloud. Once I compiled the project, I made sure to connect VS 2015 to the Remote Machine. (Don’t be a dummy like me and be sure to hit the small arrow to the right of the menu option “Device”. That cost me a minute or two.) Then, after hitting F5, I held my breath as the project’s massive content made its way via WiFi to my RP2…and then, success!
The good news is that an old dog can in fact learn new tricks. Once I had the project working, I used SQL Management Studio to connect and then alter the table in my cloud. And, lo and behold, the frequency of my LED light changed accordingly! Prototype finished and mission accomplished!
Overall, I think that the kit has the potential of being a good introduction for novices, as long as they have an adequate background in Windows software and systems. Plus, some patience is required. Even though I haven’t learned anything really useful or broadly applicable yet, I get the impression that it’ll be easy to acquire a broad base of knowledge fairly quickly with this kit. Of course, my colleagues might suggest that to acquire an actual expertise, one should get an Arduino board and become an avid part of its community (as well as become a patron of Instructables)…but, for a newb like me, I believe that this kit is a decent launch point.
Now onto the next project (though I basically covered that ground with my improvised changes to the Blinky project). I’ll still give it a try, in order to learn anything possible…but I’m really looking forward to the sensors project. One more incremental step to an actual Haunted House!