diff --git a/.gitignore b/.gitignore index 1217dc76..b5387368 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ .vscode/ipch .ipynb_checkpoints /node_modules +quiz-app/dist diff --git a/1-getting-started/lessons/1-introduction-to-iot/pi.md b/1-getting-started/lessons/1-introduction-to-iot/pi.md index 3e8fffda..47a4ae56 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/pi.md +++ b/1-getting-started/lessons/1-introduction-to-iot/pi.md @@ -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. -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 @@ -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. 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 diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/README.hi.md b/1-getting-started/lessons/1-introduction-to-iot/translations/README.hi.md index 79b91fcd..5e4a9e63 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/README.hi.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/README.hi.md @@ -218,5 +218,4 @@ IoT कुछ व्यापक समूहों में उपयोग ## असाइनमेंट -[एक IoT प्रोजेक्ट की जाँच करें](assignment.md) -
+[एक IoT प्रोजेक्ट की जाँच करें](assignment.hi.md) \ No newline at end of file diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/README.id.md b/1-getting-started/lessons/1-introduction-to-iot/translations/README.id.md index 5fb3dcc2..aec9c927 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/README.id.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/README.id.md @@ -10,7 +10,7 @@ ## 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: diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/README.zh-cn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/README.zh-cn.md index 80baeb2f..d4739b2a 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/README.zh-cn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/README.zh-cn.md @@ -14,25 +14,25 @@ 本课程将涵盖: -* [什么是 ‘物联网(IoT)’?](#what-is-the-internet-of-things) -* [IoT 设备](#iot-devices) -* [设置你的设备](#set-up-your-device) -* [IoT 的应用场景](#applications-of-iot) -* [在你的周围的IoT 设备例子](#examples-of-iot-devices-you-may-have-around-you) +* [什么是 “物联网(IoT)”?](#什么是-物联网iot) +* [物联网设备](#物联网设备) +* [设置你的设备](#设置你的设备) +* [物联网的应用场景](#物联网的应用场景) +* [在你的周围的物联网设备例子](#在你的周围的物联网设备例子) -## 什么是 ‘物联网(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 ZB(80万亿GB)的数据。这是巨量的数据! +物联网是一个快速发展的技术领域。专家预计到 2020 底,世界上有三百亿物联网设备部署并连接到互联网。专家也预计到 2025 年,物联网设备将收集大概 80 ZB(80 万亿 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)连接——为了和外围设备(如传感器或执行器)通信 -微控制器通常是较便宜的计算设备;定制硬件的平均成本下降到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,或者在电路板上有额外的微控制器来添加这种连接。 @@ -80,21 +80,21 @@ IoT 的 **T** 代表 **Things**(物)—— 可以和物理世界交互的设 Raspberry Pi 是其中最流行的单板机。 -与微控制器一样,单板机具有CPU、内存和输入/输出引脚,但它们也有额外的功能,如一个让你连接显示器的图形芯片、音频输出,以及USB端口,它让你连接键盘、鼠标和其它标准USB设备如网络摄像头和外置储存。程序与操作系统一起存储在 SD 卡或硬盘驱动器上,而不是内置于板中的内存芯片。 +与微控制器一样,单板机具有 CPU、内存和输入/输出引脚,但它们也有额外的功能,如一个让你连接显示器的图形芯片、音频输出,以及 USB 端口,它让你连接键盘、鼠标和其它标准USB设备如网络摄像头和外置储存。程序与操作系统一起存储在 SD 卡或硬盘驱动器上,而不是内置于板中的内存芯片。 -> 🎓 你可以把单板机当成一个更小、更便宜的个人电脑,就像你现在正在用来读这篇文章的PC或Mac。可是,单板机还增加了通用输入/输出引脚(GPIO,general-purpose input/output),让你和传感器、执行器交互。 +> 🎓 你可以把单板机当成一个更小、更便宜的个人电脑,就像你现在正在用来读这篇文章的 PC 或 Mac。可是,单板机还增加了通用输入/输出引脚(GPIO,general-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)查到完成作业所需的硬件。 > 💁 你不需要为了完成作业而买任何物联网硬件;虚拟单板机即可完成所有任务。 -要使用哪种硬件是你的选择,取决于你家里或学校里有什么,以及你知道或想学的编程语言。两种硬件都使用同样的传感器生态系统,所以万一你想途中改变你的选择,你也不需要替换大部分的套件。用虚拟单板机相当于在Raspberry Pi上学习,如果你最后购买了设备和传感器,大部分代码都可以转移到 Pi 上。 +要使用哪种硬件是你的选择,取决于你家里或学校里有什么,以及你知道或想学的编程语言。两种硬件都使用同样的传感器生态系统,所以万一你想途中改变你的选择,你也不需要替换大部分的套件。用虚拟单板机相当于在 Raspberry Pi 上学习,如果你最后购买了设备和传感器,大部分代码都可以转移到 Pi 上。 ### Arduino 开发者套件 @@ -104,7 +104,7 @@ Raspberry Pi 是其中最流行的单板机。 ### 单板机开发者套件 -如果你对使用单板机学物联网开发有兴趣,你可以用Raspberry Pi(树莓派),或者在你的电脑运行的虚拟设备来完成作业。 +如果你对使用单板机学物联网开发有兴趣,你可以用 Raspberry Pi(树莓派),或者在你的电脑运行的虚拟设备来完成作业。 你需要对 Python 有基本的理解,因为将来的课程只会教授与所使用的传感器和执行器相关的代码,以及与云交互的库。 @@ -115,7 +115,7 @@ Raspberry Pi 是其中最流行的单板机。 作业将用 [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 个课程创造一个物联网夜灯,而这是第一步。 * [Arduino:Wio Terminal](wio-terminal.zh-cn.md) -* [单板机:Raspberry Pi](../pi.md) +* [单板机:Raspberry Pi](pi.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)模型学习故障前的数据,再利用它预报其它未来的故障;这就叫做“预测性维护”。 -为了养活不断增长的人口,数字农业非常重要,尤其是对于依靠[自给农业](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)** *(亵渎警告)* 有几个关于消费物联网失败的好例子。 -* [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/) *(触发警告:未经同意的偷窥)* ## 作业 diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/Assignment.hi.md b/1-getting-started/lessons/1-introduction-to-iot/translations/assignment.hi.md similarity index 100% rename from 1-getting-started/lessons/1-introduction-to-iot/translations/Assignment.hi.md rename to 1-getting-started/lessons/1-introduction-to-iot/translations/assignment.hi.md diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/assignment.zh-cn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/assignment.zh-cn.md index e7e8d448..dcd78565 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/assignment.zh-cn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/assignment.zh-cn.md @@ -2,9 +2,9 @@ ## 指示 -从智慧农场到智慧城市、医疗保健监测系统、交通或利用公共空间等,世界上有非常多IoT项目。 +从智慧农场到智慧城市、医疗保健监测系统、交通或利用公共空间等,世界上有非常多 IoT 项目。 -在互联网寻找一个让你感兴趣的IoT项目的细节,最好是离你不太远的。解释一下项目的好处与坏处,例如:它带来的益处、它带来的任何麻烦以及他怎么顾及隐私。 +在互联网寻找一个让你感兴趣的 IoT 项目的细节,最好是离你不太远的。解释一下项目的好处与坏处,例如:它带来的益处、它带来的任何麻烦以及他怎么顾及隐私。 ## 评分表 diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.bn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.bn.md index 6bf87659..4a3572f8 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.bn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.bn.md @@ -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. কানেক্ট হয়ে যাওয়ার পরে [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 (হ্যালো ওয়ার্লড) diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.hi.md b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.hi.md index 35d3cbfd..abe81871 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.hi.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.hi.md @@ -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. कनेक्ट होने के बाद, [पाइलेंस एक्सटेंशन](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) निर्देशों का पालन करें। ## हैलो वर्ल्ड diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.pt.md b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.pt.md index 6d4be11a..e0ae8c94 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.pt.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.pt.md @@ -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. -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 @@ -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. 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 diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md index dcee1b19..71466a9f 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/pi.zh-cn.md @@ -67,7 +67,7 @@ > 💁 如果你有更喜欢的工具,你也可以自由使用任意的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到树莓派 -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 diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.pt.md b/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.pt.md index ccf596f7..e041e696 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.pt.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.pt.md @@ -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. -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. @@ -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: ```sh - CounterFit + counterfit ``` 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) ``` - 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 `, substituindo `` 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). -😀 Sua conexão com o hardware foi um sucesso! \ No newline at end of file +😀 Sua conexão com o hardware foi um sucesso! diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.zh-cn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.zh-cn.md index e634044f..5ab1989a 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.zh-cn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/virtual-device.zh-cn.md @@ -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 的说明,因为我们需要在每个项目中安装它。 @@ -24,15 +24,15 @@ 第一次用新的编程语言或技术,通常以创建一个“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 的强大功能之一是能够安装 [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 虚拟环境 @@ -45,7 +45,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org); cd nightlight ``` -2. 现在,运行以下的程序来在`.venv` 文件夹中创建一个虚拟环境 +2. 现在,运行以下的程序来在 `.venv` 文件夹中创建一个虚拟环境 ```sh python3 -m venv .venv @@ -82,7 +82,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org); > 💁 你的 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 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 运行: @@ -120,13 +120,13 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org); 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 和 Linux,VS 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 和 Linux,VS Code 默认被加进你的 PATH。 3. 当 VS Code 被启动,它会激活 Python 虚拟环境。被选择的虚拟环境将在底部状态栏出现: ![ 被选择的虚拟环境将在 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) @@ -138,7 +138,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org); 如果你没有 `.venv` 的字首在提示上,虚拟环境不在终端中活动。 -5. 为了启动一个新的 VS Code 终端,选择*Terminal -> New Terminal 或按`` CTRL+` ``。这个新终端将加载虚拟环境,以及激活它的调用将在终端中出现。提示也会有虚拟环境的名字(`.venv`): +5. 为了启动一个新的 VS Code 终端,选择 *Terminal -> New Terminal 或按`` CTRL+` ``。这个新终端将加载虚拟环境,以及激活它的调用将在终端中出现。提示也会有虚拟环境的名字(`.venv`): ```output ➜ 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 应用: ```sh - CounterFit + counterfit ``` 应用将开始运行以及在你的网页浏览器打开: @@ -193,7 +193,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org); 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 ` 运行 CounterFit,在`` 填着你想用的端口。 @@ -201,7 +201,7 @@ Python 的强大功能之一是能够安装 [pip 软件包](https://pypi.org); ![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) diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.bn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.bn.md index a02bc086..d40c781b 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.bn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.bn.md @@ -17,7 +17,7 @@ Wio Terminal ব্যবহার করার জন্য, আমাদের > 💁 আরডুইনো ডেভলপমেন্ট এর জন্য আর একটি ভালো আই.ডি.ই হলো [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 কে কম্পিউটার এর সাথে সংযুক্ত করব। এটির নিচের দিকে একটি ইউএসবি-সি পোর্ট আছে, সেটিকে আমরা আমাদের কম্পিউটার এর ইউএসবি পোর্ট এর সাথে সংযোগ দিব। উইও টার্মিনালে ইউএসবি-সি ও ইউএসবি-এ ক্যাবল থাকে। যদি আমাদের কম্পিউটারে শুধু ইউএসবি-সি পোর্ট থেকে, তাহলে আমাদের হয় ইউএসবি-সি ক্যাবল অথবা ইউএসবি-এ ক্যাবলের প্রয়োজন হবে ইউএসবি-সি অ্যাডাপ্টার এ সংযোগ দেওয়ার জন্য। diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.pt.md b/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.pt.md index 1fe5e7aa..21d31c96 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.pt.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.pt.md @@ -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. -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. diff --git a/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.zh-cn.md b/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.zh-cn.md index 19bd985b..9d77e621 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.zh-cn.md +++ b/1-getting-started/lessons/1-introduction-to-iot/translations/wio-terminal.zh-cn.md @@ -16,7 +16,7 @@ > 💁 另外一个为 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 适配器。 diff --git a/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md b/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md index 132186ba..4b6e8d33 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md +++ b/1-getting-started/lessons/1-introduction-to-iot/virtual-device.md @@ -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. -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. @@ -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: ```sh - CounterFit + counterfit ``` The app will start running and open in your web browser: diff --git a/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md b/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md index cd45180d..15368740 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md +++ b/1-getting-started/lessons/1-introduction-to-iot/wio-terminal.md @@ -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. -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. @@ -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. +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. 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 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. diff --git a/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md b/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md index 78e78cc6..745ca899 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/pi-actuator.md @@ -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! - > 💁 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: diff --git a/1-getting-started/lessons/3-sensors-and-actuators/translations/assignment.hi.md b/1-getting-started/lessons/3-sensors-and-actuators/translations/assignment.hi.md new file mode 100644 index 00000000..0ad7dc00 --- /dev/null +++ b/1-getting-started/lessons/3-sensors-and-actuators/translations/assignment.hi.md @@ -0,0 +1,17 @@ +# रिसर्च सेंसर और एक्चुएटर्स + +## निर्देश + +इस पाठ में सेंसर और एक्चुएटर्स शामिल थे। अनुसंधान करें और एक सेंसर तथा एक एक्चुएटर का वर्णन करें जिसका उपयोग IoT देव किट के साथ किया जा सकता है, जिसमें शामिल हैं: + +* यह क्या करता है +* अंदर इस्तेमाल होने वाले इलेक्ट्रॉनिक्स / हार्डवेयर +* क्या यह एनालॉग या डिजिटल है +* इनपुट या माप की यूनिट और रेंज क्या है + +## रूब्रिक + +| मानदंड | अनुकरणीय | पर्याप्त | सुधार की जरूरत | +| -------- | ------------- | -------- | ----------------- | +| एक सेंसर का वर्णन करें | ऊपर सूचीबद्ध सभी 4 अनुभागों के विवरण सहित एक सेंसर का वर्णन किया गया है। | एक सेंसर का वर्णन किया गया है, लेकिन ऊपर के केवल 2-3 अनुभाग प्रदान करने में सक्षम थे | एक सेंसर का वर्णन किया है, लेकिन ऊपर दिए गए अनुभागों में से केवल 1 प्रदान करने में सक्षम थे | +| एक एक्चुएटर का वर्णन करें | ऊपर सूचीबद्ध सभी 4 वर्गों के विवरण सहित एक एक्चुएटर का वर्णन किया गया है। | एक एक्चुएटर का वर्णन किया गया है, लेकिन ऊपर के केवल 2-3 अनुभाग प्रदान करने में सक्षम थे | एक एक्चुएटर का वर्णन किया है, लेकिन ऊपर के केवल 1 अनुभाग प्रदान करने में सक्षम थे | diff --git a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.hi.md b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.hi.md new file mode 100644 index 00000000..73f52e2c --- /dev/null +++ b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.hi.md @@ -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) फोल्डर में पा सकते हैं। + +😀आपका रात्रिकालीन प्रोग्राम सफल रहा! diff --git a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md index 24b8541e..98207602 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-actuator.zh-cn.md @@ -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 检查光照等级。 -如果光照小于300 - 打开LED +如果光照小于 300 + 打开 LED 否则 - 关闭LED + 关闭 LED ``` -### 连接LED +### 连接 LED -Grove LED 作为一个模块出现,以及一系列可供你选择颜色的LED。 +Grove LED 作为一个模块出现,以及一系列可供你选择颜色的 LED。 -#### 任务 - 连接LED +#### 任务 - 连接 LED -连接LED。 +连接 LED。 ![一个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) ## 编写夜灯程序 -现在夜灯可以用Grove光照传感器和Grove LED来编码了。 +现在夜灯可以用 Grove 光照传感器和 Grove LED 来编码了。 ### 任务 - 编写夜灯程序 @@ -52,26 +52,26 @@ Grove LED 作为一个模块出现,以及一系列可供你选择颜色的LED 1. 打开树莓派并等待启动完成。 -1. 直接在树莓派上或者通过远程SSH扩展,打开你在这个作业上一部分创建的VS Code中的夜灯项目。 +1. 直接在树莓派上或者通过远程 SSH 扩展,打开你在这个作业上一部分创建的 VS Code 中的夜灯项目。 -1. 把下面的代码加到`app.py`文件中来导入一个需要的函数库。这一行需要加在文件顶部,在其他`import`代码行下面。 +1. 把下面的代码加到 `app.py` 文件中来导入一个需要的函数库。这一行需要加在文件顶部,在其他 `import` 代码行下面。 ```python 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 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 if light < 300: @@ -80,13 +80,13 @@ Grove LED 作为一个模块出现,以及一系列可供你选择颜色的LED 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值就是0v,1值就是设备的最大电压。对于插着Grove传感器和执行器的树莓派而言,1的电压就是3.3V。 + > 💁 当发送数字值到执行器的时候,0 值就是 0V,1 值就是设备的最大电压。对于插着 Grove 传感器和执行器的树莓派而言,1 的电压就是 3.3V。 -1. 从VS Code终端,运行下面的命令来运行你的Python应用: +1. 从 VS Code 终端,运行下面的命令来运行你的 Python 应用: ```sh python3 app.py @@ -104,12 +104,12 @@ Grove LED 作为一个模块出现,以及一系列可供你选择颜色的LED Light level: 290 ``` -1. 遮挡和揭开光照传感器,会观察到光照等级等于300或更小时LED会点亮,如果光照等级比300大LED就会关闭。 +1. 遮挡和揭开光照传感器,会观察到光照等级等于 300 或更小时 LED 会点亮,如果光照等级比 300 大 LED 就会关闭。 - > 💁 如果LED没有点亮,确保它是正确方向连接的,而且旋转按钮是设置成全开的。 + > 💁 如果 LED 没有点亮,确保它是正确方向连接的,而且旋转按钮是设置成全开的。 ![连接到树莓派的LED随着光照等级改变点亮和关闭](../../../../images/pi-running-assignment-1-1.gif) -> 💁 你可以在[code-actuator/pi](../code-actuator/pi)文件夹里找到这份代码。 +> 💁 你可以在 [code-actuator/pi](../code-actuator/pi) 文件夹里找到这份代码。 😀 你的夜灯程序就成功了! diff --git a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.hi.md b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.hi.md new file mode 100644 index 00000000..ed7d00f5 --- /dev/null +++ b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.hi.md @@ -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) फ़ोल्डर में पा सकते हैं। + +😀 आपके नाइटलाइट प्रोग्राम में सेंसर जोड़ना सफल रहा! diff --git a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.zh-cn.md b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.zh-cn.md index 12d85e52..4c808af2 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.zh-cn.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/translations/pi-sensor.zh-cn.md @@ -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) -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. 直接在树莓派上或者通过远程SSH扩展,打开你在这个作业上一部分创建的VS Code中的夜灯项目。 +1. 直接在树莓派上或者通过远程SSH扩展,打开你在这个作业上一部分创建的 VS Code 中的夜灯项目。 -1. 打开`app.py`文件并删除里面的所有代码。 +1. 打开 `app.py` 文件并删除里面的所有代码。 -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`。这个函数库里有和Grove光照传感器交互的代码,在设置树莓派的时候就已经全局安装了。 + `import time` 语句导入了 `time` 模块,在这个作业的后面会用到这个模块。 + `from grove.grove_light_sensor_v1_2 import GroveLightSensor` 语句从 Grove Python 函数库导入了 `GroveLightSensor`。这个函数库里有和 Grove 光照传感器交互的代码,在设置树莓派的时候就已经全局安装了。 + 1. 在上面代码的后面增加下面的代码来创建一个管理光照传感器的类的实例: ```python light_sensor = GroveLightSensor(0) ``` - `light_sensor = GroveLightSensor(0)`这一行创建了一个连接到 **A0** 引脚的`GroveLightSensor`类的实例,**A0** 也就是光照传感器连接的那个引脚。 - -1. 在上面的代码后面增加一个无限循环代码来获取光照传感器数值并打印到终端: + `light_sensor = GroveLightSensor(0)` 这一行创建了一个连接到 **A0** 引脚的 `GroveLightSensor` 类的实例,**A0** 也就是光照传感器连接的那个引脚。 + +1. 在上面的代码后面增加一段无限循环代码,来获取光照传感器数值并打印到终端: ```python while True: @@ -65,15 +65,15 @@ print('Light level:', light) ``` - 使用`GroveLightSensor`类的`light`属性可以来获取 0-1023 的当前光照等级值,这个属性从引脚读取模拟量,然后这个值会被打印到终端。 - -1. 在`loop`的结尾增加一个1秒的短暂休眠,因为光照等级不需要一直不断地读取。一个休眠可以减少设备的能源消耗。 + 使用 `GroveLightSensor` 类的 `light` 属性可以来获取 0-1023 的当前光照等级值,这个属性从引脚读取模拟量,然后这个值会被打印到终端。 + +1. 在 `loop` 的结尾增加一个 1 秒的短暂休眠,因为光照等级不需要一直不断地读取。一个休眠可以减少设备的能源消耗。 ```python time.sleep(1) ``` - -1. 从VS Code终端,运行下面的命令来运行你的Python应用: + +1. 从 VS Code 终端,运行下面的命令来运行你的 Python 应用: ```sh python3 app.py @@ -91,6 +91,6 @@ Light level: 290 ``` -> 💁 你可以在[code-sensor/pi](../code-sensor/pi)文件夹找到这份代码。 +> 💁 你可以在 [code-sensor/pi](../code-sensor/pi) 文件夹找到这份代码。 -😀 给你的夜灯增加一个传感器程序就成功了! \ No newline at end of file +😀 给你的夜灯增加一个传感器程序就成功了! diff --git a/1-getting-started/lessons/4-connect-internet/README.md b/1-getting-started/lessons/4-connect-internet/README.md index 18233d7a..bd43c2c3 100644 --- a/1-getting-started/lessons/4-connect-internet/README.md +++ b/1-getting-started/lessons/4-connect-internet/README.md @@ -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. -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 diff --git a/1-getting-started/lessons/4-connect-internet/translations/README.ar.md b/1-getting-started/lessons/4-connect-internet/translations/README.ar.md index fc5e8bf8..072c1566 100644 --- a/1-getting-started/lessons/4-connect-internet/translations/README.ar.md +++ b/1-getting-started/lessons/4-connect-internet/translations/README.ar.md @@ -148,7 +148,7 @@ MQTT لديها وسيط واحد وعملاء متعددين. يتصل جميع > 💁 لك مطلق الحرية في استخدام أي محرر Python IDE أو محرر لهذه الدروس إذا كان لديك أداة مفضلة ، ولكن الدروس ستعطي إرشادات تستند إلى استخدام VS Code. -1. قم بتثبيت امتداد VS Code Pylance. هذا امتداد لـ VS Code الذي يوفر دعم لغة Python. راجع Pylance extension documentation للحصول على إرشادات حول تثبيت هذا الامتداد في VS Code. +1. قم بتثبيت امتداد VS Code Pylance. هذا امتداد لـ VS Code الذي يوفر دعم لغة Python. راجع Pylance extension documentation للحصول على إرشادات حول تثبيت هذا الامتداد في VS Code. #### تكوين بيئة Python الافتراضية diff --git a/1-getting-started/lessons/4-connect-internet/translations/README.bn.md b/1-getting-started/lessons/4-connect-internet/translations/README.bn.md index 99dbdc29..fe2c7c55 100644 --- a/1-getting-started/lessons/4-connect-internet/translations/README.bn.md +++ b/1-getting-started/lessons/4-connect-internet/translations/README.bn.md @@ -150,7 +150,7 @@ Python এবং 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) থেকে দেখে নেই। #### পাইথনের ভার্চুয়াল এনভায়রনমেন্ট কনফিগারেশন diff --git a/1-getting-started/Translations/README.ar.md b/1-getting-started/translations/README.ar.md similarity index 96% rename from 1-getting-started/Translations/README.ar.md rename to 1-getting-started/translations/README.ar.md index a0696388..e9f8068a 100644 --- a/1-getting-started/Translations/README.ar.md +++ b/1-getting-started/translations/README.ar.md @@ -13,4 +13,4 @@ #
الاعتمادات
- [Jim Bennett](https://GitHub.com/JimBobBennett) كتبت جميع الدروس مع ♥️ من قبل \ No newline at end of file + [Jim Bennett](https://GitHub.com/JimBobBennett) كتبت جميع الدروس مع ♥️ من قبل diff --git a/1-getting-started/Translations/README.bn.md b/1-getting-started/translations/README.bn.md similarity index 100% rename from 1-getting-started/Translations/README.bn.md rename to 1-getting-started/translations/README.bn.md diff --git a/1-getting-started/Translations/README.es.md b/1-getting-started/translations/README.es.md similarity index 100% rename from 1-getting-started/Translations/README.es.md rename to 1-getting-started/translations/README.es.md diff --git a/1-getting-started/Translations/README.hi.md b/1-getting-started/translations/README.hi.md similarity index 100% rename from 1-getting-started/Translations/README.hi.md rename to 1-getting-started/translations/README.hi.md diff --git a/1-getting-started/Translations/README.id.md b/1-getting-started/translations/README.id.md similarity index 87% rename from 1-getting-started/Translations/README.id.md rename to 1-getting-started/translations/README.id.md index 438bdaad..cd827385 100644 --- a/1-getting-started/Translations/README.id.md +++ b/1-getting-started/translations/README.id.md @@ -1,6 +1,6 @@ # 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) diff --git a/1-getting-started/Translations/README.ja.md b/1-getting-started/translations/README.ja.md similarity index 100% rename from 1-getting-started/Translations/README.ja.md rename to 1-getting-started/translations/README.ja.md diff --git a/1-getting-started/Translations/README.pt.md b/1-getting-started/translations/README.pt.md similarity index 100% rename from 1-getting-started/Translations/README.pt.md rename to 1-getting-started/translations/README.pt.md diff --git a/1-getting-started/Translations/README.zh-cn.md b/1-getting-started/translations/README.zh-cn.md similarity index 100% rename from 1-getting-started/Translations/README.zh-cn.md rename to 1-getting-started/translations/README.zh-cn.md diff --git a/1-getting-started/Translations/wio-running-assignment-1-1.gif b/1-getting-started/translations/wio-running-assignment-1-1.gif similarity index 100% rename from 1-getting-started/Translations/wio-running-assignment-1-1.gif rename to 1-getting-started/translations/wio-running-assignment-1-1.gif diff --git a/2-farm/lessons/1-predict-plant-growth/code-server/temperature-sensor-server/app.py b/2-farm/lessons/1-predict-plant-growth/code-server/temperature-sensor-server/app.py index 697984b8..7a4d11ff 100644 --- a/2-farm/lessons/1-predict-plant-growth/code-server/temperature-sensor-server/app.py +++ b/2-farm/lessons/1-predict-plant-growth/code-server/temperature-sensor-server/app.py @@ -5,7 +5,7 @@ import paho.mqtt.client as mqtt from os import path import csv -import datetime +from datetime import datetime id = '' diff --git a/2-farm/lessons/1-predict-plant-growth/translations/README.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/README.fr.md new file mode 100644 index 00000000..2efa34c4 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/README.fr.md @@ -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 (CO2) 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 CO2 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 CO2, 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 DJCC (degrés-jours de croissance en Celsius) sont l'équivalent de 9 DJCF (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 +* **Tmax** - il s'agit de la température maximale quotidienne en degrés Celsius +* **Tmin** - il s'agit de la température minimale quotidienne en degrés Celsius +* **Tbase** - c'est la température de base des plantes en degrés Celsius + +> 💁 Il existe certaines variations impliquant Tmax au delà de 30°C ou Tmin en deça Tbase, 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 : + +* Tmax = 16 +* Tmin = 12 +* Tbase = 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) diff --git a/2-farm/lessons/1-predict-plant-growth/translations/assignment.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/assignment.fr.md new file mode 100644 index 00000000..59dbdbe3 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/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 | diff --git a/2-farm/lessons/1-predict-plant-growth/translations/pi-temp.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/pi-temp.fr.md new file mode 100644 index 00000000..379c6a39 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/pi-temp.fr.md @@ -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 ! diff --git a/2-farm/lessons/1-predict-plant-growth/translations/single-board-computer-temp-publish.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/single-board-computer-temp-publish.fr.md new file mode 100644 index 00000000..f65a68c5 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/single-board-computer-temp-publish.fr.md @@ -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. diff --git a/2-farm/lessons/1-predict-plant-growth/translations/virtual-device-temp.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/virtual-device-temp.fr.md new file mode 100644 index 00000000..2eae15e8 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/virtual-device-temp.fr.md @@ -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 ! diff --git a/2-farm/lessons/1-predict-plant-growth/translations/wio-terminal-temp-publish.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/wio-terminal-temp-publish.fr.md new file mode 100644 index 00000000..f4866429 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/wio-terminal-temp-publish.fr.md @@ -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! diff --git a/2-farm/lessons/1-predict-plant-growth/translations/wio-terminal-temp.fr.md b/2-farm/lessons/1-predict-plant-growth/translations/wio-terminal-temp.fr.md new file mode 100644 index 00000000..e75435e9 --- /dev/null +++ b/2-farm/lessons/1-predict-plant-growth/translations/wio-terminal-temp.fr.md @@ -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 ` : + + ```cpp + #include + #include + ``` + + 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 ! diff --git a/2-farm/lessons/2-detect-soil-moisture/translations/README.fr.md b/2-farm/lessons/2-detect-soil-moisture/translations/README.fr.md new file mode 100644 index 00000000..9b7605ec --- /dev/null +++ b/2-farm/lessons/2-detect-soil-moisture/translations/README.fr.md @@ -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 (I2C) + +I2C, 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 I2C 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 I2C 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. + +I2C 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. + +I2C 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 I2C sockets on the board you can use to communicate with I2C sensors. Analog Grove sensors also use I2C 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 I2C 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 I2C, 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 [Steinhart–Hart equation](https://wikipedia.org/wiki/Steinhart–Hart_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) +* [I2C Wikipedia page](https://wikipedia.org/wiki/I²C) +* [Zigbee Wikipedia page](https://wikipedia.org/wiki/Zigbee) + +## Assignment + +[Calibrate your sensor](assignment.md) diff --git a/2-farm/lessons/3-automated-plant-watering/README.md b/2-farm/lessons/3-automated-plant-watering/README.md index f65ffec5..7801ea13 100644 --- a/2-farm/lessons/3-automated-plant-watering/README.md +++ b/2-farm/lessons/3-automated-plant-watering/README.md @@ -18,7 +18,7 @@ In this lesson we'll cover: * [Control a relay](#control-a-relay) * [Control your plant over MQTT](#control-a-relay) * [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 diff --git a/2-farm/lessons/5-migrate-application-to-the-cloud/README.md b/2-farm/lessons/5-migrate-application-to-the-cloud/README.md index 3811b456..ea6742a5 100644 --- a/2-farm/lessons/5-migrate-application-to-the-cloud/README.md +++ b/2-farm/lessons/5-migrate-application-to-the-cloud/README.md @@ -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 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. @@ -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. - ✅ 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: diff --git a/2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.bn.md b/2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.bn.md index 462b1646..c024439f 100644 --- a/2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.bn.md +++ b/2-farm/lessons/5-migrate-application-to-the-cloud/translations/README.bn.md @@ -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. 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)। এটি লোকাল ভাবে চলে, তবে ক্লাউড স্টোরেজের মতো কাজ করে। @@ -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` অংশে এর কনফিগারেশনগুলো রয়েছে। এর গুরুত্বপূর্ণ কিছু ভ্যালু হলো : diff --git a/2-farm/translations/README.fr.md b/2-farm/translations/README.fr.md new file mode 100644 index 00000000..5bf905cd --- /dev/null +++ b/2-farm/translations/README.fr.md @@ -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) diff --git a/3-transport/lessons/2-store-location-data/assignment.md b/3-transport/lessons/2-store-location-data/assignment.md index 42a32714..790dd5eb 100644 --- a/3-transport/lessons/2-store-location-data/assignment.md +++ b/3-transport/lessons/2-store-location-data/assignment.md @@ -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: -* [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 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 diff --git a/3-transport/lessons/2-store-location-data/translations/.dummy.md b/3-transport/lessons/2-store-location-data/translations/.dummy.md deleted file mode 100644 index 6e7db247..00000000 --- a/3-transport/lessons/2-store-location-data/translations/.dummy.md +++ /dev/null @@ -1,9 +0,0 @@ -# Dummy File - -This file acts as a placeholder for the `translations` folder.
-**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! diff --git a/3-transport/lessons/2-store-location-data/translations/README.bn.md b/3-transport/lessons/2-store-location-data/translations/README.bn.md new file mode 100644 index 00000000..c7699547 --- /dev/null +++ b/3-transport/lessons/2-store-location-data/translations/README.bn.md @@ -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-` দেয়া যেতে পারে। + + > 💁 যদি পূর্ববর্তী প্রজেক্টে ব্যবহৃত আইওটি হাব থাকে, সেটিও পুনরায় ব্যবহার করা যাবে। এক্ষেত্রে আইওটি হাব এবং রিসোর্স গ্রুপের নাম সঠিকভাবে ব্যবহার করতে হবে সার্ভিস তৈরির সময়। + +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" : , + "lon" : + } + } + ``` + +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": , + "timestamp" :