Sunday, November 19, 2017

MVP IoT with Windows 10, C#, Raspberry Pi and Azure IoT Hub

Boston Code Camp 28 is in the books as one of the greatest community events of recent times in my book.  Attendance was fantastic, we had amazing sponsors, and a ton of great speakers, but the thing that really made things hop was attendance.  I'm personally convinced it was the best attended Code Camp I've ever participated in.

As a presenter, I don't often get to attend as many of the amazing presentations as I'd like, but yesterday I found myself especially regretting that... there was just so much great content from so many great presenters. I did manage to get into more sessions than I usually do... how could I not?

Sure, you get a few "look at this cool stuff I can do" presentations.  These are great for folks looking for inspiration on the tough challenges.  I love the spirit of "look at this cool stuff you can do (if you apply your skills in a modestly different direction)".

This is why I do this MVP IoT presentation.  This presentation is about taking skills you already know and love (namely C# development) and applying them to what's classically though of as "embedded" development.  Yes, there's overhead in this approach...  you might have to use hardware that's slightly better equipped to handle Windows 10 IoT Core such as the Raspberry Pi 2b & 3b... but the difference is mute at small scale, and masked at large scale by not having to have a separate team with different skills. 

IoT apps on the Windows 10 IoT Core platform ARE Windows 10 apps.

The point I always try to drive home is IoT apps on the Windows 10 IoT Core platform ARE Windows 10 apps.  The very same exe you compile for your embedded device runs just as well on laptop, desktop, server, Windows 10 phone, et al.

I do regret the couple snags I had during my demos.  Still, someone approached me after the presentation with the idea that I should pre-record portions of my presentation in order to avoid these kinds of things.  I like to run live for several real reasons.  1)  I'm a coder, not a professional presenter... I don't often have time to polish my presentations to that level.  2)  Glossing over rough edges hides what development is.  Development is tough.  You have to have backup plans and contingencies.  My Raspberry Pi didn't want to connect to the guest WiFi, so I fell back to plan B, and moved on.  It's a real world scenario;  you hit a snag, but keep pressing on.

IoT is already about the last mile of the Sci-fi story, bringing Internet omnipotence to the fringes of reality, enabling the "Computer" of Star Trek (or the Cortana of the modern desktop) to reach it's potential (hopefully without becoming Skynet).
It's the stuff of science fiction... but it's not fiction.
Visual Studio 2017's ability to debug into a remote embedded device and make hot changes to a running executable is beyond top notch; it's the stuff of science fiction... but it's not fiction.



If you look through my post history, you'll see how this presentation has evolved over the past decade.  It's been an interesting evolution...  starting with connecting Windows Phone 7 to SharePoint.  Then Windows Phone 8 and SharePoint online (and the story got really muddy for a bit there).  Then CSOM hit and smoothed out the SharePoint side of things.  I changed the story to Field Enablement using Xamarin for iOS, Android, and Windows Phone with SharePoint as a back end for a bit. (It's a surprisingly compelling story, even if it's only academic).  Eventually I started focusing on UWP for Windows 10, and my love of small form factor development drew me back to Raspberry Pi. 

Finally, I'ved bridged off of SharePoint and started talking about Azure IoT Hub, which is the modern accepted best practice in the domain of this development stack.  This change happened so relatively quickly that if you notice, the synopsis for the session didn't mention it.  (  https://www.bostoncodecamp.com/CC28/sessions/details/16540 )

One can explore the code I developed for the demo at git hub, here:


That leads me to my final bit:  I am sorry I ran out of time in my presentation.  I was so psyched to show how to send telemetry back to Azure IoT Hub, and while I got to step through the code that sends updated reports, I did not get to explore any of what that looks like in the Azure IoT Hub portal, and didn't get to explore the event-driven API on the embedded side that allows you to send code with Device Twin down to a the device.

Here's the event that commits the post:

        private async void iotHubButton_Click(object sender, RoutedEventArgs e)

        {

            try

            {

                using (var client = DeviceClient.CreateFromConnectionString(

                    $"HostName=BOSCC-IOTHub.azure-devices.net;DeviceId=GraniteStHacker;SharedAccessKey={Credentials.LuisAccessKeyFromAzurePortal}", 

                    TransportType.Mqtt))

                {

                    var twinProperties = new TwinCollection();

                    twinProperties["MeasuredTemperature"] = manager.MeasuredTemperature;

                    twinProperties["HeaterPowerOn"] = manager.HeaterPowerOn;

                    twinProperties["ACPowerOn"] = manager.ACPowerOn;

                    twinProperties["Device_BOSCC"] = DateTime.Now.ToString();

                    await client.UpdateReportedPropertiesAsync(twinProperties);

                    Console.WriteLine("Done");

                }

            }

            catch(Exception ex)

            {

                Console.WriteLine(ex);

            }

        }

    }

