Emilio Méndez- Fab Lab CiDi 2024

10. Output devices

Assignment:
Group assignment:
Measure the power consumption of an output device
Document your work (in a group or individually)

Individual assignment:
Add an output device to a microcontroller board you've designed and program it to do something

Planning

I decided to use the board I designed during the "Electronics Design" week, which is a Fab-Xiao shaped like an electric guitar. It only has a minor change in the footprint of the Xiao RP2040, to be able to use a connector that allows me to remove and insert the Xiao. This way, the microcontroller can be reused in different assignments. The Gerber files of the design are available in the downloads section.

Here are the parts:
  • 1 Seeed Studio XIAO RP2040
  • 1 Red LED SML-LX1206IC-TR
  • 1 0Ω resistor
  • 1 499 Ω resistor
  • 1kΩ resistor
  • Button
  • 2 male horizontal header
  • 1 male vertical header
To manufacture the electronic board, we used the Roland MODELA Pro II MDX-540, using the same parameters described in the "Electronics Production" week. After soldering and assembling the various components, the final result was the following board:

Programming and output

To program in Micropython, I utilized the assistance of ChatGPT. I connected the servo motor to the 5V pin, as this servo motor operates on 5V. Then, I connected the Xiao to my laptop using a USB-C cable while simultaneously pressing the "B" button on the Xiao, so it would be recognized by the computer. Since I had already used Thonny in previous assignments, the interpreters for Micropython were already installed, and I only had to select them. I used the code provided by ChatGPT, but it didn't work due to two main reasons that took me some time to resolve. The first reason was that the code didn't specify the PWM frequency for the operation of this servo, which is 50 Hz. The second reason was that the Python modules necessary to operate the servo motor were not being imported correctly. For example, in the code that didn't work, they were imported like this "import machine", but the code that did work, the module was imported like this "from machine import Pin, PWM". Once this was resolved, I used a code that activated the servo motor and also made the red LED light on my board blink. It took me a lot of effort to solve it, but I succeeded. The code can be downloaded from the "downloads" section.


Group Assignment


Downloads