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
pull/55/head
Lateefah Bello 3 years ago committed by GitHub
parent cac3ccf07b
commit a5e02a5639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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:

@ -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.

@ -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.

@ -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:

@ -38,3 +38,4 @@ while True:
print('Light level:', light)
mqtt_client.publish(client_telemetry_topic, json.dumps({'light' : light}))
time.sleep(5)

@ -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.

Loading…
Cancel
Save