Click the image below to see the device I was using for the demo in Azure IoT Hub's Device Twin view.


Here's the resulting Device Twin JSON:
{
  "deviceId": "GraniteStHacker",
  "etag": "AAAAAAAAAAE=",
  "version": 8,
  "status": "enabled",
  "statusUpdateTime": "0001-01-01T00:00:00",
  "connectionState": "Disconnected",
  "lastActivityTime": "0001-01-01T00:00:00",
  "cloudToDeviceMessageCount": 0,
  "authenticationType": "sas",
  "x509Thumbprint": {
    "primaryThumbprint": null,
    "secondaryThumbprint": null
  },
  "properties": {
    "desired": {
      "$metadata": {
        "$lastUpdated": "2017-11-14T01:48:45.8322179Z"
      },
      "$version": 1
    },
    "reported": {
      "MeasuredTemperature": 74,
      "HeaterPowerOn": true,
      "ACPowerOn": false,
      "Device_BOSCC": "11/18/2017 8:34:08 AM",
      "$metadata": {
        "$lastUpdated": "2017-11-18T16:34:20.1258514Z",
        "MeasuredTemperature": {
          "$lastUpdated": "2017-11-18T16:34:20.1258514Z"
        },
        "HeaterPowerOn": {
          "$lastUpdated": "2017-11-18T16:34:20.1258514Z"
        },
        "ACPowerOn": {
          "$lastUpdated": "2017-11-18T16:34:20.1258514Z"
        },
        "Device_BOSCC": {
          "$lastUpdated": "2017-11-18T16:34:20.1258514Z"
        }
      },
      "$version": 7
    }
  }
}




43 comments:

cynthiawilliams said...

Well written post with worthy information. It will definitely be helpful for all. Do post more like this.
Cloud Training in Chennai
Cloud Computing Courses in Chennai
Azure Training in Chennai
Azure Training center in Chennai
VMware course in Chennai
AWS course in Chennai
DevOps Certification in Chennai
Cloud computing Training in Chennai

Sivanandhana Girish said...

This is one of the good blogs where I am able to learn a lot of new information.
IELTS Classes in Mumbai
IELTS Coaching in Mumbai
IELTS Mumbai
Best IELTS Coaching in Mumbai
IELTS Center in Mumbai
IELTS Classes in Chennai
Best IELTS Coaching Centre in Chennai
IELTS Centre in Chennai
IELTS Training Centre in Chennai
IELTS Course in Chennai

sandhiya said...

Thanks for sharing these niche piece of info's to our knowledge. Here, I had a solution for my inconclusive problems & it’s really helps me a lot keep updates…
ccna Training in Chennai
Best CCNA Training Institute in Chennai
Ethical Hacking Course in Chennai
PHP Training in Chennai
Angularjs Training in Chennai
ccna course in chennai
ccna training in chennai

lekha mathan said...

Very good information provided, Thanks a lot for sharing such useful information.
Aviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
best aviation academy in Chennai
Air Hostess Training Institute in Chennai
Airline Courses in Chennai
airport ground staff training in Chennai

Anbarasan14 said...

I am really impressed with the way of writing of this blog. The author has shared the info in a crisp and short way.
Spoken English Classes in Coimbatore
Best Spoken English Classes in Coimbatore
Spoken English Class in Coimbatore
Spoken English in Coimbatore
Coimbatore Spoken English Centre
Best Spoken English Institute in Coimbatore
Spoken English Institute in Coimbatore
Spoken English Course in Coimbatore

janakikrishnan said...

Most Useful blog for everyone who wants to gather a lot.

CCNA Course in Madurai
CCNA Course in Madurai
Best CCNA Institute in Madurai
CCNA Course in Coimbatore
Best CCNA Institute in Coimbatore
CCNA Training in Coimbatore

Kayal said...

I recently saw your post! I was very happy to visit your blog. I like so much and I hope more valuable post from your post...

Unix Training in Chennai
Unix shell scripting Training in Chennai
Excel Training in Chennai
Corporate Training in Chennai
Embedded System Course Chennai
Linux Training in Chennai
Tableau Training in Chennai
Unix Training in Chennai
Unix shell scripting Training in Chennai

