Merge branch 'microsoft:main' into main

pull/321/head
Ali Hakim Taşkıran 4 years ago committed by GitHub
commit 4d98f30800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1
.gitignore vendored

@ -8,3 +8,4 @@
.vscode/ipch .vscode/ipch
.ipynb_checkpoints .ipynb_checkpoints
/node_modules /node_modules
quiz-app/dist

@ -69,7 +69,7 @@ To program the Pi using the Grove sensors and actuators, you will need to instal
> 💁 You are free to use any Python IDE or editor for these lessons if you have a preferred tool, but the lessons will give instructions based off using VS Code. > 💁 You are free to use any Python IDE or editor for these lessons if you have a preferred tool, but the lessons will give instructions based off using VS Code.
1. Install Pylance. This is an extension for VS Code that provides Python language support. Refer to the [Pylance extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) for instructions on installing this extension in VS Code. 1. Install Pylance. This is an extension for VS Code that provides Python language support. Refer to the [Pylance extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) for instructions on installing this extension in VS Code.
### Remote access to code the Pi ### Remote access to code the Pi
@ -191,7 +191,7 @@ Install the required software and connect remotely to your Pi.
1. Following the same instructions, connect VS Code to the Pi 1. Following the same instructions, connect VS Code to the Pi
1. Once connected, follow the [managing extensions](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) instructions to install the [Pylance extension](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) remotely onto the Pi 1. Once connected, follow the [managing extensions](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) instructions to install the [Pylance extension](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) remotely onto the Pi
## Hello world ## Hello world

@ -218,5 +218,4 @@ IoT कुछ व्यापक समूहों में उपयोग
## असाइनमेंट ## असाइनमेंट
[एक IoT प्रोजेक्ट की जाँच करें](assignment.md) [एक IoT प्रोजेक्ट की जाँच करें](assignment.hi.md)
<br>

@ -10,7 +10,7 @@
## Pengantar ## Pengantar
Pelajaran ini mencakup beberapa topok pengantar mengenai Internet of Things, dan membuat Anda dapat mempersiapkan dan mengatur perangkat keras Anda. Pelajaran ini mencakup beberapa topik pengantar mengenai Internet of Things, dan membuat Anda dapat mempersiapkan dan mengatur perangkat keras Anda.
Dalam pelajaran ini kita akan membahas: Dalam pelajaran ini kita akan membahas:

@ -14,25 +14,25 @@
本课程将涵盖: 本课程将涵盖:
* [什么是 物联网IoT](#what-is-the-internet-of-things) * [什么是 “物联网IoT](#什么是-物联网iot)
* [IoT 设备](#iot-devices) * [物联网设备](#物联网设备)
* [设置你的设备](#set-up-your-device) * [设置你的设备](#设置你的设备)
* [IoT 的应用场景](#applications-of-iot) * [物联网的应用场景](#物联网的应用场景)
* [在你的周围的IoT 设备例子](#examples-of-iot-devices-you-may-have-around-you) * [在你的周围的物联网设备例子](#在你的周围的物联网设备例子)
## 什么是 物联网IoT ## 什么是 “物联网IoT
为了形容运用传感器sensors又译作感应器来连接网络与物理世界1999年 [凯文·阿什顿Kevin Ashton](https://wikipedia.org/wiki/Kevin_Ashton) 生造了物联网IoT这个词。自从那时起,这个术语被用来形容任何能够与周围物理世界交互的设备。这些设备可以使用传感器收集数据,或者使用执行器(actuators指的是执行诸如打开开关点亮发光二极管等操作的设备在物理世界完成任务。通常执行器会连接到其它设备或者互联网。 为了形容运用传感器sensors又译作感应器来连接网络与物理世界1999 年 [凯文·阿什顿Kevin Ashton](https://wikipedia.org/wiki/Kevin_Ashton) 生造了“物联网IoT这个词。自从那时起,这个术语被用来形容任何能够与周围物理世界交互的设备。这些设备可以使用传感器收集数据,或者使用执行器actuators指的是执行诸如打开开关点亮发光二极管等操作的设备在物理世界完成任务。通常执行器会连接到其它设备或者互联网。
> **传感器** 从世界中收集数据,例如:测量速度、温度或地点。 > **传感器** 从世界中收集数据,例如:测量速度、温度或地点。
> >
> **执行器** 将电信号转换成现实世界的交互,例如:触发开关,打开灯,发出声音或将控制信号传送到其它硬件,例如,打开电源插座。 > **执行器** 将电信号转换成现实世界的交互,例如:触发开关,打开灯,发出声音或将控制信号传送到其它硬件,例如,打开电源插座。
物联网作为一个技术领域不仅是设备它也包含云服务这些服务能处理传感器数据或者将请求传送给跟物联网设备有连接的执行器。它也包括没有或不需要互联网连接的设备它们通常被称为“边缘设备edge devices而且它们有能力用基于云的AI模型自己处理与回应传感器的数据。 物联网作为一个技术领域不仅是设备它也包含云服务这些服务能处理传感器数据或者将请求传送给跟物联网设备有连接的执行器。它也包括没有或不需要互联网连接的设备它们通常被称为“边缘设备edge devices而且它们有能力用基于云的 AI 模型自己处理与回应传感器的数据。
物联网是一个快速发展的技术领域。专家预计2020底世界上有三百亿物联网设备部署并连接到互联网。专家也预计2025年物联网设备将收集大概80 ZB80万亿GB的数据。这是巨量的数据 物联网是一个快速发展的技术领域。专家预计2020 底,世界上有三百亿物联网设备部署并连接到互联网。专家也预计2025 年,物联网设备将收集大概 80 ZB80 万亿 GB的数据。这是巨量的数据
![这个图表展示随着时间的推移的有源 IoT 设备;它展示出一个上升趋势,从2015年不超过50亿到2025年超过300亿](../../../../images/connected-iot-devices.svg) ![这个图表展示随着时间的推移的有源 IoT 设备;它展示出一个上升趋势,从 2015 年不超过 50 亿到 2025 年超过 300 亿](../../../../images/connected-iot-devices.svg)
✅ 做一点儿研究: 物联网设备收集的数据,多少是有用的、多少是被浪费的?为什么那么多数据被忽略了? ✅ 做一点儿研究: 物联网设备收集的数据,多少是有用的、多少是被浪费的?为什么那么多数据被忽略了?
@ -60,13 +60,13 @@ IoT 的 **T** 代表 **Things**(物)—— 可以和物理世界交互的设
🔌 可编程输入/输出I/O连接——为了和外围设备如传感器或执行器通信 🔌 可编程输入/输出I/O连接——为了和外围设备如传感器或执行器通信
微控制器通常是较便宜的计算设备定制硬件的平均成本下降到0.50美元,而有些设备低至 0.03 美元。开发者套件的起价低至 4 美元,但加上越多功能,价钱就越高。[Wio Terminal](https://www.seeedstudio.com/Wio-Terminal-p-4509.html) 是个来自 [Seeed studios](https://www.seeedstudio.com) 的微控制器它包含传感器、执行器、Wi-Fi和一个屏幕总共算起来大约 30美元。 微控制器通常是较便宜的计算设备;定制硬件的平均成本下降到 0.50 美元,而有些设备低至 0.03 美元。开发者套件的起价低至 4 美元,但加上越多功能,价钱就越高。[Wio Terminal](https://www.seeedstudio.com/Wio-Terminal-p-4509.html) 是个来自 [Seeed studios](https://www.seeedstudio.com) 的微控制器它包含传感器、执行器、Wi-Fi 和一个屏幕,总共算起来大约 30 美元。
![一个Wio Terminal](../../../../images/wio-terminal.png) ![一个 Wio Terminal](../../../../images/wio-terminal.png)
> 💁 当你在网上寻找微控制器时,要小心用 **MCU** 这个词,因为这回带来许多关于漫威电影宇宙Marvel Cinematic Universe的搜索结果而不是关于微控制器的。 > 💁 当你在网上寻找微控制器时,要小心用 **MCU** 这个词,因为带来许多关于漫威电影宇宙Marvel Cinematic Universe的搜索结果而不是关于微控制器的。
微控制器被设计成通过编程完成有限数量的非常特定的任务不像PC 或 Mac 那样的通用计算机。除了一些很特殊的场景,你无法连接显示器、键盘和鼠标并利用它完成通用任务。 微控制器被设计成通过编程完成有限数量的非常特定的任务,不像 PC 或 Mac 那样的通用计算机。除了一些很特殊的场景,你无法连接显示器、键盘和鼠标并利用它完成通用任务。
微控制器开发者套件通常包括额外的传感器和执行器。大多数电路板会有至少一个可编程的发光二极管LEDs还有其它设备例如用来添加不同制造商的传感器或执行器或是用来添加内置传感器的标准插头平时最常见的如温度。有些微控制器有内置的无线连接如蓝牙或 Wi-Fi或者在电路板上有额外的微控制器来添加这种连接。 微控制器开发者套件通常包括额外的传感器和执行器。大多数电路板会有至少一个可编程的发光二极管LEDs还有其它设备例如用来添加不同制造商的传感器或执行器或是用来添加内置传感器的标准插头平时最常见的如温度。有些微控制器有内置的无线连接如蓝牙或 Wi-Fi或者在电路板上有额外的微控制器来添加这种连接。
@ -80,21 +80,21 @@ IoT 的 **T** 代表 **Things**(物)—— 可以和物理世界交互的设
Raspberry Pi 是其中最流行的单板机。 Raspberry Pi 是其中最流行的单板机。
与微控制器一样单板机具有CPU、内存和输入/输出引脚但它们也有额外的功能如一个让你连接显示器的图形芯片、音频输出以及USB端口它让你连接键盘、鼠标和其它标准USB设备如网络摄像头和外置储存。程序与操作系统一起存储在 SD 卡或硬盘驱动器上,而不是内置于板中的内存芯片。 与微控制器一样,单板机具有 CPU、内存和输入/输出引脚,但它们也有额外的功能,如一个让你连接显示器的图形芯片、音频输出,以及 USB 端口它让你连接键盘、鼠标和其它标准USB设备如网络摄像头和外置储存。程序与操作系统一起存储在 SD 卡或硬盘驱动器上,而不是内置于板中的内存芯片。
> 🎓 你可以把单板机当成一个更小、更便宜的个人电脑就像你现在正在用来读这篇文章的PC或Mac。可是单板机还增加了通用输入/输出引脚GPIOgeneral-purpose input/output让你和传感器、执行器交互。 > 🎓 你可以把单板机当成一个更小、更便宜的个人电脑,就像你现在正在用来读这篇文章的 PC Mac。可是单板机还增加了通用输入/输出引脚GPIOgeneral-purpose input/output让你和传感器、执行器交互。
单板机是功能齐全的计算机所以你可以用任何编程语言来为它写程序。我们通常用Python为物联网设备写程序。 单板机是功能齐全的计算机,所以你可以用任何编程语言来为它写程序。我们通常用 Python 为物联网设备写程序。
### 日后课程的硬件选择 ### 日后课程的硬件选择
所有后续课程都包括使用物联网设备与物理世界交互并与云通信的作业。每节课会支持3种设备选择Arduino使用Seeed Studios Wio Terminal或者单板机物理设备Raspberry Pi 4或在你的电脑上运行的虚拟单板机。 所有后续课程都包括使用物联网设备与物理世界交互并与云通信的作业。每节课会支持3种设备选择Arduino使用 Seeed Studios Wio Terminal或者单板机物理设备Raspberry Pi 4或在你的电脑上运行的虚拟单板机。
你能在[硬件手册](../../../../hardware.md)查到完成作业所需的硬件。 你能在[硬件手册](../../../../hardware.md)查到完成作业所需的硬件。
> 💁 你不需要为了完成作业而买任何物联网硬件;虚拟单板机即可完成所有任务。 > 💁 你不需要为了完成作业而买任何物联网硬件;虚拟单板机即可完成所有任务。
要使用哪种硬件是你的选择取决于你家里或学校里有什么以及你知道或想学的编程语言。两种硬件都使用同样的传感器生态系统所以万一你想途中改变你的选择你也不需要替换大部分的套件。用虚拟单板机相当于在Raspberry Pi上学习如果你最后购买了设备和传感器大部分代码都可以转移到 Pi 上。 要使用哪种硬件是你的选择,取决于你家里或学校里有什么,以及你知道或想学的编程语言。两种硬件都使用同样的传感器生态系统,所以万一你想途中改变你的选择,你也不需要替换大部分的套件。用虚拟单板机相当于在 Raspberry Pi 上学习,如果你最后购买了设备和传感器,大部分代码都可以转移到 Pi 上。
### Arduino 开发者套件 ### Arduino 开发者套件
@ -104,7 +104,7 @@ Raspberry Pi 是其中最流行的单板机。
### 单板机开发者套件 ### 单板机开发者套件
如果你对使用单板机学物联网开发有兴趣你可以用Raspberry Pi树莓派或者在你的电脑运行的虚拟设备来完成作业。 如果你对使用单板机学物联网开发有兴趣,你可以用 Raspberry Pi树莓派或者在你的电脑运行的虚拟设备来完成作业。
你需要对 Python 有基本的理解,因为将来的课程只会教授与所使用的传感器和执行器相关的代码,以及与云交互的库。 你需要对 Python 有基本的理解,因为将来的课程只会教授与所使用的传感器和执行器相关的代码,以及与云交互的库。
@ -115,7 +115,7 @@ Raspberry Pi 是其中最流行的单板机。
作业将用 [Visual Studio Code](https://code.visualstudio.com/?WT.mc_id=academic-17441-jabenn)。 作业将用 [Visual Studio Code](https://code.visualstudio.com/?WT.mc_id=academic-17441-jabenn)。
如果你使用的是Raspberry Pi则可以使用完整桌面版 Raspberry Pi OS 运行你的树莓派,并使用 [VS Code 的 Raspberry Pi OS版](https://code.visualstudio.com/docs/setup/raspberry-pi?WT.mc_id=academic-17441-jabenn)直接在你的树莓派上写程序。或者把它当成一个无头设备,从你的电脑用 VS Code 的 [Remote SSH插件](https://code.visualstudio.com/docs/remote/ssh?WT.mc_id=academic-17441-jabenn)写程序;这个插件让你连接到树莓派,编辑,调试和运行代码,就像你直接在树莓派上写程序一样。 如果你使用的是 Raspberry Pi则可以使用完整桌面版 Raspberry Pi OS 运行你的树莓派,并使用 [VS Code 的 Raspberry Pi OS 版](https://code.visualstudio.com/docs/setup/raspberry-pi?WT.mc_id=academic-17441-jabenn)直接在你的树莓派上写程序。或者把它当成一个无头设备,从你的电脑用 VS Code 的 [Remote SSH 插件](https://code.visualstudio.com/docs/remote/ssh?WT.mc_id=academic-17441-jabenn)写程序;这个插件让你连接到树莓派,编辑,调试和运行代码,就像你直接在树莓派上写程序一样。
如果你选择用虚拟设备,将直接在你的电脑上写程序。你不会直接访问传感器和执行器,而是用工具来模拟此硬件,提供自己定义的传感器值,并在屏幕上显示执行器的结果。 如果你选择用虚拟设备,将直接在你的电脑上写程序。你不会直接访问传感器和执行器,而是用工具来模拟此硬件,提供自己定义的传感器值,并在屏幕上显示执行器的结果。
@ -127,13 +127,13 @@ Raspberry Pi 是其中最流行的单板机。
这些说明包括您将使用的硬件或工具的创建者提供的第三方网站链接。这是为了确保你始终遵照工具和硬件的最新说明。 这些说明包括您将使用的硬件或工具的创建者提供的第三方网站链接。这是为了确保你始终遵照工具和硬件的最新说明。
按照相关的指南来设置你的设备并完成一个“Hello World”项目。我们将用4个课程创造一个物联网夜灯而这是第一步。 按照相关的指南来设置你的设备并完成一个“Hello World”项目。我们将用 4 个课程创造一个物联网夜灯,而这是第一步。
* [ArduinoWio Terminal](wio-terminal.zh-cn.md) * [ArduinoWio Terminal](wio-terminal.zh-cn.md)
* [单板机Raspberry Pi](../pi.md) * [单板机Raspberry Pi](pi.zh-cn.md)
* [单板机:虚拟设备](virtual-device.zh-cn.md) * [单板机:虚拟设备](virtual-device.zh-cn.md)
您将使用 VS Code在Arduino 和单板机上编程。如果您以前从未使用过它,请在 [VS Code 站点](https://code.visualstudio.com/?WT.mc_id=academic-17441-jabenn)上阅读更多相关信息。 您将使用 VS Code Arduino 和单板机上编程。如果您以前从未使用过它,请在 [VS Code 站点](https://code.visualstudio.com/?WT.mc_id=academic-17441-jabenn)上阅读更多相关信息。
## 物联网的应用场景 ## 物联网的应用场景
@ -150,7 +150,7 @@ Raspberry Pi 是其中最流行的单板机。
消费物联网指的是消费者购买的家用物联网设备。这些设备中有的非常有用,例如:智能音箱、智能供暖系统和机器人吸尘器。其它的设备可用性则存疑,例如声控水龙头,这意味着您无法关闭它们,因为声控无法在流水声中听到您的声音。 消费物联网指的是消费者购买的家用物联网设备。这些设备中有的非常有用,例如:智能音箱、智能供暖系统和机器人吸尘器。其它的设备可用性则存疑,例如声控水龙头,这意味着您无法关闭它们,因为声控无法在流水声中听到您的声音。
消费物联网设备使人们能够在周围环境中获取更多能力尤其是世界上的10亿个残障人士。机器人吸尘器能为行动不便、无法亲自清扫的人提供干净的地板、声控烤箱让视力或行动较差的人用自己的语音打开烤箱、健康监测器使患者能够监测自己的慢性病情况并定期得到更加详细的信息。这些设备将变得普及到连小孩子也在天天使用它们如学生们在冠状病毒疫情时进行居家学习利用智能家居设备的计时器记录他们的功课或者设置闹钟来提醒他们参与他们未来的课程。 消费物联网设备使人们能够在周围环境中获取更多能力,尤其是世界上的 10 亿个残障人士。机器人吸尘器能为行动不便、无法亲自清扫的人提供干净的地板、声控烤箱让视力或行动较差的人用自己的语音打开烤箱、健康监测器使患者能够监测自己的慢性病情况并定期得到更加详细的信息。这些设备将变得普及到连小孩子也在天天使用它们,如学生们在冠状病毒疫情时进行居家学习,利用智能家居设备的计时器记录他们的功课或者设置闹钟来提醒他们参与他们未来的课程。
✅ 你身上或家里有什么消费物联网设备呢? ✅ 你身上或家里有什么消费物联网设备呢?
@ -166,7 +166,7 @@ Raspberry Pi 是其中最流行的单板机。
工厂以多种不同方式使用物联网设备。它们能使用各种传感器(如:温度、振动、旋转速度等)来监测机械。我们可以监测这些数据,以便在机器超出特定指标时停止机器 如它的温度太高。我们也可以收集并分析这些数据让人工智能AI模型学习故障前的数据再利用它预报其它未来的故障这就叫做“预测性维护”。 工厂以多种不同方式使用物联网设备。它们能使用各种传感器(如:温度、振动、旋转速度等)来监测机械。我们可以监测这些数据,以便在机器超出特定指标时停止机器 如它的温度太高。我们也可以收集并分析这些数据让人工智能AI模型学习故障前的数据再利用它预报其它未来的故障这就叫做“预测性维护”。
为了养活不断增长的人口,数字农业非常重要,尤其是对于依靠[自给农业](https://wikipedia.org/wiki/Subsistence_agriculture) 的5亿家户中的20亿人而言。数字农业的领域包括才几块钱的传感器也包含大规模的商业装置。农民可以首先监测温度以及用[生长度日GDD](https://wikipedia.org/wiki/Growing_degree-day),预测农作物什么时候收割。你们还可以将土壤湿度监测与自动浇水系统连接起来,为他们的植物提供刚好所需的水量,而不浪费水资源。最后,农民可以进一步、用无人驾驶飞机、卫星数据、人工智能来监测大面积农田的作物生长、疾病和土壤质量。 为了养活不断增长的人口,数字农业非常重要,尤其是对于依靠[自给农业](https://wikipedia.org/wiki/Subsistence_agriculture) 的 5 亿家户中的 20 亿人而言。数字农业的领域包括才几块钱的传感器,也包含大规模的商业装置。农民可以首先监测温度以及用[生长度日GDD](https://wikipedia.org/wiki/Growing_degree-day),预测农作物什么时候收割。你们还可以将土壤湿度监测与自动浇水系统连接起来,为他们的植物提供刚好所需的水量,而不浪费水资源。最后,农民可以进一步、用无人驾驶飞机、卫星数据、人工智能来监测大面积农田的作物生长、疾病和土壤质量。
✅ 还有什么物联网设备可以用来帮助农民呢? ✅ 还有什么物联网设备可以用来帮助农民呢?
@ -214,7 +214,7 @@ Raspberry Pi 是其中最流行的单板机。
几个例子: 几个例子:
* 这个推特账户 **[Internet of Sh*t](https://twitter.com/internetofshit)** *(亵渎警告)* 有几个关于消费物联网失败的好例子。 * 这个推特账户 **[Internet of Sh*t](https://twitter.com/internetofshit)** *(亵渎警告)* 有几个关于消费物联网失败的好例子。
* [c|net - 我的 Apple Watch 救了我一命5个人分享他们的故事](https://www.cnet.com/news/apple-watch-lifesaving-health-features-read-5-peoples-stories/) * [c|net - 我的 Apple Watch 救了我一命5 个人分享他们的故事](https://www.cnet.com/news/apple-watch-lifesaving-health-features-read-5-peoples-stories/)
* [c|net - ADT 技术人员承认多年来一直监视客户的摄像头信息](https://www.cnet.com/news/adt-home-security-technician-pleads-guilty-to-spying-on-customer-camera-feeds-for-years/) *(触发警告:未经同意的偷窥)* * [c|net - ADT 技术人员承认多年来一直监视客户的摄像头信息](https://www.cnet.com/news/adt-home-security-technician-pleads-guilty-to-spying-on-customer-camera-feeds-for-years/) *(触发警告:未经同意的偷窥)*
## 作业 ## 作业

@ -2,9 +2,9 @@
## 指示 ## 指示
从智慧农场到智慧城市、医疗保健监测系统、交通或利用公共空间等世界上有非常多IoT项目。 从智慧农场到智慧城市、医疗保健监测系统、交通或利用公共空间等,世界上有非常多 IoT 项目。
在互联网寻找一个让你感兴趣的IoT项目的细节最好是离你不太远的。解释一下项目的好处与坏处例如它带来的益处、它带来的任何麻烦以及他怎么顾及隐私。 在互联网寻找一个让你感兴趣的 IoT 项目的细节,最好是离你不太远的。解释一下项目的好处与坏处,例如:它带来的益处、它带来的任何麻烦以及他怎么顾及隐私。
## 评分表 ## 评分表

@ -66,7 +66,7 @@ Grove বেস হ্যাটটি রাস্পবেরি পাই এ
> 💁 পছন্দানুসারে যেকোন পাইথন আইডিই বা এডিটর ব্যবহার করলেই হয়, কিন্তু আমরা এখানে সম্পূর্ণ টিউটোরিয়াল সাজিয়েছি ভিএস কোডের উপর ভিত্তি করে। > 💁 পছন্দানুসারে যেকোন পাইথন আইডিই বা এডিটর ব্যবহার করলেই হয়, কিন্তু আমরা এখানে সম্পূর্ণ টিউটোরিয়াল সাজিয়েছি ভিএস কোডের উপর ভিত্তি করে।
6. Pylance ইন্সটল করতে হবে। পাইথনে কোড করার জন্য, এটি ভিএস কোডের একটি এক্সটেনশন। [Pylance extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) থেকে এটি ইন্সটল করার সকল নির্দেশনা পাওয়া যাবে। 6. Pylance ইন্সটল করতে হবে। পাইথনে কোড করার জন্য, এটি ভিএস কোডের একটি এক্সটেনশন। [Pylance extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) থেকে এটি ইন্সটল করার সকল নির্দেশনা পাওয়া যাবে।
### পাই তে রিমোট একসেস ### পাই তে রিমোট একসেস
@ -184,7 +184,7 @@ Grove বেস হ্যাটটি রাস্পবেরি পাই এ
1. একই গাইড ফলো করে রাস্পবেরি পাই কে ভিএস কোডের সাথে সংযুক্ত করতে হবে। 1. একই গাইড ফলো করে রাস্পবেরি পাই কে ভিএস কোডের সাথে সংযুক্ত করতে হবে।
1. কানেক্ট হয়ে যাওয়ার পরে [managing extensions](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) অনুসারে [Pylance extension](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) রিমোট মাধ্যমে পাই তে ইন্সটল করতে হবে। 1. কানেক্ট হয়ে যাওয়ার পরে [managing extensions](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) অনুসারে [Pylance extension](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) রিমোট মাধ্যমে পাই তে ইন্সটল করতে হবে।
## Hello world (হ্যালো ওয়ার্লড) ## Hello world (হ্যালো ওয়ার্লড)

@ -69,7 +69,7 @@
>💁 यदि आपके पास कोई पसंदीदा टूल है, तो आप इन पाठों के लिए किसी भी पायथन आईडीई या संपादक का उपयोग करने के लिए स्वतंत्र हैं, लेकिन पाठ वीएस कोड के उपयोग के आधार पर निर्देश देंगे। >💁 यदि आपके पास कोई पसंदीदा टूल है, तो आप इन पाठों के लिए किसी भी पायथन आईडीई या संपादक का उपयोग करने के लिए स्वतंत्र हैं, लेकिन पाठ वीएस कोड के उपयोग के आधार पर निर्देश देंगे।
1. पाइलेंस स्थापित करें। यह वीएस कोड के लिए एक एक्सटेंशन है जो पायथन भाषा समर्थन प्रदान करता है। वीएस कोड में इस एक्सटेंशन को स्थापित करने के निर्देशों के लिए [पायलेंस एक्सटेंशन डॉक्यूमेंटेशन](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) देखें। 1. पाइलेंस स्थापित करें। यह वीएस कोड के लिए एक एक्सटेंशन है जो पायथन भाषा समर्थन प्रदान करता है। वीएस कोड में इस एक्सटेंशन को स्थापित करने के निर्देशों के लिए [पायलेंस एक्सटेंशन डॉक्यूमेंटेशन](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) देखें।
### पाई को कोड करने के लिए रिमोट एक्सेस ### पाई को कोड करने के लिए रिमोट एक्सेस
@ -189,7 +189,7 @@
1. समान निर्देशों का पालन करते हुए, VS कोड को पाइ से कनेक्ट करें 1. समान निर्देशों का पालन करते हुए, VS कोड को पाइ से कनेक्ट करें
1. कनेक्ट होने के बाद, [पाइलेंस एक्सटेंशन](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) इंस्टॉल करने के लिए [मैनेजिंग एक्सटेंशन](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) निर्देशों का पालन करें। 1. कनेक्ट होने के बाद, [पाइलेंस एक्सटेंशन](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) इंस्टॉल करने के लिए [मैनेजिंग एक्सटेंशन](https://code.visualstudio.com/docs/remote/ssh?WT.mc_id=academic-17441-jabenn#_managing-extensions) निर्देशों का पालन करें।
## हैलो वर्ल्ड ## हैलो वर्ल्ड

@ -67,7 +67,7 @@ Para programar o Pi usando os sensores e atuadores Grove, você precisará insta
> 💁 Você está livre para usar qualquer IDE de Python ou editor para essas lições se tiver uma ferramenta preferida, mas as lições darão instruções baseadas no uso do VS Code. > 💁 Você está livre para usar qualquer IDE de Python ou editor para essas lições se tiver uma ferramenta preferida, mas as lições darão instruções baseadas no uso do VS Code.
1. Instale o Pylance. Esta é uma extensão para VS Code que fornece suporte à linguagem Python. Consulte a [documentação da extensão Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) para obter instruções sobre como instalar esta extensão no VS Code. 1. Instale o Pylance. Esta é uma extensão para VS Code que fornece suporte à linguagem Python. Consulte a [documentação da extensão Pylance](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) para obter instruções sobre como instalar esta extensão no VS Code.
### Acesso remoto para codificar o Pi ### Acesso remoto para codificar o Pi
@ -187,7 +187,7 @@ Instale o software necessário e conecte-se remotamente ao seu Pi.
1. Seguindo as mesmas instruções, conecte o VS Code ao Pi 1. Seguindo as mesmas instruções, conecte o VS Code ao Pi
1. Depois de conectado, siga as instruções em [gerenciando extensões](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) para instalar a [extensão Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) remotamente no Pi 1. Depois de conectado, siga as instruções em [gerenciando extensões](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn) para instalar a [extensão Pylance](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) remotamente no Pi
## Hello World ## Hello World

@ -67,7 +67,7 @@
> 💁 如果你有更喜欢的工具你也可以自由使用任意的Python IDE或者编辑器来学习课程但是课程中会基于VS Code来给出指示。 > 💁 如果你有更喜欢的工具你也可以自由使用任意的Python IDE或者编辑器来学习课程但是课程中会基于VS Code来给出指示。
1. 安装Pylance这是给VS Code提供Python语言支持的扩展插件可以参考这个[Pylance扩展文档](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn)中的指示在VS Code中安装这个插件。 1. 安装Pylance这是给VS Code提供Python语言支持的扩展插件可以参考这个[Pylance扩展文档](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance)中的指示在VS Code中安装这个插件。
### 远程连接来编码树莓派 ### 远程连接来编码树莓派
@ -186,7 +186,7 @@
3. 根据相同的指示连接VS Code到树莓派 3. 根据相同的指示连接VS Code到树莓派
4. 连接上之后,根据[管理扩展程序](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn)的指示来远程安装[Pylance扩展程序](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn)到树莓派上 4. 连接上之后,根据[管理扩展程序](https://code.visualstudio.com/docs/remote/ssh#_managing-extensions?WT.mc_id=academic-17441-jabenn)的指示来远程安装[Pylance扩展程序](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance)到树莓派上
## Hello world ## Hello world

@ -16,7 +16,7 @@ Instale o software necessário.
> 💁 Você está livre para usar qualquer IDE ou editor de código Python para essas lições se tiver uma ferramenta preferida, mas as lições darão instruções baseadas no uso do VS Code. > 💁 Você está livre para usar qualquer IDE ou editor de código Python para essas lições se tiver uma ferramenta preferida, mas as lições darão instruções baseadas no uso do VS Code.
1. Instale a extensão Pylance do VS Code. Esta é uma extensão para VS Code que fornece suporte à linguagem Python. Consulte a [documentação da extensão Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) para obter instruções sobre como instalar esta extensão no VS Code. 1. Instale a extensão Pylance do VS Code. Esta é uma extensão para VS Code que fornece suporte à linguagem Python. Consulte a [documentação da extensão Pylance](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) para obter instruções sobre como instalar esta extensão no VS Code.
As instruções para instalar e configurar o aplicativo CounterFit serão fornecidas no momento relevante nas instruções de atribuição, uma vez que é instalado por projeto. As instruções para instalar e configurar o aplicativo CounterFit serão fornecidas no momento relevante nas instruções de atribuição, uma vez que é instalado por projeto.
@ -177,7 +177,7 @@ Como uma segunda etapa 'Hello World', você executará o aplicativo CounterFit e
1. A partir do terminal do VS Code, inicie o aplicativo CounterFit com o seguinte comando: 1. A partir do terminal do VS Code, inicie o aplicativo CounterFit com o seguinte comando:
```sh ```sh
CounterFit counterfit
``` ```
O aplicativo começará a funcionar e abrir no seu navegador da web: O aplicativo começará a funcionar e abrir no seu navegador da web:
@ -193,7 +193,7 @@ Como uma segunda etapa 'Hello World', você executará o aplicativo CounterFit e
CounterFitConnection.init('127.0.0.1', 5000) CounterFitConnection.init('127.0.0.1', 5000)
``` ```
Este código importa a classe `CounterFitConnection` do módulo` counterfit_connection`, que vem do pacote pip `counterfit-connection` que você instalou anteriormente. Em seguida, ele inicializa uma conexão com o aplicativo CounterFit em execução em `127.0.0.1`, que é um endereço IP que você sempre pode usar para acessar seu computador local (muitas vezes referido como *localhost*), na porta 5000. Este código importa a classe `CounterFitConnection` do módulo `counterfit_connection`, que vem do pacote pip `counterfit-connection` que você instalou anteriormente. Em seguida, ele inicializa uma conexão com o aplicativo CounterFit em execução em `127.0.0.1`, que é um endereço IP que você sempre pode usar para acessar seu computador local (muitas vezes referido como *localhost*), na porta 5000.
> 💁 Se você tiver outros aplicativos em execução na porta 5000, pode alterar isso atualizando a porta no código e executando o CounterFit usando `CounterFit --port <port_number>`, substituindo `<port_number>` pela porta que deseja usar. > 💁 Se você tiver outros aplicativos em execução na porta 5000, pode alterar isso atualizando a porta no código e executando o CounterFit usando `CounterFit --port <port_number>`, substituindo `<port_number>` pela porta que deseja usar.
@ -207,4 +207,4 @@ Como uma segunda etapa 'Hello World', você executará o aplicativo CounterFit e
> 💁 Você pode encontrar este código na pasta [code/virtual-device](../code/virtual-device). > 💁 Você pode encontrar este código na pasta [code/virtual-device](../code/virtual-device).
😀 Sua conexão com o hardware foi um sucesso! 😀 Sua conexão com o hardware foi um sucesso!

@ -1,6 +1,6 @@
# 虚拟单板机 # 虚拟单板机
除了买一个 IoT 设备、传感器和执行器,你也可以用你的电脑来模拟 IoT 硬件。[CounterFit 项目](https://github.com/CounterFit-IoT/CounterFit) 让你在自己的电脑上运行模拟 IoT 硬件如传感器和执行器的应用并从本地Python代码访问传感器和执行器代码的编写方式与使用Raspberry Pi物理硬件相同。 除了买一个 IoT 设备、传感器和执行器,你也可以用你的电脑来模拟 IoT 硬件。[CounterFit 项目](https://github.com/CounterFit-IoT/CounterFit) 让你在自己的电脑上运行模拟 IoT 硬件(如传感器和执行器)的应用,并从本地 Python 代码访问传感器和执行器,代码的编写方式,与使用 Raspberry Pi 物理硬件相同。
## 设置 ## 设置
@ -10,13 +10,13 @@
安装需要的软件。 安装需要的软件。
1. 安装 Python。 在 [Python 的下载页](https://www.python.org/downloads/) 找到最新版本Python的安装指示。 1. 安装 Python。 在 [Python 的下载页](https://www.python.org/downloads/) 找到最新版本 Python 的安装指示。
1. 安装 Visual Studio Code (VS Code)。 这是你将用来写虚拟设备的 Python代码的代码编辑器。在 [VS Code 文档](https://code.visualstudio.com?WT.mc_id=academic-17441-jabenn) 找到VS Code的安装指示。 1. 安装 Visual Studio Code (VS Code)。 这是你将用来写虚拟设备的 Python 代码的代码编辑器。在 [VS Code 文档](https://code.visualstudio.com?WT.mc_id=academic-17441-jabenn) 找到 VS Code 的安装指示。
> 💁 如果你对其它平台比较熟悉,你当然可以用你较喜欢的 Python IDE 或 代码编辑器但注意这个课程将根据VS Code提供说明。 > 💁 如果你对其它平台比较熟悉,你当然可以用你较喜欢的 Python IDE 或 代码编辑器,但注意这个课程将根据 VS Code 提供说明。
1. 安装 VS Code 的 Pylance 扩展。 这个 VS Code 扩展提供 Python 语言支持。在 [Pylance 扩展文档](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) 找安装扩展的指示。 1. 安装 VS Code 的 Pylance 扩展。 这个 VS Code 扩展提供 Python 语言支持。在 [Pylance 扩展文档](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) 找安装扩展的指示。
我们将在日后的作业中提供安装及设置 CounterFit 的说明,因为我们需要在每个项目中安装它。 我们将在日后的作业中提供安装及设置 CounterFit 的说明,因为我们需要在每个项目中安装它。
@ -24,15 +24,15 @@
第一次用新的编程语言或技术通常以创建一个“Hello World”应用开始——一个输出类似`"Hello World"`文本的小小应用,以确保所有的工具被设置好。 第一次用新的编程语言或技术通常以创建一个“Hello World”应用开始——一个输出类似`"Hello World"`文本的小小应用,以确保所有的工具被设置好。
这个虚拟 IoT 硬件的“Hello World”应用将确保你安装好 Python 与 Visual Studio Code。它也会连接到 CounterFit以获取虚拟 IoT 传感器和执行器。它不会用到任何硬件,它只会以正确连接来证明每个部分运作良好。 这个虚拟 IoT 硬件的“Hello World”应用将确保你安装好 Python 与 Visual Studio Code。它也会连接到 CounterFit 以获取虚拟 IoT 传感器和执行器。它不会用到任何硬件,它只会以正确连接来证明每个部分运作良好。
这个应用放在名为`nightlight`的文件夹中,稍后将和其他代码结合,以构建夜灯应用。 这个应用放在名为 `nightlight` 的文件夹中,稍后将和其他代码结合,以构建夜灯应用。
### 配置 Python 虚拟环境 ### 配置 Python 虚拟环境
Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)这些是由其他人编写并发布到互联网上的代码包。只需一条命令就可以在你的电脑上安装pip 软件包,并在你的代码中使用它。你将用 pip 安装一个软件包来与CounterFit 沟通。 Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org);这些是由其他人编写并发布到互联网上的代码包。只需一条命令就可以在你的电脑上安装 pip 软件包,并在你的代码中使用它。你将用 pip 安装一个软件包,来与 CounterFit 沟通。
默认情况下,当你安装软件包时,在计算机的任何位置都是可用的,而这可能会造成软件包版本问题,例如:当你为新应用安装软件包的新版本,依靠旧版本的另一应用就有可能出现状况。为了避免这种问题,你可以使用 [Python 虚拟环境](https://docs.python.org/3/library/venv.html),本质上是一个专用文件夹中的 Python 副本,当你安装 pip 软件包时,它们只会安装到那个文件夹中。 默认情况下,当你安装软件包时,在计算机的任何位置都是可用的,而这可能会造成软件包版本问题,例如:当你为新应用安装软件包的新版本,依靠旧版本的另一应用就有可能出现状况。为了避免这种问题,你可以使用 [Python 虚拟环境](https://docs.python.org/3/library/venv.html),本质上是一个专用文件夹中的 Python 副本,当你安装 pip 软件包时,它们只会安装到那个文件夹中。
#### 任务:配置一个 Python 虚拟环境 #### 任务:配置一个 Python 虚拟环境
@ -45,7 +45,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
cd nightlight cd nightlight
``` ```
2. 现在,运行以下的程序来在`.venv` 文件夹中创建一个虚拟环境 2. 现在,运行以下的程序来在 `.venv` 文件夹中创建一个虚拟环境
```sh ```sh
python3 -m venv .venv python3 -m venv .venv
@ -82,7 +82,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
> 💁 你的 Python 版本有可能不一样,但只要版本是 3.6 或以上就没事。不然,请删除这个文件夹,并安装较新的 Python 版本,再试一试。 > 💁 你的 Python 版本有可能不一样,但只要版本是 3.6 或以上就没事。不然,请删除这个文件夹,并安装较新的 Python 版本,再试一试。
5. 运行以下的命令来安装CounterFit 软件包。这些软件包包括主要的 CounterFit 应用以及 Grove 硬件的[垫片](https://zh.wikipedia.org/wiki/%E5%9E%AB%E7%89%87_(%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1))。这些垫片让你就像用来自 Grove 生态系统的物理传感器和执行器一样写代码,但把它连接到虚拟 IoT 设备。 5. 运行以下的命令来安装 CounterFit 软件包。这些软件包包括主要的 CounterFit 应用以及 Grove 硬件的[垫片](https://zh.wikipedia.org/wiki/%E5%9E%AB%E7%89%87_(%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1))。这些垫片让你就像用来自 Grove 生态系统的物理传感器和执行器一样写代码,但把它连接到虚拟 IoT 设备。
```sh ```sh
pip install CounterFit pip install CounterFit
@ -94,13 +94,13 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
### 编写代码 ### 编写代码
一旦Python 虚拟环境被准备好,你就能为 “Hello World” 应用写代码。 一旦 Python 虚拟环境被准备好,你就能为 “Hello World” 应用写代码。
#### 任务:编写代码 #### 任务:编写代码
创建一个 Python 应用在控制台上打印`"Hello World"` 输出。 创建一个 Python 应用在控制台上打印 `"Hello World"` 输出。
1. 从你的终端或命令行,在虚拟环境中运行以下的程序来创建一个叫做`app.py` 的 Python 文件: 1. 从你的终端或命令行,在虚拟环境中运行以下的程序来创建一个叫做 `app.py` 的 Python 文件:
* 在 Windows 运行: * 在 Windows 运行:
@ -120,13 +120,13 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
code . code .
``` ```
> 💁 如果你的终端在 macOS 返回`command not found`,那就代表 VS Code 还未被加进你的 PATH。为了把 VS Code 加进你的 PATH你可以按照 [Launching from the command line section of the VS Code 文档](https://code.visualstudio.com/docs/setup/mac?WT.mc_id=academic-17441-jabenn#_launching-from-the-command-line) 的指示,然后运行命令。在 Windows 和 LinuxVS Code 默认被加进你的 PATH。 > 💁 如果你的终端在 macOS 返回 `command not found`,那就代表 VS Code 还未被加进你的 PATH。为了把 VS Code 加进你的 PATH你可以按照 [Launching from the command line section of the VS Code 文档](https://code.visualstudio.com/docs/setup/mac?WT.mc_id=academic-17441-jabenn#_launching-from-the-command-line) 的指示,然后运行命令。在 Windows 和 LinuxVS Code 默认被加进你的 PATH。
3. 当 VS Code 被启动,它会激活 Python 虚拟环境。被选择的虚拟环境将在底部状态栏出现: 3. 当 VS Code 被启动,它会激活 Python 虚拟环境。被选择的虚拟环境将在底部状态栏出现:
![ 被选择的虚拟环境将在 VS Code的底部状态栏出现](../../../images/vscode-virtual-env.png) ![ 被选择的虚拟环境将在 VS Code的底部状态栏出现](../../../images/vscode-virtual-env.png)
4. 如果VS Code 被启动时VS Code 终端已经正在运行,虚拟环境不会被激活。这时,最容易做的是用 **Kill the active terminal instance** 的按钮: 4. 如果 VS Code 被启动时 VS Code 终端已经正在运行,虚拟环境不会被激活。这时,最容易做的是用 **Kill the active terminal instance** 的按钮:
![VS Code Kill the active terminal instance 按钮](../../../images/vscode-kill-terminal.png) ![VS Code Kill the active terminal instance 按钮](../../../images/vscode-kill-terminal.png)
@ -138,7 +138,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
如果你没有 `.venv` 的字首在提示上,虚拟环境不在终端中活动。 如果你没有 `.venv` 的字首在提示上,虚拟环境不在终端中活动。
5. 为了启动一个新的 VS Code 终端,选择*Terminal -> New Terminal 或按`` CTRL+` ``。这个新终端将加载虚拟环境,以及激活它的调用将在终端中出现。提示也会有虚拟环境的名字(`.venv` 5. 为了启动一个新的 VS Code 终端,选择 *Terminal -> New Terminal 或按`` CTRL+` ``。这个新终端将加载虚拟环境,以及激活它的调用将在终端中出现。提示也会有虚拟环境的名字(`.venv`
```output ```output
➜ nightlight source .venv/bin/activate ➜ nightlight source .venv/bin/activate
@ -170,14 +170,14 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
### 连接“硬件” ### 连接“硬件”
你的第二个“Hello World”步骤是运行 CounterFit 应用并连接你的代码。这相当于把一些 IoT 硬件插入开发者套件。 你的第二个 “Hello World” 步骤,是运行 CounterFit 应用并连接你的代码。这相当于把一些 IoT 硬件插入开发者套件。
#### 任务:连接“硬件” #### 任务:连接“硬件”
1. 从 VS Code 终端,用以下的命令启动 CounterFit 应用: 1. 从 VS Code 终端,用以下的命令启动 CounterFit 应用:
```sh ```sh
CounterFit counterfit
``` ```
应用将开始运行以及在你的网页浏览器打开: 应用将开始运行以及在你的网页浏览器打开:
@ -193,7 +193,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
CounterFitConnection.init('127.0.0.1', 5000) CounterFitConnection.init('127.0.0.1', 5000)
``` ```
这个代码从 `counterfit_connection` 模块进口`CounterFitConnection` 类;这个模块来自你刚才安装的 `counterfit-connection` pip 软件包。然后,它初始化跟 CounterFit 应用的连接。应用在`127.0.0.1` 运行着它是一个IP 地址,而你一直可以用它在端口 5000 访问你的本地电脑(通常被叫为*localhost*)。 这个代码从 `counterfit_connection` 模块进口 `CounterFitConnection` 类;这个模块来自你刚才安装的 `counterfit-connection` pip 软件包。然后,它初始化跟 CounterFit 应用的连接。应用在 `127.0.0.1` 运行着;它是一个 IP 地址,而你一直可以用它在端口 5000 访问你的本地电脑(通常被叫为 *localhost*)。
> 💁 如果你有其它应用正在端口 5000 运行着,你可以在代码更新端口,再用 `CounterFit --port <port_number>` 运行 CounterFit在`<port_number>` 填着你想用的端口。 > 💁 如果你有其它应用正在端口 5000 运行着,你可以在代码更新端口,再用 `CounterFit --port <port_number>` 运行 CounterFit在`<port_number>` 填着你想用的端口。
@ -201,7 +201,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org)
![VS Code Create a new integrated terminal 按钮](../../../../images/vscode-new-terminal.png) ![VS Code Create a new integrated terminal 按钮](../../../../images/vscode-new-terminal.png)
4. 在这个新终端,像以前一样运行`app.py` 文件。CounterFit 的状态将改成 **Connected** 连接LED也会开着。 4. 在这个新终端,像以前一样运行 `app.py` 文件。CounterFit 的状态将改成 **Connected** 连接LED 也会开着。
![CounterFit 被连接了](../../../../images/counterfit-connected.png) ![CounterFit 被连接了](../../../../images/counterfit-connected.png)

@ -17,7 +17,7 @@ Wio Terminal ব্যবহার করার জন্য, আমাদের
> 💁 আরডুইনো ডেভলপমেন্ট এর জন্য আর একটি ভালো আই.ডি.ই হলো [Arduino IDE](https://www.arduino.cc/en/software). এই IDE টির সাথে কাজ করার পূর্ব অভিজ্ঞতা থাকলে ভি এস কোড ও platformIO এর পরিবর্তে একেও ব্যাবহার করা যেতে পারে। তবে, এখানে আমরা ভি এস কোডের উপর ভিত্তি করেই কাজ করবো। > 💁 আরডুইনো ডেভলপমেন্ট এর জন্য আর একটি ভালো আই.ডি.ই হলো [Arduino IDE](https://www.arduino.cc/en/software). এই IDE টির সাথে কাজ করার পূর্ব অভিজ্ঞতা থাকলে ভি এস কোড ও platformIO এর পরিবর্তে একেও ব্যাবহার করা যেতে পারে। তবে, এখানে আমরা ভি এস কোডের উপর ভিত্তি করেই কাজ করবো।
২. এরপর ভি এস কোড platformIO এক্সটেনশনটি ইনস্টল করতে হবে। এই এক্সটেনশনটি ভি এস কোডে ইনস্টল করতে [PlatformIO extension documentation](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide&WT.mc_id=academic-17441-jabenn) এ দেওয়া দিকির্দেশনাগুলো পড়ে দেখতে পারেন। এটি একটি ভি এস কোড এক্সটেনশন যা সি/সি++ ভাষায় মাইক্রোকন্ট্রোলার প্রোগ্রামিংকে সাপোর্ট করে। এই এক্সটেনশনটি মাইক্রোসফট সি/সি++ এর উপর নির্ভর করে , সি অথবা সি++ ভাষা নিয়ে কাজ করার জন্য। উল্লেখ্য, এই সি/সি++ এক্সটেনশন সয়ংক্রিয়ভাবে ইনস্টল হয়ে যায় যখন কেউ platformIO ইনস্টল করে। ২. এরপর ভি এস কোড platformIO এক্সটেনশনটি ইনস্টল করতে হবে। এই এক্সটেনশনটি ভি এস কোডে ইনস্টল করতে [PlatformIO extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=platformio.platformio-ide) এ দেওয়া দিকির্দেশনাগুলো পড়ে দেখতে পারেন। এটি একটি ভি এস কোড এক্সটেনশন যা সি/সি++ ভাষায় মাইক্রোকন্ট্রোলার প্রোগ্রামিংকে সাপোর্ট করে। এই এক্সটেনশনটি মাইক্রোসফট সি/সি++ এর উপর নির্ভর করে , সি অথবা সি++ ভাষা নিয়ে কাজ করার জন্য। উল্লেখ্য, এই সি/সি++ এক্সটেনশন সয়ংক্রিয়ভাবে ইনস্টল হয়ে যায় যখন কেউ platformIO ইনস্টল করে।
৩. এখন, আমরা আমাদের Wio Terminal কে কম্পিউটার এর সাথে সংযুক্ত করব। এটির নিচের দিকে একটি ইউএসবি-সি পোর্ট আছে, সেটিকে আমরা আমাদের কম্পিউটার এর ইউএসবি পোর্ট এর সাথে সংযোগ দিব। উইও টার্মিনালে ইউএসবি-সি ও ইউএসবি-এ ক্যাবল থাকে। যদি আমাদের কম্পিউটারে শুধু ইউএসবি-সি পোর্ট থেকে, তাহলে আমাদের হয় ইউএসবি-সি ক্যাবল অথবা ইউএসবি-এ ক্যাবলের প্রয়োজন হবে ইউএসবি-সি অ্যাডাপ্টার এ সংযোগ দেওয়ার জন্য। ৩. এখন, আমরা আমাদের Wio Terminal কে কম্পিউটার এর সাথে সংযুক্ত করব। এটির নিচের দিকে একটি ইউএসবি-সি পোর্ট আছে, সেটিকে আমরা আমাদের কম্পিউটার এর ইউএসবি পোর্ট এর সাথে সংযোগ দিব। উইও টার্মিনালে ইউএসবি-সি ও ইউএসবি-এ ক্যাবল থাকে। যদি আমাদের কম্পিউটারে শুধু ইউএসবি-সি পোর্ট থেকে, তাহলে আমাদের হয় ইউএসবি-সি ক্যাবল অথবা ইউএসবি-এ ক্যাবলের প্রয়োজন হবে ইউএসবি-সি অ্যাডাপ্টার এ সংযোগ দেওয়ার জন্য।

@ -16,7 +16,7 @@ Instale o software necessário e atualize o firmware.
> 💁 Outro IDE popular para o desenvolvimento do Arduino é o [Arduino IDE](https://www.arduino.cc/en/software). Se você já está familiarizado com esta ferramenta, você pode usá-la em vez do VS Code e PlatformIO, mas as lições darão instruções baseadas no uso do VS Code. > 💁 Outro IDE popular para o desenvolvimento do Arduino é o [Arduino IDE](https://www.arduino.cc/en/software). Se você já está familiarizado com esta ferramenta, você pode usá-la em vez do VS Code e PlatformIO, mas as lições darão instruções baseadas no uso do VS Code.
1. Instale a extensão PlatformIO do VS Code. Esta é uma extensão do VS Code que oferece suporte à programação de microcontroladores em C/C++. Consulte a [documentação da extensão PlatformIO](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide&WT.mc_id=academic-17441-jabenn) para obter instruções sobre como instalar esta extensão no VS Code. Esta extensão depende da extensão Microsoft C/C++ para funcionar com código C e C ++, e a extensão C/C++ é instalada automaticamente quando você instala a extensão PlatformIO. 1. Instale a extensão PlatformIO do VS Code. Esta é uma extensão do VS Code que oferece suporte à programação de microcontroladores em C/C++. Consulte a [documentação da extensão PlatformIO](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=platformio.platformio-ide) para obter instruções sobre como instalar esta extensão no VS Code. Esta extensão depende da extensão Microsoft C/C++ para funcionar com código C e C ++, e a extensão C/C++ é instalada automaticamente quando você instala a extensão PlatformIO.
1. Conecte o Wio Terminal ao computador. O Wio Terminal possui uma porta USB-C na parte inferior e ela precisa ser conectada a uma porta USB no seu computador. O Wio Terminal vem com um cabo USB-C para USB-A, mas se o seu computador tiver apenas portas USB-C, você precisará de um cabo USB-C ou de um adaptador USB-A para USB-C. 1. Conecte o Wio Terminal ao computador. O Wio Terminal possui uma porta USB-C na parte inferior e ela precisa ser conectada a uma porta USB no seu computador. O Wio Terminal vem com um cabo USB-C para USB-A, mas se o seu computador tiver apenas portas USB-C, você precisará de um cabo USB-C ou de um adaptador USB-A para USB-C.

@ -16,7 +16,7 @@
> 💁 另外一个为 Arduino 开发的 IDE 是 [Arduino IDE](https://www.arduino.cc/en/software)。如果你已经对这个工具熟悉,那你可以把它用来代替 VS Code 和 PlatformIO但这个课程的指示将基于 VS Code。 > 💁 另外一个为 Arduino 开发的 IDE 是 [Arduino IDE](https://www.arduino.cc/en/software)。如果你已经对这个工具熟悉,那你可以把它用来代替 VS Code 和 PlatformIO但这个课程的指示将基于 VS Code。
1. 安装 VS Code 的 PlatformIO 扩展。这是支持用 C 或 C++ 来为微控制器写编码的 VS Code 扩展。在 [PlatformIO 扩展文档](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide&WT.mc_id=academic-17441-jabenn) 找一下在 VS Code 安装扩展的指示。这个扩展依赖着Microsoft C/C++ 扩展来与 C 和 C++ 代码工作而这个C/C++ 扩展在默认情况下会被安装当你安装 PlatformIO。 1. 安装 VS Code 的 PlatformIO 扩展。这是支持用 C 或 C++ 来为微控制器写编码的 VS Code 扩展。在 [PlatformIO 扩展文档](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=platformio.platformio-ide) 找一下在 VS Code 安装扩展的指示。这个扩展依赖着Microsoft C/C++ 扩展来与 C 和 C++ 代码工作而这个C/C++ 扩展在默认情况下会被安装当你安装 PlatformIO。
1. 将你的 Wio 终端连接到你的电脑。Wio 终端底下有个 USB-C 端口,而它需要连接到你的电脑的一个 USB 端口。Wio 终端包括一个 USB-C 至 USB-A 电缆,但万一你的电脑只有 USB-C 端口,那你就需要一个 USB-C 电缆或者一个 USB-A 至USB-C 适配器。 1. 将你的 Wio 终端连接到你的电脑。Wio 终端底下有个 USB-C 端口,而它需要连接到你的电脑的一个 USB 端口。Wio 终端包括一个 USB-C 至 USB-A 电缆,但万一你的电脑只有 USB-C 端口,那你就需要一个 USB-C 电缆或者一个 USB-A 至USB-C 适配器。

@ -16,7 +16,7 @@ Install the required software.
> 💁 You are free to use any Python IDE or editor for these lessons if you have a preferred tool, but the lessons will give instructions based off using VS Code. > 💁 You are free to use any Python IDE or editor for these lessons if you have a preferred tool, but the lessons will give instructions based off using VS Code.
1. Install the VS Code Pylance extension. This is an extension for VS Code that provides Python language support. Refer to the [Pylance extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) for instructions on installing this extension in VS Code. 1. Install the VS Code Pylance extension. This is an extension for VS Code that provides Python language support. Refer to the [Pylance extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) for instructions on installing this extension in VS Code.
The instructions to install and configure the CounterFit app will be given at the relevant time in the assignment instructions as it is installed on a per-project basis. The instructions to install and configure the CounterFit app will be given at the relevant time in the assignment instructions as it is installed on a per-project basis.
@ -188,7 +188,7 @@ As a second 'Hello World' step, you will run the CounterFit app and connect your
1. From the VS Code terminal, launch the CounterFit app with the following command: 1. From the VS Code terminal, launch the CounterFit app with the following command:
```sh ```sh
CounterFit counterfit
``` ```
The app will start running and open in your web browser: The app will start running and open in your web browser:

@ -16,7 +16,7 @@ Install the required software and update the firmware.
> 💁 Another popular IDE for Arduino development is the [Arduino IDE](https://www.arduino.cc/en/software). If you are already familiar with this tool, then you can use it instead of VS Code and PlatformIO, but the lessons will give instructions based off using VS Code. > 💁 Another popular IDE for Arduino development is the [Arduino IDE](https://www.arduino.cc/en/software). If you are already familiar with this tool, then you can use it instead of VS Code and PlatformIO, but the lessons will give instructions based off using VS Code.
1. Install the VS Code PlatformIO extension. This is an extension for VS Code that supports programming microcontrollers in C/C++. Refer to the [PlatformIO extension documentation](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide&WT.mc_id=academic-17441-jabenn) for instructions on installing this extension in VS Code. This extension depends on the Microsoft C/C++ extension to work with C and C++ code, and the C/C++ extension is installed automatically when you install PlatformIO. 1. Install the VS Code PlatformIO extension. This is an extension for VS Code that supports programming microcontrollers in C/C++. Refer to the [PlatformIO extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=platformio.platformio-ide) for instructions on installing this extension in VS Code. This extension depends on the Microsoft C/C++ extension to work with C and C++ code, and the C/C++ extension is installed automatically when you install PlatformIO.
1. Connect your Wio Terminal to your computer. The Wio Terminal has a USB-C port on the bottom, and this needs to be connected to a USB port on your computer. The Wio Terminal comes with a USB-C to USB-A cable, but if your computer only has USB-C ports then you will either need a USB-C cable or a USB-A to USB-C adapter. 1. Connect your Wio Terminal to your computer. The Wio Terminal has a USB-C port on the bottom, and this needs to be connected to a USB port on your computer. The Wio Terminal comes with a USB-C to USB-A cable, but if your computer only has USB-C ports then you will either need a USB-C cable or a USB-A to USB-C adapter.
@ -154,6 +154,16 @@ Write the Hello World app.
The `loop` function sends the line `Hello World!` to the serial port, so the characters of `Hello World!` along with a new line character. It then sleeps for 5,000 milliseconds or 5 seconds. After the `loop` ends, it is run again, and again, and so on all the time the microcontroller is powered on. The `loop` function sends the line `Hello World!` to the serial port, so the characters of `Hello World!` along with a new line character. It then sleeps for 5,000 milliseconds or 5 seconds. After the `loop` ends, it is run again, and again, and so on all the time the microcontroller is powered on.
1. Put your Wio Terminal into upload mode. You will need to do this every time you upload new code to the device:
1. Pull down twice quickly on the power switch - it will spring back to the on position each time.
1. Check the blue status LED to the right hand side of the USB port. It should be pulsing.
[![A video showing how to put the Wio Terminal into upload mode](https://img.youtube.com/vi/LeKU_7zLRrQ/0.jpg)](https://youtu.be/LeKU_7zLRrQ)
Click the image above for a video showing how to do this.
1. Build and upload the code to the Wio Terminal 1. Build and upload the code to the Wio Terminal
1. Open the VS Code command palette 1. Open the VS Code command palette
@ -168,7 +178,7 @@ Write the Hello World app.
> 💁 If you are using macOS, a notification about a *DISK NOT EJECTED PROPERLY* will appear. This is because the Wio Terminal gets mounted as a drive as part of the flashing process, and it is disconnected when the compiled code is written to the device. You can ignore this notification. > 💁 If you are using macOS, a notification about a *DISK NOT EJECTED PROPERLY* will appear. This is because the Wio Terminal gets mounted as a drive as part of the flashing process, and it is disconnected when the compiled code is written to the device. You can ignore this notification.
⚠️ If you get errors about the upload port being unavailable, first make sure you have the Wio Terminal connected to your computer, and switched on using the switch on the left hand side of the screen. The green light on the bottom should be on. If you still get the error, pull the on/off switch down twice in quick succession to force the Wio Terminal into bootloader mode and try the upload again. ⚠️ If you get errors about the upload port being unavailable, first make sure you have the Wio Terminal connected to your computer, and switched on using the switch on the left hand side of the screen, and set into upload mode. The green light on the bottom should be on, and the blue light should be pulsing. If you still get the error, pull the on/off switch down twice in quick succession again to force the Wio Terminal into upload mode and try the upload again.
PlatformIO has a Serial Monitor that can monitor data sent over the USB cable from the Wio Terminal. This allows you to monitor the data sent by the `Serial.println("Hello World");` command. PlatformIO has a Serial Monitor that can monitor data sent over the USB cable from the Wio Terminal. This allows you to monitor the data sent by the `Serial.println("Hello World");` command.

@ -85,7 +85,7 @@ Program the nightlight.
> 💁 This code should be indented to the same level as the `print('Light level:', light)` line to be inside the while loop! > 💁 This code should be indented to the same level as the `print('Light level:', light)` line to be inside the while loop!
> 💁 When sending digital values to actuators, a 0 value is 0v, and a 1 value is the max voltage for the device. For the Raspberry Pi with Grove sensors and actuators, the 1 voltage is 3.3V. > 💁 When sending digital values to actuators, a 0 value is 0V, and a 1 value is the max voltage for the device. For the Raspberry Pi with Grove sensors and actuators, the 1 voltage is 3.3V.
1. From the VS Code Terminal, run the following to run your Python app: 1. From the VS Code Terminal, run the following to run your Python app:

@ -0,0 +1,17 @@
# रिसर्च सेंसर और एक्चुएटर्स
## निर्देश
इस पाठ में सेंसर और एक्चुएटर्स शामिल थे। अनुसंधान करें और एक सेंसर तथा एक एक्चुएटर का वर्णन करें जिसका उपयोग IoT देव किट के साथ किया जा सकता है, जिसमें शामिल हैं:
* यह क्या करता है
* अंदर इस्तेमाल होने वाले इलेक्ट्रॉनिक्स / हार्डवेयर
* क्या यह एनालॉग या डिजिटल है
* इनपुट या माप की यूनिट और रेंज क्या है
## रूब्रिक
| मानदंड | अनुकरणीय | पर्याप्त | सुधार की जरूरत |
| -------- | ------------- | -------- | ----------------- |
| एक सेंसर का वर्णन करें | ऊपर सूचीबद्ध सभी 4 अनुभागों के विवरण सहित एक सेंसर का वर्णन किया गया है। | एक सेंसर का वर्णन किया गया है, लेकिन ऊपर के केवल 2-3 अनुभाग प्रदान करने में सक्षम थे | एक सेंसर का वर्णन किया है, लेकिन ऊपर दिए गए अनुभागों में से केवल 1 प्रदान करने में सक्षम थे |
| एक एक्चुएटर का वर्णन करें | ऊपर सूचीबद्ध सभी 4 वर्गों के विवरण सहित एक एक्चुएटर का वर्णन किया गया है। | एक एक्चुएटर का वर्णन किया गया है, लेकिन ऊपर के केवल 2-3 अनुभाग प्रदान करने में सक्षम थे | एक एक्चुएटर का वर्णन किया है, लेकिन ऊपर के केवल 1 अनुभाग प्रदान करने में सक्षम थे |

@ -0,0 +1,116 @@
# रात का चिराग़ बनाएं - रास्पबेरी पाई
पाठ के इस भाग में, आप अपने रास्पबेरी पाई में एक एलईडी जोड़ेंगे और इसका उपयोग रात का चिराग़ बनाने के लिए करेंगे।
## हार्डवेयर
नाइटलाइट को अब एक एक्चुएटर की जरूरत है।
एक्चुएटर एक **LED**, एक [प्रकाश उत्सर्जक डायोड](https://wikipedia.org/wiki/Light-emmitting_diode) है जो करंट प्रवाहित होने पर प्रकाश का उत्सर्जन करता है। यह एक डिजिटल एक्ट्यूएटर है जिसमें 2 स्थिति हैं, चालू और बंद। 1 का मान भेजने से एलईडी चालू हो जाती है, और 0 इसे बंद कर देता है। एलईडी एक बाहरी ग्रोव एक्ट्यूएटर है और इसे रास्पबेरी पाई पर ग्रोव बेस हैट से जोड़ा जाना चाहिए।
सुडो कोड में नाइटलाइट तर्क है:
```आउटपुट
प्रकाश स्तर की जाँच करें।
यदि प्रकाश 300 . से कम है
एलईडी चालू करें
अन्यथा
एलईडी बंद करें
```
### एलईडी कनेक्ट करें
ग्रोव एलईडी एलईडी के चयन के साथ एक मॉड्यूल के रूप में आता है, जिससे आप रंग चुन सकते हैं।
#### कार्य - एलईडी कनेक्ट करें
एलईडी कनेक्ट करें।
![एक ग्रोव एलईडी](../../../images/grove-led.png)
1. अपनी पसंदीदा एलईडी चुनें और इसके पैरों को एलईडी मॉड्यूल के दो छेदों में डालें।
एल ई डी प्रकाश उत्सर्जक डायोड हैं, और डायोड इलेक्ट्रॉनिक उपकरण हैं जो केवल एक ही तरह से करंट ले जा सकते हैं। इसका मतलब है कि एलईडी को सही तरीके से जोड़ने की जरूरत है, अन्यथा यह काम नहीं करेगा।
एलईडी के पैरों में से एक पॉसिटिव पिन है, दूसरा नेगेटिव पिन है। एलईडी पूरी तरह गोल नहीं है और एक तरफ से थोड़ी चपटी है। थोड़ा बढ़ा हुआ पक्ष नेगेटिव पिन है। जब आप एलईडी को मॉड्यूल से कनेक्ट करते हैं, तो सुनिश्चित करें कि गोलाकार तरफ वाला पिन मॉड्यूल के बाहर + चिह्नित सॉकेट से जुड़ा है, और बढ़ा हुआा पक्ष सॉकेट से मध्य के करीब जुड़ा हुआ है।
1. एलईडी मॉड्यूल में एक स्पिन बटन है जो आपको चमक को नियंत्रित करने की अनुमति देता है। इसे शुरू करने के लिए इसे दक्षिणावर्त घुमाकर शुरू करें, जहां तक ​​​​यह एक छोटे से फिलिप्स हेड स्क्रूड्राइवर का उपयोग करके जाएगा।
1. एलईडी मॉड्यूल पर सॉकेट में ग्रोव केबल का एक सिरा डालें। यह केवल एक ही तरह से घूमेगा।
1. रास्पबेरी पाई के बंद होने के साथ, ग्रोव केबल के दूसरे छोर को पाई से जुड़ी ग्रोव बेस हैट पर **D5** चिह्नित डिजिटल सॉकेट से कनेक्ट करें। यह सॉकेट GPIO पिन के बगल में सॉकेट की पंक्ति में बाईं ओर से दूसरा है।
![सॉकेट D5 से जुड़ी ग्रोव एलईडी](../../../images/pi-led.png)
## रात के उजाले का प्रोग्राम
नाइटलाइट को अब ग्रोव लाइट सेंसर और ग्रोव एलईडी का उपयोग करके प्रोग्राम किया जा सकता है।
### कार्य - रात के चिराग़ का प्रोग्राम
रात के समय प्रोग्राम करें।
1. पाई को पावर दें और इसके बूट होने की प्रतीक्षा करें
1. वीएस कोड में नाइटलाइट प्रोजेक्ट खोलें जिसे आपने इस असाइनमेंट के पिछले भाग में बनाया था, या तो सीधे पाई पर चल रहा है या रिमोट एसएसएच एक्सटेंशन का उपयोग करके जुड़ा हुआ है।
1. आवश्यक लाइब्रेरी आयात करने के लिए कनेक्ट करने के लिए `app.py` फ़ाइल में निम्न कोड जोड़ें। इसे अन्य `import` लाइनों के नीचे, शीर्ष पर जोड़ा जाना चाहिए।
```python
from grove.grove_led import GroveLed
```
`from Grove.grove_led import GroveLed` कथन GroveLed` को Grove Python पुस्तकालयों से आयात करता है। इस पुस्तकालय में ग्रोव एलईडी के साथ बातचीत करने के लिए कोड है।
1. एलईडी का प्रबंधन करने वाले वर्ग का एक उदाहरण बनाने के लिए `light_sensor` घोषणा के बाद निम्नलिखित कोड जोड़ें:
```python
led = GroveLed(5)
```
लाइन `led = GroveLed(5)` `GroveLed` वर्ग को पिन से जोड़ने का एक उदाहरण बनाता है **D5** - वह डिजिटल ग्रोव पिन जिससे एलईडी जुड़ा है।
> 💁 सभी सॉकेट में अद्वितीय पिन नंबर होते हैं। पिन 0, 2, 4, और 6 एनालॉग पिन हैं, पिन 5, 16, 18, 22, 24 और 26 डिजिटल पिन हैं।
1. प्रकाश के स्तर की जांच करने और एलईडी को चालू या बंद करने के लिए `while` लूप के अंदर, और `time.sleep` से पहले एक चेक जोड़ें:
```python
if light < 300:
led.on()
else:
led.off()
```
यह कोड `light` के मूल्य की जांच करता है। यदि यह ३०० से कम है तो यह `GroveLed` वर्ग की `on` विधि को कॉल करता है जो एलईडी को 1 का डिजिटल मान भेजता है, इसे चालू करता है। यदि प्रकाश मान ३०० से अधिक या उसके बराबर है, तो यह `off` विधि को कॉल करता है, एलईडी को 0 का डिजिटल मान भेजकर, इसे बंद कर देता है।
> 💁 इस कोड को `print('Light level:', light)` लाइन के समान स्तर पर इंडेंट किया जाना चाहिए, while loop के अंदर होना चाहिए!
> 💁 एक्ट्यूएटर्स को डिजिटल मान भेजते समय, 0 मान 0V होता है, और 1 मान डिवाइस के लिए अधिकतम वोल्टेज होता है। ग्रोव सेंसर और एक्चुएटर्स के साथ रास्पबेरी पाई के लिए, 1 वोल्टेज 3.3V है।
1. वीएस कोड टर्मिनल से, अपना पायथन ऐप चलाने के लिए निम्नलिखित चलाएँ:
```sh
python3 app.py
```
कंसोल के लिए लाइट मान आउटपुट होंगे।
```output
pi@raspberrypi:~/nightlight $ python3 app.py
Light level: 634
Light level: 634
Light level: 634
Light level: 230
Light level: 104
Light level: 290
```
1. प्रकाश संवेदक को ढकें और उजागर करें। ध्यान दें कि यदि प्रकाश का स्तर 300 या उससे कम है, तो एलईडी कैसे जलेगी, और जब प्रकाश का स्तर 300 से अधिक हो तो बंद कर दें।
> 💁 यदि एलईडी चालू नहीं होती है, तो सुनिश्चित करें कि यह सही तरीके से जुड़ा हुआ है, और स्पिन बटन को सेट किया गया है
![प्रकाश स्तर में परिवर्तन के रूप में पाई से जुड़ी एलईडी चालू और बंद हो जाती है](../../../images/pi-running-assignment-1-1.gif)
> 💁 आप इस कोड को [code-actuator/pi](code-actuator/pi) फोल्डर में पा सकते हैं।
😀आपका रात्रिकालीन प्रोग्राम सफल रहा!

@ -1,50 +1,50 @@
# 开发一个夜灯 - 树莓派 # 开发一个夜灯 - 树莓派
在这个部分的课程中你会把一个LED加到树莓派上并使用它来创建一个夜灯。 在这个部分的课程中,你会把一个 LED 加到树莓派上并使用它来创建一个夜灯。
## 硬件 ## 硬件
现在夜灯需要一个执行器。 现在夜灯需要一个执行器。
这个执行器是**LED**,一个[发光二极管](https://wikipedia.org/wiki/Light-emitting_diode)当电流通过它时会发光。这是一个有两个打开或者关闭状态的数字执行器发送一个1值把灯打开发送0把灯关闭。这个LED是一个外部Grove执行器而且需要被连接到树莓派上的Grove基础扩展板。 这个执行器是 **LED**,一个[发光二极管](https://wikipedia.org/wiki/Light-emitting_diode),当电流通过它时会发光。这是一个有两个打开或者关闭状态的数字执行器,发送一个 1 值把灯打开,发送 0把灯关闭。这个 LED 是一个外部 Grove 执行器,而且需要被连接到树莓派上的 Grove 基础扩展板。
这个夜灯的逻辑用伪代码表示是: 这个夜灯的逻辑用伪代码表示是:
```output ```output
检查光照等级。 检查光照等级。
如果光照小于300 如果光照小于 300
打开LED 打开 LED
否则 否则
关闭LED 关闭 LED
``` ```
### 连接LED ### 连接 LED
Grove LED 作为一个模块出现以及一系列可供你选择颜色的LED。 Grove LED 作为一个模块出现,以及一系列可供你选择颜色的 LED。
#### 任务 - 连接LED #### 任务 - 连接 LED
连接LED。 连接 LED。
![一个grove LED](../../../../images/grove-led.png) ![一个grove LED](../../../../images/grove-led.png)
1. 选择你最喜欢的LED然后把引脚插到LED模块的两个洞里面。 1. 选择你最喜欢的 LED 然后把引脚插到 LED 模块的两个洞里面。
LED是发光二极管而且二极管是只允许电流单个方向通过的电子设备。这意味LED需要被连接在正确的方向不然就不会工作。 LED 是发光二极管,而且二极管是只允许电流单个方向通过的电子设备。这意味 LED 需要被连接在正确的方向,不然就不会工作。
LED引脚中的一个是正极引脚另一个是负极引脚。LED不是完全的圆形而且在一边是有些平的。这略平的一边是负极引脚。当你连接LED到这个模块的时候需要确保圆形这边的引脚是连接到模块上外边标着 **+** 的插孔,而扁平的这边是连接到靠近模块中间的插孔。 LED 引脚中的一个是正极引脚另一个是负极引脚。LED 不是完全的圆形,而且在一边是有些平的。这略平的一边是负极引脚。当你连接 LED 到这个模块的时候,需要确保圆形这边的引脚是连接到模块上外边标着 **+** 的插孔,而扁平的这边是连接到靠近模块中间的插孔。
1. LED模块有一个允许你控制亮度的旋转按钮用一个小十字螺丝起子逆时针旋转它拧到头来完全打开它。 1. LED 模块有一个允许你控制亮度的旋转按钮,用一个小十字螺丝起子逆时针旋转它拧到头来完全打开它。
1. 把Grove线缆的一端插到LED模块的插孔中这个只能从一个方向插入。 1. 把 Grove 线缆的一端插到 LED 模块的插孔中,这个只能从一个方向插入。
1. 在树莓派断电的情况下把Grove线缆的另一端连接到树莓派上插着的Grove基础扩展板标着 **D5** 的数字插孔。这个插孔在靠近GPIO引脚的一排左数第二个。 1. 在树莓派断电的情况下,把 Grove 线缆的另一端连接到树莓派上插着的 Grove 基础扩展板标着 **D5** 的数字插孔。这个插孔在靠近 GPIO 引脚的一排,左数第二个。
![连接到D5插孔的Grove LED](../../../../images/pi-led.png) ![连接到D5插孔的Grove LED](../../../../images/pi-led.png)
## 编写夜灯程序 ## 编写夜灯程序
现在夜灯可以用Grove光照传感器和Grove LED来编码了。 现在夜灯可以用 Grove 光照传感器和 Grove LED 来编码了。
### 任务 - 编写夜灯程序 ### 任务 - 编写夜灯程序
@ -52,26 +52,26 @@ Grove LED 作为一个模块出现以及一系列可供你选择颜色的LED
1. 打开树莓派并等待启动完成。 1. 打开树莓派并等待启动完成。
1. 直接在树莓派上或者通过远程SSH扩展打开你在这个作业上一部分创建的VS Code中的夜灯项目。 1. 直接在树莓派上或者通过远程 SSH 扩展,打开你在这个作业上一部分创建的 VS Code 中的夜灯项目。
1. 把下面的代码加到`app.py`文件中来导入一个需要的函数库。这一行需要加在文件顶部,在其他`import`代码行下面。 1. 把下面的代码加到 `app.py` 文件中来导入一个需要的函数库。这一行需要加在文件顶部,在其他 `import` 代码行下面。
```python ```python
from grove.grove_led import GroveLed from grove.grove_led import GroveLed
``` ```
`from grove.grove_led import GroveLed`语句从Grove Python函数库中导入了`GroveLED`。这个函数库中有和Grove LED交互的代码。 `from grove.grove_led import GroveLed` 语句从 Grove Python 函数库中导入了 `GroveLED`。这个函数库中有和 Grove LED 交互的代码。
1. 把下面的代码加到`light_sensor`声明之后来创建一个管理LED的类的实例 1. 把下面的代码加到 `light_sensor` 声明之后来创建一个管理 LED 的类的实例:
```python ```python
led = GroveLed(5) led = GroveLed(5)
``` ```
`led = GroveLed(5)`这一行创建了一个连接到 **D5** 引脚的`GroveLED`类的实例,**D5** 也就是LED连接的那个数字Grove引脚。 `led = GroveLed(5)` 这一行创建了一个连接到 **D5** 引脚的 `GroveLED` 类的实例,**D5** 也就是 LED 连接的那个数字 Grove 引脚。
> 💁 所有的插孔都有唯一的引脚号引脚0、2、4和6是模拟引脚引脚5、16、18、22、24和26是数字引脚。 > 💁 所有的插孔都有唯一的引脚号,引脚 0、2、4 6 是模拟引脚,引脚 5、16、18、22、24 26 是数字引脚。
1. 在`while`循环中增加一个判断,在`time.sleep`之前来检查光照等级并控制LED打开或者关闭 1. 在 `while` 循环中增加一个判断,在 `time.sleep` 之前来检查光照等级并控制 LED 打开或者关闭:
```python ```python
if light < 300: if light < 300:
@ -80,13 +80,13 @@ Grove LED 作为一个模块出现以及一系列可供你选择颜色的LED
led.off() led.off()
``` ```
这块代码检查了`light`的值如果小于300就调用`GroveLED`类的`on`方法来发送一个数字值1到LED把它点亮。如果`light`值大于或等于300就调用`off`方法发送一个数字值0给LED把它关闭。 这块代码检查了 `light` 的值,如果小于 300 就调用 `GroveLED` 类的 `on` 方法,来发送一个数字值 1 LED把它点亮。如果 `light` 值大于或等于 300就调用 `off` 方法,发送一个数字值 0 LED把它关闭。
> 💁 这段代码需要放到while循环里面缩进到和`print('Light level:', light)`行一个水平。 > 💁 这段代码需要放到 while 循环里面,缩进到和 `print('Light level:', light)` 行一个水平。
> 💁 当发送数字值到执行器的时候0值就是0v1值就是设备的最大电压。对于插着Grove传感器和执行器的树莓派而言1的电压就是3.3V。 > 💁 当发送数字值到执行器的时候0 值就是 0V1 值就是设备的最大电压。对于插着 Grove 传感器和执行器的树莓派而言1 的电压就是 3.3V。
1. 从VS Code终端运行下面的命令来运行你的Python应用 1. 从 VS Code 终端,运行下面的命令来运行你的 Python 应用:
```sh ```sh
python3 app.py python3 app.py
@ -104,12 +104,12 @@ Grove LED 作为一个模块出现以及一系列可供你选择颜色的LED
Light level: 290 Light level: 290
``` ```
1. 遮挡和揭开光照传感器会观察到光照等级等于300或更小时LED会点亮如果光照等级比300大LED就会关闭。 1. 遮挡和揭开光照传感器,会观察到光照等级等于 300 或更小时 LED 会点亮,如果光照等级比 300 LED 就会关闭。
> 💁 如果LED没有点亮确保它是正确方向连接的而且旋转按钮是设置成全开的。 > 💁 如果 LED 没有点亮,确保它是正确方向连接的,而且旋转按钮是设置成全开的。
![连接到树莓派的LED随着光照等级改变点亮和关闭](../../../../images/pi-running-assignment-1-1.gif) ![连接到树莓派的LED随着光照等级改变点亮和关闭](../../../../images/pi-running-assignment-1-1.gif)
> 💁 你可以在[code-actuator/pi](../code-actuator/pi)文件夹里找到这份代码。 > 💁 你可以在 [code-actuator/pi](../code-actuator/pi) 文件夹里找到这份代码。
😀 你的夜灯程序就成功了! 😀 你的夜灯程序就成功了!

@ -0,0 +1,96 @@
# रात का चिराग़ बनाएं - रास्पबेरी पाई
पाठ के इस भाग में, आप अपने रास्पबेरी पाई में एक प्रकाश सेंसर जोड़ेंगे।
## हार्डवेयर
इस पाठ के लिए सेंसर एक **प्रकाश संवेदक** है जो प्रकाश को विद्युत संकेत में बदलने के लिए [फोटोडायोड](https://wikipedia.org/wiki/Photodiode) का उपयोग करता है। यह एक एनालॉग सेंसर है जो 0 से 1,000 तक एक पूर्णांक मान भेजता है जो प्रकाश की सापेक्ष मात्रा को इंगित करता है जो माप की किसी भी मानक इकाई जैसे [lux](https://wikipedia.org/wiki/Lux) पर मैप नहीं करता है।
प्रकाश संवेदक एक टिकाऊ ग्रोव सेंसर है और इसे रास्पबेरी पाई पर ग्रोव बेस टोपी से जोड़ा जाना चाहिए।
### लाइट सेंसर कनेक्ट करें
प्रकाश के स्तर का पता लगाने के लिए उपयोग किए जाने वाले ग्रोव लाइट सेंसर को रास्पबेरी पाई से जोड़ा जाना चाहिए।
#### टास्क - लाइट सेंसर कनेक्ट करें
प्रकाश संवेदक कनेक्ट करें
![एक ग्रोव लाइट सेंसर](../../../images/grove-light-sensor.png)
1. लाइट सेंसर मॉड्यूल के सॉकेट में ग्रोव केबल का एक सिरा डालें। यह केवल एक ही तरह से घूमेगा।
1. रास्पबेरी पाई के बंद होने के साथ, ग्रोव केबल के दूसरे छोर को पाई से जुड़ी ग्रोव बेस हैट पर **A0** चिह्नित एनालॉग सॉकेट से कनेक्ट करें। यह सॉकेट GPIO पिन के बगल में सॉकेट की पंक्ति में दाईं ओर से दूसरा है।
![सॉकेट A0 से जुड़ा ग्रोव लाइट सेंसर](../../../images/pi-light-sensor.png)
## लाइट सेंसर प्रोग्राम करें
डिवाइस को अब ग्रोव लाइट सेंसर का उपयोग करके प्रोग्राम किया जा सकता है।
### टास्क - लाइट सेंसर प्रोग्राम करें
डिवाइस को प्रोग्राम करें।
1. पाई को पावर दें और इसके बूट होने की प्रतीक्षा करें।
1. वीएस कोड में नाइटलाइट प्रोजेक्ट खोलें जिसे आपने इस असाइनमेंट के पिछले भाग में बनाया था, या तो सीधे पाई पर चल रहा है या रिमोट एसएसएच एक्सटेंशन का उपयोग करके जुड़ा हुआ है।
1. `app.py` फ़ाइल खोलें और उसमें से सभी कोड हटा दें।
1. कुछ आवश्यक पुस्तकालयों को आयात करने के लिए निम्न कोड को `app.py` फ़ाइल में जोड़ें:
```python
import time
from grove.grove_light_sensor_v1_2 import GroveLightSensor
```
`import time` विवरण `time` मॉड्यूल को आयात करता है जिसे बाद में इस असाइनमेंट में उपयोग किया जाएगा।
`from grove.grove_light_sensor_v1_2 import GroveLightSensor` कथन Grove Python पुस्तकालयों से `GroveLightSensor` आयात करता है। इस लाइब्रेरी में ग्रोव लाइट सेंसर के साथ बातचीत करने के लिए कोड है, और पाई सेटअप के दौरान विश्व स्तर पर स्थापित किया गया था।
1. प्रकाश संवेदक को प्रबंधित करने वाले वर्ग का एक उदाहरण बनाने के लिए ऊपर दिए गए कोड के बाद निम्नलिखित कोड जोड़ें:
```python
light_sensor = GroveLightSensor(0)
```
लाइन `light_sensor = GroveLightSensor(0)`, `GroveLightSensor` वर्ग को पिन **A0** से जोड़ने का एक उदाहरण बनाती है - एनालॉग ग्रोव पिन जिससे लाइट सेंसर जुड़ा होता है।
1. ऊपर दिए गए कोड के बाद एक अनंत लूप जोड़ें ताकि प्रकाश संवेदक मान का पता लगाया जा सके और इसे कंसोल पर प्रिंट किया जा सके:
```python
while True:
light = light_sensor.light
print('Light level:', light)
```
यह `GroveLightSensor` वर्ग की `light` संपत्ति का उपयोग करके 0-1,023 के पैमाने पर वर्तमान प्रकाश स्तर को पढ़ेगा। यह गुण पिन से अनुरूप मान को पढ़ता है। यह मान तब कंसोल पर मुद्रित होता है।
1. लूप के अंत में एक सेकंड की एक छोटी sleep function जोड़ें क्योंकि प्रकाश के स्तर को लगातार जांचने की आवश्यकता नहीं होती है। एक sleep function डिवाइस की बिजली की खपत को कम करती है।
```python
time.sleep(1)
```
1. वीएस कोड टर्मिनल से, अपना पायथन ऐप चलाने के लिए निम्नलिखित चलाएँ:
```sh
python3 app.py
```
कंसोल के लिए लाइट मान आउटपुट होंगे। प्रकाश संवेदक को कवर और उजागर करें, और मान बदल जाएंगे:
```output
pi@raspberrypi:~/nightlight $ python3 app.py
Light level: 634
Light level: 634
Light level: 634
Light level: 230
Light level: 104
Light level: 290
```
> 💁 आप इस कोड को [कोड-सेंसर/पाई](code-sensor/pi) फ़ोल्डर में पा सकते हैं।
😀 आपके नाइटलाइट प्रोग्राम में सेंसर जोड़ना सफल रहा!

@ -4,13 +4,13 @@
## 硬件 ## 硬件
这节课程的传感器是使用[光电二极管](https://wikipedia.org/wiki/Photodiode)来把光照转化为电子信号的光照传感器。这是一个发送从0到1,000整数值的模拟传感器表示光照值的相对量而不对应任何比如[勒克斯lux](https://wikipedia.org/wiki/Lux)的标准计量单位。 这节课程的传感器是使用[光电二极管](https://wikipedia.org/wiki/Photodiode)来把光照转化为电子信号的光照传感器。这是一个发送从 0 1,000 整数值的模拟传感器,表示光照值的相对量而不对应任何比如[勒克斯lux](https://wikipedia.org/wiki/Lux)的标准计量单位。
这个光照传感器是一个外部Grove传感器需要被连接到树莓派上的Grove基础扩展板。 这个光照传感器是一个外部 Grove 传感器,需要被连接到树莓派上的 Grove 基础扩展板。
### 连接光照传感器 ### 连接光照传感器
用来检测光照等级的Grove光照传感器需要被连接到树莓派上。 用来检测光照等级的 Grove 光照传感器需要被连接到树莓派上。
#### 任务 - 连接光照传感器 #### 任务 - 连接光照传感器
@ -18,15 +18,15 @@
![一个 grove 光照传感器](../../../../images/grove-light-sensor.png) ![一个 grove 光照传感器](../../../../images/grove-light-sensor.png)
1. 把Grove线缆的一端插到光照传感器模块的插孔中这个只能从一个方向插入。 1. 把 Grove 线缆的一端插到光照传感器模块的插孔中,这个只能从一个方向插入。
1. 在树莓派断电的情况下把Grove线缆的另一端连接到树莓派上插着的Grove基础扩展板标着 **A0** 的模拟插孔。这个插孔在靠近GPIO引脚的一排右数第二个。 1. 在树莓派断电的情况下,把 Grove 线缆的另一端连接到树莓派上插着的 Grove 基础扩展板标着 **A0** 的模拟插孔。这个插孔在靠近 GPIO 引脚的一排,右数第二个。
![插在A0插孔的grove光照传感器](../../../../images/pi-light-sensor.png) ![插在 A0 插孔的 grove 光照传感器](../../../../images/pi-light-sensor.png)
## 编写光照传感器程序 ## 编写光照传感器程序
现在设备可以用Grove光照传感器来编码了。 现在设备可以用 Grove 光照传感器来编码了。
### 任务 - 编写光照传感器程序 ### 任务 - 编写光照传感器程序
@ -34,30 +34,30 @@
1. 打开树莓派并等待启动完成。 1. 打开树莓派并等待启动完成。
1. 直接在树莓派上或者通过远程SSH扩展打开你在这个作业上一部分创建的VS Code中的夜灯项目。 1. 直接在树莓派上或者通过远程SSH扩展打开你在这个作业上一部分创建的 VS Code 中的夜灯项目。
1. 打开`app.py`文件并删除里面的所有代码。 1. 打开 `app.py` 文件并删除里面的所有代码。
1. 把下面的代码加到`app.py`文件中来导入一些需要的函数库: 1. 把下面的代码加到 `app.py` 文件中来导入一些需要的函数库:
```python ```python
import time import time
from grove.grove_light_sensor_v1_2 import GroveLightSensor from grove.grove_light_sensor_v1_2 import GroveLightSensor
``` ```
`import time`语句导入了`time`模块,在这个作业的后面会用到这个模块。 `import time` 语句导入了 `time` 模块,在这个作业的后面会用到这个模块。
`from grove.grove_light_sensor_v1_2 import GroveLightSensor`语句从Grove Python函数库导入了 `GroveLightSensor`。这个函数库里有和Grove光照传感器交互的代码在设置树莓派的时候就已经全局安装了。
`from grove.grove_light_sensor_v1_2 import GroveLightSensor` 语句从 Grove Python 函数库导入了 `GroveLightSensor`。这个函数库里有和 Grove 光照传感器交互的代码,在设置树莓派的时候就已经全局安装了。
1. 在上面代码的后面增加下面的代码来创建一个管理光照传感器的类的实例: 1. 在上面代码的后面增加下面的代码来创建一个管理光照传感器的类的实例:
```python ```python
light_sensor = GroveLightSensor(0) light_sensor = GroveLightSensor(0)
``` ```
`light_sensor = GroveLightSensor(0)`这一行创建了一个连接到 **A0** 引脚的`GroveLightSensor`类的实例,**A0** 也就是光照传感器连接的那个引脚。 `light_sensor = GroveLightSensor(0)` 这一行创建了一个连接到 **A0** 引脚的 `GroveLightSensor` 类的实例,**A0** 也就是光照传感器连接的那个引脚。
1. 在上面的代码后面增加一个无限循环代码来获取光照传感器数值并打印到终端: 1. 在上面的代码后面增加一段无限循环代码,来获取光照传感器数值并打印到终端:
```python ```python
while True: while True:
@ -65,15 +65,15 @@
print('Light level:', light) print('Light level:', light)
``` ```
使用`GroveLightSensor`类的`light`属性可以来获取 0-1023 的当前光照等级值,这个属性从引脚读取模拟量,然后这个值会被打印到终端。 使用 `GroveLightSensor` 类的 `light` 属性可以来获取 0-1023 的当前光照等级值,这个属性从引脚读取模拟量,然后这个值会被打印到终端。
1. 在`loop`的结尾增加一个1秒的短暂休眠因为光照等级不需要一直不断地读取。一个休眠可以减少设备的能源消耗。 1. 在 `loop` 的结尾增加一个 1 秒的短暂休眠,因为光照等级不需要一直不断地读取。一个休眠可以减少设备的能源消耗。
```python ```python
time.sleep(1) time.sleep(1)
``` ```
1. 从VS Code终端运行下面的命令来运行你的Python应用 1. 从 VS Code 终端,运行下面的命令来运行你的 Python 应用:
```sh ```sh
python3 app.py python3 app.py
@ -91,6 +91,6 @@
Light level: 290 Light level: 290
``` ```
> 💁 你可以在[code-sensor/pi](../code-sensor/pi)文件夹找到这份代码。 > 💁 你可以在 [code-sensor/pi](../code-sensor/pi) 文件夹找到这份代码。
😀 给你的夜灯增加一个传感器程序就成功了! 😀 给你的夜灯增加一个传感器程序就成功了!

@ -157,7 +157,7 @@ Install Python and VS Code.
> 💁 You are free to use any Python IDE or editor for these lessons if you have a preferred tool, but the lessons will give instructions based off using VS Code. > 💁 You are free to use any Python IDE or editor for these lessons if you have a preferred tool, but the lessons will give instructions based off using VS Code.
1. Install the VS Code Pylance extension. This is an extension for VS Code that provides Python language support. Refer to the [Pylance extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) for instructions on installing this extension in VS Code. 1. Install the VS Code Pylance extension. This is an extension for VS Code that provides Python language support. Refer to the [Pylance extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) for instructions on installing this extension in VS Code.
#### Configure a Python virtual environment #### Configure a Python virtual environment

@ -148,7 +148,7 @@ MQTT لديها وسيط واحد وعملاء متعددين. يتصل جميع
> 💁 لك مطلق الحرية في استخدام أي محرر Python IDE أو محرر لهذه الدروس إذا كان لديك أداة مفضلة ، ولكن الدروس ستعطي إرشادات تستند إلى استخدام VS Code. > 💁 لك مطلق الحرية في استخدام أي محرر Python IDE أو محرر لهذه الدروس إذا كان لديك أداة مفضلة ، ولكن الدروس ستعطي إرشادات تستند إلى استخدام VS Code.
1. قم بتثبيت امتداد VS Code Pylance. هذا امتداد لـ VS Code الذي يوفر دعم لغة Python. راجع <a href="https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn">Pylance extension documentation</a> للحصول على إرشادات حول تثبيت هذا الامتداد في VS Code. 1. قم بتثبيت امتداد VS Code Pylance. هذا امتداد لـ VS Code الذي يوفر دعم لغة Python. راجع <a href="https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance">Pylance extension documentation</a> للحصول على إرشادات حول تثبيت هذا الامتداد في VS Code.
#### تكوين بيئة Python الافتراضية #### تكوين بيئة Python الافتراضية

@ -150,7 +150,7 @@ Python এবং VS Code ইন্সটল করি।
> 💁 এই পাঠের নির্দেশনাগুলো VS Code এর উপর ভিত্তি করে লেখা হলেও এই পাঠের জন্য আমরা আমাদের সুবিধামত টুল অর্থাৎ পাইথনবেইজ়ড যেকেনো আইডি বা ইডিটর ব্যবহার করতে পারি। > 💁 এই পাঠের নির্দেশনাগুলো VS Code এর উপর ভিত্তি করে লেখা হলেও এই পাঠের জন্য আমরা আমাদের সুবিধামত টুল অর্থাৎ পাইথনবেইজ়ড যেকেনো আইডি বা ইডিটর ব্যবহার করতে পারি।
1. VS Code এর Pylance এক্সটেনশনটি ইন্সটল করি। পাইথন লেঙ্গুয়েজের সাপোর্টের জন্য এটি VS Code এর একটি এক্সটেনশন। এটি এক্সটেনশনটি VS Code-এ কিভাবে ইন্সটল করতে হয় [Pylance extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&WT.mc_id=academic-17441-jabenn) থেকে দেখে নেই। 1. VS Code এর Pylance এক্সটেনশনটি ইন্সটল করি। পাইথন লেঙ্গুয়েজের সাপোর্টের জন্য এটি VS Code এর একটি এক্সটেনশন। এটি এক্সটেনশনটি VS Code-এ কিভাবে ইন্সটল করতে হয় [Pylance extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-python.vscode-pylance) থেকে দেখে নেই।
#### পাইথনের ভার্চুয়াল এনভায়রনমেন্ট কনফিগারেশন #### পাইথনের ভার্চুয়াল এনভায়রনমেন্ট কনফিগারেশন

@ -13,4 +13,4 @@
# <div dir="rtl">الاعتمادات</div> # <div dir="rtl">الاعتمادات</div>
[Jim Bennett](https://GitHub.com/JimBobBennett) كتبت جميع الدروس مع ♥️ من قبل [Jim Bennett](https://GitHub.com/JimBobBennett) كتبت جميع الدروس مع ♥️ من قبل

@ -1,6 +1,6 @@
# Memulai dengan IoT # Memulai dengan IoT
Pada bagian ini, Anda akan diperkenalkan dengan Internet of Things, dan mempelajari konsep dasar termasuk membangung proyek IoT 'Hello World' pertama Anda yang terhubung ke *cloud*. Proyek ini merupakan lampu malam yang akan menyala saat tingkat pencahayaan diukur dengan penurunan sensor. This project is a nightlight that lights up as light levels measured by a sensor drop. Pada bagian ini, Anda akan diperkenalkan dengan Internet of Things, dan mempelajari konsep dasar termasuk membangung proyek IoT 'Hello World' pertama Anda yang terhubung ke *cloud*. Proyek ini merupakan lampu malam yang akan menyala saat tingkat pencahayaan diukur dengan penurunan sensor.
![Lampu LED terhubung ke WIO menyala dan mati saat tingkat pencahayaan berubah](../../images/wio-running-assignment-1-1.gif) ![Lampu LED terhubung ke WIO menyala dan mati saat tingkat pencahayaan berubah](../../images/wio-running-assignment-1-1.gif)

@ -5,7 +5,7 @@ import paho.mqtt.client as mqtt
from os import path from os import path
import csv import csv
import datetime from datetime import datetime
id = '<ID>' id = '<ID>'

@ -0,0 +1,270 @@
# Anticiper la croissance de ses plantes avec l'IoT
![Un apperçu de cette leçon](../../../../sketchnotes/lesson-5.jpg)
> Illustré par [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version.
## Questionnaire de prélecture
[Questionnaire de prélecture](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/9)
## Introduction
Les plantes ont besoin de certaines choses pour pousser : de l'eau, du dioxyde de carbone, des nutriments, de la lumière et de la chaleur. Dans cette leçon, vous apprendrez à calculer les taux de croissance et de maturité des plantes en mesurant la température de l'air.
Dans cette leçon, nous allons couvrir :
* [Agriculture digitale](#agriculture-digitale)
* [L'importance de la température dans l'agriculture](#l'importance-de-la-température-dans-l'agriculture)
* [La mesure de la température ambiante](#la-mesure-de-la-température-ambiante)
* [Degrés jours de croissance (DJC)](#degrés-jours-de-croissance)
* [Calcul du DJC à l'aide de données de senseurs](#calcul-du-DJC-à-l'aide-de-données-de-senseurs)
## Agriculture digitale
L'agriculture numérique transforme notre façon de cultiver, en utilisant des outils pour collecter, stocker et analyser les données issues de l'agriculture. Nous sommes actuellement dans une période décrite comme la "quatrième révolution industrielle" par le Forum économique mondial, et l'essor de l'agriculture numérique a été qualifié de "quatrième révolution agricole", ou "agriculture 4.0".
> 🎓 Le terme "agriculture numérique" englobe également l'ensemble de la "chaîne de valeur agricole", c'est-à-dire tout le parcours de la ferme à la table. Cela inclut le suivi de la qualité des produits lors de leur expédition et de leur transformation, les systèmes d'entreposage et de commerce électronique, et même les applications de location de tracteurs !
Ces changements permettent aux agriculteurs d'augmenter leurs rendements, d'utiliser moins d'engrais et de pesticides et d'arroser plus efficacement. Bien qu'ils soient principalement utilisés dans les pays riches, le prix des capteurs et autres dispositifs diminue lentement, ce qui les rend plus accessibles dans les pays en développement.
Certaines techniques rendues possibles par l'agriculture numérique sont :
* Mesure de la température - la mesure de la température permet aux agriculteurs de prévoir la croissance et la maturité des plantes.
* L'arrosage automatisé - il s'agit de mesurer l'humidité du sol et de mettre en marche les systèmes d'irrigation lorsque le sol est trop sec, plutôt que de procéder à un arrosage programmé. L'arrosage programmé peut conduire à un arrosage insuffisant des cultures pendant une période chaude et sèche, ou à un arrosage excessif en cas de pluie. En n'arrosant que lorsque le sol en a besoin, les agriculteurs peuvent optimiser leur utilisation de l'eau.
* Lutte contre les ravageurs - les agriculteurs peuvent utiliser des caméras sur des robots ou des drones automatisés pour vérifier la présence de ravageurs, puis appliquer des pesticides uniquement là où c'est nécessaire, ce qui réduit la quantité de pesticides utilisés et le ruissellement des pesticides dans les réserves d'eau locales.
✅ Faites des recherches. Quelles autres techniques sont utilisées pour améliorer les rendements agricoles ?
> 🎓 Le terme "agriculture de précision" est utilisé pour définir l'observation, la mesure et l'intervention sur les cultures par champ, ou même sur certaines parties d'un champ. Il s'agit notamment de mesurer les niveaux d'eau, de nutriments et de parasites et de réagir avec précision, par exemple en n'arrosant qu'une petite partie du champ.
## L'importance de la température dans l'agriculture
Lorsqu'ils étudient les plantes, la plupart des élèves apprennent qu'elles ont besoin d'eau, de lumière, de dioxyde de carbone (CO<sub>2</sub>) et de nutriments. Les plantes ont également besoin de chaleur pour se développer - c'est pourquoi les plantes fleurissent au printemps lorsque la température augmente, pourquoi les perce-neige ou les jonquilles peuvent germer tôt en raison d'une courte période de chaleur, et pourquoi les serres sont si efficaces pour faire pousser les plantes.
> 🎓 Les serres et les serres chaudes font un travail similaire, mais avec une différence importante. Les serres chaudes sont chauffées artificiellement et permettent aux agriculteurs de contrôler les températures avec plus de précision. Les serres dépendent du soleil pour la chaleur et le seul moyen de contrôle est généralement l'ouverture de fenêtres ou d'autres ouvertures pour laisser sortir la chaleur.
Les plantes ont une température de base ou minimale, une température optimale et une température maximale, toutes basées sur les températures moyennes quotidiennes.
* Température de base - il s'agit de la température moyenne quotidienne minimale nécessaire à la croissance d'une plante.
* Température optimale - il s'agit de la meilleure température moyenne quotidienne pour obtenir la meilleure croissance.
* Température maximale - Il s'agit de la température maximale qu'une plante peut supporter. Au-dessus de cette température, la plante interrompt sa croissance afin de conserver l'eau et de rester en vie.
> 💁 Il s'agit de températures moyennes, calculées sur la base des températures quotidiennes et nocturnes. Les plantes ont également besoin de températures différentes le jour et la nuit pour leur permettre de réaliser une photosynthèse plus efficace et d'économiser de l'énergie la nuit.
Chaque espèce de plante a des valeurs différentes pour sa base, son optimum et son maximum. C'est pourquoi certaines plantes prospèrent dans les pays chauds, et d'autres dans les pays plus froids.
✅ Faites des recherches. Pour toutes les plantes que vous avez dans votre jardin, à l'école ou dans un parc local, voyez si vous pouvez trouver la température de base.
![Un graphique montrant que le taux de croissance augmente lorsque la température augmente, puis diminue lorsque la température devient trop élevée.](../../../../images/plant-growth-temp-graph.png)
Le graphique ci-dessus montre un exemple de taux de croissance en fonction de la température. Jusqu'à la température de base, il n'y a pas de croissance. Le taux de croissance augmente jusqu'à la température optimale, puis chute après avoir atteint ce pic. À la température maximale, la croissance s'arrête.
La forme de ce graphique varie d'une espèce végétale à l'autre. Certaines ont des chutes plus marquées au-dessus de l'optimum, d'autres ont des augmentations plus lentes de la base à l'optimum.
> 💁 Pour qu'un agriculteur obtienne la meilleure croissance, il devra connaître les trois valeurs de température et comprendre la forme des graphiques pour les plantes qu'il cultive.
Si un agriculteur a le contrôle de la température, par exemple dans une serre commerciale, il peut optimiser la croissance de ses plantes. Dans une serre commerciale où l'on cultive des tomates, par exemple, la température sera réglée à environ 25°C le jour et 20°C la nuit pour obtenir la croissance la plus rapide.
> 🍅 En combinant ces températures avec des lumières artificielles, des engrais et des niveaux de CO<sub>2</sub> contrôlés, les producteurs commerciaux peuvent cultiver et récolter toute l'année.
## La-mesure-de-la-température-ambiante
Les capteurs de température peuvent être utilisés avec les appareils IoT pour mesurer la température ambiante.
### Tâche - Mesure de la température
Suivez le guide correspondant pour surveiller les températures à l'aide de votre dispositif IoT :
* [Arduino - Wio Terminal](wio-terminal-temp.fr.md)
* [Single-board computer - Raspberry Pi](pi-temp.fr.md)
* [Single-board computer - Virtual device](virtual-device-temp.fr.md)
## Degrés-jours de croissance
Les degrés-jours de croissance (également appelés unités de degrés de croissance) sont un moyen de mesurer la croissance des plantes en fonction de la température. En supposant qu'une plante dispose de suffisamment d'eau, de nutriments et de CO<sub>2</sub>, la température détermine le taux de croissance.
Les degrés-jours de croissance, ou DJC, sont calculés par jour comme la température moyenne en Celsius pour un jour au-dessus de la température de base des plantes. Chaque plante a besoin d'un certain nombre de DJC pour croître, fleurir ou produire et faire mûrir une récolte. Plus le nombre de DJC par jour est élevé, plus la croissance de la plante est rapide.
> 🇺🇸 Pour les Américains, les degrés-jours de croissance peuvent également être calculés en Fahrenheit. 5 DJC<sup>C</sup> (degrés-jours de croissance en Celsius) sont l'équivalent de 9 DJC<sup>F</sup> (degrés-jours de croissance en Fahrenheit).
La formule complète du DJC est un peu compliquée, mais il existe une équation simplifiée qui est souvent utilisée comme une bonne approximation :
![DJC = T max + T min divisé par 2, total - T base](../../../../images/gdd-calculation.png)
* **DJC** - c'est le nombre de degrés-jours de croissance
* **T<sub>max</sub>** - il s'agit de la température maximale quotidienne en degrés Celsius
* **T<sub>min</sub>** - il s'agit de la température minimale quotidienne en degrés Celsius
* **T<sub>base</sub>** - c'est la température de base des plantes en degrés Celsius
> 💁 Il existe certaines variations impliquant T<sub>max</sub> au delà de 30°C ou T<sub>min</sub> en deça T<sub>base</sub>, mais nous ignorerons ces cas dans le contexte de ce cours.
### Exemple - Maïs 🌽
Selon la variété, le maïs a besoin de 800 à 2 700 DJC pour arriver à maturité, avec une température de base de 10°C.
Le premier jour au-dessus de la température de base, les températures suivantes ont été mesurées :
| Mesures | Temp °C |
| :---------- | :-----: |
| Maximum | 16 |
| Minimum | 12 |
En ajoutant ces chiffres à notre calcul :
* T<sub>max</sub> = 16
* T<sub>min</sub> = 12
* T<sub>base</sub> = 10
Ce qui donne un résultat de:
![DJC = 16 + 12 divisé par 2, total moins 10, résultant à 4](../../../../images/gdd-calculation-corn.png)
Le maïs a reçu 4 DJC ce jour-là. Dans l'hypothèse d'une variété de maïs qui a besoin de 800 jours DJC pour arriver à maturité, il lui faudra encore 796 DJC pour atteindre la maturité.
✅ Faites des recherches. Pour toutes les plantes que vous avez dans votre jardin, à l'école ou dans un parc local, voyez si vous pouvez trouver le nombre de DJC requis pour atteindre la maturité ou produire des récoltes.
## Calcul du DJC à l'aide de données de senseurs
Les plantes ne poussent pas à dates fixes - par exemple, vous ne pouvez pas planter une graine et savoir que la plante portera des fruits exactement 100 jours plus tard. Au lieu de cela, en tant qu'agriculteur, vous pouvez avoir une idée approximative du temps que prend une plante pour pousser, puis vous vérifiez quotidiennement quand les cultures sont prêtes.
Cela a un impact considérable sur la main-d'œuvre d'une grande exploitation, et l'agriculteur risque de manquer des cultures qui sont prêtes plus tôt que prévu. En mesurant les températures, l'agriculteur peut calculer le DJC qu'une plante a reçu, ce qui lui permet de ne vérifier que les cultures proches de la maturité attendue.
En recueillant des données de température à l'aide d'un dispositif IoT, un agriculteur peut être automatiquement informé lorsque les plantes sont proches de la maturité. Une architecture typique pour cela consiste à faire en sorte que les dispositifs IoT mesurent la température, puis publient ces données de télémétrie sur Internet en utilisant quelque chose comme MQTT. Le code du serveur écoute ensuite ces données et les enregistre quelque part, par exemple dans une base de données. Cela signifie que les données peuvent être analysées ultérieurement, par exemple une tâche nocturne pour calculer le DJC de la journée, totaliser le DJC de chaque culture jusqu'à présent et alerter si une plante est proche de la maturité.
![Les données télémétriques sont envoyées à un serveur, puis enregistrées dans une base de données.](../../../../images/save-telemetry-database.png)
Le code serveur peut également augmenter les données en ajoutant des informations supplémentaires. Par exemple, le dispositif IoT peut publier un identifiant pour indiquer de quel dispositif il s'agit, et le code du serveur peut l'utiliser pour rechercher l'emplacement du dispositif et les cultures qu'il surveille. Il peut également ajouter des données de base comme l'heure actuelle, car certains dispositifs IoT ne disposent pas du matériel nécessaire pour suivre l'heure exacte, ou nécessitent un code supplémentaire pour lire l'heure actuelle sur Internet.
✅ Pourquoi pensez-vous que des champs différents peuvent avoir des températures différentes ?
### Tâche - publier des informations sur la température
Suivez le guide correspondant pour publier les données de température sur MQTT à l'aide de votre dispositif IoT afin de pouvoir les analyser ultérieurement :
* [Arduino - Terminal Wio](wio-terminal-temp-publish.fr.md)
* [Ordinateur monocarte - Raspberry Pi/Dispositif IoT virtuel](single-board-computer-temp-publish.fr.md)
### Tâche - capturer et stocker les informations sur la température
Une fois que le dispositif IoT publie la télémétrie, le code du serveur peut être écrit pour s'abonner à ces données et les stocker. Plutôt que de les enregistrer dans une base de données, le code serveur les enregistrera dans un fichier CSV (Comma Separated Values). Les fichiers CSV stockent les données sous forme de lignes de valeurs en texte, chaque valeur étant séparée par une virgule, et chaque enregistrement sur une nouvelle ligne. Ils constituent un moyen pratique, lisible par l'homme et bien supporté d'enregistrer des données dans un fichier.
Le fichier CSV aura deux colonnes - *date* et *température*. La colonne *date* est définie comme la date et l'heure actuelles de réception du message par le serveur, la colonne *température* provient du message de télémétrie.
1. Répétez les étapes de la leçon 4 pour créer un code serveur permettant de s'abonner à la télémétrie. Vous n'avez pas besoin d'ajouter du code pour publier des commandes.
Les étapes à suivre sont les suivantes :
* Configurer et activer un environnement virtuel Python
* Installer la librairie pip paho-mqtt
* Écrire le code pour écouter les messages MQTT publiés sur le sujet de télémétrie
> ⚠️ Vous pouvez vous référer [aux instructions de la leçon 4 pour créer une application Python pour recevoir la télémétrie si nécessaire](../../../../1-getting-started/lessons/4-connect-internet/README.md#receive-telemetry-from-the-mqtt-broker).
Nommez le dossier pour ce projet `temperature-sensor-server`.
1. Assurez vous que `client_name` corresponde à ce projet:
```cpp
client_name = id + 'temperature_sensor_server'
```
1. Ajoutez les importations suivantes en haut du fichier, en dessous des importations existantes :
```python
from os import path
import csv
from datetime import datetime
```
Ceci importe une bibliothèque pour lire les fichiers, une bibliothèque pour interagir avec les fichiers CSV, et une bibliothèque pour aider avec les dates et les heures.
1. Ajoutez le code suivant avant la fonction `handle_telemetry`:
```python
temperature_file_name = 'temperature.csv'
fieldnames = ['date', 'temperature']
if not path.exists(temperature_file_name):
with open(temperature_file_name, mode='w') as csv_file:
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
writer.writeheader()
```
Ce code déclare quelques constantes pour le nom du fichier à écrire, et le nom des en-têtes de colonne pour le fichier CSV. La première ligne d'un fichier CSV contient traditionnellement des en-têtes de colonne séparés par des virgules.
Le code vérifie ensuite si le fichier CSV existe déjà. S'il n'existe pas, il est créé avec les en-têtes de colonne sur la première ligne.
1. Ajoutez le code suivant à la fin de la fonction `handle_telemetry`:
```python
with open(temperature_file_name, mode='a') as temperature_file:
temperature_writer = csv.DictWriter(temperature_file, fieldnames=fieldnames)
temperature_writer.writerow({'date' : datetime.now().astimezone().replace(microsecond=0).isoformat(), 'temperature' : payload['temperature']})
```
Ce code ouvre le fichier CSV, puis ajoute une nouvelle ligne à la fin. La ligne comporte les données et l'heure actuelles formatées dans un format lisible par l'homme, suivies de la température reçue du dispositif IoT. Les données sont stockées au [format ISO 8601] (https://wikipedia.org/wiki/ISO_8601) avec le fuseau horaire, mais sans les microsecondes.
1. Exécutez ce code de la même manière que précédemment, en vous assurant que votre dispositif IoT envoie des données. Un fichier CSV appelé `temperature.csv` sera créé dans le même dossier. Si vous le visualisez, vous verrez les dates/heures et les mesures de température :
```output
date,temperature
2021-04-19T17:21:36-07:00,25
2021-04-19T17:31:36-07:00,24
2021-04-19T17:41:36-07:00,25
```
1. Exécutez ce code pendant un certain temps pour capturer les données. Idéalement, vous devriez l'exécuter pendant une journée entière afin de recueillir suffisamment de données pour les calculs de DJC.
> 💁 Si vous utilisez le "Virtual IoT Device", cochez la case aléatoire et définissez une plage pour éviter d'obtenir la même température à chaque fois que la valeur de température est renvoyée.
![Cochez la case aléatoire et définissez une plage](../../../../images/select-the-random-checkbox-and-set-a-range.png)
> 💁 Si vous souhaitez exécuter ce programme pendant toute une journée, vous devez vous assurer que l'ordinateur sur lequel votre code serveur est exécuté ne se mettra pas en veille, soit en modifiant vos paramètres d'alimentation, soit en exécutant un programme tel que [ceci maintient le système actif](https://github.com/jaqsparow/keep-system-active).
> 💁 Vous pouvez trouver ce code dans le dossier [code-server/temperature-sensor-server](../code-server/temperature-sensor-server).
### Tâche - calculer le DJC en utilisant les données stockées
Une fois que le serveur a saisi les données de température, le DJC d'une usine peut être calculé.
Les étapes à suivre pour effectuer cette opération manuellement sont les suivantes :
1. Trouvez la température de base de la plante. Par exemple, pour les fraises, la température de base est de 10°C.
1. A partir du fichier `temperature.csv`, trouvez les températures les plus hautes et les plus basses de la journée.
1. Utilisez le calcul du DJC donné précédemment pour calculer le DJC
Par exemple, si la température la plus élevée de la journée est de 25°C, et la plus basse de 12°C :
![DJC = 25 + 12 divisé par 2, enlever 10 du résultat, donnant 8.5](../../../../images/gdd-calculation-strawberries.png)
* 25 + 12 = 37
* 37 / 2 = 18.5
* 18.5 - 10 = 8.5
Les fraises ont donc reçu **8,5** DJC. Les fraises ont besoin d'environ 250 DJC pour porter des fruits, donc il y a encore du chemin à faire.
---
## 🚀 Défi
Les plantes ont besoin de plus que de la chaleur pour pousser. Quelles autres choses sont nécessaires ?
Pour ceux-ci, cherchez s'il existe des capteurs qui peuvent les mesurer. Et des actionneurs pour contrôler ces niveaux ? Comment assembleriez-vous un ou plusieurs dispositifs IoT pour optimiser la croissance des plantes ?
## Questionnaire Post-lecture
[Questionnaire Post-lecture](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/10)
## Révision et apprentissage autodidacte
* Pour en savoir plus sur l'agriculture numérique, consultez la page [Digital Agriculture Wikipedia](https://wikipedia.org/wiki/Digital_agriculture). Pour en savoir plus sur l'agriculture de précision, consultez la page [Precision Agriculture Wikipedia](https://wikipedia.org/wiki/Precision_agriculture).
* Le calcul complet des degrés-jours de croissance est plus compliqué que le calcul simplifié présenté ici. Pour en savoir plus sur l'équation plus compliquée et sur la manière de traiter les températures inférieures à la ligne de base, consultez la page [Degrés-jours de croissance sur Wikipédia](https://wikipedia.org/wiki/Growing_degree-day).
* La nourriture pourrait se faire rare à l'avenir, même si nous utilisons toujours les mêmes méthodes agricoles. Pour en savoir plus sur les techniques agricoles de haute technologie, regardez cette vidéo [Hi-Tech Farms of Future sur YouTube](https://www.youtube.com/watch?v=KIEOuKD9KX8).
## Devoir
[Visualiser les données DJC à l'aide d'un Jupyter Notebook](assignment.fr.md)

@ -0,0 +1,43 @@
# Visualiser les données DJC à l'aide d'un Jupyter Notebook
## Instructions
Dans cette leçon, vous avez recueilli des données DJC à l'aide d'un capteur IoT. Pour obtenir de bonnes données DJC, vous devez recueillir des données pendant plusieurs jours. Pour vous aider à visualiser les données de température et à calculer le DJC, vous pouvez utiliser des outils tels que [Jupyter Notebooks](https://jupyter.org) pour analyser les données.
Commencez par recueillir des données pendant quelques jours. Vous devez vous assurer que le code de votre serveur fonctionne tout le temps que votre dispositif IoT est en marche, soit en ajustant vos paramètres de gestion de l'énergie, soit en exécutant quelque chose comme [ce script Python maintenant le système actif].(https://github.com/jaqsparow/keep-system-active).
Une fois que vous avez les données de température, vous pouvez utiliser le Jupyter Notebook dans ce repo pour les visualiser et calculer le JDC. Les notebooks Jupyter mélangent du code et des instructions dans des blocs appelés *cellules*, souvent du code en Python. Vous pouvez lire les instructions, puis exécuter chaque bloc de code, bloc par bloc. Vous pouvez également modifier le code. Dans ce notebook par exemple, vous pouvez modifier la température de base utilisée pour calculer le JDC de votre installation.
1. Créez un dossier `gdd-calcul` (GDD correspond à DJC en français)
1. Téléchargez le fichier [gdd.ipynb](../code-notebook/gdd.ipynb) et copiez le dans le dossier`gdd-calcul`.
1. Copiez le fichier `temperature.csv` créé par le serveur MQTT.
1. Créez un nouvel environnement virtuel Python dans le dossier `gdd-calcul`.
1. Installez quelques paquets pip pour les carnets Jupyter, ainsi que les bibliothèques nécessaires à la gestion et au tracé des données :
```sh
pip install --upgrade pip
pip install pandas
pip install matplotlib
pip install jupyter
```
1. Exécutez le notebook dans Jupyter :
```sh
jupyter notebook gdd.ipynb
```
Jupyter démarre et ouvre le notebook dans votre navigateur. Suivez les instructions du carnet de notes pour visualiser les températures mesurées et calculer les degrés-jours de croissance.
![Le jupyter notebook](../../../../images/gdd-jupyter-notebook.png)
## Rubrique
| Critère | Exemplaire | Adequat | À améliorer |
| -------- | --------- | -------- | ----------------- |
| Capture de données | Capture au moins deux journées de données | Capture au moins une journée de données | Capture des données |
| Calcul du DJC | Exécute le notebook et calcul le DJC | Exécute le notebook | Incapable d'exécuter le notebook |

@ -0,0 +1,111 @@
# Mesure de temperature - Raspberry Pi
Dans cette partie de la leçon, vous allez ajouter un capteur de température à votre Raspberry Pi.
## Matériel
La sonde que vous utiliserez est une [sonde d'humidité et de température DHT11](https://www.seeedstudio.com/Grove-Temperature-Humidity-Sensor-DHT11.html), combinant deux capteurs dans un même boîtier. Cette méthode est assez populaire, avec un certain nombre de capteurs disponibles dans le commerce combinant température, humidité et parfois pression atmosphérique. Le composant du capteur de température est une thermistance à coefficient de température négatif (CTN), une thermistance dont la résistance diminue lorsque la température augmente.
Il s'agit d'un capteur numérique, qui dispose donc d'un ADC intégré pour créer un signal numérique contenant les données de température et d'humidité que le microcontrôleur peut lire.
### Connecter le capteur de température
Le capteur de température Grove peut être connecté au Raspberry Pi.
#### Tâche
Connecter le capteur de température
![La sonde de température Grove](../../../../images/grove-dht11.png)
1. Insérez une extrémité d'un câble Grove dans la prise du capteur d'humidité et de température. Il ne peut être inséré que dans un seul sens.
1. Lorsque le Raspberry Pi est hors tension, connectez l'autre extrémité du câble Grove à la prise numérique marquée **D5** sur le chapeau de la base Grove fixé au Pi. Cette prise est la deuxième en partant de la gauche, sur la rangée de prises à côté des broches GPIO.
![Le capteur de température de la rainure connecté à la broche A0](../../../../images/pi-temperature-sensor.png)
## Programmez le capteur de température
L'appareil peut maintenant être programmé pour utiliser la sonde de température jointe.
### Tâche
Programmer le Raspberry Pi.
1. Brancher le Pi à l'alimentation et attendre la séquence de démarrage.
1. Lancez VS Code, soit directement sur le Pi, soit en vous connectant via l'extension SSH à distance.
> ⚠️ Vous pouvez vous référer [aux instructions de configuration et de lancement de VS Code dans la leçon 1 si nécessaire].(../../../../1-getting-started/lessons/1-introduction-to-iot/pi.md).
1. Depuis le terminal, créez un nouveau dossier dans le répertoire personnel de l'utilisateur `pi` appelé `temperature-sensor`. Créez un fichier dans ce dossier appelé `app.py` :
```sh
mkdir temperature-sensor
cd temperature-sensor
touch app.py
```
1. Ouvrez ce dossier dans VS Code
1. Pour utiliser le capteur de température et d'humidité, une librairie pip supplémentaire doit être installée. Depuis le Terminal dans VS Code, exécutez la commande suivante pour installer ce paquet Pip sur le Pi :
```sh
pip3 install seeed-python-dht
```
1. Ajoutez le code suivant au fichier `app.py` pour importer les bibliothèques requises :
```python
import time
from seeed_dht import DHT
```
L'instruction `from seeed_dht import DHT` importe la classe de capteur `DHT` pour interagir avec un capteur de température Grove du module `seeed_dht`.
1. Ajoutez le code suivant après le code ci-dessus pour créer une instance de la classe qui gère le capteur de température :
```python
sensor = DHT("11", 5)
```
Ceci déclare une instance de la classe `DHT` qui gère le capteur **D**igital **H**umidité et **T**température. Le premier paramètre indique au code que le capteur utilisé est le capteur *DHT11* - la bibliothèque que vous utilisez supporte d'autres variantes de ce capteur. Le deuxième paramètre indique au code que le capteur est connecté au port numérique `D5` du connecteur Grove de base.
> ✅ N'oubliez pas que toutes les prises ont un numéro de broche unique. Les broches 0, 2, 4 et 6 sont des broches analogiques, les broches 5, 16, 18, 22, 24 et 26 sont des broches numériques.
1. Ajoutez une boucle infinie après le code ci-dessus pour interroger la valeur du capteur de température et l'imprimer sur la console :
```python
while True:
_, temp = sensor.read()
print(f'Temperature {temp}°C')
```
L'appel à `sensor.read()` renvoie un tuple d'humidité et de température. Vous n'avez besoin que de la valeur de la température, l'humidité est donc ignorée. La valeur de la température est ensuite imprimée sur la console.
1. Ajoutez une petite mise en veille de dix secondes à la fin de la "boucle", car les niveaux de température n'ont pas besoin d'être vérifiés en permanence. Une mise en veille réduit la consommation d'énergie de l'appareil.
```python
time.sleep(10)
```
1. Depuis le terminal VS Code, exécutez ce qui suit pour lancer votre application Python :
```sh
python3 app.py
```
Vous devriez voir des valeurs de température en sortie sur la console. Utilisez quelque chose pour réchauffer le capteur, par exemple en appuyant votre pouce dessus, ou en utilisant un ventilateur pour voir les valeurs changer :
```output
pi@raspberrypi:~/temperature-sensor $ python3 app.py
Temperature 26°C
Temperature 26°C
Temperature 28°C
Temperature 30°C
Temperature 32°C
```
> 💁 Vous pouvez trouver ce code dans le dossier [code-temperature/pi](../code-temperature/pi).
😀 La réalisation de votre programme de capteur de température a été un succès !

@ -0,0 +1,57 @@
# Publier la température - Matériel virtuel IoT et Raspberry Pi
Dans cette partie de la leçon, vous allez publier les valeurs de température détectées par le Raspberry Pi ou le dispositif IoT virtuel sur MQTT afin qu'elles puissent être utilisées ultérieurement pour calculer le DJC.
## Publier la temperature
Une fois la température lue, elle peut être publiée via MQTT vers un code "serveur" qui lira les valeurs et les stockera, prêtes à être utilisées pour un calcul de DJC.
### Tâche - Publier la température
Programmez l'appareil pour qu'il publie les données de température.
1. Ouvrez le projet d'application `temperature-sensor` s'il ne l'est pas déjà.
1. Répétez les étapes de la leçon 4 pour vous connecter à MQTT et envoyer la télémétrie. Vous utiliserez le même "broker" publique Mosquitto.
Les étapes sont:
- Ajout de la librairie pip de MQTT paho
- Ajouter le code afin de se conecter au broker MQTT
- Ajouter le code permettant de publier la télémètrie
> ⚠️ Consultez les [instructions pour la connexion à MQTT](../../../../1-getting-started/lessons/4-connect-internet/single-board-computer-mqtt.md) ainsi que les [instructions pour l'envoi de la télémétrie](../../../../1-getting-started/lessons/4-connect-internet/single-board-computer-telemetry.md) de la leçon 4 si nécessaire.
1. Assurez-vous que le `client_name` reflète le nom de ce projet :
```python
client_name = id + 'temperature_sensor_client'
```
1. Pour la télémétrie, au lieu d'envoyer une valeur de lumière, envoyez la valeur de température lue par le capteur DHT dans une propriété du document JSON appelée `temperature` :
```python
_, temp = sensor.read()
telemetry = json.dumps({'temperature' : temp})
```
1. La valeur de la température n'a pas besoin d'être lue très souvent - elle ne changera pas beaucoup dans un court laps de temps, donc réglez le `time.sleep` à 10 minutes :
```cpp
time.sleep(10 * 60);
```
> 💁 La fonction `sleep` prend le temps en secondes, donc pour faciliter la lecture, la valeur est passée comme le résultat d'un calcul. 60s en une minute, donc 10 x (60s en une minute) donne un délai de 10 minutes.
1. Exécutez le code de la même manière que vous avez exécuté le code de la partie précédente du devoir. Si vous utilisez un appareil IoT virtuel, assurez-vous que l'application CounterFit est en cours d'exécution et que les capteurs d'humidité et de température ont été créés sur les bonnes broches IO.
```output
pi@raspberrypi:~/temperature-sensor $ python3 app.py
MQTT connected!
Sending telemetry {"temperature": 25}
Sending telemetry {"temperature": 25}
```
> 💁 Vous pouvez trouver ce code dans le dossier [code-publish-temperature/virtual-device].(../code-publish-temperature/virtual-device) ou encore [code-publish-temperature/pi](../code-publish-temperature/pi).
😀 Vous avez publié avec succès la température en tant que télémétrie de votre appareil.

@ -0,0 +1,140 @@
# Mesurer la température - Matériel virtuel IoT
Dans cette partie de la leçon, vous allez ajouter un capteur de température à votre dispositif IoT virtuel.
## Matériel virtuel
Le dispositif IoT virtuel utilisera un capteur numérique d'humidité et de température Grove simulé. Ce laboratoire est donc identique à celui qui utilise un Raspberry Pi avec un capteur Grove DHT11 physique.
Le capteur combine un **capteur de température** et un **capteur d'humidité**, mais dans ce laboratoire, vous n'êtes intéressé que par le composant capteur de température. Dans un dispositif IoT physique, le capteur de température serait une [thermistance] (https://wikipedia.org/wiki/Thermistor) qui mesure la température en détectant un changement de résistance lorsque la température change. Les capteurs de température sont généralement des capteurs numériques qui convertissent en interne la résistance mesurée en une température en degrés Celsius (ou Kelvin, ou Fahrenheit).
### Ajouter les capteurs à CounterFit
Pour utiliser un capteur d'humidité et de température virtuel, vous devez ajouter les deux capteurs à l'application CounterFit
#### Tâche - ajouter les capteurs à CounterFit
Ajoutez les capteurs d'humidité et de température à l'application CounterFit.
1. Créez une nouvelle application Python sur votre ordinateur dans un dossier appelé `temperature-sensor` avec un seul fichier appelé `app.py` et un environnement virtuel Python, et ajoutez les librairies pip de CounterFit.
> ⚠️ Vous pouvez vous référer [aux instructions pour créer et configurer un projet Python CounterFit dans la leçon 1 si nécessaire](../../../../1-getting-started/lessons/1-introduction-to-iot/virtual-device.md).
1. Installez une librairie pip supplémentaire afin d'installer une cale CounterFit pour le capteur DHT11. Assurez-vous que vous l'installez depuis un terminal avec l'environnement virtuel activé.
```sh
pip install counterfit-shims-seeed-python-dht
```
1. Assurez-vous que l'application web CounterFit est en cours d'exécution.
1. Créez un capteur d'humidité :
1. Dans la case *Create sensor* du volet *Sensors*, déroulez la case *Sensor type* et sélectionnez *Humidity*.
1. Laissez le paramètre *Units* à *Percentage*
1. Assurez vous que la variable *Pin* est à *5*
1. Sélectionnez le bouton **Add** pour créer le capteur d'humidité sur la broche 5
![Paramètres du capteur d'humidité](../../../../images/counterfit-create-humidity-sensor.png)
Le capteur d'humidité sera créé et apparaîtra dans la liste des capteurs.
![Le capteur d'humidité créé](../../../../images/counterfit-humidity-sensor.png)
1. Créez un capteur de température :
1. Dans la case *Create sensor* du volet *Sensors*, déroulez la case *Sensor type* et sélectionnez *Temperature*
1. Laissez la variable *Units* à *Celsius*
1. Assurez vous que la variable *Pin* est à *6*
1. Sélectionnez le bouton **Add** pour créer le capteur de température sur la broche 6
![Paramètres du capteur de température](../../../../images/counterfit-create-temperature-sensor.png)
Le capteur de température sera créé et apparaîtra dans la liste des capteurs
![Création du capteur de température](../../../../images/counterfit-temperature-sensor.png)
## Programmez l'application de la sonde de température
L'application du capteur de température peut maintenant être programmée en utilisant les capteurs CounterFit.
### Tâche - programmer l'application du capteur de température
Programmez l'application du capteur de température.
1. Assurez-vous que l'application `temperature-sensor` est ouverte dans VS Code.
1. Ouvrez le fichier `app.py`.
1. Ajoutez le code suivant au début de `app.py` pour connecter l'application à CounterFit :
```python
from counterfit_connection import CounterFitConnection
CounterFitConnection.init('127.0.0.1', 5000)
```
1. Ajoutez le code suivant au fichier `app.py` pour importer les bibliothèques requises :
```python
import time
from counterfit_shims_seeed_python_dht import DHT
```
L'instruction `from seeed_dht import DHT` importe la classe de capteur `DHT` pour interagir avec un capteur de température Grove virtuel utilisant une shim du module `counterfit_shims_seeed_python_dht`.
1. Ajoutez le code suivant après le code ci-dessus pour créer une instance de la classe qui gère le capteur virtuel d'humidité et de température :
```python
sensor = DHT("11", 5)
```
Ceci déclare une instance de la classe `DHT` qui gère le capteur virtuel **D**numérique **H**umidité et **T**température. Le premier paramètre indique au code que le capteur utilisé est un capteur virtuel *DHT11*. Le deuxième paramètre indique au code que le capteur est connecté au port `5`.
> 💁 CounterFit simule ce capteur combiné d'humidité et de température en se connectant à 2 capteurs, un capteur d'humidité sur la broche donnée lors de la création de la classe `DHT`, et un capteur de température qui se trouve sur la broche suivante. Si le capteur d'humidité est sur la broche 5, la cale s'attend à ce que le capteur de température soit sur la broche 6.
1. Ajoutez une boucle infinie après le code ci-dessus pour interroger la valeur du capteur de température et l'imprimer sur la console :
```python
while True:
_, temp = sensor.read()
print(f'Temperature {temp}°C')
```
L'appel à `sensor.read()` renvoie un tuple d'humidité et de température. Vous n'avez besoin que de la valeur de la température, l'humidité est donc ignorée. La valeur de la température est ensuite imprimée sur la console.
1. Ajoutez une petite mise en veille de dix secondes à la fin de la "boucle", car les niveaux de température n'ont pas besoin d'être vérifiés en permanence. Une mise en veille réduit la consommation d'énergie de l'appareil.
```python
time.sleep(10)
```
1. À partir du terminal VS Code avec un environnement virtuel activé, exécutez ce qui suit pour lancer votre application Python :
```sh
python app.py
```
1. Depuis l'application CounterFit, modifiez la valeur de la sonde de température qui sera lue par l'application. Vous pouvez le faire de deux façons :
* Entrez un nombre dans la case *Value* pour le capteur de température, puis sélectionnez le bouton **Set**. Le nombre que vous saisissez sera la valeur renvoyée par le capteur.
* Cochez la case *Random* et saisissez une valeur *Min* et *Max*, puis sélectionnez le bouton **Set**. Chaque fois que le capteur lit une valeur, il lit un nombre aléatoire entre *Min* et *Max*.
Vous devriez voir les valeurs que vous avez définies apparaître dans la console. Changez les paramètres *Value* ou *Random* pour voir la valeur changer.
```output
(.venv) ➜ temperature-sensor python app.py
Temperature 28.25°C
Temperature 30.71°C
Temperature 25.17°C
```
> 💁 Vous pouvez trouver ce code dans le fichier [code-temperature/virtual-device](../code-temperature/virtual-device).
😀 Votre programme de capteur de température a été un succès !

@ -0,0 +1,68 @@
# Publier la température - Terminal Wio
Dans cette partie de la leçon, vous allez publier les valeurs de température détectées par le terminal Wio sur MQTT afin qu'elles puissent être utilisées ultérieurement pour calculer le DJC.
## Publier la température
Une fois la température lue, elle peut être publiée via MQTT vers un code "serveur" qui lira les valeurs et les stockera, prêtes à être utilisées pour un calcul de DJC. Les microcontrôleurs ne lisent pas l'heure sur Internet et ne suivent pas l'heure avec une horloge en temps réel. Le dispositif doit être programmé pour le faire, en supposant qu'il dispose du matériel nécessaire.
Afin de simplifier les choses pour cette leçon, l'heure ne sera pas envoyée avec les données du capteur, mais pourra être ajoutée par le code du serveur plus tard, lorsqu'il recevra les messages.
### Tâche
Programmez l'appareil pour qu'il publie les données de température.
1. Ouvrez le projet Wio Terminal `temperature-sensor`.
1. Répétez les étapes de la leçon 4 pour vous connecter à MQTT et envoyer la télémétrie. Vous utiliserez le même courtier public Mosquitto.
Les étapes à suivre sont les suivantes :
- Ajouter les bibliothèques Seeed WiFi et MQTT au fichier `.ini`.
- Ajouter le fichier de configuration et le code pour se connecter au WiFi
- Ajouter le code pour se connecter au broker MQTT
- Ajouter le code pour publier la télémétrie
> ⚠️ Consultez les [instructions pour la connexion à MQTT].(../../../1-getting-started/lessons/4-connect-internet/wio-terminal-mqtt.md) ainsi que les [instructions pour l'envoi de la télémétrie](../../../../1-getting-started/lessons/4-connect-internet/wio-terminal-telemetry.md) de la leçon 4 si nécessaire.
1. Assurez-vous que le `CLIENT_NAME` dans le fichier d'en-tête `config.h` reflète ce projet :
```cpp
const string CLIENT_NAME = ID + "temperature_sensor_client";
```
1. Pour la télémétrie, au lieu d'envoyer une valeur de lumière, envoyez la valeur de température lue par le capteur DHT dans une propriété du document JSON appelée `temperature` en modifiant la fonction `loop` dans `main.cpp` :
```cpp
float temp_hum_val[2] = {0};
dht.readTempAndHumidity(temp_hum_val);
DynamicJsonDocument doc(1024);
doc["temperature"] = temp_hum_val[1];
```
1. La valeur de la température n'a pas besoin d'être lue très souvent - elle ne changera pas beaucoup dans un court laps de temps, donc réglez le "retard" de la fonction "boucle" à 10 minutes :
```cpp
delay(10 * 60 * 1000);
```
> 💁 La fonction `delay` prend le temps en millisecondes, donc pour faciliter la lecture, la valeur est passée comme le résultat d'un calcul. 1 000 ms en une seconde, 60s en une minute, donc 10 x (60s en une minute) x (1000 ms en une seconde) donne un délai de 10 minutes.
1. Téléchargez-le sur votre terminal Wio, et utilisez le moniteur série pour voir la température envoyée au courtier MQTT.
```output
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on /dev/cu.usbmodem1201 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Connecting to WiFi..
Connected!
Attempting MQTT connection...connected
Sending telemetry {"temperature":25}
Sending telemetry {"temperature":25}
```
> 💁 Vous pouvez trouver ce code dans le fichier [code-publish-temperature/wio-terminal].(../code-publish-temperature/wio-terminal).
😀 Vous avez publié avec succès la température en tant que télémétrie de votre appareil!

@ -0,0 +1,129 @@
# Mesure de la température - Terminal Wio
Dans cette partie de la leçon, vous allez ajouter un capteur de température à votre terminal Wio, et lire les valeurs de température à partir de celui-ci.
## Matériel
Le terminal Wio a besoin d'un capteur de température.
La sonde que vous utiliserez est une [sonde d'humidité et de température DHT11](https://www.seeedstudio.com/Grove-Temperature-Humidity-Sensor-DHT11.html), combinant deux capteurs dans un même boîtier. Cette méthode est assez populaire, avec un certain nombre de capteurs disponibles dans le commerce combinant température, humidité et parfois pression atmosphérique. Le composant du capteur de température est une thermistance à coefficient de température négatif (CTN), une thermistance dont la résistance diminue lorsque la température augmente.
Il s'agit d'un capteur numérique, qui dispose donc d'un ADC intégré pour créer un signal numérique contenant les données de température et d'humidité que le microcontrôleur peut lire.
### Connecter le capteur de température
Le capteur de température Grove peut être connecté au port numérique des terminaux Wio.
#### Tâche - connecter le capteur de température
Connectez le capteur de température.
![Capteur de température Grove](../../../../images/grove-dht11.png)
1. Insérez une extrémité d'un câble Grove dans la prise du capteur d'humidité et de température. Il ne peut être inséré que dans un seul sens.
1. Le terminal Wio étant déconnecté de votre ordinateur ou de toute autre source d'alimentation, connectez l'autre extrémité du câble Grove à la prise Grove de droite du terminal Wio lorsque vous regardez l'écran. Il s'agit de la prise la plus éloignée du bouton d'alimentation.
![La sonde de température Grove connectée à la prise de droite](../../../../images/wio-temperature-sensor.png)
## Programmer le capteur de température
Le terminal Wio peut maintenant être programmé pour utiliser le capteur de température joint.
### Tâche - programmer le capteur de température
Programmez l'appareil.
1. Créez un tout nouveau projet Wio Terminal en utilisant PlatformIO. Appelez ce projet `temperature-sensor`. Ajoutez du code dans la fonction `setup` pour configurer le port série.
> ⚠️ Vous pouvez vous référer [aux instructions pour créer un projet PlatformIO dans le projet 1, leçon 1 si nécessaire](../../../../1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md#create-a-platformio-project).
1. Ajoutez une dépendance de la bibliothèque de capteurs d'humidité et de température Seeed Grove au fichier `platformio.ini` du projet :
```ini
lib_deps =
seeed-studio/Grove Temperature And Humidity Sensor @ 1.0.1
```
> ⚠️ Vous pouvez vous référer [aux instructions pour ajouter des bibliothèques à un projet PlatformIO dans le projet 1, leçon 4 si nécessaire](../../../../1-getting-started/lessons/4-connect-internet/wio-terminal-mqtt.md#install-the-wifi-and-mqtt-arduino-libraries).
1. Ajoutez les directives `#include` suivantes en haut du fichier, sous la directive existante `#include <Arduino.h>` :
```cpp
#include <DHT.h>
#include <SPI.h>
```
Ceci importe les fichiers nécessaires pour interagir avec le capteur. Le fichier d'en-tête `DHT.h` contient le code du capteur lui-même, et l'ajout de l'en-tête `SPI.h` garantit que le code nécessaire pour parler au capteur est lié lors de la compilation de l'application.
1. Avant la fonction "setup", déclarez le capteur DHT :
```cpp
DHT dht(D0, DHT11);
```
Ceci déclare une instance de la classe `DHT` qui gère le capteur **D**numérique **H** d'humidité et **T** de température. Celle-ci est connectée au port `D0`, le connecteur Grove de droite sur le terminal Wio. Le second paramètre indique au code que le capteur utilisé est le capteur *DHT11* - la bibliothèque que vous utilisez supporte d'autres variantes de ce capteur.
1. Dans la fonction `setup`, ajoutez du code pour configurer la connexion série :
```cpp
void setup()
{
Serial.begin(9600);
while (!Serial)
; // Wait for Serial to be ready
delay(1000);
}
```
1. A la fin de la fonction `setup`, après le dernier `delay`, ajoutez un appel pour démarrer le capteur DHT :
```cpp
dht.begin();
```
1. Dans la fonction `loop`, ajoutez du code pour appeler le capteur et imprimer la température sur le port série :
```cpp
void loop()
{
float temp_hum_val[2] = {0};
dht.readTempAndHumidity(temp_hum_val);
Serial.print("Temperature: ");
Serial.print(temp_hum_val[1]);
Serial.println ("°C");
delay(10000);
}
```
Ce code déclare un tableau vide de 2 flottants, et le passe à l'appel à `readTempAndHumidity` sur l'instance `DHT`. Cet appel remplit le tableau avec 2 valeurs - l'humidité va dans l'élément 0 du tableau (rappelez-vous qu'en C++ les tableaux sont basés sur 0, donc le 0ème élément est le 'premier' élément du tableau), et la température va dans le 1er élément.
La température est lue à partir du premier élément du tableau, et imprimée sur le port série.
> 🇺🇸 La température est lue en Celsius. Pour les Américains, pour la convertir en Fahrenheit, il faut diviser la valeur Celsius lue par 5, puis multiplier par 9, puis ajouter 32. Par exemple, une température de 20°C devient ((20/5)*9) + 32 = 68°F.
1. Construisez et téléchargez le code sur le terminal Wio.
> ⚠️ Vous pouvez vous référer [aux instructions pour créer un projet PlatformIO dans le projet 1, leçon 1 si nécessaire](../../../../1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md#write-the-hello-world-app).
1. Une fois téléchargé, vous pouvez surveiller la température en utilisant le moniteur série :
```output
> Executing task: platformio device monitor <
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on /dev/cu.usbmodem1201 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Temperature: 25.00°C
Temperature: 25.00°C
Temperature: 25.00°C
Temperature: 24.00°C
```
> 💁 Vous pouvez trouver ce code dans le fichier [code-température/wio-terminal](../code-temperature/wio-terminal).
😀 Votre programme de capteur de température a été un succès !

@ -0,0 +1,262 @@
# Detect soil moisture
![A sketchnote overview of this lesson](../../../sketchnotes/lesson-6.jpg)
> Sketchnote by [Nitya Narasimhan](https://github.com/nitya). Click the image for a larger version.
## Pre-lecture quiz
[Pre-lecture quiz](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/11)
## Introduction
In the last lesson we looked at measuring an ambient property and using it to predict plant growth. Temperature can be controlled, but it is expensive to do so, requiring controlled environments. The easiest ambient property to control for plants is water - something that is controlled everyday from large-scale irrigation systems to young kids with watering cans watering their gardens.
![A child watering a garden](../../../images/child-watering-garden.jpg)
In this lesson you will learn about measuring soil moisture, and in the next lesson you will learn how to control an automated watering system. This lesson introduces a third sensor, you've already used a light sensor, a temperature sensor, so in this lesson you will also learn more about how sensors and actuators communicate with IoT devices to understand more about how a soil moisture sensor can send data to an IoT device.
In this lesson we'll cover:
* [Soil moisture](#soil-moisture)
* [How sensors communicate with IoT devices](#how-sensors-communicate-with-iot-devices)
* [Measure the moisture levels in soil](#measure-the-moisture-levels-in-soil)
* [Sensor calibration](#sensor-calibration)
## Soil moisture
Plants require water to grow. They absorb water throughout the entire plant, with the majority being absorbed by the root system. Water is used by the plant for three things:
* [Photosynthesis](https://wikipedia.org/wiki/Photosynthesis) - plants creates a chemical reaction with water, carbon dioxide and light to produce carbohydrates and oxygen.
* [Transpiration](https://wikipedia.org/wiki/Transpiration) - plants use water for diffusion of carbon dioxide from the air into the plant via pores in the leaves. This process also carries nutrients around the plant, and cools the plant, similar to how humans sweat.
* Structure - plants also need water to maintain their structure - they are 90% water (as opposed to humans at only 60%), and this water keeps the cells rigid. If a plant doesn't have enough water it will wilt and eventually die.
![Water is absorbed through plant roots then carried around the plant, being used for photosynthesis and plant structure](../../../images/transpiration.png)
✅ Do some research: how much water is lost through transpiration?
The root system provides water from moisture in the soil where the plant grows. Too little water in the soil and the plant cannot absorb enough to grow, too much water and roots cannot absorb enough oxygen needed to function. This leads to roots dying and the plant unable to get enough nutrients to survive.
For a farmer to get the best plant growth, the soil needs to be not too wet and not too dry. IoT devices can help with this by measuring soil moisture, allowing a farmer to only water when needed.
### Ways to measure soil moisture
There are a range of different types of sensor you can use to measure soil moisture:
* Resistive - a resistive sensor has 2 probes that go into the soil. An electric current is sent to one probe, and received by the other. The sensor then measures the resistance of the soil - measuring how much the current drops at the second probe. Water is a good conductor of electricity, so the higher the water content of the soil, the lower the resistance.
![A resistive soil moisture sensor](../../../images/resistive-soil-moisture-sensor.png)
> 💁 You can build a resistive soil moisture sensor using two pieces of metal, such as nails, separated by a couple of centimeters, and measuring the resistance between them using a multimeter.
* Capacitive - a capacitive moisture sensor measures the amount of electric charge that can be stored across a positive and a negative electrical plate, or [capacitance](https://wikipedia.org/wiki/Capacitance). The capacitance of soil changes as the moisture level changes, and this can be converted to a voltage that can be measured by an IoT device. The wetter the soil, the lower the voltage that comes out.
![A capacitive soil moisture sensor](../../../images/grove-capacitive-soil-moisture-sensor.png)
These are both analog sensors, returning a voltage to indicate soil moisture. So how does this voltage get to your code? Before going any further with these sensors, let's look at how sensors and actuators communicate with IoT devices.
## How sensors communicate with IoT devices
So far in these lessons you've learned about a number of sensors and actuators, and these have been communicating with your IoT dev kit if you've been doing the physical hardware labs. But how does this communication work? How does a resistance measurement from a soil moisture sensor become a number you can use from code?
To communicate with most sensors and actuators you need some hardware, and a communication protocol - that is a well defined way for data to be sent and received. Take for example a capacitive soil moisture sensor:
* How is this sensor connected to the IoT device?
* If it measures a voltage that is an analog signal, it will need an ADC to create a digital representation of the value, and this value is sent as an alternating voltage to send 0s and 1s - but how long is each bit sent for?
* If the sensor returns a digital value, that will be a stream of 0s and 1s, again how long is each bit sent for?
* If the voltage is high for 0.1s is that a single 1 bit, or 2 consecutive 1 bits, or 10?
* At what point does the number start? Is `00001101` 25, or are the first 5 bits the end of the previous value?
The hardware provides the physical connectivity over which the data is sent, the different communication protocols ensure that the data is sent or received in the correct way so it can be interpreted.
### General Purpose Input Output (GPIO) pins
GPIO is a set of pins you can use to connect hardware to your IoT device, and are often available on IoT developer kits such as the Raspberry Pi or Wio Terminal. You can use the various communication protocols covered in this section over the GPIO pins. Some GPIO pins provide a voltage, usually 3.3V or 5V, some pins are ground, and others can be programmatically set to either send a voltage (output), or receive a voltage (input).
> 💁 An electrical circuit needs to connect a voltage to ground via whatever circuitry you are using. You can think of voltage as the positive (+ve) terminal of a battery and ground as the negative (-ve) terminal.
You can use GPIO pins directly with some digital sensors and actuators when you only care about on or off values - on referred to as high, off as low. Some examples are:
* Button. You can connect a button between a 5V pin and a pin set to input. When you press the button it completes a circuit between the 5V pin, through the button to the input pin. From code you can read the voltage at the input pin, and if it is high (5V) then the button is pressed, if it is low (0v) then the button is not pressed. Remember the actual voltage itself is not read, instead you get a digital signal of 1 or 0 depending on if the voltage is above a threshold or not.
![A button is sent 5 volts. When not pressed it returns 0 volts, or 0, when pressed it returns 5 volts, or 1](../../../images/button-with-digital.png)
* LED. You can connect an LED between an output pin and a ground pin (using a resistor otherwise you'll burn out the LED). From code you can set the output pin to high and it will send 3.3V, making a circuit from the 3.3V pin, through the LED, to the ground pin. This will light the LED.
![An LED is sent a signal of 0 (3.3V), which lights the LED. If it is sent 0 (0v), the LED is not lit.](../../../images/led-digital-control.png)
For more advanced sensors, you can use GPIO pins to send and receive digital data directly with digital sensors and actuators, or via controller boards with ADCs and DACs to talk to analog sensors and actuators.
> 💁 if you are using a Raspberry Pi for these labs, the Grove Base Hat has hardware to convert analog sensor signals to digital to send over GPIO.
✅ If you have an IoT device with GPIO pins, locate these pins and find a diagram indicating which pins are voltage, ground or programmable.
### Analog pins
Some devices, such as Arduino devices, provide analog pins. These are the same as GPIO pins, but instead of only supporting a digital signal, they have an ADC to convert voltage ranges to numerical values. Usually the ADC has a 10-bit resolution, meaning it converts voltages to a value of 0-1,023.
For example, on a 3.3V board, if the sensor returns 3.3V, the value returned would be 1,023. If the voltage returned was 1.65v, the value returned will be 511.
![A soil moisture sensor sent 3.3V and returning 1.65v, or a reading of 511](../../../images/analog-sensor-voltage.png)
> 💁 Back in nightlight - lesson 3, the light sensor returned a value from 0-1,023. If you are using a Wio Terminal, the sensor was connected to an analog pin. If you are using a Raspberry Pi, then the sensor was connected to an analog pin on the base hat that has an integrated ADC to communicate over the GPIO pins. The virtual device was set to send a value from 0-1,023 to simulate an analog pin.
Soil moisture sensors rely on voltages, so will use analog pins and give values from 0-1,023.
### Inter Integrated Circuit (I<sup>2</sup>C)
I<sup>2</sup>C, pronounced *I-squared-C*, is a multi-controller, multi-peripheral protocol, with any connected device able to act as a controller or peripheral communicating over the I<sup>2</sup>C bus (the name for a communication system that transfers data). Data is sent as addressed packets, with each packet containing the address of the connected device it is intended for.
> 💁 This model used to be referred to as master/slave, but this terminology is being dropped due to its association with slavery. The [Open Source Hardware Association has adopted controller/peripheral](https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/), but you may still see references to the old terminology.
Devices have an address that is used when they connect to the I<sup>2</sup>C bus, and is usually hard coded on the device. For example, each type of Grove sensor from Seeed has the same address, so all the light sensors have the same address, all the buttons have the same address that is different from the light sensor address. Some devices have ways to change the address, by changing jumper settings or soldering pins together.
I<sup>2</sup>C has a bus made of 2 main wires, along with 2 power wires:
| Wire | Name | Description |
| ---- | --------- | ----------- |
| SDA | Serial Data | This wire is for sending data between devices. |
| SCL | Serial Clock | This wire sends a clock signal at a rate set by the controller. |
| VCC | Voltage common collector | The power supply for the devices. This is connected to the SDA and SCL wires to provide their power via a pull-up resistor that switches the signal off when no device is the controller. |
| GND | Ground | This provides a common ground for the electrical circuit. |
![I2C bus with 3 devices connected to the SDA and SCL wires, sharing a common ground wire](../../../images/i2c.png)
To send data, one device will issue a start condition to show it is ready to send data. It will then become the controller. The controller then sends the address of the device that it wants to communicate with, along with if it wants to read or write data. After the data has been transmitted, the controller sends a stop condition to indicate that it has finished. After this another device can become the controller and send or receive data.
I<sup>2</sup>C has speed limits, with 3 different modes running at fixed speeds. The fastest is High Speed mode with a maximum speed of 3.4Mbps (megabits per second), though very few devices support that speed. The Raspberry Pi for example, is limited to fast mode at 400Kbps (kilobits per second). Standard mode runs at 100Kbps.
> 💁 If you are using a Raspberry Pi with a Grove Base hat as your IoT hardware, you will be able to see a number of I<sup>2</sup>C sockets on the board you can use to communicate with I<sup>2</sup>C sensors. Analog Grove sensors also use I<sup>2</sup>C with an ADC to send analog values as digital data, so the light sensor you used simulated an analog pin, with the value sent over I<sup>2</sup>C as the Raspberry Pi only supports digital pins.
### Universal asynchronous receiver-transmitter (UART)
UART involves physical circuitry that allows two devices to communicate. Each device has 2 communication pins - transmit (Tx) and receive (Rx), with the Tx pin of the first device connected to the Rx pin of the second, and with the Tx pin of the second device connected to the Rx pin of the first. This allows data to be sent in both directions.
* Device 1 transmits data from its Tx pin, which is received by device 2 on it's Rx pin
* Device 1 receives data on its Rx pin that is transmitted by device 2 from its Tx pin
![UART with the Tx pin on one chip connected to the Rx pin on another, and vice versa](../../../images/uart.png)
> 🎓 The data is sent one bit at a time, and this is known as *serial* communication. Most operating systems and microcontrollers have *serial ports*, that is connections that can send and receive serial data that are available to your code.
UART devices have a [baud rate](https://wikipedia.org/wiki/Symbol_rate) (also known as Symbol rate), which is the speed that data will be sent and received in bits per second. A common baud rate is 9,600, meaning 9,600 bits (0s and 1s) of data are sent each second.
UART uses start and stop bits - that is it sends a start bit to indicate that it's about to send a byte (8 bits) of data, then a stop bit after it sends the 8 bits.
UART speed is dependent on hardware, but even the fastest implementations don't exceed 6.5 Mbps (megabits per second, or millions of bits, 0 or 1, sent per second).
You can use UART over GPIO pins - you can set one pin as Tx and another as Rx, then connect these to another device.
> 💁 If you are using a Raspberry Pi with a Grove Base hat as your IoT hardware, you will be able to see a UART socket on the board you can use to communicate with sensors that use the UART protocol.
### Serial Peripheral Interface (SPI)
SPI is designed for communicating over short distances, such as on a microcontroller to talk to a storage device such as flash memory. It is based on a controller/peripheral model with a single controller (usually the processor of the IoT device) interacting with multiple peripherals. The controller controls everything by selecting a peripheral and sending or requesting data.
> 💁 Like I<sup>2</sup>C, the terms controller and peripheral are recent changes, so you may see the older terms still used.
SPI controllers use 3 wires, along with 1 extra wire per peripheral. Peripherals use 4 wires. These wires are:
| Wire | Name | Description |
| ---- | --------- | ----------- |
| COPI | Controller Output, Peripheral Input | This wire is for sending data from the controller to the peripheral. |
| CIPO | Controller Input, peripheral Output | This wire is for sending data from the peripheral to the controller. |
| SCLK | Serial Clock | This wire sends a clock signal at a rate set by the controller. |
| CS | Chip Select | The controller has multiple wires, one per peripheral, and each wire connects to the CS wire on the corresponding peripheral. |
![SPI with on controller and two peripherals](../../../images/spi.png)
The CS wire is used to activate one peripheral at a time, communicating over the COPI and CIPO wires. When the controller needs to change peripheral, it deactivates the CS wire connected to the currently active peripheral, then activates the wire connected to the peripheral it wants to communicate with next.
SPI is *full-duplex*, meaning the controller can send and receive data at the same time from the same peripheral using the COPI and CIPO wires. SPI uses a clock signal on the SCLK wire to keep the devices in sync, so unlike sending directly over UART it doesn't need start and stop bits.
There are no defined speed limits for SPI, with implementations often able to transmit multiple megabytes of data per second.
IoT developer kits often support SPI over some of the GPIO pins. For example, on a Raspberry Pi you can use GPIO pins 19, 21, 23, 24 and 26 for SPI.
### Wireless
Some sensors can communicate over standard wireless protocols, such as Bluetooth (mainly Bluetooth Low Energy, or BLE), LoRaWAN (a **Lo**ng **Ra**nge low power networking protocol), or WiFi. These allow for remote sensors not physically connected to an IoT device.
One such example is in commercial soil moisture sensors. These will measure soil moisture in a field, then send the data over LoRaWan to a hub device, which will process the data or send it over the Internet. This allows the sensor to be away from the IoT device that manages the data, reducing power consumption and the need for large WiFi networks or long cables.
BLE is popular for advanced sensors such as fitness trackers work on the wrist. These combine multiple sensors and send the sensor data to an IoT device in the form of your phone via BLE.
✅ Do you have any bluetooth sensors on your person, in your house or in your school? These might include temperature sensors, occupancy sensors, device trackers and fitness devices.
One popular way for commercial devices to connect is Zigbee. Zigbee uses WiFi to form mesh networks between devices, where each device connects to as many nearby devices as possible, forming a large number of connections like a spiders web. When one device wants to send a message to the Internet it can send it to the nearest devices, which then forward it on to other nearby devices and so on, until it reaches a coordinator and can be sent to the Internet.
> 🐝 The name Zigbee refers to the waggle dance of honey bees after their return to the beehive.
## Measure the moisture levels in soil
You can measure the moisture level in soil using a soil moisture sensor, an IoT device, and a house plant or nearby patch of soil.
### Task - measure soil moisture
Work through the relevant guide to measure soil moisture using your IoT device:
* [Arduino - Wio Terminal](wio-terminal-soil-moisture.md)
* [Single-board computer - Raspberry Pi](pi-soil-moisture.md)
* [Single-board computer - Virtual device](virtual-device-soil-moisture.md)
## Sensor calibration
Sensors rely on measuring electrical properties such as resistance or capacitance.
> 🎓 Resistance, measured in ohms (Ω) is how much opposition there is to the electric current travelling through something. When a voltage is applied to a material, the amount of current that passes through it is dependant on the resistance of the material. You can read more on the [electrical resistance page on Wikipedia](https://wikipedia.org/wiki/Electrical_resistance_and_conductance).
> 🎓 Capacitance, measured in farads (F), is the ability of a component or circuit to collect and store electrical energy. You can read more on capacitance on the [capacitance page on Wikipedia](https://wikipedia.org/wiki/Capacitance).
These measurements are not always useful - imagine a temperature sensor that gave you a measurement of 22.5KΩ! Instead the value measured needs to be converted into a useful unit by being calibrated - that is matching the values measured to the quantity measured to allow new measurements to be converted to the right unit.
Some sensors come pre-calibrated. For example the temperature sensor you used in the last lesson was already calibrated so that it can return a temperature measurement in °C. In the factory the first sensor created would be exposed to a range of known temperatures and the resistance measured. This would then be used to build a calculation that can convert from the value measured in Ω (the unit of resistance) to °C.
> 💁 The formula to calculate resistance from temperature is called the [SteinhartHart equation](https://wikipedia.org/wiki/SteinhartHart_equation).
### Soil moisture sensor calibration
Soil moisture is measured using gravimetric or volumetric water content.
* Gravimetric is the weight of water in a unit weight of soil measured, as the number of kilograms of water per kilogram of dry soil
* Volumetric is the volume of water in a unit volume of soil measured, as the number of cubic metres of water per cubic metres of dry soil
> 🇺🇸 For Americans, because of the consistency of the units, these can be measured in pounds instead of kilograms or cubic feet instead of cubic metres.
Soil moisture sensors measure electrical resistance or capacitance - this not only varies by soil moisture, but also soil type as the components in the soil can change its electrical characteristics. Ideally sensors should be calibrated - that is taking readings from the sensor and comparing them to measurements found using a more scientific approach. For example a lab can calculate the gravimetric soil moisture using samples of a specific field taken a few times a year, and these numbers used to calibrate the sensor, matching the sensor reading to the gravimetric soil moisture.
![A graph of voltage vs soil moisture content](../../../images/soil-moisture-to-voltage.png)
The graph above shows how to calibrate a sensor . The voltage is captured for a soil sample that is then measured in a lab by comparing the moist weight to the dry weight (by measuring the weight wet, then drying in an oven and measuring dry). Once a few readings have been taken, this can be plotted on a graph and a line fitted to the points. This line can then be used to convert soil moisture sensor readings taken by an IoT device into actual soil moisture measurements.
💁 For resistive soil moisture sensors, the voltage increases as soil moisture increases. For capacitive soil moisture sensors, the voltage decreases as soil moisture increases, so the graphs for these would slope downwards, not upwards.
![A soil moisture value interpolated from the graph](../../../images/soil-moisture-to-voltage-with-reading.png)
The graph above shows a voltage reading from a soil moisture sensor, and by following that to the line on the graph, the actual soil moisture can be calculated.
This approach means the farmer only needs to get a few lab measurements for a field, then they can use IoT devices to measure soil moisture - drastically speeding up the time to take measurements.
---
## 🚀 Challenge
Resistive and capacitive soil moisture sensors have a number of differences. What are these differences, and which type (if any) is the best for a farmer to use? Does this answer change between developing and developed countries?
## Post-lecture quiz
[Post-lecture quiz](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/12)
## Review & Self Study
Read up on the hardware and protocols used by sensors and actuators:
* [GPIO Wikipedia page](https://wikipedia.org/wiki/General-purpose_input/output)
* [UART Wikipedia page](https://wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter)
* [SPI Wikipedia page](https://wikipedia.org/wiki/Serial_Peripheral_Interface)
* [I<sup>2</sup>C Wikipedia page](https://wikipedia.org/wiki/I²C)
* [Zigbee Wikipedia page](https://wikipedia.org/wiki/Zigbee)
## Assignment
[Calibrate your sensor](assignment.md)

@ -18,7 +18,7 @@ In this lesson we'll cover:
* [Control a relay](#control-a-relay) * [Control a relay](#control-a-relay)
* [Control your plant over MQTT](#control-a-relay) * [Control your plant over MQTT](#control-a-relay)
* [Sensor and actuator timing](#sensor-and-actuator-timing) * [Sensor and actuator timing](#sensor-and-actuator-timing)
* [Add timing to your plant control](#add-timing-to-your-plant-control) * [Add timing to your plant control server](#add-timing-to-your-plant-control-server)
## Control high power devices from a low power IoT device ## Control high power devices from a low power IoT device

@ -74,7 +74,7 @@ The Azure Functions tooling is available as a CLI, known as the Azure Functions
1. Install the Azure Functions core tools by following the instructions on the [Azure Functions Core Tools documentation](https://docs.microsoft.com/azure/azure-functions/functions-run-local?WT.mc_id=academic-17441-jabenn) 1. Install the Azure Functions core tools by following the instructions on the [Azure Functions Core Tools documentation](https://docs.microsoft.com/azure/azure-functions/functions-run-local?WT.mc_id=academic-17441-jabenn)
1. Install the Azure Functions extension for VS Code. This extension provides support for creating, debugging and deploying Azure functions. Refer to the [Azure Functions extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions&WT.mc_id=academic-17441-jabenn) for instructions on installing this extension in VS Code. 1. Install the Azure Functions extension for VS Code. This extension provides support for creating, debugging and deploying Azure functions. Refer to the [Azure Functions extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-azuretools.vscode-azurefunctions) for instructions on installing this extension in VS Code.
When you deploy your Azure Functions app to the cloud, it needs to use a small amount of cloud storage to store things like the application files and log files. When you run your Functions app locally, you still need to connect to cloud storage, but instead of using actual cloud storage, you can use a storage emulator called [Azurite](https://github.com/Azure/Azurite). This runs locally but acts like cloud storage. When you deploy your Azure Functions app to the cloud, it needs to use a small amount of cloud storage to store things like the application files and log files. When you run your Functions app locally, you still need to connect to cloud storage, but instead of using actual cloud storage, you can use a storage emulator called [Azurite](https://github.com/Azure/Azurite). This runs locally but acts like cloud storage.
@ -310,7 +310,7 @@ This will create a folder inside the `soil-moisture-trigger` folder called `iot-
> 💁 You can also have output bindings so that the output of a function is sent to another service. For example you could add an output binding to a database and return the IoT Hub event from the function, and it will automatically be inserted into the database. > 💁 You can also have output bindings so that the output of a function is sent to another service. For example you could add an output binding to a database and return the IoT Hub event from the function, and it will automatically be inserted into the database.
✅ Do some research: Read up on bindings in the [Azure Functions triggers and bindings concepts documentation](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?tabs=python&WT.mc_id=academic-17441-jabenn). ✅ Do some research: Read up on bindings in the [Azure Functions triggers and bindings concepts documentation](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?WT.mc_id=academic-17441-jabenn&tabs=python).
The `bindings` section includes configuration for the binding. The values of interest are: The `bindings` section includes configuration for the binding. The values of interest are:

@ -74,7 +74,7 @@ Azure Functions tooling আমরা CLI এর মাধ্যমে ব্য
1. Azure Functions Core Tools ইনস্টল করার জন্য [Azure Functions Core Tools documentation](https://docs.microsoft.com/azure/azure-functions/functions-run-local?WT.mc_id=academic-17441-jabenn) নির্দেশাবলী অনুসরণ করি। 1. Azure Functions Core Tools ইনস্টল করার জন্য [Azure Functions Core Tools documentation](https://docs.microsoft.com/azure/azure-functions/functions-run-local?WT.mc_id=academic-17441-jabenn) নির্দেশাবলী অনুসরণ করি।
1. VS Code এ Azure Functions extension ইন্সটল করতে হবে। এই এক্সটেনশনে মাধ্যমে Azure functions তৈরী, ডিবাগ এবং ডেপ্লয় করা যাবে। প্রয়োজনীয় নির্দেশনা [Azure Functions extension documentation](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions&WT.mc_id=academic-17441-jabenn) এ রয়েছে। 1. VS Code এ Azure Functions extension ইন্সটল করতে হবে। এই এক্সটেনশনে মাধ্যমে Azure functions তৈরী, ডিবাগ এবং ডেপ্লয় করা যাবে। প্রয়োজনীয় নির্দেশনা [Azure Functions extension documentation](https://marketplace.visualstudio.com/items?WT.mc_id=academic-17441-jabenn&itemName=ms-azuretools.vscode-azurefunctions) এ রয়েছে।
আমরা যখন ক্লাউডে অ্যাজুর ফাংশন অ্যাপ্লিকেশন শুরু করবো, তখন অ্যাপ্লিকেশন ফাইল এবং লগ ফাইলের মতো জিনিসগুলি সেভ রাখতে খুব অল্প পরিমাণে ক্লাউড স্টোরেজ ব্যবহার করা দরকার। যখন লোকালি আমরা ফাংশন অ্যাপ্লিকেশন চালাই তখন আমাদেরকে ক্লাউড স্টোরেজের সাথে সংযোগ স্থাপন করতে হবে, তবে প্রকৃত ক্লাউডের স্টোরেজ ব্যবহারের পরিবর্তে একটি স্টোরেজ এমুলেটর ব্যবহার করতে হবে যেমন [Azurite](https://github.com/Azure/Azurite)। এটি লোকাল ভাবে চলে, তবে ক্লাউড স্টোরেজের মতো কাজ করে। আমরা যখন ক্লাউডে অ্যাজুর ফাংশন অ্যাপ্লিকেশন শুরু করবো, তখন অ্যাপ্লিকেশন ফাইল এবং লগ ফাইলের মতো জিনিসগুলি সেভ রাখতে খুব অল্প পরিমাণে ক্লাউড স্টোরেজ ব্যবহার করা দরকার। যখন লোকালি আমরা ফাংশন অ্যাপ্লিকেশন চালাই তখন আমাদেরকে ক্লাউড স্টোরেজের সাথে সংযোগ স্থাপন করতে হবে, তবে প্রকৃত ক্লাউডের স্টোরেজ ব্যবহারের পরিবর্তে একটি স্টোরেজ এমুলেটর ব্যবহার করতে হবে যেমন [Azurite](https://github.com/Azure/Azurite)। এটি লোকাল ভাবে চলে, তবে ক্লাউড স্টোরেজের মতো কাজ করে।
@ -301,7 +301,7 @@ Azure Functions CLI দ্বারা নতুন Functions app তৈরী
> 💁 এছাড়াও আমরা আউটপুট বাইন্ডিং ব্যবহার করতে পারি যা কোন ফাংশনের আউটপুটকে আরেকটি ডিভাইসে প্রেরণ করতে পারে। যেমন, কোন ডেটাবেসের সাথে আউটপুট বাইন্ডিং যোগ করে ফাংশন দ্বারা আইওটি হাবের সাথে রিটার্ন করতে দিলে - সকল ডেটা স্বংক্রিয়ভাবেই সেই ডেটাবেস এ চলে আসবে। > 💁 এছাড়াও আমরা আউটপুট বাইন্ডিং ব্যবহার করতে পারি যা কোন ফাংশনের আউটপুটকে আরেকটি ডিভাইসে প্রেরণ করতে পারে। যেমন, কোন ডেটাবেসের সাথে আউটপুট বাইন্ডিং যোগ করে ফাংশন দ্বারা আইওটি হাবের সাথে রিটার্ন করতে দিলে - সকল ডেটা স্বংক্রিয়ভাবেই সেই ডেটাবেস এ চলে আসবে।
✅ এবার কিছু গবেষণা করা যাক: বাইন্ডিংস নিয়ে [Azure Functions triggers and bindings concepts documentation](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?tabs=python&WT.mc_id=academic-17441-jabenn)পড়ে আরো জেনে নিই এই বিষয়ে । ✅ এবার কিছু গবেষণা করা যাক: বাইন্ডিংস নিয়ে [Azure Functions triggers and bindings concepts documentation](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?WT.mc_id=academic-17441-jabenn&tabs=python)পড়ে আরো জেনে নিই এই বিষয়ে ।
`bindings` অংশে এর কনফিগারেশনগুলো রয়েছে। এর গুরুত্বপূর্ণ কিছু ভ্যালু হলো : `bindings` অংশে এর কনফিগারেশনগুলো রয়েছে। এর গুরুত্বপূর্ণ কিছু ভ্যালু হলো :

@ -0,0 +1,22 @@
[![French](https://img.shields.io/badge/-French-purple)](translations/README.fr.md)
# Agriculture et IoT
Les besoins en agriculture augmentent avec la croissance de la popualtion. La quantité de terres disponible ne change pas, bien que le climat lui, change. Ceci amène des défits de plus en plus importants aux fermiers, plus particulièrement pour les 2 milliards de [fermiers de subsistance](https://wikipedia.org/wiki/Subsistence_agriculture) qui dépendent de cette production afin de se nourrir ainsi que leur famille. Les technologies des objets connectés ont le potentiel d'aider ces fermiers à faire de meilleures décisions sur la production, notemment quoi faire pousser, quand récolter, accroître les récoltes, réduire la main d'oeuvre ou encore détecter et gérer les parasites.
À l'occasion de ces 6 leçons, vous apprendrez à utiliser les technologies de l'internet des objets afin d'améliorer et automatiser certaines tâches d'agriculture.
> 💁 Ces leçons utiliserons des ressources infonuagiques. Si vous ne complétez pas toutes les leçons du présent projet, nous vous prions de [nettoyer votre projet](../clean-up.md).
## Thèmes
1. [Anticiper la croissance de ses plantes](../lessons/1-predict-plant-growth/translations/README.fr.md)
1. [Détectez l'humidité du sol](../lessons/2-detect-soil-moisture/translations/README.fr.md)
1. [Automatiser l'arrosage des plantes](../lessons/3-automated-plant-watering/translations/README.fr.md)
1. [Amenez vos plants dans l'infonuagique](../lessons/4-migrate-your-plant-to-the-cloud/translations/README.fr.md)
1. [Migrez votre application dans l'infonuagique](../lessons/5-migrate-application-to-the-cloud/translations/README.fr.md)
1. [Gardez vos plants sécurisés](../lessons/6-keep-your-plant-secure/translations/README.fr.md)
## Credits
L'entièreté des leçons ont été écrites avec ♥️ par [Jim Bennett](https://GitHub.com/JimBobBennett)

@ -8,9 +8,9 @@ When working with Azure or other Microsoft technologies, the best source of info
Some pages to look at to get started are: Some pages to look at to get started are:
* [Azure Functions triggers and bindings concepts](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?tabs=python&WT.mc_id=academic-17441-jabenn) * [Azure Functions triggers and bindings concepts](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?WT.mc_id=academic-17441-jabenn&tabs=python)
* [Azure Blob storage bindings for Azure Functions overview](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob?WT.mc_id=academic-17441-jabenn) * [Azure Blob storage bindings for Azure Functions overview](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob?WT.mc_id=academic-17441-jabenn)
* [Azure Blob storage output binding for Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob-output?tabs=python&WT.mc_id=academic-17441-jabenn) * [Azure Blob storage output binding for Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob-output?WT.mc_id=academic-17441-jabenn&tabs=python)
## Rubric ## Rubric

@ -1,9 +0,0 @@
# Dummy File
This file acts as a placeholder for the `translations` folder. <br>
**Please remove this file after adding the first translation**
For the instructions, follow the directives in the [translations guide](https://github.com/microsoft/IoT-For-Beginners/blob/main/TRANSLATIONS.md) .
## THANK YOU
We truly appreciate your efforts!

@ -0,0 +1,469 @@
# লোকেশন ডেটা সংরক্ষণ
![A sketchnote overview of this lesson](../../../../sketchnotes/lesson-12.jpg)
> স্কেচনোটটি তৈরী করেছেন [Nitya Narasimhan](https://github.com/nitya)। বড় সংস্করণে দেখার জন্য ছবিটিতে ক্লিক করতে হবে।
## লেকচার-পূর্ববর্তী কুইজ
[লেকচার-পূর্ববর্তী কুইজ](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/23)
## সূচনা
গত পাঠে কীভাবে অবস্থানের ডেটা ক্যাপচার করতে একটি জিপিএস সেন্সর ব্যবহার করতে হয় তা আমরা শিখেছিলাম। খাদ্যসামগ্রীতে ভর্তি একটি ট্রাকের অবস্থান এবং এটির যাত্রার জন্য এই ডেটাটি ব্যবহার করতে, এটি ক্লাউডে আইওটি সার্ভিসে প্রেরণ করতে হবে এবং তারপরে কোথাও সংরক্ষণ করা দরকার।
এই পাঠে আইওটি ডেটা সঞ্চয় করার বিভিন্ন উপায় সম্পর্কে আমরা শিখব এবং সার্ভারলেস কোড ব্যবহার করে কীভাবে আইওটি পরিষেবা থেকে ডেটা সংরক্ষণ করা যায় তাও শিখতে পারবো।
এই পাঠে আমরা দেখবো:
* [কাঠামোগত এবং কাঠামোবিহীন ডেটা](#কাঠামোগত-এবং-কাঠামোবিহীন-ডেটা)
* [GPS ডেটা IoT Hub এ প্রেরণ](#send-gps-data-to-an-iot-hub)
* [Hot, Warm, এবং Cold Path](#Hot-Warm-এবং-Cold-Path)
* [সার্ভারবিহীন কোড ব্যবহার করে জিপিএস ইভেন্টগুলি পরিচালনা](#সার্ভারবিহীন-কোড-ব্যবহার-করে-জিপিএস-ইভেন্টগুলি-পরিচালনা)
* [Azure স্টোরেজ অ্যাকাউন্ট](#azure-স্টোরেজ-অ্যাকাউন্ট)
* [সার্ভারবিহীন-কোডকে-স্টোরেজে-সংযুক্তকরণ](#সার্ভারবিহীন-কোডকে-স্টোরেজে-সংযুক্তকরণ)
## কাঠামোগত এবং কাঠামোবিহীন ডেটা
কম্পিউটার সিস্টেমগুলি ডেটা নিয়ে কাজ করে এবং এই ডেটা বিভিন্ন আকার এবং ধরণের হয়ে থাকে। এটি একক সংখ্যা থেকে শুরু করে প্রচুর পরিমাণে টেক্সট, ভিডিও, চিত্র বা আইওটি ডেটা হতে পারে। ডেটা সাধারণত দুই ভাগে বিভক্ত করা যায় - *কাঠামোগত* ডেটা এবং *কাঠামোবিহীন* ডেটা।
* **কাঠামোগত ডেটা (Structured Data)** হল এমন ধরণের ডেটা যা একটি সংজ্ঞায়িত, অনমনীয় কাঠামোযুক্ত, যা পরিবর্তিত হয়না এবং সাধারণত টেবিল আকারে সাজানো যায় এবং অন্যান্য ডেটার সাথে কোনোভাবে সম্পর্কিত করা যায়। একটি উদাহরণ হল কোনো ব্যক্তির নাম, জন্ম তারিখ এবং ঠিকানা সহ বিশদ বিবরণ।
* **কাঠামোবিহীন ডেটা (Unstructured Data)** হল একটি অসংজ্ঞায়িত, নমনীয় কাঠামোযুক্ত ডেটা, যা ঘন ঘন কাঠামো পরিবর্তন করতে পারে। একটি উদাহরণ হলো - লিখিত নথি বা স্প্রেডশিট ।
✅ আর কী কী উদাহরণ আমরা কাঠামোগত এবং কাঠামোবিহীন ডেটাতে ভাবতে পারি তা চিন্তা করি।
> 💁 এছাড়াও আধা-কাঠামোগত (Semi-Structured) ডেটা রয়েছে যা কাঠামোগত, তবে তথ্যের নির্দিষ্ট টেবিল আকারে সাজানো যায়না ।
আইওটি ডেটা সাধারণত কাঠামোবিহীন ডেটা (Unstructured Data) হিসাবে বিবেচিত হয়।
কল্পনা করি আমরা একটি বড় বাণিজ্যিক খামারের জন্য যানবাহনের বহরে আইওটি ডিভাইস যুক্ত করেছি। বিভিন্ন ধরণের গাড়ির জন্য বিভিন্ন ডিভাইস ব্যবহার করার দরকার হতে পারে। উদাহরণস্বরূপ:
* ট্রাক্টরের জন্য জিপিএস ডেটা দরকার হতে পারে এটি নিশ্চিত করার জন্য যে তারা সঠিক খামারে বা ক্ষেতে কাজ করছে
* চালকরা নিরাপদে গাড়ি চালাচ্ছে কিনা, ড্রাইভারের পরিচয় নিশ্চিতকরণ এবং কতক্ষণ কাজ করছে তা নিশ্চিত করার জন্য খাদ্যসামগ্রী পরিবহনের ট্রাকগুলিতে জিপিএস ডেটার পাশাপাশি গতিসংক্রান্ত ডেটাও প্রয়োজন।
* রেফ্রিজারেটেড ট্রাকের জন্য তাপমাত্রার তথ্য খুব গুরুত্বপূর্ণ যাতে খাবার খুব গরম বা ঠান্ডা না হয় এবং পরিবহণের সময় তা নষ্ট না হয়।
এই ডেটা পরিবর্তিত হতে পারে। উদাহরণস্বরূপ, যদি আইওটি ডিভাইসটি একটি ট্রাকের ক্যাবে থাকে, তবে ট্রেলার পরিবর্তনের সাথে সাথে ডেটাও পরিবর্তিত হতে পারে, উদাহরণস্বরূপ যখন একটি রেফ্রিজারেটেড ট্রেলার ব্যবহার করা হবে, তখনই শুধু তাপমাত্রার ডেটা প্রেরণ করা হবে।
✅ আর কোন কোন আইওটি ডেটা গ্রহণ যেতে পারে? ট্রাকগুলি যে ধরণের বোঝা বহন করতে পারে সে সম্পর্কে একটু চিন্তা করি এবং সেইসাথে রক্ষণাবেক্ষণের ডেটা সম্পর্কেও ভাবা যেতে পারে।
এই তথ্য যানবাহনের উপর নির্ভর করে পরিবর্তিত হয়, কিন্তু এসব তথ্যাবলি আসলে প্রক্রিয়াকরণের জন্য একই IoT সার্ভিসে পাঠানো হয়। আইওটি সার্ভিসটিকে এই কাঠামোবিহীন ডেটা প্রক্রিয়া করতে পারতে হবে, এটিকে এমনভাবে সংরক্ষণ করতে হবে যা এটি অনুসন্ধান বা বিশ্লেষণের অনুমতি দেয় আবার এই ডেটা বিভিন্ন কাঠামোর সাথেও যেন কাজ করতে পারে।
### SQL এবং NoSQL স্টোরেজ
ডেটাবেসগুলি এমন পরিষেবা যা ডেটা সংরক্ষণ এবং কুয়েরি করার সুযোগ দেয়। ডাটাবেস দুই প্রকার হয় - SQL এবং NoSQL
#### SQL databases
প্রথমদিকের ডাটাবেসগুলো ছিল রিলেশনাল ডাটাবেস ম্যানেজমেন্ট সিস্টেমস (আরডিবিএমএস), বা রিলেশনাল ডাটাবেস। স্ট্রাকচার্ড ক্যোয়ারী ল্যাঙ্গুয়েজ (এসকিউএল) এখানে ডেটা যোগ, অপসারণ, আপডেট বা কোয়েরি করার জন্য তাদের সাথে ইন্টারঅ্যাক্ট করার পরে এটি এসকিউএল ডেটাবেস নামেও পরিচি্তি লাভ করে। এই ডাটাবেসগুলো একটি স্কিমা নিয়ে গঠিত যা স্প্রেডশীটের মতই ডেটা টেবিলের একটি সু-সংজ্ঞায়িত সেট। প্রতিটি টেবিলে একাধিক নামযুক্ত কলাম রয়েছে। যখন ডেটা যোগ বা insert করা, টেবিলে একটি সারি যোগ করা, প্রতিটি কলামে মান রাখা - এসব করা যায়। এটি ডেটাগুলিকে একটি অত্যন্ত কঠোর কাঠামোর মধ্যে রাখে - যদিও কলামগুলি আমরা চাইলে খালি রাখতে পারি, তবে একটি নতুন কলাম যুক্ত করতে চাইলে অবশ্যই বিদ্যমান সারির (ROW) মানগুলি পূরণ করতে হবে। এই ডেটাবেসগুলি রিলেশনাল - তাই এখানে একটি টেবিলের অন্যটির সাথে সম্পর্ক থাকতে পারে।
![A relational database with the ID of the User table relating to the user ID column of the purchases table, and the ID of the products table relating to the product ID of the purchases table](../../../../images/sql-database.png)
উদাহরণস্বরূপ, যদি কোন একটি টেবিলে আমরা কোনো ব্যবহারকারীর ব্যক্তিগত বিবরণ সংরক্ষণ করি, তাহলে প্রতি ব্যবহারকারীর জন্য অভ্যন্তরীণ স্বতন্ত্র (UNIQUE) আইডি থাকবে যা ব্যবহারকারীর নাম এবং ঠিকানা সম্বলিত সারিতে ব্যবহৃত হয়। আমরা যদি সেই ব্যবহারকারী সম্পর্কে অন্যান্য বিবরণ যেমন তাদের ক্রয় তালিকা অন্য টেবিলে সংরক্ষণ করতে চাই, তাহলে সেই ব্যবহারকারীর আইডির জন্য আমাদের নতুন টেবিলে একটি কলাম থাকবে। যখন আমরা কোন ব্যবহারকারী্র তথ্য খুঁজবো, আমরা তাদের আইডি ব্যবহার করে তাদের ব্যক্তিগত তথ্য এক টেবিল থেকে এবং অন্য টেবিল থেকে তাদের কেনাকাটার সকল তথ্য পেয়ে যাব।
এসকিউএল ডেটাবেসগুলি কাঠামোগত ডেটা সংরক্ষণের জন্য এবং স্কিমার সাথে সামঞ্জস্য রাখার জন্য আদর্শ।
✅ এসকিউএল ব্যবহারের অভিজ্ঞতা না থাকলে [SQL page - Wikipedia](https://wikipedia.org/wiki/SQL) থেকে বিস্তারিত জানতে পারবো।
কিছু বহুল পরিচিত এসকিউএল ডেটাবেস হলো Microsoft SQL Server, MySQL এবং PostgreSQL ।
✅ কিছু গবেষণা করা যাক: এসকিউএল ডেটাবেস এবং এদের কর্মপরিধি সম্পর্কে জ্ঞান অর্জন করি।
#### NoSQL ডেটাবেস
NoSQL ডেটাবসেসের নামের আগে NO বা 'না' রাখার কারণই হলো তাদের সেই সুগঠিত কাঠামো নেই। তারা 'ডকুমেন্ট ডেটাবেস' নামেও পরিচিত কারণ তারা ডকুমেন্টের মতো অসংগঠিত ডেটা সংরক্ষণ করতে পারে।
> 💁 এক্ষেত্রে জেনে রাখা ভালো যে কিছু NoSQL ডেটাবেসে আমরা SQL এর মত করে কুয়েরি করতে পারবো।
![Documents in folders in a NoSQL database](../../../../images/noqsl-database.png)
NoSQL ডাটাবেসের একটি পূর্বনির্ধারিত স্কিমা নেই যা ডেটা কিভাবে সংরক্ষণ করা হয় তা সীমাবদ্ধ করবে, বরং এর পরিবর্তে আমরা সাধারণত JSON ডকুমেন্ট ব্যবহার করে যেকোনো অবিক্রিত ডেটা সন্নিবেশ করতে পারি। এই ডকুমেন্টগুলো আমাদের কম্পিউটারের ফাইলের মতো ফোল্ডারে সংগঠিত হতে পারে। প্রতিটি ডকুমেন্টে ভিন্ন ভিন্ন ফিল্ড থাকতে পারে - উদাহরণস্বরূপ, যদি আমরা আমাদের খামারের যানবাহন থেকে আইওটি ডেটা সংরক্ষণ করি, কারও কারও জন্য অ্যাকসিলরোমিটার এবং গতির ডেটার ফিল্ড থাকতে পারে, অন্যদের ট্রেলারে তাপমাত্রার ফিল্ড থাকতে পারে। যদি আমরা একটি নতুন ধরণের ট্রাক যোগ করতে চাই, যেমন একটি বিল্ট-ইন স্কেল যুক্ত গাড়ি যা এতে থাকা ওজন ট্র্যাক করতে পারে, তাহলে আমাদের IoT ডিভাইসটি এই নতুন ফিল্ডটি যোগ করতে পারে এবং এটি ডাটাবেসের কোন পরিবর্তন ছাড়াই সংরক্ষণ করা যাবে।
কিছু সুপরিচিত NoSQL database হলো Azure CosmosDB, MongoDB এবং CouchDB ।
✅ একটু গবেষণা করা যাক: নোএসকিউএল ডেটাবেস এবং এদের কর্মপরিধি সম্পর্কে জ্ঞান অর্জন করি।
এই পাঠে, আমরা আইওটি ডেটা সঞ্চয় (Store) করতে NoSQL স্টোরেজ ব্যবহার করব।
## GPS ডেটা IoT Hub এ প্রেরণ
গত পাঠে আমরা আমাদের আইওটি ডিভাইসের সাথে সংযুক্ত একটি জিপিএস সেন্সর থেকে জিপিএস ডেটা ক্যাপচার করেছি। এই আইওটি ডেটা ক্লাউডে সংরক্ষণ করতে, তা একটি আইওটি পরিষেবাতে পাঠাতে হবে। এবারও আমরা Azure IoT Hub ব্যবহার করব, একই IoT ক্লাউড পরিষেবা যা আমরা আগের প্রজেক্টে ব্যবহার করেছিলাম।
![Sending GPS telemetry from an IoT device to IoT Hub](../../../../images/gps-telemetry-iot-hub.png)
### কাজ - GPS ডেটা IoT Hub এ প্রেরণ
1. নতুন একটি আইওটি হাব খুলতে হবে free tier এর ।
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন- থেকে আইওটি হাব তৈরীর নির্দেশাবলি অনুসরণ করা যাবে](../../../../2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md#create-an-iot-service-in-the-cloud) প্রয়োজনবোধে।
নতুন একটি Resource Group খোলার বিষয়টি মনে রাখতে হবে, যেটির নাম `gps-sensor` দেয়া যায় নতুন IoT Hub এর জন্য একটি ইউনিক নাম যেমন `gps-sensor-<your name>` দেয়া যেতে পারে।
> 💁 যদি পূর্ববর্তী প্রজেক্টে ব্যবহৃত আইওটি হাব থাকে, সেটিও পুনরায় ব্যবহার করা যাবে। এক্ষেত্রে আইওটি হাব এবং রিসোর্স গ্রুপের নাম সঠিকভাবে ব্যবহার করতে হবে সার্ভিস তৈরির সময়।
1. হাবে একটি নতুন ডিভাইস যোগ করি এবং `gps-sensor` নাম দিই। কানেকশন স্ট্রিং টি নোট রাখি
1. আগের ধাপ থেকে ডিভাইস সংযোগ স্ট্রিং ব্যবহার করে নতুন আইওটি হাব -এ জিপিএস ডেটা পাঠাতে ডিভাইস কোড আপডেট করতে হবে।
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন- থেকে আইওটি সার্ভিসের সাথে ডিভাইস সংযোজনের নির্দেশাবলি ](../../../../2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md#connect-your-device-to-the-iot-service) অনুসরণ করা যাবে।
1. যখন জিপিএস ডেটা প্রেরণ করব, তখন এটি নিম্নলিখিত বিন্যাসে JSON হিসাবে করতে হবে:
```json
{
"gps" :
{
"lat" : <latitude>,
"lon" : <longitude>
}
}
```
1. প্রতি মিনিটে জিপিএস ডেটা পাঠাতে হবে যাতে দৈনিক ম্যাসেজ ব্যবহার এর লিমিট শেষ না হয়।
আমরা যদি Wio টার্মিনাল ব্যবহার কর্রি, তাহলে সমস্ত প্রয়োজনীয় লাইব্রেরি যোগ করতে হবে এবং একটি NTP সার্ভার ব্যবহার করে সময় নির্ধারণ করার প্রয়োজন হবে। গত পাঠ থেকে বিদ্যমান কোড ব্যবহার করে , আমাদের কোডটি দ্বারা নিশ্চিত করতে হবে যে এটি জিপিএস লোকেশন পাঠানোর আগে সিরিয়াল পোর্ট থেকে সমস্ত ডেটা পড়েছে। JSON ডকুমেন্ট তৈরি করতে নিম্নলিখিত কোডটি ব্যবহার করি:
```cpp
DynamicJsonDocument doc(1024);
doc["gps"]["lat"] = gps.location.lat();
doc["gps"]["lon"] = gps.location.lng();
```
ভার্চুয়াল আইওটি ডিভাইস ব্যবহার করলে, এটির জন্য প্রয়োজনীয় সমস্ত লাইব্রেরি ইনস্টল করার বিষয়টি মনে রাখতে হবে।
রাস্পবেরি পাই এবং ভার্চুয়াল আইওটি উভয় ডিভাইসের জন্য, অক্ষাংশ এবং দ্রাঘিমাংশের মানগুলি পেতে গত পাঠ থেকে বিদ্যমান কোডটি ব্যবহার করে নিম্নলিখিত কোড সহ তাদের সঠিক JSON ফর্ম্যাটে পাঠাতে হবে:
```python
message_json = { "gps" : { "lat":lat, "lon":lon } }
print("Sending telemetry", message_json)
message = Message(json.dumps(message_json))
```
> 💁 প্রয়োজনীয় সকল কোড [code/wio-terminal](code/wio-terminal), [code/pi](code/pi) বা [code/virtual-device](code/virtual-device) ফোল্ডারে পাওয়া যাবে ।
Run your device code and ensure messages are flowing into IoT Hub using the `az iot hub monitor-events` CLI command.
ডিভাইস কোডটি রান করে নিশ্চিত করতে হবে যে বার্তাগুলি আইওটি হাবের মধ্যে প্রবাহিত হচ্ছে `az iot hub monitor-events` এর মাধ্যমে, সিএলআই কমান্ড ব্যবহার করে।
## Hot, Warm, এবং Cold Path
একটি IoT ডিভাইস থেকে ক্লাউডে প্রবাহিত ডেটা সবসময় রিয়েল টাইমে প্রসেস করা হয় না। কিছু ডেটা রিয়েল টাইম প্রক্রিয়াকরণের প্রয়োজন হয়, কিছু ডেটা অল্প কিছুক্ষণ পরে প্রক্রিয়া করা যায়, এবং অন্যান্য ডেটা অনেক পরে প্রক্রিয়া করলেও হয়। বিভিন্ন সময়ে ডেটা প্রক্রিয়া করে এমন বিভিন্ন পরিষেবাতে তথ্য প্রবাহকে Hot, Warm এবং Cold Path বলা হয়।
### Hot Path
হট পাথ (Hot Path) এমন ডেটা বোঝায় যা রিয়েল টাইমে বা রিয়েল টাইমের কাছাকাছি সময়েই প্রক্রিয়াকরণের প্রয়োজন হয়। এলার্ট দেয়ার জন্য যেমন - যে কোনও গাড়ি একটি ডিপোর কাছে আসছে অথবা একটি রেফ্রিজারেটেড ট্রাকের তাপমাত্রা খুব বেশি এমন পরিস্থিতির মোকাবেলা করতে সতর্কতার জন্য হট পাথ ডেটা ব্যবহার করা হয়।
হট পাথ ডেটা ব্যবহার করার জন্য, ক্লাউড পরিষেবাগুলি কোড পাওয়ার সাথে সাথে আমাদের ইভেন্টগুলিতে সাড়া দেবে।
### Warm path
উষ্ণ পথ (Warm path) বলতে এমন তথ্যকে বোঝায় যা প্রাপ্তির পরে অল্প কিছুক্ষণ সময় নিয়ে প্রক্রিয়া করা যায়, উদাহরণস্বরূপ রিপোর্টিং বা স্বল্পমেয়াদী বিশ্লেষণ। আগের দিনের সংগৃহীত ডেটা ব্যবহার করে গাড়ির মাইলেজের দৈনিক রিপোর্টের জন্য এই ধরণের পদ্ধতি ব্যবহার করা হয়।
ক্লাউড সার্ভিসের মাধ্যমে এই ডেটা এমনভাবে স্টোর করা হয় যাতে দ্রুত অ্যাক্সেস করা যায়।
### Cold path
ঠান্ডা পথ (Cold path) বলতে ঐতিহাসিক তথ্য বোঝায়, দীর্ঘমেয়াদে তথ্য সংরক্ষণ করে যখনই প্রয়োজন হয় তখন বিশ্লেষণ করা হবে। উদাহরণস্বরূপ, যানবাহনের বার্ষিক মাইলেজ রিপোর্ট পেতে ঠান্ডা পথ ব্যবহার করা যায় অথবা জ্বালানি খরচ কমানোর জন্য সবচেয়ে অনুকূল রুট খুঁজে বের করার জন্য রুট বিশ্লেষণ চালাতেও এটি ব্যবহার করা যায় ।
কোল্ড পাথ ডেটা সাধারণত data warehouse এ সংরক্ষিত হয় - ডেটাগুলির বড় পরিমাণে সংরক্ষণের জন্য ডিজাইন করা ডেটাবেস যা কখনও পরিবর্তন হবে না এবং দ্রুত এবং সহজেই কুয়েরি করা যাবে। সাধারণত ক্লাউড অ্যাপ্লিকেশনে নিয়মিতভাবে প্রতিদিন, সপ্তাহ বা মাসে একটি নিয়মিত সময়ে চলবে উষ্ণ পথের স্টোরেজ থেকে ওয়্যারহাউসে এই ডেটা স্থানান্তর করার কাজ।
✅ এই পাঠগুলিতে আমরা এখন পর্যন্ত যে ডেটা ক্যাপচার করেছি সে সম্পর্কে চিন্তা করি। এগুলো কি hot, warm নাকি cold path এর তথ্য?
## সার্ভারবিহীন কোড ব্যবহার করে জিপিএস ইভেন্টগুলি পরিচালনা
একবার আমাদের আইওটি হাবের মধ্যে ডেটা প্রবাহিত হয়ে গেলে, ইভেন্ট-হাব সামঞ্জস্যপূর্ণ এন্ডপয়েন্টে প্রকাশিত ইভেন্টগুলি শোনার জন্য কিছু সার্ভারলেস কোড লিখতে পারবো। এটি উষ্ণ পথে ডেটা সংরক্ষণ করা হবে এবং পরবর্তী পাঠে যাত্রার প্রতিবেদন তৈরী করার জন্য ব্যবহার করা হবে।
![Sending GPS telemetry from an IoT device to IoT Hub, then to Azure Functions via an event hub trigger](../../../../images/gps-telemetry-iot-hub-functions.png)
### কাজ - সার্ভারবিহীন কোড ব্যবহার করে জিপিএস ইভেন্টগুলি পরিচালনা
1. Azure Functions CLI ব্যবহার করে একটি Azure Functions অ্যাপ তৈরি করি। পাইথন রানটাইম ব্যবহার করি এবং এটি একটি ফোল্ডারে তৈরি করি যার নাম `gps-trigger` এবং ফাংশন অ্যাপ প্রজেক্টের নামের জন্য একই নাম ব্যবহার করতে হবে। Virtual environment তৈরীর বিষয়টি নিশ্চিত করতে হবে।
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন-৫ থেকে আইওটি সার্ভিসের সাথে সার্ভারলেস এপ্লিকেশন তৈরীর নির্দেশাবলি](../../../../2-farm/lessons/5-migrate-application-to-the-cloud/README.md#create-a-serverless-application) অনুসরণ করা যাবে।
1. Add an IoT Hub event trigger that uses the IoT Hub's Event Hub compatible endpoint.
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন-৫ থেকে আইওটি হাব ইভেন্ট ট্রিগার তৈরীর নির্দেশাবলি](../../../../2-farm/lessons/5-migrate-application-to-the-cloud/README.md#create-an-iot-hub-event-trigger) অনুসরণ করা যাবে।
1. ইভেন্ট হাব সামঞ্জস্যপূর্ণ এন্ডপয়েন্ট সংযোগ স্ট্রিং সেট করতে হবে `local.settings.json` ফাইলে এবং `function.json` ফাইলের জন্য সেই এন্ট্রির KEY ব্যবহার করতে হবে।
1. এক্ষেত্রে Azurite app ব্যবহার করতে হবে local storage emulator হিসেবে।
1. জিপিএস ডিভাইস থেকে ইভেন্ট গ্রহণ করছে কিনা তা নিশ্চিত করতে ফাংশন অ্যাপটি চালাতে হবে। এখান থেকেই নিশ্চিত করা যাবে যে আইওটি ডিভাইসটি চলছে এবং জিপিএস ডেটা পাঠাচ্ছে।
```output
Python EventHub trigger processed an event: {"gps": {"lat": 47.73481, "lon": -122.25701}}
```
## Azure স্টোরেজ অ্যাকাউন্ট
![The Azure Storage logo](../../../../images/azure-storage-logo.png)
Azure স্টোরেজ অ্যাকাউন্ট একটি সাধারণ উদ্দেশ্যে (General Purpose) ব্যবহৃত স্টোরেজ পরিষেবা যা বিভিন্ন উপায়ে ডেটা সংরক্ষণ করতে পারে। আমরা ব্লব হিসাবে, সারিতে, টেবিলে বা ফাইল হিসাবে ডেটা সংরক্ষণ করতে পারি।
### Blob storage
*ব্লব* মানে হলো বাইনারি বড় বস্তু (binary large objects) তবে যেকোন কাঠামোবিহীন ডেটার জন্য এই শব্দ ব্যবহৃত হয়। আইওটি ডেটা ধারণকারী JSON ডকুমেন্ট থেকে শুরু করে ইমেজ এবং মুভি ফাইলগুলিতেও ব্লব স্টোরেজে যেকোন ডেটা সংরক্ষণ করা যায়। ব্লব স্টোরেজে *কনটেইনার* এর ধারণা রয়েছে, এগুলো নামযুক্ত বাকেট/পাত্র যার মধ্যে ডেটা সংরক্ষণ করা যায়, একটি রিলেশনাল ডাটাবেজে টেবিলের মতো। এই পাত্রে ব্লব সংরক্ষণের জন্য এক বা একাধিক ফোল্ডার থাকতে পারে এবং প্রতিটি ফোল্ডারে অন্যান্য ফোল্ডার থাকতে পারে, যেভাবে কম্পিউটারের হার্ডডিস্কে ফাইল সংরক্ষণ করা হয়।
IoT ডেটা সংরক্ষণ করতে আমরা এই পাঠে ব্লব স্টোরেজ ব্যবহার করব।
✅ কিছু গবেষণা করা যাক:[Azure Blob Storage](https://docs.microsoft.com/azure/storage/blobs/storage-blobs-overview?WT.mc_id=academic-17441-jabenn) সম্পর্কে পড়ে আরো বিস্তারিত জানার চেষ্টা করি।
### Table storage
টেবিল স্টোরেজ আমাদের আধা কাঠামোগত ডেটা সংরক্ষণ করতে দেয়। টেবিল স্টোরেজ আসলে একটি NoSQL ডাটাবেস, তাই টেবিলের একটি সংজ্ঞায়িত সেট প্রয়োজন হয় না, কিন্তু এটি এক বা একাধিক টেবিলে ডেটা সংরক্ষণ করার জন্য ডিজাইন করা হয়েছে, প্রতিটি সারির সংজ্ঞা দিতে অনন্য কী (unique key) দিয়ে।
✅ কিছু গবেষণা করা যাক: [Azure Table Storage](https://docs.microsoft.com/azure/storage/tables/table-storage-overview?WT.mc_id=academic-17441-jabenn) সম্পর্কে পড়ে আরো বিস্তারিত জানার চেষ্টা করি।
### Queue storage
কিউ স্টোরেজ একটি সারিতে 64KB আকারের বার্তা সংরক্ষণ করতে দেয়। আমরা সারির পিছনের দিকে বার্তা যোগ করতে পা্রি এবং সেগুলি আবার সামনে থেকে পড়তে পারি। Queue এখানে বার্তাগুলিকে অনির্দিষ্টকালের জন্য সংরক্ষণ করে যতক্ষণ স্টোরেজ স্পেস রয়েছে, তাই এটি বার্তাগুলিকে দীর্ঘমেয়াদী সংরক্ষণ করতে দেয়। তারপর যখন প্রয়োজন হয় তা ব্যবহার করা যায়। উদাহরণস্বরূপ, যদি জিপিএস ডেটা প্রসেস করার জন্য একটি মাসিক কাজ চালাতে হয়, তাহলে প্রতিদিন এটিকে এক মাসের জন্য সারিতে যোগ করতে পারবো, তারপর মাসের শেষে সারির সব বার্তা একসাথে প্রক্রিয়া করতে পারবো।
✅ কিছু গবেষণা করা যাক: [Azure Queue Storage](https://docs.microsoft.com/azure/storage/queues/storage-queues-introduction?WT.mc_id=academic-17441-jabenn) সম্পর্কে পড়ে আরো বিস্তারিত জানার চেষ্টা করি।
### File storage
ফাইল স্টোরেজ হল ক্লাউডে ফাইলের স্টোরেজ এবং যে কোনও অ্যাপ বা ডিভাইস স্বীকৃত স্ট্যান্ডার্ড প্রোটোকল ব্যবহার করে সংযোগ করতে পারে। আমরা ফাইল স্টোরেজে আমাদের তথ্য রাখতে পারি, তারপরে পিসি বা ম্যাকের ড্রাইভ হিসাবে মাউন্ট করা যায়।
✅ কিছু গবেষণা করা যাক: [Azure File Storage](https://docs.microsoft.com/azure/storage/files/storage-files-introduction?WT.mc_id=academic-17441-jabenn) সম্পর্কে পড়ে আরো বিস্তারিত জানার চেষ্টা করি।
## সার্ভারবিহীন কোডকে স্টোরেজে সংযুক্তকরণ
আইওটি হাব থেকে বার্তাগুলি সঞ্চয় করতে আমাদের ফাংশন অ্যাপটিকে এখন ব্লব স্টোরেজের সাথে সংযুক্ত করতে হবে। এটি করার 2 টি উপায় রয়েছে:
* ফাংশন কোডের ভিতরে, আমাদের ব্লব স্টোরেজ Python SDK ব্যবহার করে ব্লব স্টোরেজে সংযোগ করতে হবে এবং ডেটা ব্লব হিসাবে রাখতে হবে।
* আমাদের একটি আউটপুট ফাংশন বাইন্ডিং ব্যবহার করতে হবে ফাংশনের রিটার্ন ভ্যালু ব্লোব স্টোরেজে বাইন্ড করতে এবং এক্ষেত্রে ব্লবটি স্বয়ংক্রিয়ভাবে সংরক্ষণ করতে হবে।
এই পাঠে, আমরা ব্লব স্টোরেজের সাথে কীভাবে যোগাযোগ করতে হয় তা দেখতে Python SDK ব্যবহার করব।
![Sending GPS telemetry from an IoT device to IoT Hub, then to Azure Functions via an event hub trigger, then saving it to blob storage](../../../../images/save-telemetry-to-storage-from-functions.png)
নিম্নলিখিত ফরম্যাটে ডেটা একটি JSON ব্লব হিসাবে সংরক্ষণ করা হবে:
```json
{
"device_id": <device_id>,
"timestamp" : <time>,
"gps" :
{
"lat" : <latitude>,
"lon" : <longitude>
}
}
```
### কাজ - সার্ভারবিহীন কোডকে স্টোরেজে সংযুক্তকরণ
1. একটি Azure স্টোরেজ অ্যাকাউন্ট তৈরি করে এমন একটি নাম দিই `gps<your name>`.
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন-৫ থেকে স্টোরেজ একাউন্ট তৈরীর নির্দেশাবলি](../../../../2-farm/lessons/5-migrate-application-to-the-cloud/README.md#task---create-the-cloud-resources) অনুসরণ করা যাবে।
যদি এখনও পূর্ববর্তী প্রজেক্টে্র স্টোরেজ অ্যাকাউন্ট থাকে,এটি পুনরায় ব্যবহার করা যাবে।
> 💁 এই পাঠে আমরা আমাদের Azure Functions অ্যাপটি স্থাপন করতে একই স্টোরেজ অ্যাকাউন্ট ব্যবহার করতে পারব।
1. স্টোরেজ অ্যাকাউন্টের জন্য সংযোগ স্ট্রিং পেতে নিম্নলিখিত কমান্ডটি চালাই:
```sh
az storage account show-connection-string --output table \
--name <storage_name>
```
এক্ষেত্রে `<storage_name>` এর পরিবর্তে আগের ধাপে আমাদের ব্যবহৃত স্টোরেজ এর নামটি বসাতে হবে।
1. `local.settings.json` ফাইলে স্টোরেজ একাউন্টের কানেকশন জন্য নতুন এন্ট্রি দিতে হবে, আগের ধাপের ভ্যালু ব্যবহার করে। এটির নাম দিই `STORAGE_CONNECTION_STRING`
1. এরপর `requirements.txt` এ স্টোরেজ পিপ প্যাকেজ ইন্সটল করার জন্য নিম্নের অংশ যোগ করি
```sh
azure-storage-blob
```
ভার্চুয়াল এনভায়রনমেন্টে এই ফাইল থেকে প্যাকেজ ইনস্টল করতে হবে।
> যদি কোন এরর থাকে, তাহলে আমাদের আমাদের ভার্চুয়াল পরিবেশে আমাদের পিপ সংস্করণটি নিম্নোক্ত কমান্ড দিয়ে সর্বশেষ সংস্করণে আপগ্রেড করা উচিত, তারপর আবার চেষ্টা করতে হবে:
>
> ```sh
> pip install --upgrade pip
> ```
1. এখানে `__init__.py` ফাইলে `iot-hub-trigger` এ নিম্নের ইম্পোর্ট স্টেটমেন্ট দিতে হবেঃ
```python
import json
import os
import uuid
from azure.storage.blob import BlobServiceClient, PublicAccess
```
JSON পড়তে এবং লিখতে `json` সিস্টেম মডিউল ব্যবহার করা হবে,`os` সিস্টেম মডিউলটি সংযোগ স্ট্রিং পড়ার জন্য ব্যবহার করা হবে, `uuid` সিস্টেম মডিউলটি GPS পড়ার জন্য একটি অনন্য আইডি তৈরি করতে ব্যবহৃত হবে।
আর `azure.storage.blob` প্যাকেজটিতে Python SDK রয়েছে blob storage এর সাথে কাজ করার জন্য।
1. এখন `main` মেথডের আগেই,নিম্নলিখিত হে্লপার ফাংশন যোগ করি:
```python
def get_or_create_container(name):
connection_str = os.environ['STORAGE_CONNECTION_STRING']
blob_service_client = BlobServiceClient.from_connection_string(connection_str)
for container in blob_service_client.list_containers():
if container.name == name:
return blob_service_client.get_container_client(container.name)
return blob_service_client.create_container(name, public_access=PublicAccess.Container)
```
পাইথন ব্লব এসডিকে তে যদি কোন কন্টেইনার না থাকে তবে একটি কন্টেইনার তৈরি করার জন্য কোন সহায়ক পদ্ধতি নেই। এই কোডটি `local.settings.json` ফাইল থেকে সংযোগ স্ট্রিং লোড করবে (অথবা অ্যাপ্লিকেশন সেটিংস যা ক্লাউডে রয়েছে তা থেকে ), তারপর ব্লব স্টোরেজ অ্যাকাউন্টের সাথে ইন্টারঅ্যাক্ট করার জন্য এটি থেকে একটি` BlobServiceClient` ক্লাস তৈরি করতে হবে। এটি ব্লব স্টোরেজ অ্যাকাউন্টের জন্য সমস্ত পাত্রে লুপ করে, প্রদত্ত নামের সাথে মিলিয়ে সন্ধান করে - যদি এটি একটি খুঁজে পায় তবে এটি একটি 'কনটেইনার ক্লায়েন্ট' ক্লাস ফিরিয়ে দেবে যা ব্লব তৈরি করতে কন্টেইনারের সাথে যোগাযোগ করতে পারে। যদি এটি খুঁজে না পায়, তাহলে কন্টেইনার তৈরি করা হয় এবং নতুন পাত্রে ক্লায়েন্ট রিটার্ন করা হয়।
যখন নতুন কন্টেইনার তৈরি করা হয়, তখন এতে থাকা ব্লবগুলি কুয়েরি করার জন্য সর্বজনীন অ্যাক্সেস দেওয়া হয়। এটি একটি মানচিত্রে জিপিএস ডেটা প্রদর্শন করার জন্য পরবর্তী পাঠে ব্যবহার করা হবে।
1. এই কোডের সাহায্যে আমরা প্রতিটি ইভেন্ট সংরক্ষণ করতে চাই (যা মাটির আর্দ্রতা সংরক্ষণের মত নয়), তাই লগিং স্টেটমেন্টের নীচে `মেইন` ফাংশনে `for event in events:` ল্যুপে নিম্নের কোড যোগ করি:
```python
device_id = event.iothub_metadata['connection-device-id']
blob_name = f'{device_id}/{str(uuid.uuid1())}.json'
```
এই কোডটি ইভেন্ট মেটাডেটা থেকে ডিভাইস আইডি পায়, তারপর এটি একটি ব্লব নাম তৈরি করতে ব্যবহার করে। ব্লবগুলি ফোল্ডারে সংরক্ষণ করা যেতে পারে এবং ফোল্ডারের নামের জন্য ডিভাইস আইডি ব্যবহার করা হবে, তাই প্রতিটি ডিভাইসে তার সমস্ত জিপিএস ইভেন্ট একটি ফোল্ডারে থাকবে। ব্লব নামটি এই ফোল্ডার, এর পরে একটি ডকুমেন্টের নাম, ফরওয়ার্ড স্ল্যাশ দিয়ে আলাদা, লিনাক্স এবং ম্যাকওএস পাথের মতো (উইন্ডোজের মতোই, তবে উইন্ডোজ ব্যাক স্ল্যাশ ব্যবহার করে)। ডকুমেন্টের নাম হল একটি ইউনিক আইডি যা পাইথন `uuid` মডিউল ব্যবহার করে তৈরি করা হয়, যার ফাইল টাইপ `json` থাকে।
যেমন, `gps-sensor` ডিভাইস ID এর জন্য, ব্লবের নাম হতে পারে`gps-sensor/a9487ac2-b9cf-11eb-b5cd-1e00621e3648.json` ।
1. এরপর নীচের কোড যোগ করি:
```python
container_client = get_or_create_container('gps-data')
blob = container_client.get_blob_client(blob_name)
```
এরপর `get_or_create_container` হেল্পার ক্লাস ব্যবহার করে, এই কোডটি কন্টেইনার ক্লায়েন্ট পায় এরপর blob name ব্যবহার করে ব্লব ক্লায়েন্ট অবজেক্ট পায়। এই ব্লব ক্লায়েন্টগুলো বিদ্যমান ব্লব, অথবা এই ক্ষেত্রে, নতুন ব্লবকে রেফার করতে পারে।
1. তারপর নীচের কোড যোগ করি:
```python
event_body = json.loads(event.get_body().decode('utf-8'))
blob_body = {
'device_id' : device_id,
'timestamp' : event.iothub_metadata['enqueuedtime'],
'gps': event_body['gps']
}
```
এটি ব্লবের বডি তৈরি করে যাতে ব্লব স্টোরেজে লেখা হবে। এটি একটি JSON ডকুমেন্ট যা ডিভাইসের আইডি, টেলিমেট্রি আইওটি হাব -এ পাঠানোর সময় এবং জিপিএস টেলিমেট্রি থেকে সমন্বয় করে।
> 💁 বার্তা প্রেরণ এর সময় জানার জন্য বর্তমান সময় ব্যবহার না করে বরং এই ম্যাসেজগুলোর enqueued time বিবেচনায় নেয়া গুরুত্বপূর্ণ। ফাংশন অ্যাপ চালু না থাকলে এটি গৃহিত হওয়ার আগে কিছুক্ষণের জন্য আইওটি হাবে থাকতে পারে।
1. এবার নীচের কোড যোগ করি:
```python
logging.info(f'Writing blob to {blob_name} - {blob_body}')
blob.upload_blob(json.dumps(blob_body).encode('utf-8'))
```
এই কোডটি লগ করে যে একটি ব্লব তার বিশদ বিবরণ সহ তৈরী হতে চলেছে, তারপর নতুন ব্লবের বিষয়বস্তু হিসাবে ব্লব বডি আপলোড করে।
1. এখন ফাংশন অ্যাপ রান করি। আউটপুটে সমস্ত জিপিএস ইভেন্টের জন্য ব্লব লেখা দেখা যাবে:
```output
[2021-05-21T01:31:14.325Z] Python EventHub trigger processed an event: {"gps": {"lat": 47.73092, "lon": -122.26206}}
...
[2021-05-21T01:31:14.351Z] Writing blob to gps-sensor/4b6089fe-ba8d-11eb-bc7b-1e00621e3648.json - {'device_id': 'gps-sensor', 'timestamp': '2021-05-21T00:57:53.878Z', 'gps': {'lat': 47.73092, 'lon': -122.26206}}
```
> 💁 সতর্ক থাকতে হবে যে আমরা একই সময়ে IoT Hub ইভেন্ট মনিটরটি চালাচ্ছি না।
> 💁 সকল কোড [code/functions](code/functions) ফোল্ডারে রয়েছে।
### কাজ - আপলোড করা ব্লব যাচাইকরণ
1. তৈরি ব্লবগুলি দেখতে, আমরা [Azure Storage Explorer](https://azure.microsoft.com/features/storage-explorer/?WT.mc_id=academic-17441-jabenn),একটি ফ্রি টুল যা স্টোরেজ অ্যাকাউন্টগুলি দেখতে এবং পরিচালনা করতে দেয় তা ব্যবহার করতে পারি অথবা সরাসরি CLI থেকেও কাজ করা যায়।
1. CLI ব্যবহার করার জন্য প্রথমে একটি অ্যাকাউন্ট কী (KEY) প্রয়োজন হবে। এই কী পেতে নিম্নলিখিত কমান্ডটি চালাই:
```sh
az storage account keys list --output table \
--account-name <storage_name>
```
`<storage_name>` এর স্থলে আমাদের ব্যবহৃত স্টোরেজের নামটিই দিতে হবে।
`key1` এর ভ্যালু কপি করে রাখি।
1. কন্টেইনারে ব্লবগুলি তালিকাভুক্ত করতে নিম্নলিখিত কমান্ডটি চালাইঃ
```sh
az storage blob list --container-name gps-data \
--output table \
--account-name <storage_name> \
--account-key <key1>
```
`<storage_name>` এর স্থলে আমাদের ব্যবহৃত স্টোরেজের নামটিই দিতে হবে এবং `<key1>` এর জায়গায় আগের ধাপে কপি করা মানটি বসাতে হবে।
এটি সমস্ত ব্লবগুলি তালিকাভুক্ত করবে:
```output
Name Blob Type Blob Tier Length Content Type Last Modified Snapshot
---------------------------------------------------- ----------- ----------- -------- ------------------------ ------------------------- ----------
gps-sensor/1810d55e-b9cf-11eb-9f5b-1e00621e3648.json BlockBlob Hot 45 application/octet-stream 2021-05-21T00:54:27+00:00
gps-sensor/18293e46-b9cf-11eb-9f5b-1e00621e3648.json BlockBlob Hot 45 application/octet-stream 2021-05-21T00:54:28+00:00
gps-sensor/1844549c-b9cf-11eb-9f5b-1e00621e3648.json BlockBlob Hot 45 application/octet-stream 2021-05-21T00:54:28+00:00
gps-sensor/1894d714-b9cf-11eb-9f5b-1e00621e3648.json BlockBlob Hot 45 application/octet-stream 2021-05-21T00:54:28+00:00
```
1. নিম্নলিখিত কমান্ড ব্যবহার করে একটি ব্লব ডাউনলোড করি:
```sh
az storage blob download --container-name gps-data \
--account-name <storage_name> \
--account-key <key1> \
--name <blob_name> \
--file <file_name>
```
`<storage_name>` এর স্থলে আমাদের ব্যবহৃত স্টোরেজের নামটিই দিতে হবে এবং `<key1>` এর জায়গায় আগের ধাপে কপি করা মানটি বসাতে হবে।
আর `<blob_name>` এর পরিবর্তে কাজের পূর্ববর্তী ধাপের `Name` কলামের আউটপুটটি বসাই ফোল্ডারের নাম সহ। এক্ষেত্রে ব্লব সংরক্ষণ করতে `<file_name>` এর জায়গায় একটি লোকাল ফাইলের জন্য নাম দিই।
একবার ডাউনলোড হয়ে গেলে, আমরা VS কোডে JSON ফাইলটি খুলতে পারব এবং আমরা জিপিএস অবস্থানের বিবরণ সহ ব্লব দেখতে পাব:
```json
{"device_id": "gps-sensor", "timestamp": "2021-05-21T00:57:53.878Z", "gps": {"lat": 47.73092, "lon": -122.26206}}
```
### কাজ - ক্লাউডে ফাংশন এপ ডেপ্লয় করা
এখন যেহেতু ফাংশন অ্যাপটি কাজ করছে, আমরা এটিকে ক্লাউডে ডেপ্লয় করতে পারি।
1. আগে তৈরি করা স্টোরেজ অ্যাকাউন্ট ব্যবহার করে নতুন Azure ফাংশন অ্যাপ তৈরি করা যাক। এটির নাম দিই `gps-sensor-` এবং এর শেষে কোন ইউনিক নাম বা সংখ্যা যোগ করে দিই।
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন-৫ থেকে ফাংশন ডেপ্লয় করার নির্দেশাবলি](../../../../2-farm/lessons/5-migrate-application-to-the-cloud/README.md#task---create-the-cloud-resources) অনুসরণ করা যাবে।
1. `IOT_HUB_CONNECTION_STRING` এবং `STORAGE_CONNECTION_STRING` ভ্যালুগুলো এপ্লিকেশন সেটিংস এ আপলোড করি।
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন-৫ থেকে এপ্লিকেশন সেটিংস আপলোড করার নির্দেশাবলি](../../../../2-farm/lessons/5-migrate-application-to-the-cloud/README.md#task---upload-your-application-settings) অনুসরণ করা যাবে।
1. ্লোকাল ফাংশন এপ কে ক্লাউডে ডেপ্লয় করি।
> ⚠️ এক্ষেত্রে [প্রজেক্ট-২ লেসন-৫ থেকে ফাংশন এপ কে ক্লাউডে ডেপ্লয় করার নির্দেশাবলি](../../../../2-farm/lessons/5-migrate-application-to-the-cloud/README.md#task---deploy-your-functions-app-to-the-cloud) অনুসরণ করা যাবে।
---
## 🚀 চ্যালেঞ্জ
জিপিএস ডেটা পুরোপুরি সঠিক নয়, এবং সনাক্ত করা অবস্থানগুলি কয়েক মিটার পর্যন্ত ভুল হতে পারে, আর টানেল এবং লম্বা ভবনের এলাকায় তা আরো বেশি হয়ে থাকে।
স্যাটেলাইট নেভিগেশন কীভাবে এটি কাটিয়ে উঠতে পারে সে সম্পর্কে চিন্তা করি। আমাদের sat-nav এর কোন ডেটা আছে যা এটি আমাদেরকে অবস্থানে্র ব্যাপারে আরও ভাল ভবিষ্যদ্বাণী করতে দেয়?
## লেকচার-পরবর্তী কুইজ
[লেকচার-পরবর্তী কুইজ](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/24)
## রিভিউ এবং স্ব-অধ্যয়ন
* কাঠামোগত ডেটা এর ব্যাপারে [Data model - Wikipedia](https://wikipedia.org/wiki/Data_model) থেকে পড়তে পারি।
* Semi-structured ডেটা এর ব্যাপারে [Semi-structured data - Wikipedia](https://wikipedia.org/wiki/Semi-structured_data) থেকে পড়তে পারি।
* কাঠামোবিহীন ডেটা এর ব্যাপারে [Unstructured data - Wikipedia](https://wikipedia.org/wiki/Unstructured_data) থেকে পড়তে পারি।
* Azure Storage এবং বিভিন্ন ধরণের স্টোরেজ সম্পর্কে [Azure Storage documentation](https://docs.microsoft.com/azure/storage/?WT.mc_id=academic-17441-jabenn) থেকে পড়তে পারি।
## এসাইনমেন্ট
[ফাংশন বাইন্ডিং পর্যালোচনা](assignment.bn.md)

@ -0,0 +1,19 @@
# ফাংশন বাইন্ডিং পর্যালোচনা
## নির্দেশাবলী
ফাংশন বাইন্ডিংগুলি মূলত আমাদের কোডগুলিকে `main` ফাংশন থেকে রিটার্ন করে ব্লব স্টোরেজে সংরক্ষণ করার সুযোগ দেয়। Azure স্টোরেজ অ্যাকাউন্ট এবং অন্যান্য বিবরণ `function.json` ফাইলে কনফিগার করা আছে।
Azure বা অন্যান্য Microsoft প্রযুক্তির সাথে কাজ করার সময়, তথ্যের সর্বোত্তম উৎস হল [docs.com এ Microsoft ডকুমেন্টেশনগুলো](https://docs.microsoft.com/?WT.mc_id=academic-17441-jabenn) । এই অ্যাসাইনমেন্টে আমাদেরকে আউটপুট বাইন্ডিং কিভাবে সেটআপ করতে হবে তা জানতে Azure Functions বাইন্ডিং ডকুমেন্টেশন পড়তে হবে।
কাজের আগে কিছু রিসোর্স দেখে নেয়া যেতে পারেঃ
* [Azure Functions triggers and bindings concepts](https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings?tabs=python&WT.mc_id=academic-17441-jabenn)
* [Azure Blob storage bindings for Azure Functions overview](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob?WT.mc_id=academic-17441-jabenn)
* [Azure Blob storage output binding for Azure Functions](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob-output?tabs=python&WT.mc_id=academic-17441-jabenn)
## এসাইনমেন্ট মূল্যায়ন মানদন্ড
| ক্রাইটেরিয়া | দৃষ্টান্তমূলক (সর্বোত্তম) | পর্যাপ্ত (মাঝারি) | উন্নতি প্রয়োজন (নিম্নমান) |
| --------- | ------------------ | -------------- | -------------------- |
| ব্লব স্টোরেজ আউটপুট বাইন্ডিং কনফিগার করা | আউটপুট বাইন্ডিং কনফিগার করতে সক্ষম হয়েছিল, যেখানে ব্লবটি রিটার্ন এবং সফলভাবে ব্লব স্টোরেজে সংরক্ষণ হয়েছিলো | আউটপুট বাইন্ডিং কনফিগার করতে বা ব্লবটি রিটার্ন করতে সক্ষম হয়েছিল কিন্তু ব্লব স্টোরেজে সংরক্ষণ করতে পারেনি| আউটপুট বাইন্ডিং কনফিগার করতে ব্যার্থ |

@ -88,11 +88,11 @@ Working with maps is an interesting exercise, and there are many to choose from
Azure Maps is "a collection of geospatial services and SDKs that use fresh mapping data to provide geographic context to web and mobile applications." Developers are provided with tools to create beautiful, interactive maps that can do things like provide recommended traffic routes, give information about traffic incidents, indoor navigation, search capabilities, elevation information, weather services and more. Azure Maps is "a collection of geospatial services and SDKs that use fresh mapping data to provide geographic context to web and mobile applications." Developers are provided with tools to create beautiful, interactive maps that can do things like provide recommended traffic routes, give information about traffic incidents, indoor navigation, search capabilities, elevation information, weather services and more.
✅ Experiment with some [mapping code samples](https://docs.microsoft.com/samples/browse/?products=azure-maps&WT.mc_id=academic-17441-jabenn) ✅ Experiment with some [mapping code samples](https://docs.microsoft.com/samples/browse?WT.mc_id=academic-17441-jabenn&products=azure-maps)
You can display the maps as a blank canvas, tiles, satellite images, satellite images with roads superimposed, various types of grayscale maps, maps with shaded relief to show elevation, night view maps, and a high contrast map. You can get real-time updates on your maps by integrating them with [Azure Event Grid](https://azure.microsoft.com/services/event-grid/?WT.mc_id=academic-17441-jabenn). You can control the behavior and look of your maps by enabling various controls to allow the map to react to events like pinch, drag, and click. To control the look of your map, you can add layers that include bubbles, lines, polygons, heat maps, and more. Which style of map you implement depends on your choice of SDK. You can display the maps as a blank canvas, tiles, satellite images, satellite images with roads superimposed, various types of grayscale maps, maps with shaded relief to show elevation, night view maps, and a high contrast map. You can get real-time updates on your maps by integrating them with [Azure Event Grid](https://azure.microsoft.com/services/event-grid/?WT.mc_id=academic-17441-jabenn). You can control the behavior and look of your maps by enabling various controls to allow the map to react to events like pinch, drag, and click. To control the look of your map, you can add layers that include bubbles, lines, polygons, heat maps, and more. Which style of map you implement depends on your choice of SDK.
You can access Azure Maps APIs by leveraging its [REST API](https://docs.microsoft.com/javascript/api/azure-maps-rest/?view=azure-maps-typescript-latest&WT.mc_id=academic-17441-jabenn), its [Web SDK](https://docs.microsoft.com/azure/azure-maps/how-to-use-map-control?WT.mc_id=academic-17441-jabenn), or, if you are building a mobile app, its [Android SDK](https://docs.microsoft.com/azure/azure-maps/how-to-use-android-map-control-library?pivots=programming-language-java-android&WT.mc_id=academic-17441-jabenn). You can access Azure Maps APIs by leveraging its [REST API](https://docs.microsoft.com/javascript/api/azure-maps-rest/?WT.mc_id=academic-17441-jabenn&view=azure-maps-typescript-latest), its [Web SDK](https://docs.microsoft.com/azure/azure-maps/how-to-use-map-control?WT.mc_id=academic-17441-jabenn), or, if you are building a mobile app, its [Android SDK](https://docs.microsoft.com/azure/azure-maps/how-to-use-android-map-control-library?WT.mc_id=academic-17441-jabenn&pivots=programming-language-java-android).
In this lesson, you will use the web SDK to draw a map and display your sensor's GPS location's path. In this lesson, you will use the web SDK to draw a map and display your sensor's GPS location's path.

@ -1,9 +0,0 @@
# Dummy File
This file acts as a placeholder for the `translations` folder. <br>
**Please remove this file after adding the first translation**
For the instructions, follow the directives in the [translations guide](https://github.com/microsoft/IoT-For-Beginners/blob/main/TRANSLATIONS.md) .
## THANK YOU
We truly appreciate your efforts!

@ -0,0 +1,340 @@
# লোকেশন ডেটা প্রদর্শন
![A sketchnote overview of this lesson](../../../../sketchnotes/lesson-13.jpg)
> স্কেচনোটটি তৈরী করেছেন [Nitya Narasimhan](https://github.com/nitya)। বড় সংস্করণে দেখার জন্য ছবিটিতে ক্লিক করতে হবে।
## লেকচার-পূর্ববর্তী কুইজ
[লেকচার-পূর্ববর্তী কুইজ](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/25)
## সূচনা
গত পাঠে আমরা শিখেছি কিভাবে সার্ভারবিহীন কোড ব্যবহার করে স্টোরেজ কন্টেইনারে ক্লাউডে সংরক্ষণ করতে আমাদেরকে সেন্সর থেকে জিপিএস ডেটা পেতে হয়। এখন আমরা দেখবো কিভাবে একটি Azure ম্যাপে সেই পয়েন্টগুলি দেখানো যায়। আমরা একটি ওয়েব পেজে একটি মানচিত্র তৈরি করতে শিখব, GeoJSON ডেটা ফরম্যাট এবং আমাদেরকে ম্যাপে ক্যাপচার করা সমস্ত জিপিএস পয়েন্ট প্লট করার জন্য এটি কীভাবে ব্যবহার করতে হবে তা শিখব।
এই লেসনে আমরা দেখবোঃ
* [ডেটা ভিস্যুয়ালাইজেশন কী ?](#ডেটা-ভিস্যুয়ালাইজেশন-কী)
* [ম্যাপ সার্ভিস](#ম্যাপ-সার্ভিস)
* [Azure Maps রিসোর্স তৈরী করা](#Azure-Maps-রিসোর্স-তৈরী-করা)
* [ওয়েব পেইজে ম্যাপ প্রদর্শন](#ওয়েব-পেইজে-ম্যাপ-প্রদর্শন)
* [GeoJSON ফরম্যাট](#geojson-ফরম্যাট)
* [GeoJSON দ্বারা ম্যাপে জিপিএস ডেটা প্লট করা](#GeoJSON-দ্বারা-ম্যাপে-জিপিএস-ডেটা-প্লট-করা)
> 💁 এই লেসনে HTML এবং JavaScript এর ব্যবহার থাকবে। এই ল্যাংগুয়েজগুলো ব্যবহার করে ওয়েব ডেভলাপমেন্ট বিষয়ে আরো জানতে চাইলে [Web development for beginners](https://github.com/microsoft/Web-Dev-For-Beginners) কারিক্যুলাম দেখতে পারি।
## ডেটা ভিস্যুয়ালাইজেশন কী
ডেটা দৃশ্যায়ন বা ভিস্যুয়ালাইজেশন, নাম থেকেই বোঝা যায়, ডেটা ভিজুয়ালাইজ বা প্রদর্শন করা হয় এমন উপায়ে যা মানুষের পক্ষে বোঝা সহজ হয়। এটি সাধারণত চার্ট এবং গ্রাফের সাথে যুক্ত থাকে, মানুষকে কেবল তথ্য উপাত্তকে আরও ভালভাবে বুঝতে সাহায্য করার পাশাপাশি, তাদের প্রয়োজনীয় সিদ্ধান্ত নিতেও সাহায্য করে।
একটি সহজ উদাহরণ নিই- শুরুর দিকের একটি প্রজেক্টে আমরা মাটির আর্দ্রতা সংগ্রহ করেছি । ১লা জুন ২০২১ -এর জন্য প্রতি ঘণ্টায় মাটির আর্দ্রতার তথ্যের একটি টেবিল নিম্নরূপ :
| সময় | মান |
| ---------------- | ------: |
| 01/06/2021 00:00 | 257 |
| 01/06/2021 01:00 | 268 |
| 01/06/2021 02:00 | 295 |
| 01/06/2021 03:00 | 305 |
| 01/06/2021 04:00 | 325 |
| 01/06/2021 05:00 | 359 |
| 01/06/2021 06:00 | 398 |
| 01/06/2021 07:00 | 410 |
| 01/06/2021 08:00 | 429 |
| 01/06/2021 09:00 | 451 |
| 01/06/2021 10:00 | 460 |
| 01/06/2021 11:00 | 452 |
| 01/06/2021 12:00 | 420 |
| 01/06/2021 13:00 | 408 |
| 01/06/2021 14:00 | 431 |
| 01/06/2021 15:00 | 462 |
| 01/06/2021 16:00 | 432 |
| 01/06/2021 17:00 | 402 |
| 01/06/2021 18:00 | 387 |
| 01/06/2021 19:00 | 360 |
| 01/06/2021 20:00 | 358 |
| 01/06/2021 21:00 | 354 |
| 01/06/2021 22:00 | 356 |
| 01/06/2021 23:00 | 362 |
একজন সাধারণ মানুষ হিসাবে, এই ডেটা বোঝা কঠিন হতে পারে। এটি কোন অর্থ ছাড়া সংখ্যার একটি প্রাচীর মাত্র। এই ডেটা ভিজ্যুয়ালাইজ করার প্রথম পদক্ষেপ হিসাবে, এটি একটি লাইন চার্টে প্লট করা যেতে পারে:
![A line chart of the above data](../../../../images/chart-soil-moisture.png)
এই লাইন চার্টটি আরো উন্নত করা যেতে পারে যদি আমরা মাটির আর্দ্রতার মান 450 হলে, স্বয়ংক্রিয় জল ব্যবস্থা চালু করা হয়েছিল এটি বোঝাতে একটি লাইন টেনে দিই।
![A line chart of soil moisture with a line at 450](../../../../images/chart-soil-moisture-relay.png)
এই চার্টটি খুব তাড়াতাড়ি দেখায় যে মাটির আর্দ্রতার মাত্রা কত ছিল এবং ঠিক কোন পয়েন্ট থেকে সেচ ব্যবস্থা চালু হয়েছিল।
ডেটা ভিজ্যুয়ালাইজ করার জন্য চার্টই একমাত্র হাতিয়ার নয়। আইওটি ডিভাইসগুলি যেগুলি আবহাওয়া ট্র্যাক করে সেগুলিতে ওয়েব অ্যাপস বা মোবাইল অ্যাপ থাকতে পারে যা বিভিন্ন প্রতীক ব্যবহার করে আবহাওয়ার অবস্থা যেমন মেঘলা দিনের জন্য মেঘের প্রতীক, বৃষ্টির দিনের জন্য বৃষ্টির চিহ্ন ইত্যাদি। ডেটা ভিজ্যুয়ালাইজ করার অনেক উপায় আছে, কিছু বেশ সিরিয়াস, আবার কিছু অনেক মজার।
✅ আমরা ডেটা ভিজ্যুয়ালাইজেশনের যেসব উপায় ইতোমধ্যে দেখেছি, সে সম্পর্কে চিন্তা করি। কোন পদ্ধতিগুলি সবচেয়ে পরিষ্কার এবং দ্রুততম সিদ্ধান্ত নেওয়ার সুযোগ দেয় ?
ভালো ভিজ্যুয়ালাইজেশনগুলি মানুষকে দ্রুত সিদ্ধান্ত নিতে সহায়তা করে। উদাহরণস্বরূপ, শিল্প যন্ত্রপাতি থেকে সব ধরনের রিডিং স্ক্রিনে দেখানো হলে, এগুলো বিশ্লেষণ করা কঠিন। কিন্তু যদি আমরা যেকোন সমস্যাজনক পরিস্থিতিতে একটি লাল বাতি জ্বালাই, তাহলে একজন মানুষ সহজে সিদ্ধান্ত নিতে পারে।
জিপিএস ডেটা নিয়ে কাজ করার সময় সবচেয়ে স্পষ্ট দৃশ্যায়ন হলো একটি মানচিত্রে ডেটা প্লট করা। উদাহরণস্বরূপ ডেলিভারি ট্রাক এর অবস্থাম দেখানো একটি মানচিত্র, একটি কারখানার শ্রমিকদের ট্রাক কখন আসবে তা দেখতে সাহায্য করতে পারে। যদি এই মানচিত্রটি তাদের বর্তমান অবস্থানে ট্রাকের শুধু ছবি দেখানোর পাশাপাশি ট্রাকের অন্যান্য তথ্য সম্পর্কে ধারণা দেয়, তাহলে প্লান্টের শ্রমিকরা সেই অনুযায়ী পরিকল্পনা করতে পারে। যদি তারা তাদের কারখানার কাছাকাছি একটি রেফ্রিজারেটেড ট্রাক দেখতে পায় তবে তারা দ্রুত প্রস্তুতি নিতে পারে।
## ম্যাপ সার্ভিস
মানচিত্র নিয়ে কাজ করা বেশ চিত্তাকর্ষক একটি কাজ। ম্যাপের জন্য অনেকগুলো সার্ভিস যেমন Bing মানচিত্র, লিফলেট, ওপেন স্ট্রিট মানচিত্র এবং গুগল মানচিত্র থেকে বেছে নেওয়া যায়। এই লেসনে আমরা [Azure Maps](https://azure.microsoft.com/services/azure-maps/?WT.mc_id=academic-17441-jabenn) নিয়ে আরো বিস্তারিত জানবো এবং কীভাবে ডেটা প্লট করা হবে তা শিখবো
![The Azure Maps logo](../../../../images/azure-maps-logo.png)
Azure ম্যাপ হলো ভূ-স্থানিক পরিষেবা এবং SDK- এর একটি সংগ্রহ যা ওয়েব এবং মোবাইল অ্যাপ্লিকেশনগুলিকে ভৌগলিক প্রেক্ষাপট সরবরাহ করতে নতুন ম্যাপিং ডেটা ব্যবহার করে। ডেভেলপারদের সুন্দর, ইন্টারেক্টিভ মানচিত্র তৈরির জন্য ট্যুল দেওয়া হয় যা সুপারিশকৃত ট্রাফিক রুট প্রদান, ট্রাফিক ঘটনা সম্পর্কে তথ্য প্রদান, অভ্যন্তরীণ নেভিগেশন, অনুসন্ধান ক্ষমতা, উচ্চতা তথ্য, আবহাওয়া পরিষেবা এবং আরও অনেক কিছু করতে পারে।
✅ এখানে কিছু [কোড স্যাম্পল](https://docs.microsoft.com/samples/browse?WT.mc_id=academic-17441-jabenn&products=azure-maps) রয়েছে যা আমরা এক্সপেরিমেন্ট করে দেখতে পারি।
আমরা বিভিন্নভাবে মানচিত্র প্রদর্শন করতে পারি, যেমনঃ ফাঁকা ক্যানভাস, টাইলস, স্যাটেলাইট ইমেজ, রাস্তা সহ স্যাটেলাইট ইমেজ, গ্রেস্কেল মানচিত্র, উচ্চতা দেখানোর জন্য ছায়াময় মানচিত্র, রাতের দৃশ্যের মানচিত্র এবং হাই-কনট্রাস্ট ইত্যাদি । [Azure Event Grid](https://azure.microsoft.com/services/event-grid/?WT.mc_id=academic-17441-jabenn) এর সাথে একীভূত করে আমরা আমাদের মানচিত্রে রিয়েল-টাইম আপডেট পেতে পারি। আমাদের মানচিত্রের আচরণ এবং ভিস্যুয়াল পরিবর্তন করতে পারি বিভিন্ন নিয়ন্ত্রণ যুক্ত করে, যেমনঃ pinch, drag এবং ক্লিক করার মতো অপারেশনের মাধ্যমে। মানচিত্রের রূপ পরিবর্তন করতে, আমরা বাবল, লাইন, বহুভুজ, হিটম্যাপ এবং আরও অনেক কিছু অন্তর্ভুক্ত করতে পারি। কোন মানচিত্রটি বাস্তবায়ন করবো তা আমাদের SDK এর পছন্দের উপর নির্ভর করে।
[REST API](https://docs.microsoft.com/javascript/api/azure-maps-rest/?WT.mc_id=academic-17441-jabenn&view=azure-maps-typescript-latest) ব্যবহার করে আমরা Azure Maps APIs একসেস করতে পারি। এছাড়াও এটির [Web SDK](https://docs.microsoft.com/azure/azure-maps/how-to-use-map-control?WT.mc_id=academic-17441-jabenn) বা মোবাইলের জন্য [Android SDK](https://docs.microsoft.com/azure/azure-maps/how-to-use-android-map-control-library?WT.mc_id=academic-17441-jabenn&pivots=programming-language-java-android) আমরা কাজে লাগাতে পারি।
এই পাঠে, আমরা একটি মানচিত্র আঁকতে এবং আমাদের সেন্সরের জিপিএস অবস্থানের পথ প্রদর্শন করতে ওয়েব SDK ব্যবহার করবো।
## Azure Maps রিসোর্স তৈরী করা
আমাদের প্রথম ধাপ হল একটি Azure Maps অ্যাকাউন্ট তৈরি করা।
### কাজ - Azure Maps রিসোর্স তৈরী করা
1. টার্মিনাল বা কমান্ড প্রম্পট থেকে নিম্নের কমান্ড রান করে `gps-sensor` রিসোর্স গ্রুপে Azure Maps রিসোর্স তৈরী করি।
```sh
az maps account create --name gps-sensor \
--resource-group gps-sensor \
--accept-tos \
--sku S1
```
এটি Azure Maps রিসোর্স তৈরী করবে যার নাম `gps-sensor` । এক্ষেত্রে `S1` tier ব্যবহৃত হচ্ছে যা একটি paid tier যাতে অনেকগুলো ফীচার থাকে।
> 💁 Azure Maps ব্যবহারের খরচ সম্পর্কে জানতে, [Azure Maps pricing page](https://azure.microsoft.com/pricing/details/azure-maps/?WT.mc_id=academic-17441-jabenn) পড়তে পারি।
1. ম্যাপের জন্য API key প্রয়োজন। নীচের কমান্ড দিয়ে তা পাওয়া যাবেঃ
```sh
az maps account keys list --name gps-sensor \
--resource-group gps-sensor \
--output table
```
এখানে `PrimaryKey` ভ্যালুটি কপি করে নিতে হবে।
## ওয়েব পেইজে ম্যাপ প্রদর্শন
এখন আমরা পরবর্তী পদক্ষেপ নিতে পারি যা হলো একটি ওয়েব পেজে মানচিত্র প্রদর্শন করা। ছোট ওয়েব অ্যাপের জন্য মাত্র একটি `html` ফাইল ব্যবহার করবো; তবে এক্ষেত্রে মনে রাখতে হবে যে একটি উত্পাদন শিল্প বা দলগত পরিবেশে, ওয়েব অ্যাপ্লিকেশনে সম্ভবত আরো কিছু চলমান অংশ থাকবে!
### Task - ওয়েব পেইজে ম্যাপ প্রদর্শন
1. এখন index.html নামে একটি ফাইল তৈরী করতে হবে লোকাল কম্পিউটারের কোন ফোল্ডারে । HTML মার্ক-আপ দিয়ে ম্যাপ স্থাপন করিঃ
```html
<html>
<head>
<style>
#myMap {
width:100%;
height:100%;
}
</style>
</head>
<body onload="init()">
<div id="myMap"></div>
</body>
</html>
```
ম্যাপটি `myMap` `div` এ তৈরী হবে । পেইজের প্রস্থ এবং উচ্চতা ঠিক করার জন্য কিছু HTML স্টাইল ব্যবহার করলেই হবে।
> 🎓`div` একটি ওয়েব পেজের একটি বিভাগ বা অংশ যেটিতে আমরা নাম এবং স্টাইল পরিবর্তন করতে পারি সহজেই ।
1. শুরুতেই `<head>` ট্যাগের অধীনে একটি এক্সটার্নাল style sheet যুক্ত করতে হবে ম্যাপ সুন্দরভাবে প্রদর্শনের জন্য। এছাড়াও ম্যাপের ব্যবহার নিয়ন্ত্রণ করতে, একটি বাহ্যিক script ফাইল দরকার যা আমরা Web SDK থেকে পাব:
```html
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
```
এই স্টাইল শীটে মানচিত্রটি কেমন দেখায় সেটির সেটিংস রয়েছে এবং স্ক্রিপ্ট ফাইলে মানচিত্র লোড করার কোড রয়েছে। এই কোড যোগ করার কাজটি C++ এ হেডার ফাইল বা পাইথন মডিউল ইম্পোর্ট করার অনুরূপ।
1. এবার নিম্নের স্ক্রিপ্ট ব্লক যোগ করি
```javascript
<script type='text/javascript'>
function init() {
var map = new atlas.Map('myMap', {
center: [-122.26473, 47.73444],
zoom: 12,
authOptions: {
authType: "subscriptionKey",
subscriptionKey: "<subscription_key>",
}
});
}
</script>
```
এক্ষেত্রে `<subscription_key>` এর পরিবর্তে API key ব্যবহার করতে হবে Azure Maps একাউন্টের।
যদি আমরা `index.html` পেজটি ব্রাউজারে ওপেন করি, তাহলে আমরা ম্যাপ দেখতে পাব যা Seattle অঞ্চলে ফোকাস করে।
![A map showing Seattle, a city in Washington State, USA](../../../../images/map-image.png)
✅ মানচিত্র প্রদর্শন পরিবর্তন করতে জুম এবং কেন্দ্রের পরামিতিগুলি নিয়ে পরীক্ষা করি। আমরা অক্ষাংশ এবং দ্রাঘিমাংশের সাথে সম্পর্কিত বিভিন্ন স্থানাঙ্ক যোগ করে মানচিত্রে পরিবর্তন লক্ষ্য করতে পারবো।
> 💁 Web apps নিয়ে কাজ করা ক্ষেত্রে একটি ভালো উপায় হলো [http-server](https://www.npmjs.com/package/http-server) কে লোকালি ইন্সটল করা। তবে আমাদেরকে [node.js](https://nodejs.org/) এবং [npm](https://www.npmjs.com/) ইন্সটল করতে হবে আগেই। এগুলো ইনস্টল হয়ে গেলে, `index.html` ফাইলে নেভিগেট করে, ` http-server` টাইপ করলে ওয়েব অ্যাপটি একটি স্থানীয় ওয়েব সার্ভারে খুলবে [http://127.0.0.1:8080/](http://127.0.0.1:8080/) ।
## GeoJSON ফরম্যাট
এখন যেহেতু মানচিত্র প্রদর্শনের সাথে আমাদের ওয়েব অ্যাপটি রয়েছে, আমাদেরকে আমাদের স্টোরেজ অ্যাকাউন্ট থেকে জিপিএস ডেটা বের করতে হবে এবং এটি মানচিত্রের উপরে মার্কারের একটি স্তরে প্রদর্শন করতে হবে। আমরা এটি করার আগে, [GeoJSON](https://wikipedia.org/wiki/GeoJSON) ফর্ম্যাটটি দেখি যা Azure মানচিত্রের জন্য প্রয়োজনীয়।
[GeoJSON](https://geojson.org/) হল একটি ওপেন স্ট্যান্ডার্ড JSON স্পেসিফিকেশন যা ভৌগোলিক-নির্দিষ্ট ডেটা হ্যান্ডেল করার জন্য ডিজাইন করা হয়েছে বিশেষ ফর্ম্যাটিং সহ। আমরা [geojson.io](https://geojson.io) ব্যবহার করে নমুনা ডেটা পরীক্ষা করে এটি সম্পর্কে জানতে পার্রি, যা GeoJSON ফাইলগুলি ডিবাগ করার জন্য একটি দরকারী ট্যুল।
GeoJSON ডেটার একটি নমুনা ফাইলঃ
```json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-2.10237979888916,
57.164918677004714
]
}
}
]
}
```
একটি বিশেষ বৈশিষ্ট্য হল ডেটাকে একটি 'ফিচারকলেকশন' এর মধ্যে 'ফিচার' হিসেবে নেস্ট করা। সেই বস্তুর মধ্যে অক্ষাংশ এবং দ্রাঘিমাংশ নির্দেশকারী 'স্থানাঙ্ক' এর 'জ্যামিতি' পাওয়া যাবে।
✅ GeoJSON তৈরি করার সময়, বস্তুর মধ্যে 'অক্ষাংশ' এবং 'দ্রাঘিমাংশ' এর ক্রমটির দিকে মনোযোগ দিতে হবে নয়তো মান অনুযায়ী অবস্থান যেখানে দেখা উচিত, সেখানে তা উপস্থাপিত হবে না! GeoJSON পয়েন্টের জন্য `lon,lat` এই ক্রমানুসারে ডেটা প্রদান করতে হয় , `lat,lon` ফরম্যাটে নয়।
`জ্যামিতি` বিভিন্ন ধরনের হতে পারে, যেমন একক বিন্দু বা বহুভুজ। এই উদাহরণে, আমরা কাজ করছি বিন্দু নিয়ে যার দুটি স্থানাঙ্কঃ দ্রাঘিমাংশ এবং অক্ষাংশ রয়েছে।
✅ Azure Maps সকল GeoJSON এবং এর সাথে অতিরিক্ত কিছু [উন্নত বৈশিষ্ট্য](https://docs.microsoft.com/azure/azure-maps/extend-geojson?WT.mc_id=academic-17441-jabenn) সাপোর্ট করে যেমনঃ বৃত্ত এবং অন্যান্য জ্যামিতিক গঠন আঁকার ক্ষমতা।
## GeoJSON দ্বারা ম্যাপে জিপিএস ডেটা প্লট করা
এখন আমরা আগের পাঠে যে স্টোরেজটি তৈরি করেছিলাম সেখান থেকে ডেটা গ্রহণ করার জন্য প্রস্তুত। এগুলো ব্লব স্টোরেজে বেশ কয়েকটি ফাইল হিসাবে সংরক্ষণ করা হয়েছে যাতে আমাদেরকে ফাইলগুলি পুনরুদ্ধার করতে হয় এবং সেগুলি বিশ্লেষণ করতে হবে যাতে Azure Maps সেই ডেটা ব্যবহার করতে পারে।
### কাজ - ওয়েব পেজ থেকে একসেস করার জন্য স্টোরেজ কনফিগার করা
আমরা যদি ডেটা আনতে আমাদের স্টোরেজে কল করি, তবে আমাদের ব্রাউজারের কনসোলে অনেক এরর দেখে অনেকেই অবাক হইয়ে যেতে পারে। এর কারণ হল এই স্টোরেজে [CORS](https://developer.mozilla.org/docs/Web/HTTP/CORS) এর জন্য আমাদেরকে পার্মিশন সেট করতে হবে যাতে বাইরের ওয়েব অ্যাপস থেকে ডেটা একসেস করা যায়।
> 🎓 CORS এর পূর্ণরূপ হলো "Cross-Origin Resource Sharing" এবং সাধারণত নিরাপত্তাজনিত কারণে Azure এ এটি স্পষ্টভাবে সেট করা প্রয়োজন। যেসকল সাইটগুলিকে ডেটা একসেস করার অনুমতি দেয়ার প্রয়োজন নেই, তা আমরা এখান থেকে নিয়ন্ত্রণ করতে পারি।
1. নিম্নের কমান্ড রান করে CORS চালু করি:
```sh
az storage cors add --methods GET \
--origins "*" \
--services b \
--account-name <storage_name> \
--account-key <key1>
```
এখানে `<storage_name>` এর জায়গায় আমাদের ব্যবহৃত স্টোরেজটির নাম দিতে হবে এবং `<key1>` এর পরিবর্তে স্টোরেজ একাউন্টের key দিতে হবে।
এই কমান্ড যেকোনো ওয়েবসাইটকে (ওয়াইল্ডকার্ড `*` চিহ্ন মানে হলো 'যেকোনো') আমাদের স্টোরেজ অ্যাকাউন্ট থেকে একটি *GET* অনুরোধ করার জন্য অনুমতি দেয়, অর্থাৎ ডেটা পাওয়ার সুযোগ করে দেয়। আর `--services b` মানে হলো শুধুমাত্র ব্লবগুলির জন্য এই সেটিং প্রয়োগ করা হচ্ছে।
### কাজ - স্টোরেজ থেকে জিপিএস ডেটা লোড করা
1. `init` ফাংশনের সবগুলো কনটেন্টকে নিম্নের কোড দিয়ে রিপ্লেস করে দিইঃ
```javascript
fetch("https://<storage_name>.blob.core.windows.net/gps-data/?restype=container&comp=list")
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(xml => {
let blobList = Array.from(xml.querySelectorAll("Url"));
blobList.forEach(async blobUrl => {
loadJSON(blobUrl.innerHTML)
});
})
.then( response => {
map = new atlas.Map('myMap', {
center: [-122.26473, 47.73444],
zoom: 14,
authOptions: {
authType: "subscriptionKey",
subscriptionKey: "<subscription_key>",
}
});
map.events.add('ready', function () {
var source = new atlas.source.DataSource();
map.sources.add(source);
map.layers.add(new atlas.layer.BubbleLayer(source));
source.add(features);
})
})
```
আর `<storage_name>` এর জায়গায় আমাদের ব্যবহৃত স্টোরেজের নামটি দিতে হবে আর `<subscription_key>` এর পরিবর্তে API key দিতে হবে Azure Maps একাউন্ট এর ।
এখানে বেশ কিছু ঘটনা ঘটছে। প্রথমে, কোডটি আমাদের স্টোরেজ অ্যাকাউন্টের নাম ব্যবহার করে নির্মিত একটি ইউআরএল এন্ডপয়েন্ট ব্যবহার করে আমাদের ব্লব কন্টেইনার থেকে জিপিএস ডেটা নিয়ে আসে। এই ইউআরএল `gps-data` থেকে পুনরুদ্ধার করে, রিসোর্সের ধরন নির্দেশ করে একটি কন্টেইনার (`restype=container`) এবং সমস্ত ব্লব সম্পর্কে তথ্য তালিকাভুক্ত করে। এই তালিকাটি ব্লবগুলি নিজেরা রিটার্ন দেবে না, তবে প্রতিটি ব্লবের জন্য একটি URL রিটার্ন করবে যা ব্লব ডেটা লোড করতে ব্যবহার করা যেতে পারে।
> 💁 এই ইউআরএলটি আমাদের ব্রাউজারে সমস্ত ব্লবের বিষদ বিবরণ দেখতে পারে। প্রতিটি আইটেমের একটি `Url` প্রপার্টি থাকবে, যার দ্বারা আমরা আমাদের ব্রাউজারেও ব্লবের বিষয়বস্তু দেখতে পারি।
এই কোডটি তারপর প্রতিটি ব্লব লোড করে, একটি `loadJSON` ফাংশন কল করে, যা পরবর্তীতে তৈরি করা হবে। এটি তখন মানচিত্রের নিয়ন্ত্রণ তৈরি করে এবং `ready` ইভেন্টে কোড যোগ করে। ওয়েব পেজে মানচিত্র প্রদর্শিত হলে এই ইভেন্টকে কল করা হয়।
প্রস্তুতকৃত ইভেন্টটি একটি Azure Maps ডেটা উৎস তৈরি করে - একটি কন্টেইনার যা GeoJSON ডেটা ধারণ করে যা পরে পপুলেটেড হবে। এই ডেটা সোর্সটি তখন একটি বাবল বা বুদবুদ স্তর তৈরি করতে ব্যবহৃত হয় - এটি GeoJSON এর প্রতিটি বিন্দুকে কেন্দ্র করে মানচিত্রে বৃত্তের একটি সেট তৈরী করে।
1. `loadJSON` ফাংশনটি `init` ফাংশনের নীচে স্ক্রিপ্ট ব্লক হিসেবে যোগ করিঃ
```javascript
var map, features;
function loadJSON(file) {
var xhr = new XMLHttpRequest();
features = [];
xhr.onreadystatechange = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
gps = JSON.parse(xhr.responseText)
features.push(
new atlas.data.Feature(new atlas.data.Point([parseFloat(gps.gps.lon), parseFloat(gps.gps.lat)]))
)
}
}
};
xhr.open("GET", file, true);
xhr.send();
}
```
এই ফাংশনটি ফেচ রুটিন দ্বারা কল করে, JSON ডেটার মাধ্যমে বিশ্লেষণ করা হয় এবং এটিকে জিওজেসন হিসাবে দ্রাঘিমাংশ এবং অক্ষাংশ স্থানাঙ্ক হিসাবে রূপান্তরিত করা হয়।
একবার বিশ্লেষণ করা হলে, ডেটা একটি জিওজেসন `ফিচার` এর অংশ হিসাবে সেট করা হয়। মানচিত্রটি চালু হবে এবং ডেটা প্লটিং এর পথে ছোট ছোট বাবল উপস্থিত হবেঃ
1. ব্রাউজারে HTML পেইজটি লোড করি। এটি প্রথমে ম্যাপ লোড করবে, তারপর সকল জিপিএস ডেটা স্টোরেজ থেকে সংগ্রহ করে তা ম্যাপে প্লট করে দিবে।
![A map of Saint Edward State Park near Seattle, with circles showing a path around the edge of the park](../../../../images/map-path.png)
> 💁 সকল কোড পাওয়া যাবে এখানে [code](./code) ফোল্ডারটিতে ।
---
## 🚀 চ্যালেঞ্জ
একটি মানচিত্রে মার্কার হিসেবে স্ট্যাটিক ডেটা প্রদর্শন করতে পারাটা বেশ বড় একটি সাফল্য। টাইমস্ট্যাম্পড JSON ফাইল ব্যবহার করে অ্যানিমেশন যুক্ত করতে এবং সময়ের সাথে চিহ্নিতকারীদের পথ দেখানোর জন্য এই ওয়েব অ্যাপটির কী আরো উন্নয়ন ঘটানো যায়? মানচিত্রের মধ্যে অ্যানিমেশন ব্যবহারের [কিছু নমুনা](https://azuremapscodesamples.azurewebsites.net/) দেওয়া হল।
## লেকচার-পরবর্তী কুইজ
[লেকচার-পরবর্তী কুইজ](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/26)
## রিভিউ এবং স্ব-অধ্যয়ন
IoT ডিভাইস নিয়ে কাজ করার ক্ষেত্রে Azure Maps খুবই ভালো একটি ট্যুল।
* [Azure Maps documentation নিয়ে Microsoft docs](https://docs.microsoft.com/azure/azure-maps/tutorial-iot-hub-maps?WT.mc_id=academic-17441-jabenn) থেকে পড়ে ইউজ কেইস গুলো আমরা দেখতে পারি।
* এছাড়াও Azure Maps নিয়ে আমাদের জ্ঞান আরো বাড়ানোর জন্য আমরা আমাদের জন্য [route finding app তৈরী করতে পারি Azure Maps self-guided learning module ব্যবহার করে](https://docs.microsoft.com/learn/modules/create-your-first-app-with-azure-maps/?WT.mc_id=academic-17441-jabenn) ।
## এসাইনমেন্ট
[অ্যাপ ডেপ্লয় করা](assignment.bn.md)

@ -0,0 +1,13 @@
# অ্যাপ ডেপ্লয় করা
## নির্দেশাবলী
আমাদের অ্যাপটি ডেপ্লয় করার বেশ কয়েকটি উপায় রয়েছে যাতে আমরা এটি সারা বিশ্বের সাথে শেয়ার করতে পারি। গিটহাব পেইজ ব্যবহার করা বা কোন সার্ভিস প্রোভাইডার ব্যবহার করাও যায়। এটি করার একটি দুর্দান্ত উপায় হল Azure Static Web Apps ব্যবহার করা। এইক্ষেত্রে আমাদের ওয়েব অ্যাপ তৈরি করতে হবে এবং [এই নির্দেশাবলী](https://github.com/Azure/static-web-apps-cli) অনুসরণ করে অথবা [এই ভিডিওগুলি](https://www.youtube.com/watch?v=ADVGIXciYn8&list=PLlrxD0HtieHgMPeBaDQFx9yNuFxx6S1VG&index=3) দেখে এটিকে ক্লাউডে স্থাপন করা যায়।
অ্যাজুর স্ট্যাটিক ওয়েব অ্যাপস ব্যবহার করার একটি সুবিধা হল যে আমরা পোর্টালে যেকোন API কী লুকিয়ে রাখতে পারি, তাই আমাদের সাবস্ক্রিপশন কী কে একটি ভেরিয়েবল হিসাবে রিফ্যাক্টর করার এবং ক্লাউডে সংরক্ষণ করার এই সুযোগটি নিতে পারবো আমরা।
## এসাইনমেন্ট মূল্যায়ন মানদন্ড
| ক্রাইটেরিয়া | দৃষ্টান্তমূলক (সর্বোত্তম) | পর্যাপ্ত (মাঝারি) | উন্নতি প্রয়োজন (নিম্নমান) |
| --------- | ------------------ | -------------- | -------------------- |
| |একটি কার্যকরী ওয়েব অ্যাপকে একটি GitHub রেপোতে উপস্থাপন করা হলো, যার সাবস্ক্রিপশন কী ক্লাউডে সংরক্ষিত থাকে এবং একটি ভেরিয়েবলের মাধ্যমে কল করা হয় | একটি কার্যকরী ওয়েব অ্যাপ একটি GitHub রেপোতে উপস্থাপন করা হলো, কিন্তু এর সাবস্ক্রিপশন কী ক্লাউডে সংরক্ষণ করা হয়নি | ওয়েব অ্যাপটিতে বাগ আছে বা সঠিকভাবে কাজ করছেনা |

@ -7,8 +7,8 @@ In your code so far you have just logged the distance to the geofence. In this a
Azure Functions has many options for bindings, including to third-party services such as Twilio, a communications platform. Azure Functions has many options for bindings, including to third-party services such as Twilio, a communications platform.
* Sign up for a free account at [Twilio.com](https://www.twilio.com) * Sign up for a free account at [Twilio.com](https://www.twilio.com)
* Read the documentation on binding Azure Functions to Twilio SMS on the [Microsoft docs Twilio binding for Azure Functions page](https://docs.microsoft.com/azure/azure-functions/functions-bindings-twilio?tabs=python&WT.mc_id=academic-17441-jabenn). * Read the documentation on binding Azure Functions to Twilio SMS on the [Microsoft docs Twilio binding for Azure Functions page](https://docs.microsoft.com/azure/azure-functions/functions-bindings-twilio?WT.mc_id=academic-17441-jabenn&tabs=python).
* Read the documentation on binding Azure Functions to Twilio SendGrid to send emails on the [Microsoft docs Azure Functions SendGrid bindings page](https://docs.microsoft.com/azure/azure-functions/functions-bindings-sendgrid?tabs=python&WT.mc_id=academic-17441-jabenn). * Read the documentation on binding Azure Functions to Twilio SendGrid to send emails on the [Microsoft docs Azure Functions SendGrid bindings page](https://docs.microsoft.com/azure/azure-functions/functions-bindings-sendgrid?WT.mc_id=academic-17441-jabenn&tabs=python).
* Add the binding to your Functions app to be notified on the GPS coordinates either inside or outside the geofence - not both. * Add the binding to your Functions app to be notified on the GPS coordinates either inside or outside the geofence - not both.
## Rubric ## Rubric

@ -1,9 +0,0 @@
# Dummy File
This file acts as a placeholder for the `translations` folder. <br>
**Please remove this file after adding the first translation**
For the instructions, follow the directives in the [translations guide](https://github.com/microsoft/IoT-For-Beginners/blob/main/TRANSLATIONS.md) .
## THANK YOU
We truly appreciate your efforts!

@ -0,0 +1,238 @@
# খাদ্যপণ্যের গুণমান সনাক্তকারী মডেলকে ট্রেনিং প্রদান
![A sketchnote overview of this lesson](../../../../sketchnotes/lesson-15.jpg)
> স্কেচনোটটি তৈরী করেছেন [Nitya Narasimhan](https://github.com/nitya)। বড় সংস্করণে দেখার জন্য ছবিটিতে ক্লিক করতে হবে।
এই ভিডিওটি Azure কাস্টম ভিশন সার্ভিসর একটি সংক্ষিপ্ত বিবরণ দেয়, যা এই পাঠে আমরা বিস্তারিত জানবো।
[![Custom Vision Machine Learning Made Easy | The Xamarin Show](https://img.youtube.com/vi/TETcDLJlWR4/0.jpg)](https://www.youtube.com/watch?v=TETcDLJlWR4)
> 🎥 উপরের ছবিতে ক্লিক করে ভিডিওটি দেখে নিই
## লেকচার-পূর্ববর্তী কুইজ
[লেকচার-পূর্ববর্তী কুইজ](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/29)
## সূচনা
কৃত্রিম বুদ্ধিমত্তা (এআই) এবং মেশিন লার্নিং (এমএল) -এর সাম্প্রতিক উন্নতি আজকের ডেভেলপারদের বিস্তৃত ক্ষমতা প্রদান করছে। এমএল মডেলগুলিকে চিত্রের বিভিন্ন জিনিস চিনতে প্রশিক্ষণ দেওয়া যেতে পারে যেমন অপরিপক্ক ফল সনাক্তকরণ এবং এটি আইওটি ডিভাইসেও ব্যবহার করা যেতে পারে ।
এই পাঠে আমরা ইমেজ বা ছবির শ্রেণিবিন্যাস সম্পর্কে জানতে পারব - এমএল মডেল ব্যবহার করে বিভিন্ন জিনিসের ছবির মধ্যে পার্থক্য করা ছাড়াও কিভাবে একটি ইমেজ ক্লাসিফায়ারকে প্রশিক্ষণ দিতে হয় যে ফলটি ভাল এবং খারাপ ফল তা জানবো।
এই পাঠে আমরা শিখবো :
* [AI এবং ML দ্বারা পণ্য শ্রেনিবদ্ধকরণ](#AI-এবং-ML-দ্বারা-পণ্য-শ্রেনিবদ্ধকরণ)
* [মেশিন লার্নিং দ্বারা ছবি চিহ্নিতকরণ](#মেশিন-লার্নিং-দ্বারা-ছবি-চিহ্নিতকরণ)
* [ইমেজ ক্লাসিফায়ারকে প্রশিক্ষণ প্রদান](#ইমেজ-ক্লাসিফায়ারকে-প্রশিক্ষণ-প্রদান)
* [ইমেজ ক্লাসিফায়ারকে টেস্ট করা](#ইমেজ-ক্লাসিফায়ারকে-মূল্যায়ণ)
* [ইমেজ ক্লাসিফায়ারকে পুনরায় প্রশিক্ষণ প্রদান](#ইমেজ-ক্লাসিফায়ারকে-পুনরায়-প্রশিক্ষণ)
## AI এবং ML দ্বারা পণ্য শ্রেনিবদ্ধকরণ
বিশ্বব্যাপী জনসাধারণের খাদ্যের যোগান দেয়া কঠিন, বিশেষত কমদামে দামে সহজলভ্য করে সরবরাহ করা। সবচেয়ে বড় খরচ হল শ্রম, তাই কৃষকরা তাদের শ্রম খরচ কমাতে ক্রমবর্ধমান অটোমেশন এবং আইওটি এর মতো সরঞ্জামগুলির দিকে ঝুঁকছেন। হাতে ফসল তোলা খুবই শ্রমসাধ্য কাজ যা যন্ত্রপাতি দ্বারা প্রতিস্থাপিত হচ্ছে, বিশেষত ধনী দেশগুলিতে। ফসল কাটার জন্য যন্ত্রপাতি ব্যবহারের খরচ বাঁচানো সত্ত্বেও, একটি নেতিবাচক দিক রয়েছে - খাদ্য সংগ্রহ করার সময় ফসল সঠিকভাবে সাজানো (sort করা)।
সব ফসল সমানভাবে পরিপক্ব হয়না। উদাহরণস্বরূপ, টমেটো ক্ষেতে কিছু কিছু সবুজ ফল থাকতেই এই ফসল তোলার জন্য প্রস্তুত থাকে। যদিও তাড়াতাড়ি ফসল তোলা অপচয়, তবুও কৃষকের জন্য যন্ত্রপাতি ব্যবহার করে সব ফসল সংগ্রহ করা এবং পরবর্তীতে অপরিপক্ক ফসলের নিষ্পত্তি করা সস্তা এবং সহজ।
✅ আমাদের কাছাকাছি খামারে বা আমাদের বাগানে বা দোকানে থাকা বিভিন্ন ফল বা সবজি পর্যবেক্ষণ করি। সেগুলি কি একই রকম পরিপক্ক নাকি বৈচিত্র দেখা যাচ্ছে ?
স্বয়ংক্রিয় পদ্ধতিতে ফসল তোলার ফলে, উৎপাদিত পণ্যের শ্রেণিবিন্যাস কার্যক্রম বর্তমানে কারখানায় হয়ে থাকে। খাদ্য লম্বা কনভেয়ার বেল্ট দিয়ে যাবে এবং শ্রমিকেরা নিম্নমানের পণ্য অপসারণ করবে। যন্ত্রপাতির কল্যাণে ফসল কাটা ও সংগ্রহ করার ক্ষেত্রে খরচ কম ছিল, কিন্তু ম্যানুয়ালি পণ্য বাছাই করা অতিরিক্ত খরচ ও শ্রমের কাজ।
![If a red tomato is detected it continues its journey uninterrupted. If a green tomato is detected it is flicked into a waste bin by a lever](../../../../images/optical-tomato-sorting.png)
এই যাত্রায় পরবর্তী বিবর্তন ছিল মেশিনগুলিকে বাছাই করার জন্য ব্যবহার করা, হয় হার্ভেস্টারে নির্মিত অথবা প্রক্রিয়াকরণ কারখানায়। এই মেশিনের প্রথম প্রজন্ম অপটিক্যাল সেন্সর ব্যবহার করে রং সনাক্ত করে, অ্যাকচুয়েটরগুলিকে নিয়ন্ত্রণ করে সবুজ টমেটোকে একটি পাত্রে ধাক্কা দিয়ে ফেলে দিতো, বাতাসের লিভার বা পফ ব্যবহার করে। আবার লাল টমেটো গুলোকে ছেড়ে দিতো যাতে তারা কনভেয়র বেল্টে এগিয়ে যেতে থাকে।
নীচের ভিডিওটি এই মেশিনগুলির মধ্যে একটিকে দেখায়।
[![Automatic sorting of tomatoes via color](https://img.youtube.com/vi/AcRL91DouAU/0.jpg)](https://www.youtube.com/watch?v=AcRL91DouAU)
> 🎥 উপরের ছবিতে ক্লিক করে ভিডিওটি দেখে নিই
এই ভিডিওতে, টমেটো যখন একটি পরিবাহক বেল্ট (conveyer belt) থেকে অন্যটিতে যায়, সবুজ টমেটো সনাক্ত করা হয় এবং লিভারের সাহায্যে একটি আলাদা পাত্রে সরিয়ে ফেলা হয়।
✅ এই অপটিক্যাল সেন্সরগুলি সঠিকভাবে কাজ করার জন্য কারখানায় বা খেতে কেমন অবস্থার প্রয়োজন হবে?
এই বাছাই মেশিনের সর্বশেষ বিবর্তন এআই এবং এমএল এর সুবিধা গ্রহণ করে, ভাল পণ্যকে খারাপ থেকে আলাদা করার জন্য প্রশিক্ষিত মডেলগুলি ব্যবহার কর। এটি কেবলমাত্র সবুজ টমেটো বনাম লাল রঙের সুস্পষ্ট রঙের পার্থক্য দ্বারা নয়, বরং পণ্যের অবস্থা থেকে আরও সূক্ষ্ম পার্থক্য ধরতে পারে যা রোগ বা ক্ষত নির্দেশ করে ।
## মেশিন লার্নিং দ্বারা ছবি চিহ্নিতকরণ
সার্বজনীনভাবে প্রোগ্রামিং হলো এমন একটি কার্যক্রম যেখানে আমরা ডেটা গ্রহণ করি, ডেটাতে একটি অ্যালগরিদম প্রয়োগ এবং আউটপুট পাই। উদাহরণস্বরূপ, গত প্রজেক্টে আমরা জিপিএস কোঅর্ডিনেটস এবং একটি জিওফেন্স নিয়েছি্লাম, একটি অ্যালগরিদম প্রয়োগ করা হয়েছিলো যা Azure ম্যাপ দ্বারা সরবরাহ করা হয়েছিল এবং জিওফেন্সের ভিতরে বা বাইরে পয়েন্ট থাকলে তার ফলাফল পেয়েছিলাম। আমরা আরও ডেটা ইনপুট নিলে, আমরা আরও বেশি আউটপুট পাব।
![Traditional development takes input and an algorithm and gives output. Machine learning uses input and output data to train a model, and this model can take new input data to generate new output](../../../../images/traditional-vs-ml.png)
মেশিন লার্নিং এটিকে সম্পূর্ণ উল্টোদিক থেকে করে - আমরা ডেটা এবং পরিচিত আউটপুট দিয়ে শুরু করি এবং মেশিন লার্নিং অ্যালগরিদম সেই সংগৃহীত ফলাফলের ডেটা থেকে শিখে যে তাকে কী করতে হবে। তারপর আমরা সেই প্রশিক্ষিত অ্যালগরিদম নিতে পারি, যাকে বলা হয় *মেশিন লার্নিং মডেল* বা শুধুমাত্র *মডেল*, এবং এটিতে নতুন ডেটা ইনপুট করে আমরা নতুন আউটপুট পাব।
> 🎓 তথ্য থেকে মেশিন লার্নিং অ্যালগরিদম শেখার প্রক্রিয়াকে বলা হয় *প্রশিক্ষণ (training)*। ইনপুট এবং পরিচিত আউটপুটগুলিকে *প্রশিক্ষণ ডেটা (training data)*বলা হয়।
উদাহরণস্বরূপ, ইনপুট ট্রেনিং ডেটা হিসাবে আমরা একটি মডেলকে কাঁচা কলা এর কয়েক লক্ষ ছবি দিতে পারি, প্রশিক্ষণ আউটপুটকে `কাঁচা` হিসাবে সেট করতে পারি, এবং একইভাবে লক্ষ লক্ষ পাকা কলার ছবিগুলিকে প্রশিক্ষণ ডেটা হিসাবে আউটপুট সেট `পাকা` হিসাবে সেট করতে পারি। এমএল অ্যালগরিদম তারপর এই ডেটা ভিত্তিক একটি মডেল তৈরি করবে। আমরা তারপর এই মডেলটিকে যেকোন একটি কলার একটি নতুন ছবি দিলে, এটি জানাবে যে নতুন ছবিটি একটি পাকা নাকি কাঁচা কলা।
> 🎓 এমএল মডেলের ফলাফলকে বলা হয় *পূর্বাভাস (predictions)*
![2 bananas, a ripe one with a prediction of 99.7% ripe, 0.3% unripe, and an unripe one with a prediction of 1.4% ripe, 98.6% unripe](../../../../images/bananas-ripe-vs-unripe-predictions.png)
এমএল মডেলগুলি বাইনারি উত্তর দেয় না, বরং তারা সম্ভাব্যতা দেয়। উদাহরণস্বরূপ, একটি মডেলকে একটি কলার ছবি দেওয়া হলে এবং `পাকা` তে ৯৯.% এবং `কাঁচা` তে .০৩% এর রেজাল্ট দিতে পারে। আমাদের কোড তারপর সেই পূর্বাভাস বাছাই করবে এবং কলা পাকা - এই সিদ্ধান্ত নেবে।
এইরকম ছবি সনাক্ত করতে ব্যবহৃত এমএল মডেলটিকে বলা হয় *ইমেজ ক্লাসিফায়ার* - এটিকে লেবেলযুক্ত ছবি দেওয়া হয় এবং তারপরে এই লেবেলগুলির ভিত্তিতে নতুন চিত্রগুলি শ্রেণিবদ্ধ করা হয়।
> 💁 এটি একটি অতি-সরলীকরণ ব্যখ্যা এবং মডেলগুলিকে প্রশিক্ষণ দেওয়ার আরও অনেক উপায় রয়েছে যা সর্বদা লেবেলযুক্ত আউটপুটগুলির প্রয়োজন হয় না, যেমন unsupervised learning প্রক্রিয়া। আমরা যদি এমএল সম্পর্কে আরও জানতে চাই, তাহলে [মেশিন লার্নিং এর ২৪ লেসনের কারিক্যুলামটি](https://aka.ms/ML-beginners) দেখি।
## ইমেজ ক্লাসিফায়ারকে প্রশিক্ষণ প্রদান
একটি ইমেজ ক্লাসিফায়ার সফলভাবে প্রশিক্ষণের জন্য আমাদের লক্ষ লক্ষ ইমেজ প্রয়োজন। যেমন দেখা যাচ্ছে, একবার আমাদের লক্ষ লক্ষ বা কোটি কোটি ইমেজের উপর প্রশিক্ষণপ্রাপ্ত একটি ইমেজ ক্লাসিফায়ার হয়ে গেলে, আমরা এটি পুনরায় ব্যবহার করতে পারি এবং ছবিগুলির একটি ছোট সেট ব্যবহার করে পুনরায় প্রশিক্ষণ দিতে পারি এবং *ট্রান্সফার লার্নিং* নামক একটি প্রক্রিয়া ব্যবহার করে দুর্দান্তরকমের এক্যুরেট ফলাফল পেতে পারি। ।
> 🎓 ট্রান্সফার লার্নিং হল এমন প্রক্রিয়া যেখানে আমরা একটি বিদ্যমান এমএল মডেল থেকে নতুন ডেটা ভিত্তিক নতুন মডেলে আগের লার্নিং ট্রান্সফার করি।
একবার ইমেজ ক্লাসিফায়ারকে বিভিন্ন ধরণের চিত্রের জন্য প্রশিক্ষণ দেওয়া হলে, এর অভ্যন্তরীণ আকার, রঙ এবং নিদর্শনগুলি সনাক্ত করতে বেশ পারদর্শী হয়ে যায়। ট্রান্সফার লার্নিং এর দ্বারা মডেলটি ইমেজ পার্টস এর ইতিমধ্যে যা শিখেছে তা নিতে এবং নতুন ইমেজ চিনতে বেশ সুবিধা হয়।
![Once you can recognize shapes, they can be put into different configurations to make a boat or a cat](../../../../images/shapes-to-images.png)
আমরা এটিকে ছোটদেরকে আকার-আকৃতি চেনানোর জন্য ছবির বইয়ের মতো মনে করতে পারি, যেখানে একবার আমরা একটি অর্ধ-বৃত্ত, একটি আয়তক্ষেত্র এবং একটি ত্রিভুজ চিনতে পারিদ। আমরা এই আকারগুলির কনফিগারেশনের উপর নির্ভর করে একটি পাল তোলা নৌকা বা একটি বিড়ালকে চিনতে পারি। ইমেজ ক্লাসিফায়ার আকার চিনতে পারে এবং ট্রান্সফার লার্নিং এটি শেখায় যে কী কী সমন্বয় করে একটি নৌকা বা একটি বিড়াল তৈরি করে - অথবা একটি কীভাবে একটি পাকা কলা পাওয়া যায়।
ক্লাউড-ভিত্তিক সার্ভিসগুলি যা আমাদেরকে আমাদের মডেলকে প্রশিক্ষণ দিতে সাহায্য করে। তারপর ওয়েব এপিআইয়ের মাধ্যমে এটি ব্যবহার করতে পারি।
> 💁 এই মডেলগুলিকে প্রশিক্ষণ দিতে প্রচুর কম্পিউটার রিসোর্স লাগে, সাধারণত গ্রাফিক্স প্রসেসিং ইউনিট বা জিপিইউ এর মাধ্যমে তা করা হয়। এটি সেই বিশেষ হার্ডওয়্যার যা আমাদের এক্সবক্সে গেমগুলি চালায়। মেশিন লার্নিং মডেলগুলি প্রশিক্ষণের জন্যও এটি ব্যবহার করা যেতে পারে। ক্লাউড ব্যবহার করে আমরা এই মডেলগুলিকে প্রশিক্ষণের জন্য জিপিইউ সহ শক্তিশালী কম্পিউটারের রিসোর্স পেতে পারি, আমাদের প্রয়োজনীয় কম্পিউটিং পাওয়ার এর অ্যাক্সেস পেতে পারি, কেবল আমাদের প্রয়োজনীয় সময়ের জন্য - এতে করে আমাদের খরচও কম, কাজও হয়ে যাবে।
## কাস্টম ভিশন
কাস্টম ভিশন হল ইমেজ ক্লাসিফায়ার প্রশিক্ষণের জন্য একটি ক্লাউড ভিত্তিক টুল। এটি আমাদেরকে অল্প সংখ্যক চিত্র ব্যবহার করে একটি ক্লাসিফায়ার প্রশিক্ষণ দেওয়ার অনুমতি দেয়। আমরা একটি ওয়েব পোর্টাল, ওয়েব এপিআই বা একটি এসডিকে এর মাধ্যমে ছবি আপলোড করতে পারি, প্রতিটি ইমেজকে একটি *ট্যাগ* দিতে পারি যেটি সেই ছবির শ্রেণিবিন্যাস নির্দেশ করে। তারপরে আমরা মডেলটিকে প্রশিক্ষণ দিব এবং এটি কতটা ভাল কাজ করে তা পরীক্ষা করে দেখব। একবার আমরা মডেলটি নিয়ে সন্তুষ্ট হলে, আমরা এর সংস্করণগুলি প্রকাশ করতে পারি যা একটি ওয়েব API বা SDK এর মাধ্যমে ব্যবহার করা যায়।
![The Azure Custom Vision logo](../../../../images/custom-vision-logo.png)
> 💁 একটি কাস্টম ভিশন মডেলকে প্রতি শ্রেণিবিন্যাসের জন্য কমপক্ষে 5টির মতো প্রশিক্ষণ ছবি দিতে পারি, তবে যত বেশী দিতে পারবো, তত ভালো। উন্নত ফলাফলের জন্য কমপক্ষে 30 টি ছবি দেয়া উচিত।
কাস্টম ভিশন মাইক্রোসফটের কগনিটিভ সার্ভিস নামে পরিচিত এআই টুলের একটি অংশের অংশ। এগুলি হল এআই টুলস যা কোনো প্রশিক্ষণ ছাড়াই ব্যবহার করা যেতে পারে অথবা অল্প পরিমাণে প্রশিক্ষণ দিয়ে ব্যবহার করা যেতে পারে। এর মধ্যে রয়েছে speech recognition, অনুবাদ, ভাষা বোঝা এবং চিত্র বিশ্লেষণ। এগুলি Azure সার্ভিস হিসাবে উপলব্ধ আছে, Free tier এ।
> 💁 বিনামূল্যে স্তর বা Free tier একটি মডেল তৈরি করা, প্রশিক্ষণ দেওয়া, তারপর উন্নয়ন কাজের জন্য এটি ব্যবহার করার জন্য যথেষ্ট। [মাইক্রোসফট ডকস এ কাস্টম ভিশন এর লিমিট এবং কোটা - এই পেইজে](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/limits-and-quotas?WT.mc_id=academic-17441-jabenn) বিনামূল্যে স্তর (Free tier) সম্পর্কে আমরা পড়তে পারি
### কাজ - কগনিটিভ সার্ভিস রিসোর্স তৈরী
কাস্টম ভিশন ব্যবহার করার জন্য, আমাদেরকে প্রথমে Azure CLI ব্যবহার করে Azure- এ দুটি cognitive services resources তৈরি করতে হবে, একটি কাস্টম ভিশন প্রশিক্ষণের জন্য এবং একটি কাস্টম ভিশন ফলাফলের জন্য।
1. একটি রিসোর্স গ্রুপ তৈরী করি যার নাম `fruit-quality-detector`
1. একটি বিনামূল্যে কাস্টম ভিশন প্রশিক্ষণ রিসোর্স তৈরি করতে নিম্নলিখিত কমান্ডটি ব্যবহার ্করি:
```sh
az cognitiveservices account create --name fruit-quality-detector-training \
--resource-group fruit-quality-detector \
--kind CustomVision.Training \
--sku F0 \
--yes \
--location <location>
```
`<location>` এর স্থলে রিসোর্স গ্রুপ তৈরীতে যে লোকেশোন দেয়া হয়েছে তা বসাই।
এটি আমাদের রিসোর্স গ্রুপে একটি কাস্টম ভিশন ট্রেনিং রিসোর্স তৈরি করবে। এটিকে নাম দেয়া হবে `fruit-quality-detector-training` (ফলের-গুণ-সনাক্তকারী-প্রশিক্ষণ) এবং `F0` sku ব্যবহার করি, যা বিনামূল্য স্তরে পাওয়া যায়। `--yes` অপশনের অর্থ হল কগনিটিভ সার্ভিসের শর্তাবলীতে আমরা সম্মত।
> 💁 আমরা যদি ইতিমধ্যে কোন ফ্রী একাউন্ট থেকে কগনিটিভ সার্ভিস ব্যবহার করে থাকি, তাহলে `S0` sku ব্যবহার করতে হবে।
1. একটি বিনামূল্যে কাস্টম ভিশন প্রেডিকশোন রিসোর্স তৈরি করতে নিম্নলিখিত কমান্ডটি ব্যবহার করি:
```sh
az cognitiveservices account create --name fruit-quality-detector-prediction \
--resource-group fruit-quality-detector \
--kind CustomVision.Prediction \
--sku F0 \
--yes \
--location <location>
```
`<location>` এর স্থলে রিসোর্স গ্রুপ তৈরীতে যে লোকেশোন দেয়া হয়েছে তা বসাই।
এটি আমাদের রিসোর্স গ্রুপে একটি কাস্টম ভিশন ্প্রেডিকশন রিসোর্স তৈরি করবে। এটিকে বলা হবে `fruit-quality-detector-prediction` এবং 'F0' স্কু ব্যবহার করি, যা ফ্রী। `-yes` অপশনের অর্থ হল কগনিটিভ সার্ভিসের শর্তাবলীতে আমরা সম্মত।
### কাজ - ইমেজ ক্লাসিফায়ার প্রজেক্ট তৈরী
1. Custom Vision portal চালু করি [CustomVision.ai](https://customvision.ai) এবুং Azure এর জন্য ব্যবহৃত মাইক্রোসফট একাউন্টে লগিন করি।
1. এখন [একটি ক্লাসিফায়ার নির্মাণের জন্য নতুন প্রজেক্ট তৈরি করার প্রক্রিয়া - Microsoft docs](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/getting-started-build-a-classifier?WT.mc_id=academic-17441-jabenn#create-a-new-project) পড়ে নতুন কাস্টম ভিশন প্রজেক্ট নির্মাণ করি।
প্রজেক্টের নাম দিই `fruit-quality-detector`.
আমরা এখন আমাদের প্রজেক্ট তৈরি করি, আমাদের আগে তৈরি করা `fruit-quality-detector-training` রিসোর্স ব্যবহার করতে হবে। একটি *ক্লাসিফিকেশন* প্রজেক্ট টাইপ, একটি *মাল্টিক্লাস* ক্লাসিফিকেশন টাইপ এবং *ফুড* ডোমেইন ব্যবহার করি।
![The settings for the custom vision project with the name set to fruit-quality-detector, no description, the resource set to fruit-quality-detector-training, the project type set to classification, the classification types set to multi class and the domains set to food](../../../../images/custom-vision-create-project.png)
✅ ইমেজ ক্লাসিফায়ারের জন্য কাস্টম ভিশন ইউআই এক্সপ্লোর করার জন্য কিছু সময় নিই।
### কাজ - ইমেজ ক্লাসিফায়ারকে প্রশিক্ষণ প্রদান
একটি ইমেজ ক্লাসিফায়ারকে প্রশিক্ষণ দেওয়ার জন্য, আমাদের ভাল এবং খারাপ উভয় গুণের ফলের একাধিক ছবি প্রয়োজন হবে, যেমন একটি পাকা এবং একটি অতিরিক্ত পাকা কলা।
> 💁এই ক্লাসিফায়ারগুলো যেকোনো কিছুর ছবিকে শ্রেণীবদ্ধ করতে পারে। তাই যদি আমাদের কাছে ভিন্ন মানের ফল না থাকে তবে আমরা অন্য যেকোন দুটি ভিন্ন ধরনের ফল ব্যবহার করতে পারেন, অথবা বিড়াল এবং কুকুর - এই ধর০ণের ক্লাসিফিকেশনও করতে পারি!
আদর্শভাবে প্রতিটি ছবিতে শুধু ফল থাকা উচিত, যার মধ্যে একটি সামঞ্জস্যপূর্ণ ব্যাকগ্রাউণ্ড , অথবা বিভিন্ন প্রকারের ব্যাকগ্রাউণ্ড থাকতে হবে। নিশ্চিত করি যে ব্যাকগ্রাউণ্ড এ এমন কিছু নেই যা পাকা বনাম কাঁচা ফলের সনাক্তকরণে প্রভাব ফেলবে।
> 💁 নির্দিষ্ট ব্যাকগ্রাউণ্ড বা নির্দিষ্ট আইটেম না থাকাই ভালো যা ক্লাসিফায়ারের জন্য অপ্রাসঙ্গিক, অন্যথায় ক্লাসিফায়ারের কেবল ব্যাকগ্রাউণ্ড এর উপর ভিত্তি করে শ্রেণীবদ্ধ করতে পারে। ত্বকের ক্যান্সারের জন্য একটি ক্লাসিফায়ার ছিল যা মোলগুলির স্বাভাবিক এবং ক্যান্সারযুক্ত উভয় এর জন্য প্রশিক্ষিত ছিল। ক্যান্সারযুক্ত মোলের ছবিতে আকার পরিমাপের জন্য সেখানে স্কেল রাখা ছিলো। এটি দেখা যায় যে, ক্লাসিফায়ারের ছবিগুলিতে স্কেল্গুলোকে চিহ্নিত করার ক্ষেত্রে প্রায় 100% নির্ভুল ছিল, কিন্তু সত্যিকারের ক্যান্সারযুক্ত মোল এর ক্ষেত্রে (ছবিতে স্কেল না রেখে) তা ততটা ভালো প্রেডিকশন দিতে পারেনি।।
ইমেজ ক্লাসিফায়ার খুব কম রেজ্যুলেশনে চলে। উদাহরণস্বরূপ, কাস্টম ভিশন 10240x10240 পর্যন্ত প্রশিক্ষণ এবং ভবিষ্যদ্বাণী চিত্র গ্রহণ করতে পারে, কিন্তু 227x227 রেজ্যুলেশনে চিত্রগুলিতে মডেলটি প্রশিক্ষণ এবং রান করে। বড় আকারের ছবিগুলি এই আকারে সঙ্কুচিত হয়, তাই আমাদেরকে নিশ্চিত করতে হবে যে আমরা যে জিনিসটি শ্রেণিবদ্ধ করছি তা চিত্রের একটি বড় অংশ দখল করে অন্যথায় এটি ক্লাসিফায়ার দ্বারা পরিবর্তিত ছোট ছবিতে খুবই ছোট হয়ে যেতে পারে।
1. আমাদের ক্লাসিফায়ারের জন্য ছবি সংগ্রহ করতে হবে। ক্লাসিফায়ারকে প্রশিক্ষণের জন্য আমাদেরকে প্রতিটি লেবেলের কমপক্ষে .৫ টি ছবির প্রয়োজন হবে, তবে বেশি হলে আরও ভাল। ক্লাসিফায়ার পরীক্ষা করার জন্য আমাদের কয়েকটি অতিরিক্ত চিত্রেরও প্রয়োজন হবে। এই ছবিগুলি সব একই জিনিসের ভিন্ন চিত্র হওয়া উচিত। উদাহরণ স্বরূপ:
* ২টি পাকা কলা নিয়ে, কয়েকটি ভিন্ন অবস্থান থেকে প্রত্যেকটির কিছু ছবি তুলি, কমপক্ষে টি ছবি তুলতে হবে (৫ টি প্রশিক্ষণ, ২টি পরীক্ষা)। কিন্তু আরও বেশি ছবি তুলতে পারলে ভালো।
![Photos of 2 different bananas](../../../../images/banana-training-images.png)
* ২টি কাঁচা কলা একই কাজটি আবারও করি।
আমাদের কমপক্ষে ১০টি প্রশিক্ষণ চিত্র থাকতে হবে, যার মধ্যে কমপক্ষে ৫ টি পাকা এবং ৫ টি কাঁচা এবং টি পরীক্ষার চিত্র, যেখানে ২টি পাকা, ২টি কাঁচা। আমাদের ছবিগুলি png বা jpegs হওয়া উচিত যা 6MB এর চেয়ে ছোট। যদি আমরা সেগুলোকে আইফোন দিয়ে ধারণ করি, উদাহরণস্বরূপ সেগুলো হতে পারে উচ্চ রেজোলিউশনের HEIC ছবি, তাই রূপান্তর করতে হবে এবং সম্ভবত সঙ্কুচিত হতে হবে। মনে রাখতে হবে, যত বেশি ছবি তত ভাল এবং আমাদের একই সংখ্যক পাকা এবং কাঁচা ্কলার ছবি থাকতে হবে।
যদি আমাদের পাকা এবং কাঁচা উভয় ফলই না থাকে, তাহলে আমরা বিভিন্ন ফল, অথবা আমাদের কাছে থাকা যেকোনো দুটি বস্তু ব্যবহার করতে পারব। আমরা পাকা এবং কাঁচা কলাগুলির [images](./images) ফোল্ডারে কিছু উদাহরণ চিত্র খুঁজে পাব যা আমরা ব্যবহার চাইলে করতে পারি।
1. এক্ষেত্রে সহজে অনুসরণযোগ্য গাইড হিসেবে [ক্লাসিফায়ারের জন্য ছবি আপলোড ও ট্যাগ](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/getting-started-build-a-classifier?WT.mc_id=academic-17441-jabenn#upload-and-tag-images) ্দেখতে পারি। পাকা কলাকে `ripe` এবং কাঁচাগুলোকে `unripe` হিসেবে ট্যাগ দিই।
![The upload dialogs showing the upload of ripe and unripe banana pictures](../../../../images/image-upload-bananas.png)
1. এখন [ক্লাসিফায়ারের ট্রেনিং কুইকস্টার্ট গাইড ](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/getting-started-build-a-classifier?WT.mc_id=academic-17441-jabenn#train-the-classifier) দেখে ট্রেনিং সম্পন্ন করি।
ট্রেনিং টাইপের জন্য **Quick Training** নির্বাচন করি।
> 🍌 ক্লাসিফায়ার প্রশিক্ষণ চলাকালীন যদি এই ফলগুলো খাওয়ার চিন্তা মাথায় আসে, তাহলে আগেই যথেষ্ট সংখ্যক ছবি তুলে রাখি !
## ইমেজ ক্লাসিফায়ারকে মূল্যায়ণ
একবার এই ক্লাসিফায়ার ট্রেইনড হয়ে গেলে, এটিতে ছবি চিহ্নিতকরণের জন্য করার জন্য একটি নতুন (টেস্ট) চিত্র দিয়ে এটি পরীক্ষা করি।
### কাজ - ইমেজ ক্লাসিফায়ারকে মূল্যায়ণ
1. এক্ষেত্রে সহজে অনুসরণযোগ্য [মডেল টেস্ট করার গাইড](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/test-your-model?WT.mc_id=academic-17441-jabenn#test-your-model) অনুসরণ করি, নতুন ছবি দিয়ে টেস্ট করতে।
![A unripe banana predicted as unripe with a 98.9% probability, ripe with a 1.1% probability](../../../../images/banana-unripe-quick-test-prediction.png)
1. আমাদের কাছে থাকা সমস্ত ছবিগুলি দিয়ে চেষ্টা করি এবং ফলাফলের নির্ভুল হবার সম্ভাবনা পর্যবেক্ষণ করি।
## ইমেজ ক্লাসিফায়ারকে পুনরায় প্রশিক্ষণ
যখন আমরা আমাদের ক্লাসিফায়ার পরীক্ষা করি, এটি আমাদের প্রত্যাশিত ফলাফল নাও দিতে পারে। ইমেজ ক্লাসিফায়ার মেশিন লার্নিং ব্যবহার করে একটি ছবিতে কি আছে সে সম্পর্কে ভবিষ্যদ্বাণী করে, সম্ভাবনার উপর ভিত্তি করে একটি ইমেজের বিশেষ বৈশিষ্ট্য (একটি নির্দিষ্ট লেবেলের) সাথে মিলিয়ে দেখে। এটি ছবিতে কি আছে তা বোঝে না - এটি একটি কলা কী তা জানে না বা বুঝতে পারেনা যে একটি কলা ও নৌকার মধ্যে কী পার্থক্য। কোন ভুল থাকলে, আমরা আমাদের ক্লাসিফায়ারকে ইমেজ দিয়ে পুনরায় প্রশিক্ষণ দিয়ে আরো উন্নত করতে পারি।
প্রতিবার আমরা quick test ব্যবহার করে রান দিলে, ছবি এবং ফলাফল সংরক্ষণ করা হয়। আমরা আমাদের মডেল পুনরায় প্রশিক্ষণ দিতে এই ছবি ব্যবহার করতে পারি।
### কাজ - ইমেজ ক্লাসিফায়ারকে পুনরায় প্রশিক্ষণ
1. এক্ষেত্রে সহজে অনুসরণযোগ্য গাইড হিসেবে [Predicted ছবি ব্যবহার করে ট্রেনিং প্রদান - এই ডকুমেন্ট ](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/test-your-model?WT.mc_id=academic-17441-jabenn#use-the-predicted-image-for-training) পড়ে, আমাদের মডেলকে পুনরায় প্রশিক্ষণ দিতে পারি, সঠিক ট্যাগ ব্যবহার করে।
1. মডেলকে retrain করা হয়ে গেলে, টেস্ট ইমেজ দিয়ে পরীক্ষা করে দেখি।
---
## 🚀 চ্যালেঞ্জ
যদি আমরা কলার উপর প্রশিক্ষিত একটি মডেলকে একটি স্ট্রবেরি এর ছবি অথবা একজন ব্যক্তি যিনি কলার স্যুট বা কস্টিউম পরে রয়েছেন অথবা একটি হলুদ রঙের কার্টুন চরিত্র যেমন সিম্পসন এর ছবি দিয়ে টেস্ট করতে যাই, তাহলে কোন ধরণের ফলাফল আসতে পারে বলে মনে হয় ?
নিশ্চিত না হলে, আমরা বরং কাজটি আসলেই করে দেখি যে কেমন ফলাফল আসে। ছবি আমরা [Bing Image search](https://www.bing.com/images/trending) থেকেই পেয়ে যাব।
## লেকচার-পরবর্তী কুইজ
[লেকচার-পরবর্তী কুইজ](https://brave-island-0b7c7f50f.azurestaticapps.net/quiz/30)
## রিভিউ এবং স্ব-অধ্যয়ন
* যখন ক্লাসিফায়ারকে প্রশিক্ষণ দিচ্ছিলাম, তখন সেখানে আমরা হয়তো *Precision*, *Recall*, and *AP* এর মান দেখেছি যা তৈরি করা মডেলটিকে রেটিং দেয়। এই মানগুলি কী তা সম্পর্কে আরো জানতে আমরা [ক্লাসিফায়ার মূল্যায়ন সংক্রান্ত ডকুমেন্ট](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/getting-started-build-a-classifier?WT.mc_id=academic-17441-jabenn#evaluate-the-classifier) পড়তে পারি।
* ক্লাসিফায়ারের মান আরো উন্নত করার জন্য [কাস্টম ভিশন মানোন্নয়ন সংক্রান্ত ডকুমেন্ট](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/getting-started-improving-your-classifier?WT.mc_id=academic-17441-jabenn) পড়তে পারি।
## এসাইনমেন্ট
[বিভিন্ন ফল ও সবজির জন্য ক্লাসিফায়ার তৈরী](assignment.bn.md)

@ -0,0 +1,16 @@
# বিভিন্ন ফল ও সবজির জন্য ক্লাসিফায়ার তৈরী
## নির্দেশাবলী
এই পাঠে আমরা একটি ইমেজ ক্লাসিফায়ারকে পাকা এবং কাঁচা ফলের মধ্যে পার্থক্য করতে প্রশিক্ষণ দিয়েছি, কিন্তু শুধুমাত্র এক ধরনের ফল ব্যবহার করে। ফলের ধরণ এবং পাকা ও কাঁচা এর মধ্যে পার্থক্য অনুসারে সাফল্যের বিভিন্ন হারের সাথে একটি ক্লাসিফায়ারকে একাধিক ফল চিনতে প্রশিক্ষণ দেওয়া যেতে পারে।
উদাহরণস্বরূপ, যেসব ফল পাকলে রঙ পরিবর্তন করে তাদের সাথে, ইমেজ ক্লাসিফায়ারগুলি রঙ সনাক্তকারী সেন্সরের চেয়ে কম কার্যকর হতে পারে কারণ তারা সাধারণত সম্পূর্ণ রঙের পরিবর্তে ধূসর স্কেলের ছবিতে কাজ করে।
আমাদের ক্লাসিফায়ারকে অন্যান্য ফলের সাথে প্রশিক্ষণ দিয়ে দেখা যেতে পারে যে এটি কতটা ভাল কাজ করে, বিশেষ করে যখন ফলগুলি প্রায় একই রকম দেখতে হয়। উদাহরণস্বরূপ, আপেল এবং টমেটো।
## এসাইনমেন্ট মূল্যায়ন মানদন্ড
| ক্রাইটেরিয়া | দৃষ্টান্তমূলক (সর্বোত্তম) | পর্যাপ্ত (মাঝারি) | উন্নতি প্রয়োজন (নিম্নমান) |
| --------- | ------------------ | -------------- | -------------------- |
|একাধিক খাদ্যপণ্যের জন্য ক্লাসিফায়ারকে প্রশিক্ষণ প্রদান | একাধিক ফলের জন্য ক্লাসিফায়ার প্রশিক্ষণ দিতে সক্ষম | কেবল একধরণের ফলের জন্য ক্লাসিফায়ারকে প্রশিক্ষণ দিতে সক্ষম| ক্লাসিফায়ার প্রশিক্ষণ দিতে ব্যার্থ |
| ক্লাসিফায়ারের সাফল্য নিরূপণ | বিভিন্ন খাদ্যপণ্যের জন্য ক্লাসিফায়ারের সাফল্য নিরূপণ করে তা যথাযথভাবে ব্যখ্যা করতে সক্ষম | পর্যবেক্কখণ এবং মানোন্নয়নের জন্য সুপারিশ প্রদান করতে সক্ষম | ক্লাসিফায়ারের সাফল্য নির্ধারণে ব্যার্থ |

@ -151,7 +151,7 @@ If you were to create a production device to sell to farms or factories, how wou
You trained your custom vision model using the portal. This relies on having images available - and in the real world you may not be able to get training data that matches what the camera on your device captures. You can work round this by training directly from your device using the training API, to train a model using images captured from your IoT device. You trained your custom vision model using the portal. This relies on having images available - and in the real world you may not be able to get training data that matches what the camera on your device captures. You can work round this by training directly from your device using the training API, to train a model using images captured from your IoT device.
* Read up on the training API in the [using the Custom Vision SDK quick start](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?tabs=visual-studio&pivots=programming-language-python&WT.mc_id=academic-17441-jabenn) * Read up on the training API in the [using the Custom Vision SDK quick start](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/quickstarts/image-classification?WT.mc_id=academic-17441-jabenn&tabs=visual-studio&pivots=programming-language-python)
## Assignment ## Assignment

@ -463,7 +463,7 @@ Your container can now be deployed to your IoT Edge device. To deploy you need t
1. Connect to the IoT edge device: 1. Connect to the IoT edge device:
* If you are using a Raspberry Pi to run IoT Edge, connect using ssh either from your terminal, or via a remote SSH session in VS Code * If you are using a Raspberry Pi to run IoT Edge, connect using ssh either from your terminal, or via a remote SSH session in VS Code
* If you are running IoT Edge in a Linux container on Windows, follow the steps in the [verify successful configuration guide](https://docs.microsoft.com/azure/iot-edge/how-to-install-iot-edge-on-windows?view=iotedge-2018-06&tabs=powershell&WT.mc_id=academic-17441-jabenn#verify-successful-configuration) to connect to the IoT Edge device. * If you are running IoT Edge in a Linux container on Windows, follow the steps in the [verify successful configuration guide](https://docs.microsoft.com/azure/iot-edge/how-to-install-iot-edge-on-windows?WT.mc_id=academic-17441-jabenn&view=iotedge-2018-06&tabs=powershell#verify-successful-configuration) to connect to the IoT Edge device.
* If you are running IoT Edge on a virtual machine, you can SSH into the machine using the `adminUsername` and `password` you set when creating the VM, and using either the IP address or DNS name: * If you are running IoT Edge on a virtual machine, you can SSH into the machine using the `adminUsername` and `password` you set when creating the VM, and using either the IP address or DNS name:
```sh ```sh

@ -4,7 +4,7 @@
It's not just image classifiers that can be run on the edge, anything that can be packaged up into a container can be deployed to an IoT Edge device. Serverless code running as Azure Functions, such as the triggers you've created in earlier lessons can be run in containers, and therefor on IoT Edge. It's not just image classifiers that can be run on the edge, anything that can be packaged up into a container can be deployed to an IoT Edge device. Serverless code running as Azure Functions, such as the triggers you've created in earlier lessons can be run in containers, and therefor on IoT Edge.
Pick one of the previous lessons and try to run the Azure Functions app in an IoT Edge container. You can find a guide that shows how to do this using a different Functions app project in the [Tutorial: Deploy Azure Functions as IoT Edge modules on Microsoft docs](https://docs.microsoft.com/azure/iot-edge/tutorial-deploy-function?view=iotedge-2020-11&WT.mc_id=academic-17441-jabenn). Pick one of the previous lessons and try to run the Azure Functions app in an IoT Edge container. You can find a guide that shows how to do this using a different Functions app project in the [Tutorial: Deploy Azure Functions as IoT Edge modules on Microsoft docs](https://docs.microsoft.com/azure/iot-edge/tutorial-deploy-function?WT.mc_id=academic-17441-jabenn&view=iotedge-2020-11).
## Rubric ## Rubric

@ -1,9 +0,0 @@
# Dummy File
This file acts as a placeholder for the `translations` folder. <br>
**Please remove this file after adding the first translation**
For the instructions, follow the directives in the [translations guide](https://github.com/microsoft/IoT-For-Beginners/blob/main/TRANSLATIONS.md) .
## THANK YOU
We truly appreciate your efforts!

@ -0,0 +1,26 @@
# উৎপাদন এবং প্রক্রিয়াকরণ - খাদ্য প্রক্রিয়াজাতকরণে IoT এর ব্যবহার
একবার খাদ্য একটি কেন্দ্রীয় হাব বা প্রক্রিয়াকরণ কারখানায় পৌঁছে গেলে, এটি যে সরাসরি সুপার মার্কেটে পাঠানো হয় তা কিন্তু সবসময় সত্য নয়। অনেক সময় খাদ্য প্রক্রিয়াজাতকরণের কয়েকটি ধাপের মধ্য দিয়ে যায়, যেমন গুণমান অনুসারে বাছাই করা। এটি একটি প্রক্রিয়া যা আগে মানুষ নিজে করতো - এটি শস্যক্ষেত থেকেই শুরু হতো এবং বাছাইকারীরা কেবল পাকা ফল আলাদা করতো, তারপর কারখানায় ফল একটি কনভেয়ার বেল্টে চড়তো এবং কর্মচারীরা ম্যানুয়ালি যে কোনও ক্ষত বা পচা ফল সরিয়ে দেবে। স্কুলজীবনে গ্রীষ্মকালীন চাকরি হিসেবে স্ট্রবেরি বাছাই করার কাজ করে, আমি সাক্ষ্য দিতে পারি যে এটি খুব একটা মজাদার কাজ নয়।
তখন কিছু আধুনিক সেটআপগুলোতে বাছাইয়ের জন্য IoT- এর উপর নির্ভর করে। [Weco](https://wecotek.com) এর মতো প্রথম দিকের কিছু যন্ত্র ছিলো, যেগুলো উৎপাদনের মান সনাক্ত করতে অপটিক্যাল সেন্সর ব্যবহার করে, উদাহরণস্বরূপ সবুজ টমেটো প্রত্যাখ্যান করে। এগুলি খামারেইবা প্রক্রিয়াকরণ কারখানায় স্থাপন করা যেতে পারে।
আর্টিফিশিয়াল ইন্টেলিজেন্স (এআই) এবং মেশিন লার্নিং (এমএল) -এর অগ্রগতির ফলে, এই মেশিনগুলি আরও উন্নত হয়ে উঠতে পারছে, এমএল মডেল ব্যবহার করে ফল এবং বিদেশী বস্তু যেমন পাথর, ময়লা বা পোকামাকড়ের মধ্যে পার্থক্য করতে পারছে। এই মডেলগুলিকে ফলের গুণাগুণ সনাক্ত করার জন্য প্রশিক্ষণ দেওয়া যেতে পারে; কেবলমাত্র ফেটে যাওয়া ফলই নয় বরং ফসলের রোগ বা অন্যান্য সমস্যা প্রাথমিকভাবে সনাক্তকরণ করাক যেতে পারে।
> 🎓 *এমএল মডেল* শব্দটি ডেটা সেটের প্রশিক্ষিত (trained) মেশিন লার্নিং সফটওয়্যারের আউটপুটকে বোঝায়। উদাহরণস্বরূপ, একটি এমএল মডেলকে পাকা এবং কাঁচা টমেটোর মধ্যে পার্থক্য করতে প্রশিক্ষণ দেয়া যায়, তারপর টমেটো পাকা কি না তা দেখতে নতুন ছবিতে মডেলটি ব্যবহার করতে পারি।
এই 4টি পাঠে আমরা শিখব কিভাবে ফলের গুণমান সনাক্ত করতে ইমেজ-ভিত্তিক এআই মডেলগুলিকে প্রশিক্ষণ দিতে হয়, কিভাবে একটি আইওটি ডিভাইস থেকে এগুলি ব্যবহার করতে হয় এবং কীভাবে এগুলি Edge ডিভাইস হিসেবে চালাতে হয় - যেটি ক্লাউডের পরিবর্তে একটি আইওটি ডিভাইসে কাজ করবে ।
> 💁 এই লেসনগুলোতে আমরা কিছু ক্লাউড রিসোর্স ব্যবহার করবো। এখানে সবগুলো প্রজেক্ট সম্পূর্ণ না হলেও, আমাদেরকে [প্রজেক্ট ক্লীন-আপ](../translations/clean-up.bn.md) করতে হবে।
## পাঠ্যসূচি
1. [খাদ্যপণ্যের গুণমান সনাক্তকারীকে প্রশিক্ষণ প্রদান](./lessons/1-train-fruit-detector/translations/README.bn.md)
1. [একটি IoT ডিভাইস থেকে ফলের গুণমান পরীক্ষাকরণ](./lessons/2-check-fruit-from-device/translations/README.bn.md)
1. [ফলের মান সনাক্তকারী প্রোগ্রাম কে Edge এ চালানো](./lessons/3-run-fruit-detector-edge/translations/README.bn.md)
1. [সেন্সরের মাধ্যমে ফলের মান সনাক্তকারীকে চালনা করা](./lessons/4-trigger-fruit-detector/translations/README.bn.md)
## ক্রেডিট
♥️ ভালোবাসার সাথে প্রতিটি অধ্যায় লিখেছেন [Jen Looper](https://github.com/jlooper) এবং [Jim Bennett](https://GitHub.com/JimBobBennett)

@ -520,7 +520,7 @@ Rather than calling LUIS from the IoT device, you can use serverless code with a
This key will need to be added as a query parameter to the URL, so the final URL will be `https://<APP_NAME>.azurewebsites.net/api/text-to-timer?code=<FUNCTION_KEY>`, where `<APP_NAME>` will be the name of your functions app, and `<FUNCTION_KEY>` will be your default function key. This key will need to be added as a query parameter to the URL, so the final URL will be `https://<APP_NAME>.azurewebsites.net/api/text-to-timer?code=<FUNCTION_KEY>`, where `<APP_NAME>` will be the name of your functions app, and `<FUNCTION_KEY>` will be your default function key.
> 💁 You can change the type of authorization of the HTTP trigger using `authlevel` setting in the `function.json` file. You can read more about this in the [configuration section of the Azure Functions HTTP trigger documentation on Microsoft docs](https://docs.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python&WT.mc_id=academic-17441-jabenn#configuration). > 💁 You can change the type of authorization of the HTTP trigger using `authlevel` setting in the `function.json` file. You can read more about this in the [configuration section of the Azure Functions HTTP trigger documentation on Microsoft docs](https://docs.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-trigger?WT.mc_id=academic-17441-jabenn&tabs=python#configuration).
* Run the functions app locally, and access using the IP address - you can get the IP address of your computer on your local network, and use that to build the URL. * Run the functions app locally, and access using the IP address - you can get the IP address of your computer on your local network, and use that to build the URL.
@ -552,7 +552,7 @@ There are many ways to request the same thing, such as setting a timer. Think of
* Read more about LUIS and it's capabilities on the [Language Understanding (LUIS) documentation page on Microsoft docs](https://docs.microsoft.com/azure/cognitive-services/luis/?WT.mc_id=academic-17441-jabenn) * Read more about LUIS and it's capabilities on the [Language Understanding (LUIS) documentation page on Microsoft docs](https://docs.microsoft.com/azure/cognitive-services/luis/?WT.mc_id=academic-17441-jabenn)
* Read more about language understanding on the [natural-language understanding page on Wikipedia](https://wikipedia.org/wiki/Natural-language_understanding) * Read more about language understanding on the [natural-language understanding page on Wikipedia](https://wikipedia.org/wiki/Natural-language_understanding)
* Read more on HTTP triggers in the [Azure Functions HTTP trigger documentation on Microsoft docs](https://docs.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python&WT.mc_id=academic-17441-jabenn) * Read more on HTTP triggers in the [Azure Functions HTTP trigger documentation on Microsoft docs](https://docs.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-trigger?WT.mc_id=academic-17441-jabenn&tabs=python)
## Assignment ## Assignment

@ -470,7 +470,7 @@ The reason for running the functions app locally is because the `librosa` Pip pa
The way to do this is instead to deploy your functions app using a Docker container. This container is deployed by the cloud whenever it needs to spin up a new instance of your function app (such as when the demand exceeds the available resources, or if the function app hasn't been used for a while and is closed down). The way to do this is instead to deploy your functions app using a Docker container. This container is deployed by the cloud whenever it needs to spin up a new instance of your function app (such as when the demand exceeds the available resources, or if the function app hasn't been used for a while and is closed down).
You can find the instructions to set up a function app and deploy via Docker in the [create a function on Linux using a custom container documentation on Microsoft Docs](https://docs.microsoft.com/azure/azure-functions/functions-create-function-linux-custom-image?tabs=bash%2Cazurecli&pivots=programming-language-python&WT.mc_id=academic-17441-jabenn). You can find the instructions to set up a function app and deploy via Docker in the [create a function on Linux using a custom container documentation on Microsoft Docs](https://docs.microsoft.com/azure/azure-functions/functions-create-function-linux-custom-image?WT.mc_id=academic-17441-jabenn&tabs=bash%2Cazurecli&pivots=programming-language-python).
Once this has been deployed, you can port your Wio Terminal code to access this function: Once this has been deployed, you can port your Wio Terminal code to access this function:

@ -1,9 +0,0 @@
# Dummy File
This file acts as a placeholder for the `translations` folder. <br>
**Please remove this file after adding the first translation**
For the instructions, follow the directives in the [translations guide](https://github.com/microsoft/IoT-For-Beginners/blob/main/TRANSLATIONS.md) .
## THANK YOU
We truly appreciate your efforts!

@ -5,6 +5,8 @@ agree to a Contributor License Agreement (CLA) declaring that you have the right
and actually do, grant us the rights to use your contribution. For details, visit and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com. https://cla.microsoft.com.
> Important: when translating text in this repo, please ensure that you do not use machine translation. We will verify translations via the community, so please only volunteer for translations in languages where you are proficient.
When you submit a pull request, a CLA-bot will automatically determine whether you need When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA. instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

@ -11,6 +11,7 @@
[![Bengali](https://img.shields.io/badge/-Bengali-blue)](translations/README.bn.md) [![Bengali](https://img.shields.io/badge/-Bengali-blue)](translations/README.bn.md)
[![Chinese](https://img.shields.io/badge/-Chinese-yellow)](translations/README.zh-cn.md) [![Chinese](https://img.shields.io/badge/-Chinese-yellow)](translations/README.zh-cn.md)
[![Turkish](https://img.shields.io/badge/-Turkish-darkgreen)](translations/README.tr.md) [![Turkish](https://img.shields.io/badge/-Turkish-darkgreen)](translations/README.tr.md)
[![French](https://img.shields.io/badge/-French-purple)](translations/README.fr.md)
# IoT for Beginners - A Curriculum # IoT for Beginners - A Curriculum
@ -75,32 +76,32 @@ We have two choices of IoT hardware to use for the projects depending on persona
## Lessons ## Lessons
| | Project Name | Concepts Taught | Learning Objectives | Linked Lesson | | | Project Name | Concepts Taught | Learning Objectives | Linked Lesson |
| :-: | :----------: | :-------------: | ------------------- | :-----------: | | :---: | :------------------------------------: | :---------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------: |
| 01 | [Getting started](./1-getting-started) | Introduction to IoT | Learn the basic principles of IoT and the basic building blocks of IoT solutions such as sensors and cloud services whilst you are setting up your first IoT device | [Introduction to IoT](./1-getting-started/lessons/1-introduction-to-iot/README.md) | | 01 | [Getting started](./1-getting-started) | Introduction to IoT | Learn the basic principles of IoT and the basic building blocks of IoT solutions such as sensors and cloud services whilst you are setting up your first IoT device | [Introduction to IoT](./1-getting-started/lessons/1-introduction-to-iot/README.md) |
| 02 | [Getting started](./1-getting-started) | A deeper dive into IoT | Learn more about the components of an IoT system, as well as microcontrollers and single-board computers | [A deeper dive into IoT](./1-getting-started/lessons/2-deeper-dive/README.md) | | 02 | [Getting started](./1-getting-started) | A deeper dive into IoT | Learn more about the components of an IoT system, as well as microcontrollers and single-board computers | [A deeper dive into IoT](./1-getting-started/lessons/2-deeper-dive/README.md) |
| 03 | [Getting started](./1-getting-started) | Interact with the physical world with sensors and actuators | Learn about sensors to gather data from the physical world, and actuators to send feedback, whilst you build a nightlight | [Interact with the physical world with sensors and actuators](./1-getting-started/lessons/3-sensors-and-actuators/README.md) | | 03 | [Getting started](./1-getting-started) | Interact with the physical world with sensors and actuators | Learn about sensors to gather data from the physical world, and actuators to send feedback, whilst you build a nightlight | [Interact with the physical world with sensors and actuators](./1-getting-started/lessons/3-sensors-and-actuators/README.md) |
| 04 | [Getting started](./1-getting-started) | Connect your device to the Internet | Learn about how to connect an IoT device to the Internet to send and receive messages by connecting your nightlight to an MQTT broker | [Connect your device to the Internet](./1-getting-started/lessons/4-connect-internet/README.md) | | 04 | [Getting started](./1-getting-started) | Connect your device to the Internet | Learn about how to connect an IoT device to the Internet to send and receive messages by connecting your nightlight to an MQTT broker | [Connect your device to the Internet](./1-getting-started/lessons/4-connect-internet/README.md) |
| 05 | [Farm](./2-farm) | Predict plant growth | Learn how to predict plant growth using temperature data captured by an IoT device | [Predict plant growth](./2-farm/lessons/1-predict-plant-growth/README.md) | | 05 | [Farm](./2-farm) | Predict plant growth | Learn how to predict plant growth using temperature data captured by an IoT device | [Predict plant growth](./2-farm/lessons/1-predict-plant-growth/README.md) |
| 06 | [Farm](./2-farm) | Detect soil moisture | Learn how to detect soil moisture and calibrate a soil moisture sensor | [Detect soil moisture](./2-farm/lessons/2-detect-soil-moisture/README.md) | | 06 | [Farm](./2-farm) | Detect soil moisture | Learn how to detect soil moisture and calibrate a soil moisture sensor | [Detect soil moisture](./2-farm/lessons/2-detect-soil-moisture/README.md) |
| 07 | [Farm](./2-farm) | Automated plant watering | Learn how to automate and time watering using a relay and MQTT | [Automated plant watering](./2-farm/lessons/3-automated-plant-watering/README.md) | | 07 | [Farm](./2-farm) | Automated plant watering | Learn how to automate and time watering using a relay and MQTT | [Automated plant watering](./2-farm/lessons/3-automated-plant-watering/README.md) |
| 08 | [Farm](./2-farm) | Migrate your plant to the cloud | Learn about the cloud and cloud-hosted IoT services and how to connect your plant to one of these instead of a public MQTT broker | [Migrate your plant to the cloud](./2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md) | | 08 | [Farm](./2-farm) | Migrate your plant to the cloud | Learn about the cloud and cloud-hosted IoT services and how to connect your plant to one of these instead of a public MQTT broker | [Migrate your plant to the cloud](./2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md) |
| 09 | [Farm](./2-farm) | Migrate your application logic to the cloud | Learn about how you can write application logic in the cloud that responds to IoT messages | [Migrate your application logic to the cloud](./2-farm/lessons/5-migrate-application-to-the-cloud/README.md) | | 09 | [Farm](./2-farm) | Migrate your application logic to the cloud | Learn about how you can write application logic in the cloud that responds to IoT messages | [Migrate your application logic to the cloud](./2-farm/lessons/5-migrate-application-to-the-cloud/README.md) |
| 10 | [Farm](./2-farm) | Keep your plant secure | Learn about security with IoT and how to keep your plant secure with keys and certificates | [Keep your plant secure](./2-farm/lessons/6-keep-your-plant-secure/README.md) | | 10 | [Farm](./2-farm) | Keep your plant secure | Learn about security with IoT and how to keep your plant secure with keys and certificates | [Keep your plant secure](./2-farm/lessons/6-keep-your-plant-secure/README.md) |
| 11 | [Transport](./3-transport) | Location tracking | Learn about GPS location tracking for IoT devices | [Location tracking](./3-transport/lessons/1-location-tracking/README.md) | | 11 | [Transport](./3-transport) | Location tracking | Learn about GPS location tracking for IoT devices | [Location tracking](./3-transport/lessons/1-location-tracking/README.md) |
| 12 | [Transport](./3-transport) | Store location data | Learn how to store IoT data to be visualized or analysed later | [Store location data](./3-transport/lessons/2-store-location-data/README.md) | | 12 | [Transport](./3-transport) | Store location data | Learn how to store IoT data to be visualized or analysed later | [Store location data](./3-transport/lessons/2-store-location-data/README.md) |
| 13 | [Transport](./3-transport) | Visualize location data | Learn about visualizing location data on a map, and how maps represent the real 3d world in 2 dimensions | [Visualize location data](./3-transport/lessons/3-visualize-location-data/README.md) | | 13 | [Transport](./3-transport) | Visualize location data | Learn about visualizing location data on a map, and how maps represent the real 3d world in 2 dimensions | [Visualize location data](./3-transport/lessons/3-visualize-location-data/README.md) |
| 14 | [Transport](./3-transport) | Geofences | Learn about geofences, and how they can be used to alert when vehicles in the supply chain are close to their destination | [Geofences](./3-transport/lessons/4-geofences/README.md) | | 14 | [Transport](./3-transport) | Geofences | Learn about geofences, and how they can be used to alert when vehicles in the supply chain are close to their destination | [Geofences](./3-transport/lessons/4-geofences/README.md) |
| 15 | [Manufacturing](./4-manufacturing) | Train a fruit quality detector | Learn about training an image classifier in the cloud to detect fruit quality | [Train a fruit quality detector](./4-manufacturing/lessons/1-train-fruit-detector/README.md) | | 15 | [Manufacturing](./4-manufacturing) | Train a fruit quality detector | Learn about training an image classifier in the cloud to detect fruit quality | [Train a fruit quality detector](./4-manufacturing/lessons/1-train-fruit-detector/README.md) |
| 16 | [Manufacturing](./4-manufacturing) | Check fruit quality from an IoT device | Learn about using your fruit quality detector from an IoT device | [Check fruit quality from an IoT device](./4-manufacturing/lessons/2-check-fruit-from-device/README.md) | | 16 | [Manufacturing](./4-manufacturing) | Check fruit quality from an IoT device | Learn about using your fruit quality detector from an IoT device | [Check fruit quality from an IoT device](./4-manufacturing/lessons/2-check-fruit-from-device/README.md) |
| 17 | [Manufacturing](./4-manufacturing) | Run your fruit detector on the edge | Learn about running your fruit detector on an IoT device on the edge | [Run your fruit detector on the edge](./4-manufacturing/lessons/3-run-fruit-detector-edge/README.md) | | 17 | [Manufacturing](./4-manufacturing) | Run your fruit detector on the edge | Learn about running your fruit detector on an IoT device on the edge | [Run your fruit detector on the edge](./4-manufacturing/lessons/3-run-fruit-detector-edge/README.md) |
| 18 | [Manufacturing](./4-manufacturing) | Trigger fruit quality detection from a sensor | Learn about triggering fruit quality detection from a sensor | [Trigger fruit quality detection from a sensor](./4-manufacturing/lessons/4-trigger-fruit-detector/README.md) | | 18 | [Manufacturing](./4-manufacturing) | Trigger fruit quality detection from a sensor | Learn about triggering fruit quality detection from a sensor | [Trigger fruit quality detection from a sensor](./4-manufacturing/lessons/4-trigger-fruit-detector/README.md) |
| 19 | [Retail](./5-retail) | Train a stock detector | Learn how to use object detection to train a stock detector to count stock in a shop | [Train a stock detector](./5-retail/lessons/1-train-stock-detector/README.md) | | 19 | [Retail](./5-retail) | Train a stock detector | Learn how to use object detection to train a stock detector to count stock in a shop | [Train a stock detector](./5-retail/lessons/1-train-stock-detector/README.md) |
| 20 | [Retail](./5-retail) | Check stock from an IoT device | Learn how to check stock from an IoT device using an object detection model | [Check stock from an IoT device](./5-retail/lessons/2-check-stock-device/README.md) | | 20 | [Retail](./5-retail) | Check stock from an IoT device | Learn how to check stock from an IoT device using an object detection model | [Check stock from an IoT device](./5-retail/lessons/2-check-stock-device/README.md) |
| 21 | [Consumer](./6-consumer) | Recognize speech with an IoT device | Learn how to recognize speech from an IoT device to build a smart timer | [Recognize speech with an IoT device](./6-consumer/lessons/1-speech-recognition/README.md) | | 21 | [Consumer](./6-consumer) | Recognize speech with an IoT device | Learn how to recognize speech from an IoT device to build a smart timer | [Recognize speech with an IoT device](./6-consumer/lessons/1-speech-recognition/README.md) |
| 22 | [Consumer](./6-consumer) | Understand language | Learn how to understand sentences spoken to an IoT device | [Understand language](./6-consumer/lessons/2-language-understanding/README.md) | | 22 | [Consumer](./6-consumer) | Understand language | Learn how to understand sentences spoken to an IoT device | [Understand language](./6-consumer/lessons/2-language-understanding/README.md) |
| 23 | [Consumer](./6-consumer) | Set a timer and provide spoken feedback | Learn how to set a timer on an IoT device and give spoken feedback on when the timer is set and when it finishes | [Set a timer and provide spoken feedback](./6-consumer/lessons/3-spoken-feedback/README.md) | | 23 | [Consumer](./6-consumer) | Set a timer and provide spoken feedback | Learn how to set a timer on an IoT device and give spoken feedback on when the timer is set and when it finishes | [Set a timer and provide spoken feedback](./6-consumer/lessons/3-spoken-feedback/README.md) |
| 24 | [Consumer](./6-consumer) | Support multiple languages | Learn how to support multiple languages, both being spoken to and the responses from your smart timer | [Support multiple languages](./6-consumer/lessons/4-multiple-language-support/README.md) | | 24 | [Consumer](./6-consumer) | Support multiple languages | Learn how to support multiple languages, both being spoken to and the responses from your smart timer | [Support multiple languages](./6-consumer/lessons/4-multiple-language-support/README.md) |
## Offline access ## Offline access
@ -129,6 +130,7 @@ Our team produces other curricula! Check out:
- [Web Dev for Beginners](https://aka.ms/webdev-beginners) - [Web Dev for Beginners](https://aka.ms/webdev-beginners)
- [ML for Beginners](https://aka.ms/ml-beginners) - [ML for Beginners](https://aka.ms/ml-beginners)
- [Data Science for Beginners](https://aka.ms/datascience-beginners)
## Image attributions ## Image attributions

@ -1,6 +1,6 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK --> <!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
## Security # Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

@ -17,6 +17,8 @@ When translating the initial Readme, link the other translations to your transla
where _[language]_ is a two letter language abbreviation following the ISO 639-1 standard (e.g. `README.es.md` for Spanish and `README.nl.md` for Dutch). where _[language]_ is a two letter language abbreviation following the ISO 639-1 standard (e.g. `README.es.md` for Spanish and `README.nl.md` for Dutch).
> Important: when translating text in this repo, please ensure that you do not use machine translation. We will verify translations via the community, so please only volunteer for translations in languages where you are proficient.
## Quizzes ## Quizzes
Add your translation to the quiz-app by adding a file here: https://github.com/microsoft/IoT-For-Beginners/tree/main/quiz-app/src/assets/translations. Please don't localize the words 'true' or 'false' however. thanks! Add your translation to the quiz-app by adding a file here: https://github.com/microsoft/IoT-For-Beginners/tree/main/quiz-app/src/assets/translations. Please don't localize the words 'true' or 'false' however. thanks!

@ -38,4 +38,4 @@ Enter `y` to confirm and delete the Resource Group.
It will take a while to delete all the services. It will take a while to delete all the services.
> 💁 You can read more about deleting resource groups on the [Azure Resource Manager resource group and resource deletion documentation on Microsoft Docs](https://docs.microsoft.com/azure/azure-resource-manager/management/delete-resource-group?tabs=azure-cli&WT.mc_id=academic-17441-jabenn) > 💁 You can read more about deleting resource groups on the [Azure Resource Manager resource group and resource deletion documentation on Microsoft Docs](https://docs.microsoft.com/azure/azure-resource-manager/management/delete-resource-group?WT.mc_id=academic-17441-jabenn&tabs=azure-cli)

@ -0,0 +1,51 @@
# [Topik Pelajaran]
![Sematkan video di sini](video-url)
## [Kuis Pra-Kuliah](quiz-url)
[Jelaskan apa yang akan kita pelajari]
### Pengenalan
Jelaskan apa yang akan dibahas
> Catatan
### Prasyarat
Langkah-langkah apa yang seharusnya sudah dibahas sebelum pelajaran ini?
### Persiapan
Langkah-langkah persiapan untuk memulai pelajaran ini
---
[Melangkah melalui konten dalam blok]
## [Topik 1]
### Tugas:
Bekerja sama untuk meningkatkan *codebase* anda secara progresif untuk membangun proyek dengan kode bersama:
```html
blok kode
```
✅ Cek Pengetahuan - gunakan momen ini untuk memperluas pengetahuan siswa dengan membuka pertanyaan
## [Topik 2]
## [Topik 3]
🚀 Tantangan: Tambahkan sebuah tantangan kepada siswa untuk dikerjakan secara kolaboratif di kelas untuk menyempurnakan project
Opsional: tambahkan tangkapan layar UI dari pelajaran yang telah selesai jika sesuai
## [Kuis Setelah Kuliah](quiz-url)
## Ulasan & Belajar Mandiri
**Keterlambatan Tugas [MM/YY]**: [Nama Tugas](assignment.md)

@ -0,0 +1,9 @@
# [Nama Tugas]
## Instruksi
## Rubrik
| Kriteria | Teladan | Memadai | Perlu Perbaikan |
| -------- | --------- | -------- | ----------------- |
| | | | |

@ -0,0 +1,9 @@
# Code de conduite de Microsoft pour les logiciels libres
Ce projet a adopté le [Code de conduite de Microsoft Open Source](https://opensource.microsoft.com/codeofconduct/).
Resources:
- [Code de conduite de Microsoft pour les logiciels libres](https://opensource.microsoft.com/codeofconduct/)
- [FAQ sur le code de conduite de Microsoft](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns

@ -0,0 +1,12 @@
# Contributing
Ce projet est ouvert aux contributions et aux suggestions. La plupart des contributions nécessitent que vous
accepter un Accord de Licence de Contributeur (CLA) déclarant que vous avez le droit de,
et que vous nous accordez effectivement les droits d'utilisation de votre contribution. Pour plus de détails, visitez
https://cla.microsoft.com.
Lorsque vous soumettez une demande de retrait, un robot CLA déterminera automatiquement si vous devez fournir une CLA et décorer le PR de manière appropriée (par exemple, étiquette, commentaire). Il suffit de suivre les instructions fournies par le bot. Vous n'aurez à le faire qu'une seule fois pour tous les dépôts utilisant notre CLA.
Ce projet a adopté le [Code de conduite de Microsoft Open Source](https://opensource.microsoft.com/codeofconduct/).
Pour plus d'informations, lisez la [FAQ sur le code de conduite](https://opensource.microsoft.com/codeofconduct/faq/)
ou contactez [opencode@microsoft.com](mailto:opencode@microsoft.com) pour toute question ou commentaire supplémentaire.

@ -86,8 +86,8 @@
| 09 | [ফার্ম](../2-farm) | অ্যাপ্লিকেশন লজিককে ক্লাউডে স্থানান্তর | ক্লাউডে কীভাবে অ্যাপ্লিকেশন লজিক লিখতে হবে যাতে তা আইওটি ম্যাসেজের প্রতিক্রিয়া জানাতে পারে তা শেখা| [অ্যাপ্লিকেশন লজিককে ক্লাউডে স্থানান্তর](../2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.bn.md) | | 09 | [ফার্ম](../2-farm) | অ্যাপ্লিকেশন লজিককে ক্লাউডে স্থানান্তর | ক্লাউডে কীভাবে অ্যাপ্লিকেশন লজিক লিখতে হবে যাতে তা আইওটি ম্যাসেজের প্রতিক্রিয়া জানাতে পারে তা শেখা| [অ্যাপ্লিকেশন লজিককে ক্লাউডে স্থানান্তর](../2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.bn.md) |
| 10 | [ফার্ম](../2-farm) | উদ্ভিদের নিরাপত্তা নিশ্চিতকরণ | আইওটি তে নিরাপত্তা সম্পর্কে জানা এবং Key ও Certificate এর সাহায্যে আমাদের উদ্ভিদটিকে কীভাবে সুরক্ষিত রাখা যায় তা শেখা | [উদ্ভিদের নিরাপত্তা নিশ্চিতকরণ](../2-farm/lessons/6-keep-your-plant-secure/translations/README.bn.md) | | 10 | [ফার্ম](../2-farm) | উদ্ভিদের নিরাপত্তা নিশ্চিতকরণ | আইওটি তে নিরাপত্তা সম্পর্কে জানা এবং Key ও Certificate এর সাহায্যে আমাদের উদ্ভিদটিকে কীভাবে সুরক্ষিত রাখা যায় তা শেখা | [উদ্ভিদের নিরাপত্তা নিশ্চিতকরণ](../2-farm/lessons/6-keep-your-plant-secure/translations/README.bn.md) |
| 11 | [পরিবহন](../3-transport) | লোকেশন ট্র্যাকিং | আইওটি ডিভাইসে জিপিএস লোকেশন ট্র্যাকিং শেখা | [লোকেশন ট্র্যাকিং](../3-transport/lessons/1-location-tracking/translations/README.bn.md) | | 11 | [পরিবহন](../3-transport) | লোকেশন ট্র্যাকিং | আইওটি ডিভাইসে জিপিএস লোকেশন ট্র্যাকিং শেখা | [লোকেশন ট্র্যাকিং](../3-transport/lessons/1-location-tracking/translations/README.bn.md) |
| 12 | [পরিবহন](../3-transport) | Store location data | পরবর্তী সময়ে বিশ্লেষণ বা চিত্রভিত্তিক ডেটা প্রদর্শন (Visualization) এর জন্য আইওটি ডেটা কীভাবে স্টোর করা যায় তা জানা | [Store location data](../3-transport/lessons/2-store-location-data/README.md) | | 12 | [পরিবহন](../3-transport) | লোকেশন ডেটা সংরক্ষণ | পরবর্তী সময়ে বিশ্লেষণ বা চিত্রভিত্তিক ডেটা প্রদর্শন (Visualization) এর জন্য আইওটি ডেটা কীভাবে স্টোর করা যায় তা জানা | [লোকেশন ডেটা সংরক্ষণ](../3-transport/lessons/2-store-location-data/translations/README.bn.md) |
| 13 | [পরিবহন](../3-transport) | Visualize location data |মানচিত্রে অবস্থানের ডেটা প্রদর্শন করা এবং মানচিত্রগুলি কীভাবে ২টি মাত্রায় বাস্তব ত্রিমাত্রিক বিশ্বের উপস্থাপন করে সে সম্পর্কে জ্ঞান অর্জন | [Visualize location data](../3-transport/lessons/3-visualize-location-data/README.md) | | 13 | [পরিবহন](../3-transport) | লোকেশন ডেটা প্রদর্শন |মানচিত্রে অবস্থানের ডেটা প্রদর্শন করা এবং মানচিত্রগুলি কীভাবে ২টি মাত্রায় বাস্তব ত্রিমাত্রিক বিশ্বের উপস্থাপন করে সে সম্পর্কে জ্ঞান অর্জন | [লোকেশন ডেটা প্রদর্শন](../3-transport/lessons/3-visualize-location-data/translations/README.bn.md) |
| 14 | [পরিবহন](../3-transport) | Geofences | Geofences সম্পর্কে জানা এবং কীভাবে এটি ব্যবহার করে সাপ্লাই চেইনের বিভিন্ন পর্যায়ের বাহনগুলো যখন গন্তব্যের কাছাকাছি পৌঁছায় তখন এলার্ট দেয়া যায় তা শেখা | [Geofences](../3-transport/lessons/4-geofences/README.md) | | 14 | [পরিবহন](../3-transport) | Geofences | Geofences সম্পর্কে জানা এবং কীভাবে এটি ব্যবহার করে সাপ্লাই চেইনের বিভিন্ন পর্যায়ের বাহনগুলো যখন গন্তব্যের কাছাকাছি পৌঁছায় তখন এলার্ট দেয়া যায় তা শেখা | [Geofences](../3-transport/lessons/4-geofences/README.md) |
| 15 | [উৎপাদন](../4-manufacturing) | Train a fruit quality detector | ক্লাউডের ছবি শ্রেণিবদ্ধকরণ মডেলকে (Image Classifier) ফলের মান সনাক্ত করতে কীভাবে প্রশিক্ষিত করতে হবে সে সম্পর্কে জানা | [Train a fruit quality detector](../4-manufacturing/lessons/1-train-fruit-detector/README.md) | | 15 | [উৎপাদন](../4-manufacturing) | Train a fruit quality detector | ক্লাউডের ছবি শ্রেণিবদ্ধকরণ মডেলকে (Image Classifier) ফলের মান সনাক্ত করতে কীভাবে প্রশিক্ষিত করতে হবে সে সম্পর্কে জানা | [Train a fruit quality detector](../4-manufacturing/lessons/1-train-fruit-detector/README.md) |
| 16 | [উৎপাদন](../4-manufacturing) | Check fruit quality from an IoT device | আইওটি ডিভাইসে ফলের গুণগত মান সনাক্তকারী ব্যবহার | [Check fruit quality from an IoT device](../4-manufacturing/lessons/2-check-fruit-from-device/README.md) | | 16 | [উৎপাদন](../4-manufacturing) | Check fruit quality from an IoT device | আইওটি ডিভাইসে ফলের গুণগত মান সনাক্তকারী ব্যবহার | [Check fruit quality from an IoT device](../4-manufacturing/lessons/2-check-fruit-from-device/README.md) |

@ -0,0 +1,136 @@
[![GitHub license](https://img.shields.io/github/license/microsoft/IoT-For-Beginners.svg)](https://github.com/microsoft/IoT-For-Beginners/blob/master/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/microsoft/IoT-For-Beginners.svg)](https://GitHub.com/microsoft/IoT-For-Beginners/graphs/contributors/)
[![GitHub issues](https://img.shields.io/github/issues/microsoft/IoT-For-Beginners.svg)](https://GitHub.com/microsoft/IoT-For-Beginners/issues/)
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/microsoft/IoT-For-Beginners.svg)](https://GitHub.com/microsoft/IoT-For-Beginners/pulls/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![GitHub watchers](https://img.shields.io/github/watchers/microsoft/IoT-For-Beginners.svg?style=social&label=Watch)](https://GitHub.com/microsoft/IoT-For-Beginners/watchers/)
[![GitHub forks](https://img.shields.io/github/forks/microsoft/IoT-For-Beginners.svg?style=social&label=Fork)](https://GitHub.com/microsoft/IoT-For-Beginners/network/)
[![GitHub stars](https://img.shields.io/github/stars/microsoft/IoT-For-Beginners.svg?style=social&label=Star)](https://GitHub.com/microsoft/IoT-For-Beginners/stargazers/)
[![Bengali](https://img.shields.io/badge/-Bengali-blue)](README.bn.md)
[![Chinese](https://img.shields.io/badge/-Chinese-yellow)](README.zh-cn.md)
[![Turkish](https://img.shields.io/badge/-Turkish-darkgreen)](README.tr.md)
[![French](https://img.shields.io/badge/-French-purple)](README.fr.md)
# IoT pour débutants - Le Curriculum
Chez Microsoft, les partisans d'Azure infonuagique sont fiers de vous offrir ce cursus de formation en ligne sur les bases de l'Internet des Objets (IoT). Cette formation de 12 semaines sera ventillée en 24 leçons, comprendra des questionnaires avant et après chacune des leçons. Elle comprendra aussi des instructions écrites permettant de compléter les leçons, des solutions et bien plus encore. Notre pédagogie orientée sur la réalisation de projet vous permettra d'apprendre tout en développant des compétences durables.
L'ensemble des projets parlent du parcours que les aliments suivent, de la ferme jusqu'à l'assiette. On y aborde notemment la production à la ferme, la logistique, la fabrication, la ou encore de la vente au détail. Bref, un ensemble d'industries propices à l'utilisation d'objets connectés.
![Un cursus de 24 leçons abordant l'exploitation agricole, le transport, la transformation alimentaire, la vente au détail ainsi que la cuisine](../sketchnotes/Roadmap.jpg)
> Illustré de [Nitya Narasimhan](https://github.com/nitya). Cliquez sur l'image pour l'agrandir.
**Un remerciements chaleureux à nos auteurs [Jen Fox](https://github.com/jenfoxbot), [Jen Looper](https://github.com/jlooper), [Jim Bennett](https://github.com/jimbobbennett), and our sketchnote artist [Nitya Narasimhan](https://github.com/nitya).**
**Un grand merci aussi à notre équipe [Microsoft Learn Student Ambassadors](https://studentambassadors.microsoft.com?WT.mc_id=academic-17441-jabenn) qui ont révisés et traduit cette série de cours - [Aditya Garg](https://github.com/AdityaGarg00), [Anurag Sharma](https://github.com/Anurag-0-1-A), [Arpita Das](https://github.com/Arpiiitaaa), [Aryan Jain](https://www.linkedin.com/in/aryan-jain-47a4a1145/), [Bhavesh Suneja](https://github.com/EliteWarrior315), [Faith Hunja](https://faithhunja.github.io/), [Lateefah Bello](https://www.linkedin.com/in/lateefah-bello/), [Manvi Jha](https://github.com/Severus-Matthew), [Mireille Tan](https://www.linkedin.com/in/mireille-tan-a4834819a/), [Mohammad Iftekher (Iftu) Ebne Jalal](https://github.com/Iftu119), [Mohammad Zulfikar](https://github.com/mohzulfikar), [Priyanshu Srivastav](https://www.linkedin.com/in/priyanshu-srivastav-b067241ba), [Thanmai Gowducheruvu](https://github.com/innovation-platform), and [Zina Kamel](https://www.linkedin.com/in/zina-kamel/).**
Rencontrez l'équipe!
[![Video promo](../images/iot-for-beginners.png)](https://youtu.be/-wippUJRi5k)
> 🎥 Cliquez sur l'image ci-haut afin de consulter la vidéo du projet
> **Enseignants**, nous avons [inclus quelques suggestions](./for-teachers.fr.md) sur la manière d'utiliser cette série de cours. Si vous souhaitez ajouter vos propres leçons, nous avons créé ce [gabarit de cours](../lesson-template/README.md) pour votre convenance.
> **Étudiants**, afin d'utiliser cette série de cours, clônez le projet gitHub et complétez les exercices en commençant par les questionnaires de pré-lecture, suivi des lectures elles-mêmes puis du reste des activités proposées. Nous vous conseillons fortement de créer les projets en vous basant aux lessons associées au lieu de copier les solutionnaires;toutefois, ce code est disponible dans la section /solutions de chaque leçon. Une autre proposition serait de créer un groupe d'étude avec des amis afin de compléter le contenu ensembles. Pour des activités d'apprentissage avancées, nous vous invitons à consulter [Microsoft Learn](https://docs.microsoft.com/users/jimbobbennett/collections/ke2ehd351jopwr?WT.mc_id=academic-17441-jabenn).
Pour un apperçu de cette série de cours, voici une vidéo intéressante:
[![Video promo](https://img.youtube.com/vi/bccEMm8gRuc/0.jpg)](https://youtube.com/watch?v=bccEMm8gRuc "Video promo")
> 🎥 Cliquez sur l'image ci-haut afin de consulter la vidéo du projet!
## Pédagogie
Nous avons construit ce cursus de formation en utilisant deux principes pédagogiques: l'apprentissage par projet ainsi que l'utilisation de quizzes fréquents. À la fin de cette série, les étudiants auront bâtis une système de surveillance et d'arrosage de plantes, un système de géolocalisation de véhicules, un système de suivi et de contrôle des aliments en usine ainsi qu'un minuteur contrôlé par la voix. Ces éléments d'apprentissage auront inclus l'écriture de code pour les objets connectés, la connectivité au cloud, l'analyse de télémétrie ainsi que l'utilisation d'intelligence artificielle par des appareils de périphérie (edge devices).
En s'assurant que le contenu théorique soit conséquent avec les projets proposés, le processus d'apprentissage devient alors plus engageant et la rétention des concepts plus durable.
De surcroît, les quizzes de début de cours mettent la tâble en orientant l'attention de l'étudiant vers le sujet d'apprentissage alors que les quizzes de fin de cours assurent une meilleur rétention des notions. Ce cursus de formation a été conçu afin d'être flexible et plaisant, pouvant être suivi en entièreté ou en partie. En effet, les projets commencent petits et deviennent de plus en plus complexes en fin de parcours.
Il est aussi à noter que chaque projet est construit à partir de matériel disponible pour les étudiants et hobbyistes. Chaque projet permet une compréhension du contexte auquel il appartient en fournissant suffisemment d'information pertinentes. En effet, afin de devenir un développeur compétent, il est capitale de comprendre le contexte dans lequel un problème est exprimé puis résolue. Cela permet aux étudiants de mieux concevoir leurs solutions "IoT" fâce à des problèmes réels qu'ils seront éventuellement amenés à résoudre en tant que professionnels. Ces derniers comprennent alors les raisons qui justifient une conception et sont en mesure d'apprécier la perspective d'un utilisateur.
## Matériel
Nous proposons deux possibilités de matériel "IoT" afin de réaliser nos projets afin de permettre plus de flexibilité vis à vis vos preférences, language de programmation favoris, objectifs d'apprentissage ou encore disponibilité. Nous avons aussi fournis une version virtuelle du matériel en vue d'accomoder ceux n'ayant pas accès au matériel ou ne souhaitant pas débourser. Alors, libre à vous d'en lire d'avantage sur la [page de matériel](./hardware.fr.md) incluant plusieurs liens permettant d'acheter des ensembles chez nos amis à Seeed Studio.
> 💁 Découvrez nos guides sur le [Code de conduite](CODE_OF_CONDUCT.fr.md), la [Contribution](CONTRIBUTING.fr.md), ainsi que la [Traduction](TRANSLATIONS.fr.md). Nous vous invitons à nous partager vos impressions!
## Chaque leçon inclus:
- illustré
- vidéo supplémentaire optionnelle
- questionnaire préliminaire
- leçon écrite
- pour les leçons incluant un projet, un guide complet sur la manière de construire le projet
- étapes d'apprentissage
- un défi
- lectures complémentaires
- devoir
- questionnaire de fin de cours
> **Note à propos des questionnaires**: Tous les questionnaires se retrouvent dans [cette application](https://brave-island-0b7c7f50f.azurestaticapps.net), pour un total de 48 questionnaires de trois questions chaque. Des liens sont fournis à l'intérieur de chacune des leçons bien que l'application puisse être exécutée localement; suivez les instructions situées dans le dossier `quiz-app`. Ces dernières deviennent progressivement localisées.
## Leçons
| | Nome du projet | Concept enseigné | Objectifs d'apprentissage | leçon associée |
| :-: | :----------: | :-------------: | ------------------- | :-----------: |
| 01 | [Démarrer](../1-getting-started) | Introduction aux IoT | Apprenez les principes fondamentaux de l'IoT ainsi que les éléments fondamentaux qui en font des solutions viables, tels que les capteurs et les services infonuagiques. Ceci, en configurant votre premier dispositif IoT | [Introduction aux IoT](../1-getting-started/lessons/1-introduction-to-iot/translations/README.fr.md) |
| 02 | [Démarrer](../1-getting-started) | Approfondir les bases | Apprenez-en davantage sur les composants d'un système IoT, ainsi que sur les microcontrôleurs et les ordinateurs monocartes | [Approfondir les bases](../1-getting-started/lessons/2-deeper-dive/translations/README.fr.md) |
| 03 | [Démarrer](../1-getting-started) | Interagir avec le monde physique à l'aide de capteurs et d'actuateurs | Apprenez à connaître les capteurs qui recueillent les données du monde physique et les actionneurs qui envoient des informations, tout en construisant une veilleuse | [Interagir avec le monde physique à l'aide de capteurs et d'actuateurs](../1-getting-started/lessons/3-sensors-and-actuators/translations/README.fr.md) |
| 04 | [Démarrer](../1-getting-started) | Connectez votre appareil à l'Internet | Découvrez comment connecter un appareil IoT à Internet pour envoyer et recevoir des messages en connectant votre veilleuse à un broker MQTT | [Connectez votre appareil à l'Internet](../1-getting-started/lessons/4-connect-internet/translations/README.fr.md) |
| 05 | [Jardinner](../2-farm) | Anticiper la croissance de ses plantes | Apprenez à prédire la croissance des plantes à l'aide des données de température capturées par un dispositif IoT | [Anticiper la croissance de ses plantes](../2-farm/lessons/1-predict-plant-growth/translations/README.fr.md) |
| 06 | [Jardinner](../2-farm) | Détecter l'humidité du sol | Apprenez à détecter l'humidité du sol et à calibrer un capteur d'humidité du sol | [Détecter l'humidité du sol](../2-farm/lessons/2-detect-soil-moisture/translations/README.fr.md) |
| 07 | [Jardinner](../2-farm) | Automatiser l'arrosage | Apprenez comment automatiser et chronométrer l'arrosage à l'aide d'un relais et de MQTT | [Automatiser l'arrosage](../2-farm/lessons/3-automated-plant-watering/translations/README.fr.md) |
| 08 | [Jardinner](../2-farm) | Connectez votre plant au cloud | Découvrez les services IoT hébergés dans le nuage et comment connecter votre plant à l'un d'entre eux plutôt qu'à un broker MQTT public | [Connectez votre plant au cloud](../2-farm/lessons/4-migrate-your-plant-to-the-cloud/translations/README.fr.md) |
| 09 | [Jardinner](../2-farm) | Migrer votre logique applicative vers le cloud | Découvrez comment vous pouvez écrire dans le nuage une logique d'applicative qui répond aux messages IoT | [Migrer votre logique applicative vers le cloud](../2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.fr.md) |
| 10 | [Jardinner](../2-farm) | Plante en sécurité | Découvrez la sécurité de l'IoT et comment sécuriser votre plante à l'aide de clés et de certificats | [Plante en sécurité](../2-farm/lessons/6-keep-your-plant-secure/translations/README.fr.md) |
| 11 | [Transport](../3-transport) | Géolocalisation | En savoir plus sur le suivi de la localisation GPS pour les dispositifs IoT | [Géolocalisation](../3-transport/lessons/1-location-tracking/translations/README.fr.md) |
| 12 | [Transport](../3-transport) | Stocker les données localisées | Apprenez à stocker les données IoT pour les visualiser ou les analyser ultérieurement | [Stocker les données localisées](../3-transport/lessons/2-store-location-data/translations/README.fr.md) |
| 13 | [Transport](../3-transport) | Visualiser les données localisées | Learn about visualizing location data on a map, and how maps represent the real 3d world in 2 dimensions | [Visualiser les données localisées](../3-transport/lessons/3-visualize-location-data/translations/README.fr.md) |
| 14 | [Transport](../3-transport) | Barrières géographiques virtuelles | Découvrez les géofences et la manière dont elles peuvent être utilisées pour alerter lorsque les véhicules de la chaîne d'approvisionnement sont proches de leur destination | [Barrières géographiques virtuelles](../3-transport/lessons/4-geofences/translations/README.fr.md) |
| 15 | [Fabrication](../4-manufacturing) | Former un détecteur de qualité des fruits | Apprenez à former un classificateur d'images dans le nuage pour détecter la qualité des fruits | [Former un détecteur de qualité des fruits](../4-manufacturing/lessons/1-train-fruit-detector/translations/README.fr.md) |
| 16 | [Fabrication](../4-manufacturing) | Vérifier la qualité des fruits à partir d'un dispositif IoT | Découvrez comment utiliser votre détecteur de qualité des fruits à partir d'un dispositif IoT | [Vérifier la qualité des fruits à partir d'un dispositif IoT](../4-manufacturing/lessons/2-check-fruit-from-device/translations/README.fr.md) |
| 17 | [Fabrication](../4-manufacturing) | Faites fonctionner votre détecteur de fruits sur le Edge | Découvrez comment faire fonctionner votre détecteur de fruits sur un dispositif IoT à la périphérie | [Faites fonctionner votre détecteur de fruits sur le Edge](../4-manufacturing/lessons/3-run-fruit-detector-edge/translations/README.fr.md) |
| 18 | [Fabrication](../4-manufacturing) | Déclencher la détection de la qualité du fruit à partir d'un capteur | En savoir plus sur le déclenchement de la détection de la qualité des fruits à partir d'un capteur | [Déclencher la détection de la qualité du fruit à partir d'un capteur](../4-manufacturing/lessons/4-trigger-fruit-detector/translations/README.fr.md) |
| 19 | [Vente au détail](../5-retail) | Former un détecteur d'actions | Apprenez à utiliser la détection d'objets pour entraîner un détecteur de stock à compter les stocks dans un magasin | [Former un détecteur d'actions](../5-retail/lessons/1-train-stock-detector/translations/README.fr.md) |
| 20 | [Vente au détail](../5-retail) | Vérifier le stock à partir d'un dispositif IoT | Apprenez à vérifier le stock d'un dispositif IoT à l'aide d'un modèle de détection d'objets. | [Vérifier le stock à partir d'un dispositif IoT](../5-retail/lessons/2-check-stock-device/translations/README.fr.md) |
| 21 | [Consommateur](../6-consumer) | Reconnaître la parole avec un dispositif IoT | Apprenez à reconnaître la parole à partir d'un dispositif IoT pour construire une minuterie intelligente | [Reconnaître la parole avec un dispositif IoT](../6-consumer/lessons/1-speech-recognition/translations/README.fr.md) |
| 22 | [Consommateur](../6-consumer) | Comprendre la langue | Apprenez à comprendre les phrases adressées à un dispositif IoT | [Comprendre la langue](../6-consumer/lessons/2-language-understanding/translations/README.fr.md) |
| 23 | [Consommateur](../6-consumer) | Réglez un minuteur et donnez un feedback oral | Apprenez à régler une minuterie sur un dispositif IoT et à donner un retour oral sur le moment où la minuterie est réglée et où elle se termine. | [Réglez un minuteur et donnez un feedback oral](../6-consumer/lessons/3-spoken-feedback/translations/README.fr.md) |
| 24 | [Consommateur](../6-consumer) | Prise en charge de plusieurs langues | Apprenez à prendre en charge plusieurs langues, qu'il s'agisse de la langue parlée ou des réponses de votre minuterie intelligente | [Prise en charge de plusieurs langues](../6-consumer/lessons/4-multiple-language-support/translations/README.fr.md) |
## Accès hors ligne
Il vous est possible de rouler cette documentation en utilisant [Docsify](https://docsify.js.org/#/). Clônez ce projet, [installez Docsify](https://docsify.js.org/#/quickstart) localement sur votre machine puis dans le dossier racine de ce projet, tapez `docsify serve`. Le site web sera alors hébergé localement au port 3000: `localhost:3000`
### PDF
Il vous est aussi possible de générer un fichier PDF à partir de ce contenu pour un accès hors ligne. Afin d'y parvenir, assurez vous d'[avoir npm installé](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) puis entrez cette commande à partir du dossier racine de ce projet:
```sh
npm i
npm run convert
```
### Acétates
Les acétates de plusieures leçons sont contenues dans le dossier ["slides"](../slides).
## Supportez la traduction!
Vous souhaitez contribuer à la traduction? Nous vous prions de lire le [guide de traduction](TRANSLATIONS.fr.md), faites un "fork" de ce projet sur votre compte github puis ajoutez vos changements [à l'une de nos issues de traduction](https://github.com/microsoft/IoT-For-Beginners/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation). Si vous souhaitez traduire en un nouveau language, vous devez alors lever une nouvelle issue afin de pouvoir la suivre.
## D'autres formations
Notre équipe a aussi produit d'autres cursus de formation! Nous vous invitons à y jeter un oeuil:
- [Web Dev for Beginners](https://aka.ms/webdev-beginners)
- [ML for Beginners](https://aka.ms/ml-beginners)
## Droits des images
Les [droits](../attributions.md) des images utilisées dans ce projet sont le fichier attributions.md

@ -14,7 +14,7 @@
# 物联网IoT for Beginners 课程 # 物联网IoT for Beginners 课程
Microsoft 的 Azure Cloud 大使很高兴提供关于 IoT 基础一个12个星期、24课的课程。每一课包括课前测验和课后测验、为了完成课的指示、解答、作业等。我们通过项目式的教学让你一边创建一边学习这是一种有效率巩固新技能的方式。 Microsoft 的 Azure Cloud 大使很高兴提供关于 IoT 基础一个 12 个星期、24 课的课程。每一课包括课前测验和课后测验、为了完成课的指示、解答、作业等。我们通过项目式的教学让你一边创建,一边学习,这是一种有效率巩固新技能的方式。
这些项目囊括食物从农场到桌子的过程。这包括农业、物流、制造、零售和消费者——这些都是 IoT 设备的热门行业。 这些项目囊括食物从农场到桌子的过程。这包括农业、物流、制造、零售和消费者——这些都是 IoT 设备的热门行业。
@ -23,20 +23,20 @@ Microsoft 的 Azure Cloud 大使很高兴提供关于 IoT 基础一个12个星
> Sketchnote by [Nitya Narasimhan](https://github.com/nitya). 请点击图片查看原图。 > Sketchnote by [Nitya Narasimhan](https://github.com/nitya). 请点击图片查看原图。
**多谢我们的作者[Jen Fox](https://github.com/jenfoxbot), [Jen Looper](https://github.com/jlooper), [Jim Bennett](https://github.com/jimbobbennett), 和我们的插图画家[Nitya Narasimhan](https://github.com/nitya).** **多谢我们的作者 [Jen Fox](https://github.com/jenfoxbot), [Jen Looper](https://github.com/jlooper), [Jim Bennett](https://github.com/jimbobbennett), 和我们的插图画家 [Nitya Narasimhan](https://github.com/nitya).**
**也感谢帮我们审查以及翻译这个课程的一组 [Microsoft Learn 学生大使](https://studentambassadors.microsoft.com?WT.mc_id=academic-17441-jabenn) [Aditya Garg](https://github.com/AdityaGarg00), [Anurag Sharma](https://github.com/Anurag-0-1-A), [Arpita Das](https://github.com/Arpiiitaaa), [Aryan Jain](https://www.linkedin.com/in/aryan-jain-47a4a1145/), [Bhavesh Suneja](https://github.com/EliteWarrior315), [Faith Hunja](https://faithhunja.github.io/), [Lateefah Bello](https://www.linkedin.com/in/lateefah-bello/), [Manvi Jha](https://github.com/Severus-Matthew), [Mireille Tan](https://www.linkedin.com/in/mireille-tan-a4834819a/), [Mohammad Iftekher (Iftu) Ebne Jalal](https://github.com/Iftu119), [Mohammad Zulfikar](https://github.com/mohzulfikar), [Priyanshu Srivastav](https://www.linkedin.com/in/priyanshu-srivastav-b067241ba), [Thanmai Gowducheruvu](https://github.com/innovation-platform), 和 [Zina Kamel](https://www.linkedin.com/in/zina-kamel/).** **也感谢帮我们审查以及翻译这个课程的一组 [Microsoft Learn 学生大使](https://studentambassadors.microsoft.com?WT.mc_id=academic-17441-jabenn) [Aditya Garg](https://github.com/AdityaGarg00), [Anurag Sharma](https://github.com/Anurag-0-1-A), [Arpita Das](https://github.com/Arpiiitaaa), [Aryan Jain](https://www.linkedin.com/in/aryan-jain-47a4a1145/), [Bhavesh Suneja](https://github.com/EliteWarrior315), [Faith Hunja](https://faithhunja.github.io/), [Lateefah Bello](https://www.linkedin.com/in/lateefah-bello/), [Manvi Jha](https://github.com/Severus-Matthew), [Mireille Tan](https://www.linkedin.com/in/mireille-tan-a4834819a/), [Mohammad Iftekher (Iftu) Ebne Jalal](https://github.com/Iftu119), [Mohammad Zulfikar](https://github.com/mohzulfikar), [Priyanshu Srivastav](https://www.linkedin.com/in/priyanshu-srivastav-b067241ba), [Thanmai Gowducheruvu](https://github.com/innovation-platform) 和 [Zina Kamel](https://www.linkedin.com/in/zina-kamel/).**
> **老师们**,我们为这个课程的用法 [提供了一些意见](../for-teachers.md)。如果你想自己创建课程,那我们也提供了一个[课程模板](../lesson-template/README.md). > **老师们**,我们为这个课程的用法 [提供了一些意见](../for-teachers.md)。如果你想自己创建课程,那我们也提供了一个[课程模板](../lesson-template/README.md).
> **学生们** 为了自己学习这个课程,请复刻整个项目库,再自己完成练习,从课前知识测验开始,再阅读讲座,然后完成剩余的活动。尝试通过理解课程的内容来完成项目,而不要仅仅把代码答案抄下来;然而,在每个项目课程里,你都能从 /solutions 文件夹访问那些答案代码。另外一个办法是跟朋友成立学习小组,然后一起分析内容。想进一步研究,我们鼓励你查一查[Microsoft Learn](https://docs.microsoft.com/users/jimbobbennett/collections/ke2ehd351jopwr?WT.mc_id=academic-17441-jabenn)。 > **学生们** 为了自己学习这个课程,请复刻整个项目库,再自己完成练习,从课前知识测验开始,再阅读讲座,然后完成剩余的活动。尝试通过理解课程的内容来完成项目,而不要仅仅把代码答案抄下来;然而,在每个项目课程里,你都能从 /solutions 文件夹访问那些答案代码。另外一个办法是跟朋友成立学习小组,然后一起分析内容。想进一步研究,我们鼓励你查一查 [Microsoft Learn](https://docs.microsoft.com/users/jimbobbennett/collections/ke2ehd351jopwr?WT.mc_id=academic-17441-jabenn)。
[![宣传片](../images/iot-for-beginners.png)](https://youtube.com/watch?v=bccEMm8gRuc "Promo video") [![宣传片](../images/iot-for-beginners.png)](https://youtube.com/watch?v=bccEMm8gRuc "Promo video")
> 🎥 点击以上的图片来看这个项目的宣传片! > 🎥 点击以上的图片来看这个项目的宣传片!
## 教学法 ## 教学
创建这个课程时,我们选择了两个教育原理:确保它基于项目以及它常常包括知识测验。完成课程后,学生们应该创建了一个植物监测和浇水系统、车辆追踪器、为了追踪和检查食物的智能工厂设置以及声控烹饪定时器,还有学会了物联网的基本技能,包括怎么为设备写代码、连接到云、分析遥测以及在边缘上运行人工智能。 创建这个课程时,我们选择了两个教育原理:确保它基于项目以及它常常包括知识测验。完成课程后,学生们应该创建了一个植物监测和浇水系统、车辆追踪器、为了追踪和检查食物的智能工厂设置以及声控烹饪定时器,还有学会了物联网的基本技能,包括怎么为设备写代码、连接到云、分析遥测以及在边缘上运行人工智能。
@ -44,13 +44,13 @@ Microsoft 的 Azure Cloud 大使很高兴提供关于 IoT 基础一个12个星
此外,课前的一种低风险知识测验将帮学生为学某个题目树立目标,而课后的第二个知识测验确保他把内容记住。我们设计课程的其中一个目的是让它既灵活又有趣,也给学生们完成这个课程或者课程的一个部分的选择。项目一开始会小,但 12 星期的过程中,它就会变得越来越复杂。 此外,课前的一种低风险知识测验将帮学生为学某个题目树立目标,而课后的第二个知识测验确保他把内容记住。我们设计课程的其中一个目的是让它既灵活又有趣,也给学生们完成这个课程或者课程的一个部分的选择。项目一开始会小,但 12 星期的过程中,它就会变得越来越复杂。
每个项目基于在学生们和业余爱好者能把握到的物质硬件。每个项目调某个项目领域,并提供相关的背景知识。想当个成功的开发者,理解问题的领域是有意义的,所以提供这些背景知识允许学生们在当个 IoT 开发者的景况下思考他们的IoT 解决方案和新知识。学生们将学到解决方案的理由,便得到最终使用者的赞赏。 每个项目基于在学生们和业余爱好者能把握到的物质硬件。每个项目调某个项目领域,并提供相关的背景知识。想当个成功的开发者,理解问题的领域是有意义的,所以提供这些背景知识允许学生们在当个 IoT 开发者的景况下思考他们的 IoT 解决方案和新知识。学生们将学到解决方案的理由,便得到最终使用者的赞赏。
## 硬件 ## 硬件
根据你自己的选择、知道或喜欢的编码语言、学习目标等,我们对于项目的 IoT 硬件有两个选择。我们也提供了一个“虚拟硬件”的版本,为无法拿到硬件或者想在买硬件之前学多一点儿东西的人。你能在[硬件页](../hardware.md)找到更多资料与“购物清单”它也包括来自我们朋友Seeed Studio完整套件的链接。 根据你自己的选择、知道或喜欢的编码语言、学习目标等,我们对于项目的 IoT 硬件有两个选择。我们也提供了一个“虚拟硬件”的版本,为无法拿到硬件或者想在买硬件之前学多一点儿东西的人。你能在[硬件页](../hardware.md)找到更多资料与“购物清单”;它也包括来自我们朋友 Seeed Studio 完整套件的链接。
> 💁 找一下我们的[行为守则](../CODE_OF_CONDUCT.md)、 [贡献](../CONTRIBUTING.md)和 [翻译](../TRANSLATIONS.md)的指导方针。 我们欢迎你的建设性反馈! > 💁 找一下我们的 [行为守则](../CODE_OF_CONDUCT.md)、 [贡献](../CONTRIBUTING.md) 和 [翻译](../TRANSLATIONS.md) 的指导方针。 我们欢迎你的建设性反馈!
## 每个课包括: ## 每个课包括:
@ -65,7 +65,7 @@ Microsoft 的 Azure Cloud 大使很高兴提供关于 IoT 基础一个12个星
- 作业 - 作业
- 课后测验 - 课后测验
> **关于知识测验的注意**: 课前和课后的所有知识测验将在[这个应用中](https://brave-island-0b7c7f50f.azurestaticapps.net),总共有 48 知识测验,每个有三个问题。课中将有它们的链接,但这个应用也可以在本地运行;按照`quiz-app` 文件夹中的指示。它们正在逐渐被本地化中。 > **关于知识测验的注意**: 课前和课后的所有知识测验将在[这个应用中](https://brave-island-0b7c7f50f.azurestaticapps.net),总共有 48 知识测验,每个有三个问题。课中将有它们的链接,但这个应用也可以在本地运行;按照 `quiz-app` 文件夹中的指示。它们正在逐渐被本地化中。
## 课程 ## 课程
@ -75,14 +75,14 @@ Microsoft 的 Azure Cloud 大使很高兴提供关于 IoT 基础一个12个星
| 01 | [入门](../1-getting-started) | 物联网IoT简介 | 学会 IoT 的基本原则(例如:传感器和云服务),同时设置你的第一个 IoT 设备| [物联网IoT简介](../1-getting-started/lessons/1-introduction-to-iot/README.md) | | 01 | [入门](../1-getting-started) | 物联网IoT简介 | 学会 IoT 的基本原则(例如:传感器和云服务),同时设置你的第一个 IoT 设备| [物联网IoT简介](../1-getting-started/lessons/1-introduction-to-iot/README.md) |
| 02 | [入门](../1-getting-started) | 深入了解物联网IoT | 深入了解 IoT 系统的不同部分,以及微控制器和单板机 | [深入了解物联网IoT](../1-getting-started/lessons/2-deeper-dive/README.md) | | 02 | [入门](../1-getting-started) | 深入了解物联网IoT | 深入了解 IoT 系统的不同部分,以及微控制器和单板机 | [深入了解物联网IoT](../1-getting-started/lessons/2-deeper-dive/README.md) |
| 03 | [入门](../1-getting-started) | 用传感器和执行器跟物质世界互相作用 | 学会传感器怎么从物质世界收集数据和执行器怎么发送反馈,同时创建一个夜灯 | [用传感器和执行器跟物质世界互相作用](../1-getting-started/lessons/3-sensors-and-actuators/README.md) | | 03 | [入门](../1-getting-started) | 用传感器和执行器跟物质世界互相作用 | 学会传感器怎么从物质世界收集数据和执行器怎么发送反馈,同时创建一个夜灯 | [用传感器和执行器跟物质世界互相作用](../1-getting-started/lessons/3-sensors-and-actuators/README.md) |
| 04 | [入门](../1-getting-started) | 将你的设备连接到互联网 | 学会怎么把一个 IoT 设备连接到互联网将夜灯连接到MQTT 中转站让它发送和收到消息 | [将你的设备连接到互联网](../1-getting-started/lessons/4-connect-internet/README.md) | | 04 | [入门](../1-getting-started) | 将你的设备连接到互联网 | 学会怎么把一个 IoT 设备连接到互联网,将夜灯连接到 MQTT 中转站让它发送和收到消息 | [将你的设备连接到互联网](../1-getting-started/lessons/4-connect-internet/README.md) |
| 05 | [农场](../2-farm) | 预测植物生长 | 学会怎么用 IoT 设备捕获的温度数据来预测植物生长 | [预测植物生长](../2-farm/lessons/1-predict-plant-growth/README.md) | | 05 | [农场](../2-farm) | 预测植物生长 | 学会怎么用 IoT 设备捕获的温度数据来预测植物生长 | [预测植物生长](../2-farm/lessons/1-predict-plant-growth/README.md) |
| 06 | [农场](../2-farm) | 检测土壤水分 | 学会怎么检测土壤水分以及校准土壤湿度传感器 | [检测土壤水分](../2-farm/lessons/2-detect-soil-moisture/README.md) | | 06 | [农场](../2-farm) | 检测土壤水分 | 学会怎么检测土壤水分以及校准土壤湿度传感器 | [检测土壤水分](../2-farm/lessons/2-detect-soil-moisture/README.md) |
| 07 | [农场](../2-farm) | 自动植物浇水 | 学会怎么用一个中继和 MQTT 为植物浇水使自动化和计时 | [自动植物浇水](../2-farm/lessons/3-automated-plant-watering/README.md) | | 07 | [农场](../2-farm) | 自动植物浇水 | 学会怎么用一个中继和 MQTT 为植物浇水使自动化和计时 | [自动植物浇水](../2-farm/lessons/3-automated-plant-watering/README.md) |
| 08 | [农场](../2-farm) | 将你的植物迁移到云端 | 了解云端和云端 IoT 服务与学会怎么把你的植物连接到它,而不是一个公共 MQTT中转站 | [将你的植物迁移到云端](../2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md) | | 08 | [农场](../2-farm) | 将你的植物迁移到云端 | 了解云端和云端 IoT 服务与学会怎么把你的植物连接到它,而不是一个公共 MQTT 中转站 | [将你的植物迁移到云端](../2-farm/lessons/4-migrate-your-plant-to-the-cloud/README.md) |
| 09 | [农场](../2-farm) | 将你的应用程序逻辑迁移到云端 | 学会怎么在云端写能够响应 IoT 消息的应用程序逻辑 | [将你的应用程序逻辑迁移到云端](../2-farm/lessons/5-migrate-application-to-the-cloud/README.md) | | 09 | [农场](../2-farm) | 将你的应用程序逻辑迁移到云端 | 学会怎么在云端写能够响应 IoT 消息的应用程序逻辑 | [将你的应用程序逻辑迁移到云端](../2-farm/lessons/5-migrate-application-to-the-cloud/README.md) |
| 10 | [农场](../2-farm) | 确保你的植物安全 | 了解 IoT 安全以及学会怎么用密钥和证书来确保你的植物安全 | [确保你的植物安全](../2-farm/lessons/6-keep-your-plant-secure/README.md) | | 10 | [农场](../2-farm) | 确保你的植物安全 | 了解 IoT 安全以及学会怎么用密钥和证书来确保你的植物安全 | [确保你的植物安全](../2-farm/lessons/6-keep-your-plant-secure/README.md) |
| 11 | [交通](../3-transport) | 位置追踪 | 了解 IoT 设备的 GPS位置追踪 | [位置追踪](../3-transport/lessons/1-location-tracking/README.md) | | 11 | [交通](../3-transport) | 位置追踪 | 了解 IoT 设备的 GPS 位置追踪 | [位置追踪](../3-transport/lessons/1-location-tracking/README.md) |
| 12 | [交通](../3-transport) | 存储位置数据 | 学会怎么存储 IoT 数据,让你未来能可视化或分析它 | [存储位置数据](../3-transport/lessons/2-store-location-data/README.md) | | 12 | [交通](../3-transport) | 存储位置数据 | 学会怎么存储 IoT 数据,让你未来能可视化或分析它 | [存储位置数据](../3-transport/lessons/2-store-location-data/README.md) |
| 13 | [交通](../3-transport) | 可视化位置数据 | 学会在地图上可视化位置数据以及地图怎么用 2D 来代表 3D 的世界 | [可视化位置数据](../3-transport/lessons/3-visualize-location-data/README.md) | | 13 | [交通](../3-transport) | 可视化位置数据 | 学会在地图上可视化位置数据以及地图怎么用 2D 来代表 3D 的世界 | [可视化位置数据](../3-transport/lessons/3-visualize-location-data/README.md) |
| 14 | [交通](../3-transport) | 地理围栏 | 学会地理围栏是什么以及怎么用它们来通知当供应链的车辆快到目的地时 | [地理围栏](../3-transport/lessons/4-geofences/README.md) | | 14 | [交通](../3-transport) | 地理围栏 | 学会地理围栏是什么以及怎么用它们来通知当供应链的车辆快到目的地时 | [地理围栏](../3-transport/lessons/4-geofences/README.md) |
@ -113,14 +113,15 @@ npm run convert
## 需要帮忙! ## 需要帮忙!
想贡献一个翻译?请阅读我们的[翻译指导方针](../TRANSLATIONS.md) 以及在[其中一个翻译 issue](https://github.com/microsoft/IoT-For-Beginners/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation) 添加输入。如果你想帮我们翻译成一个新语言,请一个新 issue 用于跟踪。 想贡献一个翻译?请阅读我们的[翻译指导方针](../TRANSLATIONS.md) 以及在[其中一个翻译 issue](https://github.com/microsoft/IoT-For-Beginners/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation) 添加输入。如果你想帮我们翻译成一个新语言,请提交一个新 issue 用于跟踪。
## 其它课程 ## 其它课程
我们的组生成了其它课程!查一下: 我们的团队制作了其它课程!查一下:
- [网站开发Web Dev for Beginners](https://aka.ms/webdev-beginners) - [网站开发Web Dev for Beginners](https://aka.ms/webdev-beginners)
- [机器学习ML for Beginners](https://aka.ms/ml-beginners) - [机器学习ML for Beginners](https://aka.ms/ml-beginners)
- [数据科学Data Science for Beginners](https://aka.ms/datascience-beginners)
## 图片属性 ## 图片属性

@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->
## Sécurité
Microsoft prend au sérieux la sécurité de ses produits et services logiciels, ce qui inclut tous les dépôts de code source gérés par nos organisations GitHub, dont [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), ainsi que [gestion GitHub](https://opensource.microsoft.com/).
Si vous pensez avoir découvert une faille de sécurité dans un référentiel appartenant à Microsoft et répondant à [la définition de Microsoft d'une faille de sécurité](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), veuillez nous le signaler comme décrit ci-dessous.
## Signaler les problèmes de sécurité
**Veuillez ne pas signaler les vulnérabilités de sécurité par le biais de problèmes publics sur GitHub.**
Veuillez plutôt les signaler au centre de réponse à la sécurité de Microsoft (MSRC) à l'adresse [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
Si vous préférez soumettre votre candidature sans vous connecter, envoyez un courrier électronique à l'adresse suivante : [secure@microsoft.com](mailto:secure@microsoft.com). Si possible, chiffrez votre message à l'aide de notre clé PGP ; téléchargez-la à partir de la page [Microsoft Security Response Center PGP Key](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
Vous devriez recevoir une réponse dans les 24 heures. Si, pour une raison ou une autre, ce n'est pas le cas, veuillez relancer votre demande par courrier électronique pour vous assurer que nous avons bien reçu votre message initial. Des informations supplémentaires sont disponibles à l'adresse [microsoft.com/msrc](https://www.microsoft.com/msrc).
Veuillez inclure les informations demandées ci-dessous (dans la mesure où vous pouvez les fournir) afin de nous aider à mieux comprendre la nature et la portée du problème éventuel :
* Type de problème (par exemple, dépassement de tampon, injection SQL, scripting intersite, etc.)
* Chemins d'accès complets du ou des fichiers sources liés à la manifestation du problème.
* L'emplacement du code source affecté (tag/branche/commit ou URL directe)
* Toute configuration spéciale requise pour reproduire le problème
* Instructions étape par étape pour reproduire le problème
* Preuve de concept ou code d'exploitation (si possible)
* Impact du problème, y compris la manière dont un attaquant pourrait l'exploiter.
Ces informations nous aideront à trier votre rapport plus rapidement.
Si vous faites un rapport pour une prime de bogue, des rapports plus complets peuvent contribuer à une prime plus élevée. Veuillez consulter notre [Programme de prime de bogue de Microsoft].(https://microsoft.com/msrc/bounty) page pour plus de détails sur nos programmes actifs.
## Langues préférées
Nous préférons que toutes les communications soient en anglais.
## Politique
Microsoft suit le principe de la [divulgation coordonnée des vulnérabilités](https://www.microsoft.com/en-us/msrc/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

@ -0,0 +1,11 @@
# Support
## Comment déposer des problèmes et obtenir de l'aide
Ce projet utilise GitHub Issues pour suivre les bogues et les demandes de fonctionnalités. Veuillez rechercher les problèmes existants avant de déposer de nouveaux problèmes afin d'éviter les doublons. Pour les nouvelles questions, déposez votre bogue ou votre demande de fonctionnalité dans une nouvelle question.
Pour toute aide ou question concernant l'utilisation de ce projet, veuillez nous contacter en créant une "issue" dans ce projet.
## Politique d'assistance de Microsoft
Le soutien à ce **PROJET ou PRODUIT** est limité aux ressources énumérées ci-dessus.

@ -0,0 +1,26 @@
# Contribuez en traduisant des leçons
Les traductions des leçons de ce programme sont les bienvenues !
## Directives
Il y a des dossiers [**translations**](https://github.com/microsoft/IoT-For-Beginners/tree/main/1-getting-started/lessons/1-introduction-to-iot/translations) qui contiennent les fichiers markdown traduits.
Les leçons traduites doivent respecter cette convention d'appellation :
Lorsque vous traduisez le Readme initial, reliez les autres traductions à votre readme traduit et reliez le vôtre au readme principal en anglais en utilisant les boucliers comme indiqué :
```markdown
[![Bengali](https://img.shields.io/badge/-Bengali-blue)](translations/README.bn.md)
```
**README._[language]_.md**
Dans la mesure ou _[language]_ est une abréviation linguistique de deux lettres suivant la norme ISO 639-1 (par exemple `README.es.md` pour l'espagnol et `README.nl.md` pour l'allemand).
## Questionnaires
Ajoutez votre traduction au quiz-app en ajoutant un fichier ici : https://github.com/microsoft/IoT-For-Beginners/tree/main/quiz-app/src/assets/translations. Veuillez ne pas localiser les mots 'true' ou 'false'. Merci !
## MERCI !
Nous apprécions vraiment vos efforts !

@ -0,0 +1,41 @@
# 清理你的项目
当你完成每个项目后,请删除你的云端资源。
在每个项目的课程中,也许你创建了下列的某些:
* 一个资源组
* 一个物联网中心
* 物联网设备注册
* 一个存储账户
* 一个函数应用
* 一个 Azure 地图账户
* 一个自定义视觉项目
* 一个 Azure 容器注册表
* 一个认知服务资源
这些资源中大部分都不收费 - 完全免费或者是免费层。对于规定了付费层的服务,你的使用额度会在免费范围内,或只花费几分钱。
即使成本相对较低,当你完成项目后也建议删除这些资源。例如,免费层只能有一个物联网中心,所以如果你想额外创建一个,你需要使用付费层。
你的所有服务都是在资源组内创建的,这让管理更加轻松。你可以删除某个资源组,所有资源组内的资源都会跟着删除。
在你的终端或命令提示符中运行以下命令来删除资源组:
```sh
az group delete --name <resource-group-name>
```
替代 `<resource-group-name>` 为你想删除的资源组名字。
接下来会显示下列的确认信息:
```output
Are you sure you want to perform this operation? (y/n):
```
输入 `y` 确认并删除资源组.
删除所有服务会耗费一些时间。
> 💁 你可以在 [Microsoft 文档的 Azure 资源管理器资源组和资源删除](https://docs.microsoft.com/azure/azure-resource-manager/management/delete-resource-group?WT.mc_id=academic-17441-jabenn&tabs=azure-cli) 获取更多删除资源组的相关内容。

@ -0,0 +1,27 @@
# Pour les éducateurs
Vous souhaitez utiliser ce programme dans votre classe ? N'hésitez pas à le faire !
En fait, vous pouvez l'utiliser au sein même de GitHub en utilisant GitHub Classroom.
Pour ce faire, créez ce dépôt. Vous allez devoir créer un repo pour chaque leçon, donc vous allez devoir extraire chaque dossier dans un repo séparé. De cette façon, [GitHub Classroom](https://classroom.github.com/classrooms) peut reprendre chaque leçon séparément.
Ces [instructions complètes](https://github.blog/2020-03-18-set-up-your-digital-classroom-with-github-classroom/) vous donneront une idée de la manière dont vous devez organiser votre classe.
## Modèle d'apprentissage recommandé
Vous pouvez en savoir plus sur le modèle d'apprentissage recommandé pour l'enseignement de ce programme dans notre [Guide du modèle d'apprentissage recommandé](recommended-learning-model.md).
## En utilisant le dépôt tel quel
Si vous souhaitez utiliser ce dépôt tel qu'il est actuellement, sans utiliser GitHub Classroom, c'est également possible. Il vous faudra alors indiquer à vos élèves quelle leçon ils souhaitent travailler ensemble.
Dans un format en ligne (Zoom, Teams ou autre), vous pouvez créer des salles de discussion pour les quiz et guider les étudiants pour les aider à se préparer à apprendre. Invitez ensuite les étudiants à répondre aux quiz et à soumettre leurs réponses sous forme de "questions" à un moment donné. Vous pouvez faire de même avec les devoirs, si vous souhaitez que les élèves travaillent en collaboration en plein air.
Si vous préférez un format plus privé, demandez à vos élèves de transférer le programme, leçon par leçon, vers leurs propres dépôts GitHub en tant que dépôts privés, et de vous en donner l'accès. Ils pourront alors remplir les questionnaires et les devoirs en privé et vous les soumettre via des problèmes sur votre dépôt de classe.
Il existe de nombreuses façons de faire fonctionner ce système dans un format de classe en ligne. Faites-nous part de ce qui fonctionne le mieux pour vous !
## Donnez-nous votre avis!
Nous voulons que ce programme d'études fonctionne pour vous et vos élèves. Veuillez nous faire part de [vos commentaires](https://forms.microsoft.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR2humCsRZhxNuI79cm6n0hRUQzRVVU9VVlU5UlFLWTRLWlkyQUxORTg5WS4u).

@ -0,0 +1,107 @@
# Matériel
Le **T** dans IoT est **Things** et fait référence aux dispositifs qui interagissent avec le monde qui nous entoure. Chaque projet est basé sur du matériel du monde réel disponible pour les étudiants et les amateurs. Nous proposons deux choix de matériel IoT à utiliser en fonction des préférences personnelles, des connaissances ou des préférences en matière de langage de programmation, des objectifs d'apprentissage et de la disponibilité. Nous avons également prévu une version "matériel virtuel" pour ceux qui n'ont pas accès au matériel ou qui souhaitent en savoir plus avant de s'engager dans un achat.
> 💁 Vous n'avez pas besoin d'acheter de matériel IoT pour réaliser les missions. Vous pouvez tout faire en utilisant du matériel IoT virtuel.
Les choix de matériel physique sont Arduino ou Raspberry Pi. Chaque plateforme a ses propres avantages et inconvénients, qui sont tous abordés dans l'une des premières leçons. Si vous n'avez pas encore choisi de plate-forme matérielle, vous pouvez consulter [la deuxième leçon du premier projet](./1-getting-started/lessons/2-deeper-dive/translations/README.fr.md) to decide which hardware platform you are most interested in learning.
Le matériel spécifique a été choisi pour réduire la complexité des leçons et des devoirs. Bien que d'autres matériels puissent fonctionner, nous ne pouvons pas garantir que toutes les missions seront prises en charge par votre appareil sans matériel supplémentaire. Par exemple, de nombreux appareils Arduino ne disposent pas du WiFi, qui est nécessaire pour se connecter au cloud - le terminal Wio a été choisi parce qu'il dispose du WiFi intégré.
Vous aurez également besoin de quelques articles non techniques, comme de la terre ou une plante en pot, et des fruits ou des légumes.
## Acheter les kits
![Le logo des studios Seeed](../images/seeed-logo.png)
Seeed Studios a très aimablement mis à disposition tout le matériel sous forme de kits faciles à acheter :
### Arduino - Terminal Wio
**[IoT pour les débutants avec Seeed et Microsoft - Wio Terminal Starter Kit](https://www.seeedstudio.com/IoT-for-beginners-with-Seeed-and-Microsoft-Wio-Terminal-Starter-Kit-p-5006.html)**
[![Kit matériel du terminal Wio](../images/wio-hardware-kit.png)](https://www.seeedstudio.com/IoT-for-beginners-with-Seeed-and-Microsoft-Wio-Terminal-Starter-Kit-p-5006.html)
### Raspberry Pi
**[IoT pour les débutants avec Seeed et Microsoft - Kit de démarrage Raspberry Pi 4](https://www.seeedstudio.com/IoT-for-beginners-with-Seeed-and-Microsoft-Raspberry-Pi-Starter-Kit.html)**
[![Le kit matériel du terminal Raspberry Pi](../images/pi-hardware-kit.png)](https://www.seeedstudio.com/IoT-for-beginners-with-Seeed-and-Microsoft-Raspberry-Pi-Starter-Kit.html)
## Arduino
Tout le code du dispositif pour Arduino est en C++. Pour réaliser tous les travaux, vous aurez besoin des éléments suivants :
### Carte Arduino
* [Terminal Wio](https://www.seeedstudio.com/Wio-Terminal-p-4509.html)
* *Optionnel* - Câble USB-C ou adaptateur USB-A vers USB-C. Le terminal Wio possède un port USB-C et est livré avec un câble USB-C vers USB-A. Si votre PC ou Mac ne possède que des ports USB-C, vous aurez besoin d'un câble USB-C ou d'un adaptateur USB-A vers USB-C.
### Capteurs et actionneurs spécifiques à Arduino
Ils sont spécifiques à l'utilisation du terminal Wio Arduino, et ne sont pas pertinentes pour l'utilisation du Raspberry Pi.
* [ArduCam Mini 2MP Plus - OV2640](https://www.arducam.com/product/arducam-2mp-spi-camera-b0067-arduino/)
* [ReSpeaker 2-Mics Pi HAT](https://www.seeedstudio.com/ReSpeaker-2-Mics-Pi-HAT.html)
* [Breadboard Jumper Wires](https://www.seeedstudio.com/Breadboard-Jumper-Wire-Pack-241mm-200mm-160mm-117m-p-234.html)
* Un casque ou un autre haut-parleur avec une prise de 3,5 mm, ou un haut-parleur JST tel que :
* [Mono Enclosed Speaker - 2W 6 Ohm](https://www.seeedstudio.com/Mono-Enclosed-Speaker-2W-6-Ohm-p-2832.html)
* Carte microSD de 16 Go ou moins, ainsi qu'un connecteur pour utiliser la carte SD avec votre ordinateur si vous n'en avez pas un intégré. **REMARQUE** - le terminal Wio ne prend en charge que les cartes SD jusqu'à 16 Go, il ne prend pas en charge les capacités supérieures.
## Raspberry Pi
Tout le code du dispositif pour Raspberry Pi est en Python. Pour réaliser tous les travaux, vous aurez besoin des éléments suivants :
### Carte Raspberry Pi
* [Raspberry Pi](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/)
> 💁 Les versions du Pi 2B et plus devraient fonctionner avec les devoirs de ces leçons.
* Carte microSD (vous pouvez obtenir des kits Raspberry Pi fournis avec une carte microSD), ainsi qu'un connecteur pour utiliser la carte SD avec votre ordinateur si vous n'en avez pas un intégré.
* Alimentation électrique USB (vous pouvez obtenir des kits Raspberry Pi 4 fournis avec une alimentation électrique). Si vous utilisez un Raspberry Pi 4, vous avez besoin d'une alimentation USB-C. Les appareils plus anciens ont besoin d'une alimentation micro-USB.
### Capteurs et actionneurs spécifiques à Raspberry Pi
Ils sont spécifiques à l'utilisation du Raspberry Pi et ne sont pas pertinentes pour l'utilisation du dispositif Arduino.
* [Grove Pi base hat](https://www.seeedstudio.com/Grove-Base-Hat-for-Raspberry-Pi.html)
* [Raspberry Pi Camera module](https://www.raspberrypi.org/products/camera-module-v2/)
* Microphone et speaker:
Utilisez l'une des options suivantes (ou un équivalent) :
* Tout microphone USB avec tout haut-parleur USB, ou haut-parleur avec un câble jack 3,5 mm, ou en utilisant la sortie audio HDMI si votre Raspberry Pi est connecté à un moniteur ou un téléviseur avec des haut-parleurs.
* Tout casque d'écoute USB avec un microphone intégré
* [ReSpeaker 2-Mics Pi HAT](https://www.seeedstudio.com/ReSpeaker-2-Mics-Pi-HAT.html) with
* Un casque ou un autre haut-parleur avec une prise de 3,5 mm, ou un haut-parleur JST tel que :
* [Mono Enclosed Speaker - 2W 6 Ohm](https://www.seeedstudio.com/Mono-Enclosed-Speaker-2W-6-Ohm-p-2832.html)
* [USB Speakerphone](https://www.amazon.com/USB-Speakerphone-Conference-Business-Microphones/dp/B07Q3D7F8S/ref=sr_1_1?dchild=1&keywords=m0&qid=1614647389&sr=8-1)
* [Senseur Grove Light](https://www.seeedstudio.com/Grove-Light-Sensor-v1-2-LS06-S-phototransistor.html)
* [Boutton Grove](https://www.seeedstudio.com/Grove-Button.html)
## Capteurs et actionneurs
Most of the sensors and actuators needed are used by both the Arduino and Raspberry Pi learning paths:
* [Grove LED](https://www.seeedstudio.com/Grove-LED-Pack-p-4364.html) x 2
* [Grove humidity and temperature sensor](https://www.seeedstudio.com/Grove-Temperature-Humidity-Sensor-DHT11.html)
* [Grove capacitive soil moisture sensor](https://www.seeedstudio.com/Grove-Capacitive-Moisture-Sensor-Corrosion-Resistant.html)
* [Grove relay](https://www.seeedstudio.com/Grove-Relay.html)
* [Grove GPS (Air530)](https://www.seeedstudio.com/Grove-GPS-Air530-p-4584.html)
* [Grove Time of flight Distance Sensor](https://www.seeedstudio.com/Grove-Time-of-Flight-Distance-Sensor-VL53L0X.html)
## Matériel Optionel
Les leçons sur l'arrosage automatique fonctionnent à l'aide d'un relais. En option, vous pouvez connecter ce relais à une pompe à eau alimentée par USB en utilisant le matériel indiqué ci-dessous.
* [Pompe à eau 6V](https://www.seeedstudio.com/6V-Mini-Water-Pump-p-1945.html)
* [Terminal USB](https://www.adafruit.com/product/3628)
* Tubes en silicone
* Fils rouge et noir
* Petit tournevis à tête plate
## Matériel virtuel
La route du matériel virtuel fournira des simulateurs pour les capteurs et les actionneurs, implémentés en Python. En fonction de la disponibilité de votre matériel, vous pouvez l'exécuter sur votre périphérique de développement habituel, tel qu'un Mac ou un PC, ou l'exécuter sur un Raspberry Pi et simuler uniquement le matériel dont vous ne disposez pas. Par exemple, si vous avez la caméra Raspberry Pi mais pas les capteurs Grove, vous pourrez exécuter le code du dispositif virtuel sur votre Pi et simuler les capteurs Grove, mais utiliser une caméra physique.
Le matériel virtuel utilisera le [projet CounterFit](https://github.com/CounterFit-IoT/CounterFit).
Pour suivre ces leçons, vous devez disposer d'une webcam, d'un microphone et d'une sortie audio (haut-parleurs ou casque). Ces éléments peuvent être intégrés ou externes, et doivent être configurés pour fonctionner avec votre système d'exploitation et être disponibles pour toutes les applications.
Loading…
Cancel
Save