Editing UBISS2024
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | This course is designed as a week-long tutorial to engage with ubiquitous devices in the domain of smart environments and how to use machine learning to build smart devices. Here, we use an | + | This course is designed as a week-long tutorial to engage with ubiquitous devices in the domain of smart environments and how to use machine learning to build smart devices. Here, we use an Arduino Nano RP2040 Connect (https://store.arduino.cc/products/arduino-nano-rp2040-connect). |
− | = | + | = Link Page = |
− | + | https://www.sketching-with-hardware.org/wiki/UBISS2024-Links | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
= Tasks = | = Tasks = | ||
− | == Task | + | == Task 0: connect an Arduino Nano RP2040 Connect board == |
− | + | * Install the basic software https://labs.arduino.cc/en/labs/micropython | |
− | + | * connect the board via USB | |
− | * Install the | + | * Make the orange LED (pin 6) blink using micro python https://docs.arduino.cc/micropython/basics/digital-analog-pins/ |
− | * | + | * Connect an external RGB LED (pin 2, 3, 4), https://www.sketching-with-hardware.org/wiki/RGB_LED |
− | * | + | * Control the external RGB LED (on, off, mix color, brightness) |
− | * | ||
− | |||
− | === Solution Task | + | === Solution Task 0.1: LED Blinking === |
<syntaxhighlight lang="python" line='line'> | <syntaxhighlight lang="python" line='line'> | ||
# Blinky example | # Blinky example | ||
Line 123: | Line 31: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === Solution Task | + | === Solution Task 0.2 Control external RGB === |
<syntaxhighlight lang="python" line='line'> | <syntaxhighlight lang="python" line='line'> | ||
# RGB example | # RGB example | ||
Line 130: | Line 38: | ||
from machine import Pin | from machine import Pin | ||
− | # RGB LED connected to | + | # RGB LED connected to Nano WiFi module. |
− | ledG = Pin( | + | ledG = Pin(2, Pin.OUT) |
− | ledR = Pin( | + | ledR = Pin(3, Pin.OUT) |
− | ledB = Pin( | + | ledB = Pin(4, Pin.OUT) |
print("start") | print("start") | ||
Line 152: | Line 60: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | == Task 1: read Acceleration from Arduino Nano RP2040 Connect board == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* read data from the accelerometer and the gyro and print them (Arduino IDE) https://docs.arduino.cc/micropython/basics/board-examples/ | * read data from the accelerometer and the gyro and print them (Arduino IDE) https://docs.arduino.cc/micropython/basics/board-examples/ | ||
− | * extend | + | * extend you program to write the data from the accelerometers to a file, https://www.sketching-with-hardware.org/wiki/FileIO |
* transfer the file to your computer | * transfer the file to your computer | ||
− | * optional: add the photo resistors to your board, read their values, and write them to the file | + | * optional: add the photo resistors to your board, read their values, and write them to the file, too, https://www.sketching-with-hardware.org/wiki/LDR |
− | === Solution Task | + | === Solution Task 1.1: Read Accelerometer and Gyro === |
<syntaxhighlight lang="python" line='line'> | <syntaxhighlight lang="python" line='line'> | ||
import time | import time | ||
Line 210: | Line 83: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === Solution Task | + | |
− | A0 is the analog input with 16 | + | === Solution Task 1.2: Read analog values - Code Example Arduino Nano Connect RP2040 === |
+ | A0 is the analog input with 16 bit resolution. It reads the analog value every second and print it to the console- | ||
<syntaxhighlight lang="python" line='line'> | <syntaxhighlight lang="python" line='line'> | ||
+ | #Example usage for Arduino Nano | ||
from machine import Pin, ADC | from machine import Pin, ADC | ||
from time import sleep | from time import sleep | ||
Line 225: | Line 100: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == Task | + | == Task 2: Jupyter Notebook == |
− | * | + | * connect the board |
− | * | + | * install the Juypter Notebook, https://www.sketching-with-hardware.org/wiki/Jupyter |
− | * | + | * read the accelerometer and the gyro and show it in the notebook |
− | === Task | + | |
+ | === Task 2.1: is it moved? === | ||
* read acceleration and gyro | * read acceleration and gyro | ||
* calculate the differences between values | * calculate the differences between values | ||
Line 236: | Line 112: | ||
* create a file on the device that logs, when it is moved | * create a file on the device that logs, when it is moved | ||
− | === Task | + | === Task 2.2: it was turned upside down? === |
* read acceleration and gyro | * read acceleration and gyro | ||
* make a rule based "AI" that records | * make a rule based "AI" that records | ||
Line 243: | Line 119: | ||
** it was moved "quickly" | ** it was moved "quickly" | ||
− | == Task | + | == Task 3: ML on Arduino Nano Connect RP2040 == |
We will use https://github.com/eloquentarduino/everywhereml to detect the same gestures as in Task 2.2. For this, install everywhereml: | We will use https://github.com/eloquentarduino/everywhereml to detect the same gestures as in Task 2.2. For this, install everywhereml: | ||
− | |||
− | |||
− | |||
<syntaxhighlight lang="Bash"> | <syntaxhighlight lang="Bash"> | ||
− | pip3 install -U | + | pip3 install -U everywhere |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 266: | Line 139: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == Task | + | == Task 4: connect both boards to WIFI == |
− | + | * connect both boards to WIFI using [[Tutorial_Network]] | |
− | * | + | * use the Arduino Nano RP2040 Connect as output (showing a color) |
− | * | + | * use the Arduino Nano RP2040 Connect as input (recognize with rules 3 gestures) |
− | * | ||
= Links = | = Links = | ||
Line 321: | Line 193: | ||
C:\Users\ru42qak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\jupyterlab>python -m notebook | C:\Users\ru42qak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\jupyterlab>python -m notebook | ||
− | [[Category: | + | [[Category:Course]] |
[[Category:UBISS2024]] | [[Category:UBISS2024]] | ||
− | |||
− |