kimjhon said...

Great info. The content you wrote is very interesting to read. This will loved by all age groups.
Angularjs Training in Chennai
Angularjs Course in Chennai
CCNA Training in Chennai
Salesforce Training in Chennai
Angular5 Training in Chennai
Angular6 Training in Chennai
Angular7 Training in Chennai
Angularjs Training in Chennai
Angularjs Course in Chennai

Vicky Ram said...

Excellent post! keep sharing such a post

Guest posting sites
Technology

sandeep saxena said...

Thank you very much for shared this. I got lot of ideas after reading this. Share more as similar to this.
core java training in chennai
core java training institutes in chennai
core java Training in Velachery
C C++ Training in Chennai
javascript training in chennai
Appium Training in Chennai
JMeter Training in Chennai
core java training in chennai

kiruthika said...

This is really a valuable post... The info shared is helpful and valuable. Thank you for sharing.
aviation training in Chennai
air hostess academy in Chennai
Airline Courses in Chennai
Ground staff training in Chennai
Aviation Academy in Chennai
air hostess training in Chennai
airport management courses in Chennai
ground staff training in Chennai

Mark ben said...

Thank you for your valuable content , Easy to understand and follow. As said, the migration to cloud is very essential for the protection of the database.

Cloud Migration services
Aws Cloud Migration services
Azure Cloud Migration services
Vmware Cloud Migration services
Database Migration services

kavithasathish said...

Great information you have been shared and it will be useful to everyone.
Spoken English Classes in Chennai
Best Spoken English Classes in Chennai
German Language Classes in Chennai
Japanese Classes in Chennai
spanish language in chennai
IELTS Coaching centre in Chennai
Spoken English Classes in Porur
Spoken English Classes in Adyar

Kerrthika K said...

It's a great article!!look's impressive and it's useful blog for us
Blockchain certification
Blockchain Training in Chennai
film making courses in chennai
film direction course in chennai
part time film direction course in chennai
Data Analytics Courses in Chennai
Hadoop Admin Training in Chennai

MidiTech said...

I am definitely enjoying your website. You definitely have some great insight and great stories.
VPS Hosting India

high technologies solutions said...

I have been following your post for a long time. I always found it very interesting and valuable. keep posting it is really helpful.

cloud computing course in delhi

cloud computing course in Noida

cloud computing course in Gurgaon

SFJ Business Solutions Training said...

Thanks for Sharing a useful content about Internet of Things
Please visit our website At SFJ Business Solutions we to shared some blogs about IoT
iot online course

nadiya said...

This is an awesome post.Really very informative and creative contents.
IELTS Coaching in Chennai
Best IELTS Coaching in Chennai
French Language Classes in Chennai
pearson vue exam centers in chennai
Informatica MDM Training in Chennai
Hadoop Admin Training in Chennai
IELTS Coaching in Tambaram
IELTS Coaching in Anna Nagar

sellakumar said...

Thank you for the informative post about Security challenges in AWS , Found it useful . cloud migration services have now become secured and with no-risk
Cloud Migration services

Aws Cloud Migration services

Azure Cloud Migration services

sellakumar said...

I have gone through your post and I found it very helpfull. Looking forward to see more post from you.
Vmware Cloud Migration services

Database Migration services

sellakumar said...

I am really impressed with the way of writing of this blog. The author has shared the info in a crisp and short way.

Lia Infraservices

sellakumar said...

We are a part of the success story for many of our customer's successful cloud Migrations.
Cloud Migration services


Best Cloud Migration Tool

harish kalyan said...

Nice blog and valuable for all people. Thank you for posting this.
French Classes in Chennai
French Language Classes in Chennai
IELTS Coaching in Chennai
Japanese Classes in Chennai
Spoken English Classes in Chennai
TOEFL Coaching in Chennai
spanish classes in chennai
content writing course in chennai
French Classes in Velachery
French Classes in Adyar

Vale Co Xenia said...

Great Article
IEEE Projects on Cloud Computing
Final Year Projects for CSE


JavaScript Training in Chennai
JavaScript Training in Chennai


Chris Hemsworth said...

The article is so informative. This is more helpful for our
selenium training in chennai
selenium online courses best selenium online training
selenium testing training
selenium classes
Thanks for sharing.

