element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
IoT on Wheels Design Challenge
  • Challenges & Projects
  • Design Challenges
  • IoT on Wheels Design Challenge
  • More
  • Cancel
IoT on Wheels Design Challenge
Blog VeTAS - Blog #6: Console App - Setup New Device
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shantimohan
  • Date Created: 12 Nov 2017 8:31 PM Date Created
  • Views 426 views
  • Likes 1 like
  • Comments 0 comments
  • iot on wheels design challenge
  • temperature alert system
  • vetas
  • iot on wheels
Related
Recommended

VeTAS - Blog #6: Console App - Setup New Device

shantimohan
shantimohan
12 Nov 2017

In previous blog post #5 I have shown the Setup New Device page in Mobile App. But unfortunately I found that Azure services are not easily available from Xamarin Forms. There are many Xamarin, the tech that I want to use for cross-platform apps, examples on Azure site but they are all for either .NET console apps or Xamarin Native code. The Xamarin Forms is so appealing that I completely neglected native coding with Xamarin. Hence I chose to work with .NET Console Apps for the present. The following screenshot shows the console app named vs_add_new_device.

image

 

This program is to be run in the cmd window. This asks for the values for the various parameters needed one by one. The format is same as explained earlier.

 

  1. First it will ask for the Device Model #. The 1st letter can be either C, W or B. If it is C then WiFi details will not be asked later on. The 2nd letter can be either M, A or G. Currently only M is allowed which stands for Microsoft Azure services. The last 2 digits indicate the hardware board version.
  2. Next Device Serial # will be asked.
  3. If the Device Model # doesn't start with C, then Wi-Fi Network Name and Wi-Fi Password will be asked. Though the password is shown in clear text, it will not be displayed in the Release mode.
  4. Then Unit of Temperature and Threshold Temperature will be asked. For Unit of Temperature only C or F values are allowed.
  5. Then Mobile Number for Alert Text Messages and E-mail Address for Alert Messages will be asked for. In the Console app, these entries will not be verified by sending confirmation messages. That is skipped for now.

 

Once all the details are entered, the entered values will be displayed and the Azure IoT Hub will be contacted to register the device whose device id is formed by appending the model number and serial number to a fixed set of letters. Once the device id is successfully registered, the Azure IoT Hub will return a device primary key that is to be used by the device to connect to Azure IoT Hub and send sensor data to be stored in cloud.

 

Unfortunately I couldn't lay immediately on code examples to use Bluetooth to send all the required data to the device. Hence I thought of copying the Device Access Key to the mobile app and send it to the device. That is why the access key is displayed here. But that effort also was not successful as I was not able to communicate with the device from phone's Bluetooth. So for the present I hard coded the device access key into the device code.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube