Results: Output Devices
My exploration with output devices this week is important for my final project. Therefore, I focused on testing a servomotor, mini speaker, RGB LED, and Neopixel LED. To test the output devices I used the XIAO RP2040 on the Fab&Plant PCB that I made on week 8.
Output devices tested this week
This is the result I got with the servomotor:
#include < Servo.h> #define SERVO_PIN A0 Servo servoMotor; // Create a servo object to control a servo void setup() { servoMotor.attach(SERVO_PIN); // Attaches the servo on pin A0 to the servo object } void loop() { // Move the servo to different positions servoMotor.write(0); // Move the servo to 0 degrees delay(1000); // Wait for 1 second servoMotor.write(90); // Move the servo to 90 degrees delay(1000); // Wait for 1 second servoMotor.write(180); // Move the servo to 180 degrees delay(1000); // Wait for 1 second }
Code in Arduino IDE for programming the microservo in Fab&Plant PCB
This is the Happy Birthday melody I got with the mini speaker:
#define SPEAKER_PIN D0 // D0 pin void setup() { pinMode(SPEAKER_PIN, OUTPUT); } void loop() { // Play Happy Birthday melody playNote(262, 400); // C4 playNote(262, 400); // C4 playNote(294, 800); // D4 playNote(262, 800); // C4 playNote(349, 800); // F4 playNote(330, 1600); // E4 // Second line playNote(262, 400); // C4 playNote(262, 400); // C4 playNote(294, 800); // D4 playNote(262, 800); // C4 playNote(392, 800); // G4 playNote(349, 1600); // F4 // Third line playNote(262, 400); // C4 playNote(262, 400); // C4 playNote(523, 800); // C5 playNote(440, 800); // A4 playNote(349, 800); // F4 playNote(330, 800); // E4 playNote(294, 800); // D4 // Fourth line playNote(466, 400); // A#4 playNote(466, 400); // A#4 playNote(440, 800); // A4 playNote(349, 800); // F4 playNote(392, 800); // G4 playNote(349, 1600); // F4 } // Function to play a note of a given frequency and duration void playNote(int frequency, int duration) { tone(SPEAKER_PIN, frequency, duration); delay(duration + 50); // Add a slight delay between notes for rhythm }
Code in Arduino IDE for programming the mini speaker in Fab&Plant PCB
To test the RGB LED, I made another board that I connected to the Fab&Plant PCB.
There was very intense work this week and I feel I little bit closer to understand the electronics in my final project.
Group Assignment: Measure Power Consumption
The group assignment page is here.
Individual Assignment: Exploration with Output Devices
An output device is any component or device that receives signals or data from a computer or electronic system and converts them into a human-readable form or a form usable by other systems. Output devices are crucial for displaying information, transmitting data, or controlling other devices based on processed input. Examples include displays (such as monitors, screens, or LEDs), printers, speakers, actuators (such as motors or solenoids), and communication interfaces (such as audio output jacks or network ports). These devices play a vital role in providing feedback, presenting results, or enabling interaction between electronic systems and users or other systems.
Servomotor
A servomotor is a rotary or linear actuator that allows for precise control of angular or linear position, velocity, and acceleration. It consists of a motor, a control circuit, and a feedback mechanism. Servomotors are commonly used in applications where accurate and controlled movement is required, such as robotics, RC vehicles, industrial automation, and aerospace systems. They can maintain a specific position or move to a desired position based on input signals, making them versatile components in various electromechanical systems.
The SG90 Tower Pro microservomotor, commonly known as the "9g microservo," is a compact and lightweight actuator renowned for its versatility and precision. With its small size of 23mm x 12.2mm x 29mm and lightweight design of approximately 9 grams, it is ideal for applications where space and weight are critical factors. Despite its diminutive stature, the SG90 is capable of exerting considerable torque, typically around 1.5 to 2.5 kg/cm, enabling it to perform a wide range of tasks with ease. Equipped with a feedback control system, it offers accurate and repeatable positioning, making it suitable for tasks requiring precise motion control. The SG90 operates over a standard pulse width modulation (PWM) signal range, typically from 1000µs to 2000µs, allowing for compatibility with various microcontroller platforms. Whether used in robotics, model airplanes, or other mechatronic applications, the SG90 microservomotor stands out for its reliability, compactness, and exceptional performance.
9g microservo
I programmed the servomotor with the XIAO RP2040 on the Fab&Plant PCB that I made in week 8.
#include < Servo.h> #define SERVO_PIN A0 Servo servoMotor; // Create a servo object to control a servo void setup() { servoMotor.attach(SERVO_PIN); // Attaches the servo on pin A0 to the servo object } void loop() { // Move the servo to different positions servoMotor.write(0); // Move the servo to 0 degrees delay(1000); // Wait for 1 second servoMotor.write(90); // Move the servo to 90 degrees delay(1000); // Wait for 1 second servoMotor.write(180); // Move the servo to 180 degrees delay(1000); // Wait for 1 second }
Code in Arduino IDE for programming the servomotor in Fab&Plant PCB
For my final project, I will probably use a higher power servomotor.
Speaker
The mini speaker is a compact audio transducer designed for integration into electronic devices and circuits. With a diameter of 12mm, it occupies minimal space, making it suitable for applications where size is a constraint. Operating at a frequency of 2.048kHz, it produces sound output within the audible range, suitable for various audio signaling purposes. Mounted directly onto PCBs, it simplifies assembly and integration into electronic projects. Despite its small size, it offers clear and recognizable sound reproduction, making it useful for alarms, notifications, and other audio playback applications in portable electronics, appliances, and gadgets.
Mini speaker
I programmed the mini speaker with the XIAO RP2040 on the Fab&Plant PCB that I made in week 8 for getting the happy birthday melody.
#define SPEAKER_PIN D0 // D0 pin void setup() { pinMode(SPEAKER_PIN, OUTPUT); } void loop() { // Play Happy Birthday melody playNote(262, 400); // C4 playNote(262, 400); // C4 playNote(294, 800); // D4 playNote(262, 800); // C4 playNote(349, 800); // F4 playNote(330, 1600); // E4 // Second line playNote(262, 400); // C4 playNote(262, 400); // C4 playNote(294, 800); // D4 playNote(262, 800); // C4 playNote(392, 800); // G4 playNote(349, 1600); // F4 // Third line playNote(262, 400); // C4 playNote(262, 400); // C4 playNote(523, 800); // C5 playNote(440, 800); // A4 playNote(349, 800); // F4 playNote(330, 800); // E4 playNote(294, 800); // D4 // Fourth line playNote(466, 400); // A#4 playNote(466, 400); // A#4 playNote(440, 800); // A4 playNote(349, 800); // F4 playNote(392, 800); // G4 playNote(349, 1600); // F4 } // Function to play a note of a given frequency and duration void playNote(int frequency, int duration) { tone(SPEAKER_PIN, frequency, duration); delay(duration + 50); // Add a slight delay between notes for rhythm }
Code in Arduino IDE for programming the mini speaker in Fab&Plant PCB
RGB Led
I also designed a board por a RGB LED, but I need to get the component for finish this exploration.
Code in Arduino IDE for programming the RGB LED in Fab&Plant PCB
During this week's exploration I better understood how to approach my final project. It was a great learning experience with output devices.
Conclusions
- An output device is a component that converts electronic signals into human-readable or usable forms.
- The 9g SG90 Tower Pro microservomotor is a versatile and compact motor known for its lightweight design, precise control, and compatibility with various projects. With its 180-degree rotation capability and ease of integration, it is ideal for applications requiring precise angular movement
- The mini speaker offers compact size, and easy mounting, making it suitable for various applications where space is limited and clear sound reproduction is desired.
- Neopixel LEDs offer individually addressable control with simplified wiring, while traditional RGB LEDs require separate control for each color channel.
- To finish this task I thank my fellow students and tutors, especially Henry Sanchez for helping me assemble my furniture, Vaneza Caycho, Roberto Delgado for the guidance in this process, Hans Moncca, and Cristian Loayza for for helping me with the use of the CNC router and valuable tips on the design of the furniture.