From cac3ccf07b9127780a5d2b0616ae5123d4ddce1d Mon Sep 17 00:00:00 2001 From: coolAryan <42404394+coolAryan@users.noreply.github.com> Date: Wed, 2 Jun 2021 07:33:50 +0530 Subject: [PATCH 1/2] done some Grammatical Changes and attached Link (#42) * done some Grammatical Changes and attached Link * Update README.md Co-authored-by: Jim Bennett --- 1-getting-started/lessons/1-introduction-to-iot/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1-getting-started/lessons/1-introduction-to-iot/README.md b/1-getting-started/lessons/1-introduction-to-iot/README.md index ee2d1a87..f2bd8dda 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/README.md +++ b/1-getting-started/lessons/1-introduction-to-iot/README.md @@ -64,7 +64,7 @@ Microcontrollers are typically low cost computing devices, with average prices f ![A Wio Terminal](../../../images/wio-terminal.png) -> πŸ’ When searching the Internet for microcontrollers be wary of searching for the term **MCU** as this will bring back a lot of results for the Marvel Cinematic Universe, not microcontrollers. +> πŸ’ When searching the Internet for microcontrollers be observant of searching for the term **MCU** as this will bring back a lot of results for the Marvel Cinematic Universe, not microcontrollers. Microcontrollers are designed to be programmed to do a limited number of very specific tasks, rather than being general-purpose computers like PCs or Macs. Except for very specific scenarios, you can't connect a monitor, keyboard and mouse and use them for general purpose tasks. @@ -74,7 +74,7 @@ Microcontroller developer kits usually come with additional sensors and actuator ### Single-board computers -A single-board computer is a small computing devices that has all the elements of a complete computer contained on a single small board. These are devices that have specifications close to a desktop or laptop PC or Mac, run a full operating system, but are small, use lower power, and are substantially cheaper. +A single-board computer is a small computing device that has all the elements of a complete computer contained on a single small board. These are devices that have specifications close to a desktop or laptop PC or Mac, run a full operating system, but are small, use less power, and are substantially cheaper. ![A Raspberry Pi 4](../../../images/raspberry-pi-4.jpg) @@ -86,7 +86,7 @@ Like a microcontroller, single-board computers have a CPU, memory and input/outp > πŸŽ“ You can think of a single-board computer as a smaller, cheaper version of the PC or Mac you are reading this on, with the addition of GPIO (general-purpose input/output) pins to interact with sensors and actuators. -SIngle-board computers are fully-featured computers, so can be programmed in any language. IoT devices are typically programmed in Python. +Single-board computers are fully-featured computers, so can be programmed in any language. IoT devices are typically programmed in Python. ### Hardware choices for the rest of the lessons From a5e02a5639fff0828a13f530bb31a4b1231a03da Mon Sep 17 00:00:00 2001 From: Lateefah Bello <2019cinnamon@gmail.com> Date: Wed, 2 Jun 2021 18:03:42 +0100 Subject: [PATCH 2/2] Fixed typo and broken links (#38) * Fixed typos and broken links The link to hardware.md was broken in majority of the files that I have read, I fixed it in addition to correcting some typos. * Update README.md * Update README.md * fixed typos and broken links * Completed chapter one review * Update README.md * Update app.py * Update virtual-device.md * worked on the request * fixed up the apps * Update README.md --- .../1-introduction-to-iot/virtual-device.md | 1 + .../lessons/3-sensors-and-actuators/README.md | 2 +- .../wio-terminal-actuator.md | 2 +- .../lessons/4-connect-internet/README.md | 16 +++++++++------- .../virtual-device/nightlight/app.py | 1 + .../single-board-computer-mqtt.md | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) 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 dc49f29e..bc37888d 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 @@ -119,6 +119,7 @@ Create a Python application to print `"Hello World"` to the console. ```sh code . ``` + > πŸ’ If your terminal returns `command not found` on macOS it means VS Code has not been added to PATH, you can [add VS Code to PATH](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line) and run the command afterwards. VS Code is installed to PATH by default on Windows and Linux. 1. When VS Code launches, it will activate the Python virtual environment. You will see this in the bottom status bar: diff --git a/1-getting-started/lessons/3-sensors-and-actuators/README.md b/1-getting-started/lessons/3-sensors-and-actuators/README.md index 55887a23..436d5ebd 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/README.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/README.md @@ -112,7 +112,7 @@ Actuators are the opposite of sensors - they convert an electrical signal from y Some common actuators include: * LED - these emit light when turned on -* Speaker - these emil sound based on the signal sent to them, from a basic buzzer to an audio speaker that can play music +* Speaker - these emit sound based on the signal sent to them, from a basic buzzer to an audio speaker that can play music * Stepper motor - these convert a signal into a defined amount of rotation, such as turning a dial 90Β° * Relay - these are switches that can be turned on or off by an electrical signal. They allow a small voltage from an IoT device to turn on larger voltages. * Screens - these are more complex actuators and show information on a multi-segment display. Screens vary from simple LED displays to high-resolution video monitors. diff --git a/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md b/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md index e99b8aab..d4dfd1db 100644 --- a/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md +++ b/1-getting-started/lessons/3-sensors-and-actuators/wio-terminal-actuator.md @@ -34,7 +34,7 @@ Connect the LED. One of the legs of the LED is the positive pin, the other is the negative pin. The LED is not perfectly round, and is slightly flatter on one side. The side that is slightly flatter is the negative pin. When you connect the LED to the module, make sure the pin by the rounded side is connected to the socket marked **+** on the outside of the module, and the flatter side is connected to the socket closer to the middle of the module. -1. The LED module has a spin button that allows you to control the brightness. Turn this all the way up to start with byt rotating it anti-clockwise as far as it will go using a small Phillips head screwdriver. +1. The LED module has a spin button that allows you to control the brightness. Turn this all the way up to start with by rotating it anti-clockwise as far as it will go using a small Phillips head screwdriver. 1. Insert one end of a Grove cable into the socket on the LED module. It will only go in one way round. diff --git a/1-getting-started/lessons/4-connect-internet/README.md b/1-getting-started/lessons/4-connect-internet/README.md index b6cd3e68..80d9e811 100644 --- a/1-getting-started/lessons/4-connect-internet/README.md +++ b/1-getting-started/lessons/4-connect-internet/README.md @@ -86,7 +86,7 @@ Messages can be sent with a quality of service (QoS), which determines the guara βœ… What situations might require an assured delivery message over a fire and forget message? -Although the name is Message Queueing, it doesn't actually support message queues. This means that if a client is disconnected, then reconnects it won't receive messages sent during the disconnect except for those messages that it had already started to process using the QoS process. Messages can have a retained flag set on them. If this is set, the MQTT broker will store the last message sent on a topic with this flag, and send this to any clients who later subscribe to the topic. This way the clients will always get the latest message. +Although the name is Message Queueing, it doesn't actually support message queues. This means that if a client disconnects, then reconnects it won't receive messages sent during the disconnection except for those messages that it had already started to process using the QoS process. Messages can have a retained flag set on them. If this is set, the MQTT broker will store the last message sent on a topic with this flag, and send this to any clients who later subscribe to the topic. This way the clients will always get the latest message. MQTT also supports a keep alive function that checks to see if the connection is still alive during long gaps between messages. @@ -102,19 +102,19 @@ The word telemetry is derived from Greek roots meaning to measure remotely. Tele > πŸ’ One of the earliest telemetry devices was invented in France in 1874 and sent real-time weather and snow depths from Mont Blanc to Paris. It used physical wires as wireless technologies were not available at the time. -Lets look back at the example of the smart thermostat from Lesson 1. +Let's look back at the example of the smart thermostat from Lesson 1. ![An Internet connected thermostat using multiple room sensors](../../../images/telemetry.png) ***An Internet connected thermostat using multiple room sensors. Temperature by Vectors Market / Microcontroller by Template / dial by Jamie Dickinson / heater by Pascal Heß / mobile phone and Calendar by Alice-vector / Cloud by Debi Alpa Nugraha / smart sensor by Andrei Yushchenko / weather by Adrien Coquet - all from the [Noun Project](https://thenounproject.com)*** -The thermostat has temperature sensors to gather telemetry. It would most likely have one temperature sensor built in, and it might connect to multiple external temperature sensors over a wireless protocol such as BLE. +The thermostat has temperature sensors to gather telemetry. It would most likely have one temperature sensor built in, and it might connect to multiple external temperature sensors over a wireless protocol such as [Bluetooth Low Energy](https://wikipedia.org/wiki/Bluetooth_Low_Energy) (BLE). An example of the telemetry data it would send could be: | Name | Value | Description | | ---- | ----- | ----------- | -| `thermostat_temperature` | 18Β°C | The temperature measured by the thermostat's built in temperature sensor | +| `thermostat_temperature` | 18Β°C | The temperature measured by the thermostat's built-in temperature sensor | | `livingroom_temperature` | 19Β°C | The temperature measured by a remote temperature sensor that has been named `livingroom` to identify the room it is in | | `bedroom_temperature` | 21Β°C | The temperature measured by a remote temperature sensor that has been named `bedroom` to identify the room it is in | @@ -139,7 +139,7 @@ Follow the relevant step below to send telemetry from your device to the MQTT br ### Receive telemetry from the MQTT broker -There's no point in sending telemetry if there's nothing on the other end to listen for it. The light level telemetry needs something listening to it to process the data. This 'server' code is the kind of code you wold deploy to a cloud service as part of a larger IoT application, but here you are going to run this code locally on your computer (on on you Pi if you are coding directly on there). The server code consists of a Python app that listens to telemetry messages over MQTT with light levels. Later in this less you will make it reply with a command message with instructions to turn the LED on or off. +There's no point in sending telemetry if there's nothing on the other end to listen for it. The light level telemetry needs something listening to it to process the data. This 'server' code is the kind of code you will deploy to a cloud service as part of a larger IoT application, but here you are going to run this code locally on your computer (or on your Pi if you are coding directly on there). The server code consists of a Python app that listens to telemetry messages over MQTT with light levels. Later in this lesson you will make it reply with a command message with instructions to turn the LED on or off. βœ… Do some research: What happens to MQTT messages if there is no listener? @@ -318,6 +318,8 @@ Write the server code. Message received: {'light': 0} Message received: {'light': 400} ``` + + The app.py file in the nightlight virtual environment has to be running for the app.py file in the nightlight-server virtual environment to recieve the messages being sent. > πŸ’ You can find this code in the [code-server/server](code-server/server) folder. @@ -357,7 +359,7 @@ A thermostat could receive a command from the cloud to turn the heating on. Base ### Send commands to the MQTT broker -The next step for our Internet controlled nightlight is for the server code to send a command back to the IoT device to control the light based off the light levels it senses. +The next step for our Internet controlled nightlight is for the server code to send a command back to the IoT device to control the light based on the light levels it senses. 1. Open the server code in VS Code @@ -396,7 +398,7 @@ The next step for our Internet controlled nightlight is for the server code to s ### Handle commands on the IoT device -Now that commands are being sent from the server, you cna now add code to the IoT device to handle them and control the LED. +Now that commands are being sent from the server, you can now add code to the IoT device to handle them and control the LED. Follow the relevant step below to listen to commands from the MQTT broker: diff --git a/1-getting-started/lessons/4-connect-internet/code-commands/virtual-device/nightlight/app.py b/1-getting-started/lessons/4-connect-internet/code-commands/virtual-device/nightlight/app.py index 4857aa61..5e9a46fc 100644 --- a/1-getting-started/lessons/4-connect-internet/code-commands/virtual-device/nightlight/app.py +++ b/1-getting-started/lessons/4-connect-internet/code-commands/virtual-device/nightlight/app.py @@ -38,3 +38,4 @@ while True: print('Light level:', light) mqtt_client.publish(client_telemetry_topic, json.dumps({'light' : light})) + time.sleep(5) diff --git a/1-getting-started/lessons/4-connect-internet/single-board-computer-mqtt.md b/1-getting-started/lessons/4-connect-internet/single-board-computer-mqtt.md index f153a39b..a1f11d11 100644 --- a/1-getting-started/lessons/4-connect-internet/single-board-computer-mqtt.md +++ b/1-getting-started/lessons/4-connect-internet/single-board-computer-mqtt.md @@ -74,6 +74,6 @@ Write the device code. Light level: 0 ``` -> πŸ’ You can find this code in the [code-mqtt/virtual-device](code/virtual-device) folder or the [code-mqtt/pi](code/pi) folder. +> πŸ’ You can find this code in the [code-mqtt/virtual-device](code-mqtt/virtual-device) folder or the [code-mqtt/pi](code-mqtt/pi) folder. πŸ˜€ You have successfully connected your device to an MQTT broker.