Session 7 - Microtransmitters Flashcards
This is a computer that we can embed - (2)
Python code into to do clever things
has USB cable plugged into computer to desktop
What is this?
It is a whole computer system
it is designed to interface to the real world - all those little gold contacts around the edge are input / output pins that can send
and receive data from the world. It even has a cute little built-in thermometer.
This is called a …
It is the cheapest…
More often… - (3)
The RP2040 is a microcontroller chip developed by Raspberry Pi.
Cheapest computer you can buy
More often though, they are used as embedded computers in things like robotics projects
This has a - (3)
import port and two buttons of reset button and boot button
an LEG with 3 colours - inside got red, green and blue LED and can make any colour with it
inbuilt theometer to measure temperature of the chip
Each group has…
First thing is to attach the - (2)
Each group has an RP2040 and a USB-C cable. You will also need to be logged in to a Windows PC.
Attach the RP2040 to the PC.
The RP2040 is a computer. Like all computers it needs an
You are used to… - (2)
‘operating system’.
You are used to computers already coming with different operating systems (Windows, Linux, macOS)… but you will need to install one on the RP2040.
You will download an operating system for the RP2040 from a website and then
install it over the USB cable
There are lots of possible operating systems you can put on RP2040 device and
At least two of them let you control it in Python.
here are lots of possible operating systems you can put on this RP2040 device
We are going to install operating system called
Circuitpython on the RP2040 device - lets Python run on RP2040 device
We can download the Circuitpython operating system from a link which will - (7)
Then steps to put Circuitpython operating system onto RP2040 device
This will put a ‘.uf2’ file in your downloads folder. It should be about 1.7MB.
The RP2040 has two buttons on it called Reset and Boot. You need good eyes to see the words but the buttons are easy to see.
You are going to tell the RP2040 that you want to install a new operating system (essentially, you are going to “wipe its memory”). To do this… hold down the Boot button for a few seconds. Then while it’s down, press the Reset’ button at the same time and hold both for a couple more seconds.
So
“Boot”…. one, … two,…. “Reset”, one…., two…., “Release”
When you do this, the RP2040 should show up as a device (‘RPI-RP2’) in the Explorer window. It looks like you just plugged in a thumbdrive.
To install CircuitPython, drag the .uf2 file you just downloaded to the RP2040 in the file explorer. That’s it.
The RP2040 will reboot (or you can force it to reset with the Reset button) and it will show up again on the Explorer as something like ‘CIRCUITPY’ instead of CIRCUITPY
Inside CIRCUITPY (D:) it has a file called ‘code.py’
this is where purpose of this computer device is to find code.py in directory and then run whatever code is in it
However, today we will settle for making the onboard LED flash different colours.
The LED is the
white dot between the two buttons.
To make the onboard LED flash different colours, we need to add a
add a single ‘library’ to the ones that come bundled with CircuitPython. “neopixel” that doesnt have in toolkit which comes from Ada fruit to allow to flash LED
We can download neopixel via a link and - (3)
drag neopixel.mpy into ‘lib’ (where it likes to store all its libaries)
The library file you downloaded is called neopixel.mpy
Drag this over to the lib folder on the RP2040 in the file explorer
In the CIRCUITPY directory (see above) you can see a file called code.py
If you put Python code in this file, it will run when the
RP2040 is turned on.
You can edit the code in the code.py file and it would - (2)
edit a text file on a thumbdrive.
But to make our lives easier we will use a program called muEditor.
What is muEditor? - (3)
This is just a normal text editor but it is designed for use with little Python projects like this.
You can find it in the applications menu of your Windows PC.
Its good to run Python on attached devices
If your RP2040 board is plugged in when you start muEditor
it will try to detect it.
First time you run , you need to tell muEditor you are using
CircuitPython