azure iot
For whatever reason when a programmer tries something out for the first time, they write a "Hello World!" application. In the IoT (Internet of Things) world of devices, it's always fun to make an LED blink as a good getting started sample project.
不管出于什么原因,程序员第一次尝试某些东西时,他们都会写“ Hello World!”。 应用。 在设备的IoT(物联网)世界中,使LED闪烁是一个很好的入门示例项目,总是很有趣。
When I'm trying out an IoT platform or tiny microcontroller I have my own "Hello World" project - I try to build a simple system that tells me "Did I leave the garage door open?"
当我尝试使用IoT平台或微型微控制器时,我有自己的“ Hello World”项目-我尝试构建一个简单的系统,告诉我“我没有打开车库门吗?”
I wanted to see how hard it would be to use an Azure IoT MXChip DevKit to build this little system. The DevKit is small and thin but includes Wifi, OLED display, headphone, microphone, sensors like temperature, humidity, motion, pressure sensors. The kit isn't super expensive given all it does and you can buy it most anywhere. The DevKit is also super easy to update and it's actively developed. In fact, I just updated mine to Firmware 1.6.2 yesterday and there is an Azure IoT Device Workbench Extension for VS Code. There is also a fantastic IoT DevKit Project Catalog you should check out.
我想看看使用Azure IoT MXChip DevKit构建这个小系统会有多困难。 DevKit体积小巧但包括Wifi,OLED显示屏,耳机,麦克风,温度,湿度,运动,压力传感器等传感器。 考虑到它的全部功能,该工具包并不算是昂贵的,您可以在任何地方买到最多。 DevKit还非常易于更新,并且正在积极开发中。 实际上,我昨天刚刚将我的固件更新为固件1.6.2,并且有一个VS Code的Azure IoT设备工作台扩展。 您还应该查看一个出色的IoT DevKit项目目录。
I wanted to use this little Arduino friendly device and have it talk to Azure. My goal was to see how quickly and simply I could make a solution that would:
我想使用这种小型的Arduino友好设备,并使其与Azure通讯。 我的目标是看我能多快又简单地做出一个解决方案,该解决方案将:
- Detect if my garage door is open 检测我的车库门是否打开
- If it's open for more than 4 minutes, text me 如果开放时间超过4分钟,请给我发短信
- Later, perhaps I'll figure out how to reply to the Text or take an action to close the door remotely.稍后,也许我会弄清楚如何回复文本或采取措施远程关闭门。
However, there is an Azure IoT Hub and there's Azure IoT Central and this was initially confusing to me. It seems that Azure IoT Hub is a individual Azure service but it's not an end-to-end IoT solution - it's a tool in the toolbox. Azure IoT Central, on the other hand, is an browser-based system with templates that is a SaaS (Software as a Service) and hides most of the underlying systems. With IoT Central no coding is needed!
但是,这里有一个Azure IoT中心和一个Azure IoT中心,这最初让我感到困惑。 看来Azure IoT中心是一项单独的Azure服务,但它不是端到端的IoT解决方案-它是工具箱中的工具。 另一方面,Azure IoT Central是一个基于浏览器的系统,带有模板,该模板是SaaS(软件即服务),并且隐藏了大多数基础系统。 使用IoT Central,无需编码!
Azure IoT Central: What is Azure IoT Central?
Azure IoT中心:什么是Azure IoT中心?
IoT solution accelerators: What are Azure IoT solution accelerators?
IoT解决方案加速器:什么是Azure IoT解决方案加速器?
IoT Hub: What is Azure IoT Hub?
IoT中心:什么是Azure IoT中心?
Slick. I was fully prepared to write Arduino code to get this garage door sensor working but if I can do it with no code, rock on. I may finish this before lunch is over. I have an Azure account so I went to https://azureiotcentral.com and created a new Application. I chose Pay as You Go but it's free for the first 5 devices so, swag.
光滑我已经准备好编写Arduino代码来使该车库门传感器正常工作,但是如果我可以不使用任何代码就可以继续使用。 我可以在午餐结束之前完成此操作。 我有一个Azure帐户,所以我去了https://azureiotcentral.com并创建了一个新的应用程序。 我选择了“随用随付”功能,但前5种设备免费,因此赃物。
You should totally check this out even if you don't have an IoT DevKit because you likely DO have a Raspberry Pi and it totally has device templates for Pis or even Windows 10 IoT Core Devices.
即使您没有IoT DevKit,也应该完全检查一下,因为您可能确实有Raspberry Pi,并且它完全具有Pis甚至Windows 10 IoT核心设备的设备模板。
Updating the firmware for the IoT DevKit couldn't be easier. You plug it into a free USB port, it shows up as a disk drive, and you drag in the new (or alternate) firmware. If you're doing something in production you'll likely want to do OTA (Over-the-air) firmware updates with Azure IoT Hub automatic device management, so it's good to know that's also an option. The default DevKit firmware is fun to explore but I am connecting this device to Azure (and my Wifi) so I used the firmware and instructions from here which is firmware specific to Azure IoT Central.
更新IoT DevKit的固件再简单不过了。 您将其插入免费的USB端口,它显示为磁盘驱动器,然后拖入新的(或备用)固件。 如果您要在生产中执行某项操作,则可能希望通过Azure IoT中心自动设备管理进行OTA(空中下载)固件更新,因此很高兴知道这也是一个选择。 探索默认的DevKit固件很有趣,但是我将此设备连接到Azure(和我的Wifi),因此我使用了此处的固件和说明,这些是特定于Azure IoT Central的固件。
The device reboots as a temporary hotspot (very clever) and then you can connect to it's wifi, and then it'll connect to yours over WPA2. Once you're connected to Wifi, you can add a new Real (or Simulated - you can actually do everything I'm doing where without a real device!) device using a Device ID that you'll pair with your Mxchip IoT DevKit. After it's connect you'll see tons of telemetry pour into Azure. You can, of course, choose what you want to send and send just the least amount your projects needs, but it's still a very cool first experience to see temp, humidity, and on and on from this little device.
设备将作为临时热点重新启动(非常聪明),然后您可以连接到其wifi,然后通过WPA2连接到您的设备。 连接到Wifi后,您可以使用与Mxchip IoT DevKit配对的设备ID添加新的Real(或Simulated-实际上可以在没有实际设备的情况下完成我正在做的所有事情! )设备。 连接后,您会看到大量遥测涌入Azure。 当然,您可以选择要发送的内容,并发送最少项目所需的数量,但是从这种小型设备上不断查看温度,湿度和温度仍然是非常酷的初体验。
Here's a wonderful HIGH QUALITY diagram of my Garage door planned system. You only wish your specifications were this sophisticated. ;)
这是我的车库门计划系统的出色的HIGH QUALITY图。 您只希望您的规格如此复杂。 ;)
Basically the idea is that when the door is closed I'll have the IoT DevKit taped to the door with a battery, then when it open it'll rotate 90 degrees and the Z axis of the Accelerometer will change! If it stays there for more than 5 minutes then it should text me!
基本上的想法是,当门关闭时,我将用电池将IoT DevKit贴在门上,然后当它打开时,它将旋转90度,并且加速度计的Z轴将改变! 如果它在那呆了5分钟以上,那就应该给我发短信!
In Azure IoT central I made a Device Template with a Telemetry Rule that listens to the changes in the accelerometer Z and when the average is less than 900 (I figured this number out by moving it around and testing) then it fires an Action.
在Azure IoT Central中,我制作了一个带有遥测规则的设备模板,该模板可以监听加速度计Z的变化,并且当平均值小于900时(我通过移动并进行测试得出了这个数字),然后触发了一个Action。
The "Action" is using an Azure Monitor action group that can either SMS or even call me voice!
“操作”使用的是Azure Monitor操作组,该操作组既可以短信也可以给我打电话!
In this chart when the accelerometer is above the line the garage door is closed and when it drops below the line it's open!
在此图表中,当加速度计在直线上方时,车库门关闭,而当其下降到直线下方时,车库门则打开!
Here's the Azure Monitoring alert that texts me when I leave the garage door open too long.
这是Azure监视警报,当我将车库门打开太长时间时会向我发送短信。
And here's my alert SMS!
这是我的提醒短信!
I was very impressed I didn't have to write any code to pull this off. I'm going to try this same "Hello World" later with custom code using a AdaFruit Huzzah Feather and an ADXL345 Accelerometer. I'll write Arduino C code and still have it talk to Azure for Alerts.
令我印象深刻的是,我无需编写任何代码即可实现这一目标。 稍后,我将使用AdaFruit Huzzah羽毛和ADXL345加速度计使用自定义代码尝试使用相同的“ Hello World”。 我将编写Arduino C代码,并仍然与Azure进行警报交流。
It's amazing how clean and simple the building blocks are for projects like this today.
今天这样的项目的构建模块多么干净,简单,这真是令人惊讶。
Sponsor: Manage GitHub Pull Requests right from the IDE with the latest JetBrains Rider. An integrated performance profiler on Windows comes to the rescue as well.
赞助商:使用最新的JetBrains Rider从IDE直接管理GitHub Pull Requests。 Windows上的集成性能分析器也可以解决。
azure iot