Week 9

Output Devices

Introduction

This week we learned about output devices. Output devices are devices that take in data from a microcontroller and convert it into a form that humans can perceive, such as sound, light, or movement. Some common output devices include speakers, LEDs, and motors.


Choosing Output Devices for My Project

For my water bottle project, I want one main output device that can provide feedback to the user in a clear and engaging way. Since the project was inspired by Plant Nanny (pictured to the left), I wanted the stationary mascot, kind of like the plant in plant nanny to be a playful and interactive element that encourages regular hydration.

Output Device for Stationary Plant Mascot

I decided to use a TFT display as the primary output device. Additionally, I plan to include a few RGB LEDs that can change color based on the user's hydration level throughout the day. For example, the LEDs could glow green when the user is on track with their water intake and shift to yellow or red if they fall behind their goals. This visual feedback will help users stay aware of their hydration habits in a fun and engaging way. Overall, the combination of sound and light output devices will create an interactive experience that motivates users to drink more water regularly.

Output Device for Mobile water bottle attachment

For the mobile water bottle attachment, I plan to use a small speaker to provide auditory feedback. The speaker can play cheerful sounds or short tunes when the user takes a sip of water, reinforcing positive behavior. . In previous weeks I wanted to use a distance sensor but I realized that that is not practical. As a load sensor, the device would be located underneath my water bottle to measure the weight and estimate the amount of water consumed.


but how do I visualize the weight measurement?


I decided on a ring of LED strip lights around the base of the water bottle, above the attachment. When a load was being measured, the LEDs would emit a warm light, which gives feedback to the user when measurements are occuring.

Making Output Device

Class Notes

Storing Premade Sound

  • SSD to ESP32 MP3 Player Module


  • Generating Sound

    I2S DAC w/ Amplifier
    • I2S Protocol for Audio Data
    • 3 different time sampling rates
    • sounds that respond to what you are doing not as precorded ones but generated in real-time with sin wave frequencies (final project idea: what if i could control the sound with drinking water?)
    • Send out the audio samples along the sin waves. But there is PWM involved. Each note is a waveform. Then each note is modulated by the PWM signal. Why add the PWM in the first place? It allows for more control over the sound output and can help reduce noise.
    • Making sound at the lowest level
    • can not vary the resistance continuously because the power transistor does not want to be in between open and close for a long time. PWM controls how fast we are toggling the switch to produce the waveform.
    I2S Protocol is like I2C but for audio data.

    Class Notes: Driving High Power LEDs with MOSFETs

    MOSFET. Two things to know, RDF and RDS on. RDF is the resistance from drain to source when the MOSFET is off. RDS on is the resistance from drain to source when the MOSFET is on. You want a low RDS on so that when the MOSFET is on it does not waste power and heat up. At low VGS, the MOSFET is off and the current is blocked, bad inductor. At high VGS, the MOSFET is on and current flows, good inductor.

    Don't need a current limiting resistor if you have enough resistance in the circuit. The gate of the MOSFET is capacitive so it draws a lot of current when switching. If you have a low resistance circuit, the current spike can damage the microcontroller pin. A resistor in series with the gate limits this current spike.

    So enough diodes in series can act like this big resistor, limiting the current spike when switching the MOSFET.

    Heat transfer matters when LED brightness is high cuz they can get hot quickly. Make sure to use a heat sink or other cooling methods to keep the temperature down.

    MOSFET half way between on and off is bad cuz it dissipates a lot of power as heat, very resistive. When it switches it is "noisy".