Week 9. Output Device
Image Courtesy: Photo by Jorge Ramirez on Unsplash
By the end of this assignment, we will have a better understanding of the role of output devices in computing and how to choose the best device for your needs. I chose to experiment with an addressable LED and a speaker connected to a new board that will be designed with the SAMD11 chip.
Assignment Tasks:
-
Group Assignment: Measure the power consumption of an output device.
-
Individual Assignment: Add an output device to a microcontroller board that was designed, and program it to perform something.
Learning Process
I started with understanding output devices first. Output devices can be broadly categorized into several types, including visual output devices, audio output devices, and physical output devices. Here are some examples of each type:
Visual output devices
These output devices are used to display visual information.
LCD screens
LED screens
Projectors
Printers
Audio output device
These output devices are used to play sound or music.
Speakers
Headphones
Microphones
Physical output devices
These output devices are used to create movement or other physical effects.
Motors
LEDs
Haptic feedback devices: These create physical sensations, such as vibrations, pressure etc.
Individual Assignment
After learning more about addressable LEDs, I came up with the idea of connecting them to a speaker and creating an output that will be interesting to watch. The idea was to use a simple music-making program and link LEDs to the beats. I began creating a new board using the SAMD11 chip. I realised that understanding the chip was the very first step I should take.
SAMD11C14A
To program our output device, I decided to make the PCB using SAMD11 chip. SAM D11 is a microcontroller from the SAM D series of Atmel’s ARM Cortex-M0+ based microcontrollers. It is a low-power, compact, and cost-effective device that is widely used in various applications such as Internet of Things (IoT), wearable devices, and industrial automation.
The SAM D11 microcontroller features a 32-bit ARM Cortex-M0+ processor with a clock speed of up to 48 MHz. It has 256 KB of Flash memory, 32 KB of SRAM, and 8 KB of ROM. It also includes a wide range of communication interfaces such as I2C, SPI, USART, and USB. One of the key features of the SAM D11 microcontroller is its low power consumption, making it ideal for battery-powered devices. It has several power-saving modes, including sleep mode, standby mode, and backup mode, which help to extend the battery life of the device.
Like every other microcontroller, learning process for a microcontroller starts with a Data Sheet.
From Adrian’s page we got a better pinout, which gives more understanding on the chip.
The Process
In this experiment I want to add an addressable LED. Here I got 1 meter long LED strip of NeoPixels. It has got 3 connections: 5V, GND and a DATA line, the latter of which is used to program the LED strip with. The strip comes itself 3 wires, white for GND, green for data and red for VCC.
The other output device needed was a speaker. SPeaker comes with 2 pins. One GND and other VCC but we cannot connect speaker directly to any PCB, we need amplifiers. So here we use a mosfet as an amplifier .his is where i made the first mistake. The connection which i drawn was wrong and i identified this only after milling.
After deciding on the output devices, we have to figure out which input connections are required. In this instance, we require four connection pins to program the microcontroller. We also required a USB connection, so I chose a micro USB port for that. Since our SAMD only requires 3.3V input and we have 5V inputs, additional voltage regulator were needed. Therefore, before connecting the power to the SAMD, the voltage must be regulated down to 3.3V. Along with this voltage regulator I added 1 LED, so that it can act as a power LED. In order to check the microcontroller while programming, I placed 1 LED and connected it to the microcontroller. The final schematic came out like this.
Now is the time to design the PCB. I followed the steps as we did in design week. The final result was like this.
While designing, I realised it was not that simple like the previous weeks design. Here I added 3 Zero resistor to act as jumper.
Once the board has been milled using Roland Modela in accordance with the procedures outlined in electronic production week, it is time to create the component BOM.
Bill of Materials (BOM)
a. PCB Board - 50mm x 50mm (Minimum Size as per design)
b. AT SAMD11C14A - 1 no.
c. USB B Mini - 1 no.
d. Voltage Regulator ANS1117-3.3V - 1 no.
e. Capacitor - 1 microF - 1 no.
f. Capacitor - 100 nf - 3 nos
g. Resistor - 499 Ohm - 2 nos
h. Resistor - R1k - 2 no.
i. Resistor - R0 - 3 nos
j. Conn. Pin 2x2 - 1 no.
k. Conn. Pin 1x2 - 1 no.
l. Conn. Pin 1x3 - 1 no.
m. LED - 2 nos
n. MOSFET-P CH 30V 1.7A - 1 no.
After collecting everything from our lab, I began soldering everything into place. which was challenging because the components are smaller on this board. I now recognize the actual skill required for soldering. While soldering, mistakes were made, but I still finished this with a much better result. And the result was this.
It is now time to program the board after it has been built. We require an additional board for that, which was created independently with the aid of one of our undergraduates, Mr. Saheen, and which can program the current board. We created a board using SAMD11 based on his design, and we used that one as our programmer. We connected the programmer and new board to the PC and used the Arduino IDE to program the new board. Refer Programmer SWD D11C.
Once the board was programmed, now we are able to upload any program to run our output devices. I started with some simple examples which was already in the library which I installed previuosly for Neopixels.
First I progammed to get a single colour running with a delay of 50. The program shows below.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 2
#define NUMPIXELS 75
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 50
int i;
void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
pixels.begin();
void loop() {
pixels.clear();
for(i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
pixels.show();
delay(DELAYVAL);
}
}
After that I made loop for 3 different colour with alternate LEDs with Red, Green & Blue.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 2
#define NUMPIXELS 75
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 50
int i;
void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
pixels.begin();
void loop() {
pixels.clear();
for(i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
pixels.setPixelColor(i + 1, pixels.Color(0, 255, 0));
pixels.setPixelColor(i + 2, pixels.Color(0, 0, 255));
pixels.show();
delay(DELAYVAL);
}
}
Final Output
Some Glimpse on Output with Different Program.
Group Assignment
Detailed Study Report on our Group Assignment Page.
Downloads
Help Taken & Other References
Chat GPT used for doubt clearing and content helps.
SAMD11 and SAMD21 Arduino Toolchain