From 0bc0e83655929e57b702592cf89d1c32d0227549 Mon Sep 17 00:00:00 2001 From: Jim Bennett Date: Wed, 22 Jun 2022 08:33:03 -0700 Subject: [PATCH] Updating things (#382) * Update README.md * Spelling fixes * Update hardware.md * Adding IoT for beginners episode * Adding intro video * Fixing formatting of read more and self study sections. * Adding instructions for installing the ReSpeaker * Adding auth to language understanding * Adding Wio terminal timer setting * Update config.h * Fixing links and images * Increasing version numbers for SD card fix * Adding SD card requirement * speech and translations * Adding more on translations * All Wio Terminal now working except playing audio * Adding more details on virtual environments. * Fixing tracking links * Update app.py * Changing casing for case sensitive OSes * Fix for #322 * Fix for #323 * Adding dev container * Updating setup guides for latest releasesr --- .devcontainer/Dockerfile | 6 +++ .devcontainer/devcontainer.json | 26 ++++++++++ .../lessons/1-introduction-to-iot/pi.md | 47 +++++++++++++------ .../1-introduction-to-iot/virtual-device.md | 10 ++++ 4 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..a27d75a --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM mcr.microsoft.com/vscode/devcontainers/base:0-bullseye + +# [Optional] Uncomment this section to install additional packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3839b97 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/markdown +{ + "name": "Markdown Editing", + "dockerFile": "Dockerfile", + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "docsmsft.docs-authoring-pack" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} 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 184d775..75b244a 100644 --- a/1-getting-started/lessons/1-introduction-to-iot/pi.md +++ b/1-getting-started/lessons/1-introduction-to-iot/pi.md @@ -33,13 +33,6 @@ Set up your Pi for development. 1. Follow the instructions in the [Raspberry Pi setup guide](https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up) to set up your Pi, connect it to a keyboard/mouse/monitor, connect it to your WiFi or ethernet network, and update the software. - > IMPORTANT - > - > Currently the latest Raspberry Pi OS no longer suports accessing the camera via PiCamera or any other Python library. You can read about this change in this [Raspberry Pi blog post](https://www.raspberrypi.com/news/bullseye-camera-system/). - > You will need to install an older OS by downloading the Buster image from the here: - > - > [https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2021-05-28/](https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2021-05-28/) - To program the Pi using the Grove sensors and actuators, you will need to install an editor to allow you to write the device code, and various libraries and tools that interact with the Grove hardware. 1. Once your Pi has rebooted, launch the Terminal by clicking the **Terminal** icon on the top menu bar, or choose *Menu -> Accessories -> Terminal* @@ -50,16 +43,28 @@ To program the Pi using the Grove sensors and actuators, you will need to instal sudo apt update && sudo apt full-upgrade --yes ``` -1. Run the following command to install all the needed libraries for the Grove hardware: +1. Run the following commands to install all the needed libraries for the Grove hardware: ```sh - curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s - + sudo apt install git python3-dev python3-pip --yes + + git clone https://github.com/Seeed-Studio/grove.py + cd grove.py + sudo pip3 install . + + sudo raspi-config nonint do_i2c 0 ``` - One of the powerful features of Python is the ability to install [Pip packages](https://pypi.org) - these are packages of code written by other people and published to the Internet. You can install a Pip package onto your computer with one command, then use that package in your code. This Grove install script will install the Pip packages you will use to work with the Grove hardware from Python. + This starts by installing Git, along with Pip to install Python packages. + + One of the powerful features of Python is the ability to install [Pip packages](https://pypi.org) - these are packages of code written by other people and published to the Internet. You can install a Pip package onto your computer with one command, then use that package in your code. + + The Seeed Grove Python packages need to be installed from source. These commands will clone the repo containing the source code for this package, then install it locally. > 💁 By default when you install a package it is available everywhere on your computer, and this can lead to problems with package versions - such as one application depending on one version of a package that breaks when you install a new version for a different application. To work around this problem, you can use a [Python virtual environment](https://docs.python.org/3/library/venv.html), essentially a copy of Python in a dedicated folder, and when you install Pip packages they get installed just to that folder. You won't be using virtual environments when using your Pi. The Grove install script installs the Grove Python packages globally, so to use a virtual environment you would need to set up a virtual environment then manually re-install the Grove packages inside that environment. It's easier to just use global packages, especially as a lot of Pi developers will re-flash a clean SD card for each project. + Finally, this enables the I2C interface. + 1. Reboot the Pi either using the menu or running the following command in the Terminal: ```sh @@ -166,16 +171,28 @@ Configure the installed Pi software and install the Grove libraries. The Pi will be updated and rebooted. The `ssh` session will end when the Pi is rebooted, so leave it for about 30 seconds then reconnect. -1. From the reconnected `ssh` session, run the following command to install all the needed libraries for the Grove hardware: +1. From the reconnected `ssh` session, run the following commands to install all the needed libraries for the Grove hardware: ```sh - curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s - + sudo apt install git python3-dev python3-pip --yes + + git clone https://github.com/Seeed-Studio/grove.py + cd grove.py + sudo pip3 install . + + sudo raspi-config nonint do_i2c 0 ``` - One of the powerful features of Python is the ability to install [Pip packages](https://pypi.org) - these are packages of code written by other people and published to the Internet. You can install a Pip package onto your computer with one command, then use that package in your code. This Grove install script will install the Pip packages you will use to work with the Grove hardware from Python. + This starts by installing Git, along with Pip to install Python packages. + + One of the powerful features of Python is the ability to install [Pip packages](https://pypi.org) - these are packages of code written by other people and published to the Internet. You can install a Pip package onto your computer with one command, then use that package in your code. + + The Seeed Grove Python packages need to be installed from source. These commands will clone the repo containing the source code for this package, then install it locally. > 💁 By default when you install a package it is available everywhere on your computer, and this can lead to problems with package versions - such as one application depending on one version of a package that breaks when you install a new version for a different application. To work around this problem, you can use a [Python virtual environment](https://docs.python.org/3/library/venv.html), essentially a copy of Python in a dedicated folder, and when you install Pip packages they get installed just to that folder. You won't be using virtual environments when using your Pi. The Grove install script installs the Grove Python packages globally, so to use a virtual environment you would need to set up a virtual environment then manually re-install the Grove packages inside that environment. It's easier to just use global packages, especially as a lot of Pi developers will re-flash a clean SD card for each project. + Finally, this enables the I2C interface. + 1. Reboot the Pi by running the following command: ```sh @@ -239,10 +256,10 @@ Create the Hello World app. 1. From the VS Code Terminal, run the following to run your Python app: ```sh - python3 app.py + python app.py ``` - > 💁 You need to explicitly call `python3` to run this code just in case you have Python 2 installed in addition to Python 3 (the latest version). If you have Python2 installed then calling `python` will use Python 2 instead of Python 3 + > 💁 You may need to explicitly call `python3` to run this code if you have Python 2 installed in addition to Python 3 (the latest version). If you have Python2 installed then calling `python` will use Python 2 instead of Python 3. By default, the latest Raspberry Pi OS versions only have Python 3 installed. The following output will appear in the terminal: 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 4b6e8d3..7d3a30f 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 @@ -70,6 +70,16 @@ Configure a Python virtual environment and install the Pip packages for CounterF .\.venv\Scripts\Activate.ps1 ``` + > If you get an error about running scripts being disabled on this system, you will need to enable running scripts by setting an appropriate execution policy. You can do this by launching PowerShell as an administrator, then running the following command: + + ```powershell + Set-ExecutionPolicy -ExecutionPolicy Unrestricted + ``` + + Enter `Y` when asked to confirm. Then re-launch PowerShell and try again. + + You can reset this execution policy at a later date if needed. You can read more on this in the [Execution Policies page on Microsoft Docs](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies?WT.mc_id=academic-17441-jabenn). + * On macOS or Linux, run: ```cmd