zuan said...

Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
Web Designing Training Institute in Chennai | web design training class in chennai | web designing course in chennai with placement
Mobile Application Development Courses in chennai
Data Science Training in Chennai | Data Science courses in Chennai
Professional packers and movers in chennai | PDY Packers | Household Goods Shifting
Web Designing Training Institute in Chennai | Web Designing courses in Chennai
Google ads services | Google Ads Management agency
Web Designing Course in Chennai | Web Designing Training in Chennai

sasi said...

Great experience for me by reading this blog. Thank you for wonderful article.
Angularjs course in Chennai
Angularjs Training in Bangalore
angular training in bangalore
Angular Training in hyderabad
Angularjs Training institute in Chennai
Angular 6 Training in hyderabad
web design training in coimbatore
python training in Bangalore

shreekavi said...


Amazing Post. keep update more information.
Selenium Training in Chennai
Selenium Training in Bangalore
Selenium Training in Coimbatore
Selenium Course in Bangalore
Best Selenium Training in Bangalore
Selenium training in marathahalli
Selenium training in Btm
Ethical Hacking Course in Bangalore
Tally Course in Chennai

subha said...

Good blog, its really very informative, do more blog under good concepts.
Data Science Course in Chennai
Data Science Courses in Bangalore
Data Science Training in Bangalore
Best Data Science Courses in Bangalore
Data Science Institute in Bangalore
Data Science Training Institutes in Bangalore
Data Science Training in BTM
AWS Training in Bangalore
DevOps Training in Bangalore
PHP Training in Bangalore

Niyaz said...

Fantastic blog!!! Thanks for sharing with us, Waiting for your upcoming data.
Digital Marketing Course in Chennai
Digital Marketing Course
digital marketing classes in chennai
Digital Marketing Training in Chennai
Digital marketing course in Guindy
Digital marketing course in Tambaram
Python Training in Chennai
Big data training in chennai
SEO training in chennai
JAVA Training in Chennai

Vivek Vichu said...

Nice Blog...Thanks for sharing the article waiting for next update...
Artificial Intelligence Course in Chennai
AI Training in chennai
ai classes in chennai
C C++ Training in Chennai
javascript training in chennai
Html5 Training in Chennai
QTP Training in Chennai
Spring Training in Chennai
DOT NET Training in Chennai

sasi said...

This was an excellent post and very good information provided, Thanks for sharing.
Selenium Training in Chennai
Selenium Course in Chennai
Python Training in Bangalore
Python Course in Bangalore
Selenium Training in Bangalore
Selenium Course in Bangalore
Selenium Training in Coimbatore
salesforce institute in bangalore
Software Testing Course in Bangalore
Software Testing Course in Madurai

deiva said...

Thanks for sharing the information. It is very useful for my future. keep sharing
Digital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery

subha said...

Really very nice blog information for this one and more technical skills are improve,i like that kind of post. realy happy to see this page
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai

Janu said...

Nice! you are sharing such helpful and easy to understandable blog. i have no words for say i just say thanks because it is helpful for me.



Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery





Sreyas Ram said...

awesome article,the content has very informative ideas, waiting for the next update...
Study Abroad Consultants in Kerala
study abroad consultants in thrissur
Study Abroad Consultants in Calicut
abroad job consultancy in coimbatore
foreign job consultancy in coimbatore
overseas job consultancy in coimbatore
study abroad
study in poland
study in europe
free abroad study

Tech Institute said...

Fantastic article with valuable information found very helpful waiting for next blog thank you.
Data Science Course in Hyderabad 360DigiTMG

Data Science Training said...

Really nice and interesting blog information shared was valuable and enjoyed reading this one. Keep posting. Thanks for sharing.
Data Science Training in Hyderabad

Cyber Security said...

Nice Information Your first-class knowledge of this great job can become a suitable foundation for these people. I did some research on the subject and found that almost everyone will agree with your blog.
Cyber Security Course in Bangalore

Cyber Security Course said...

Writing in style and getting good compliments on the article is hard enough, to be honest, but you did it so calmly and with such a great feeling and got the job done. This item is owned with style and I give it a nice compliment. Better!
Cyber Security Training in Bangalore

PMP Certification said...

This is an excellent article. I like this topic. This site has many advantages. I have found a lot of interesting things on this site. It helps me in so many ways. Thanks for posting this again. PMP Certification in Hyderabad

Ethical Hacking Course said...

Fantastic article with informative content. Information shared was valuable and enjoyed reading it looking forward for next blog thank you.
Ethical Hacking Course in Bangalore

Anu said...

Thanks for sharing this, I actually appreciate you taking the time to share with everybody.
Data Science Institutes In Hyderabad