Output Devices

1 November 2017 | By Casey Evans

“Am I the only one breathing oxygen? Or is it the other way around?” -Anonymous

[com_metronome.jpg]
This is the metronome I grew up with. It is my inspiration.

Assignment

  • Group Assignment: None.
  • Individual Assignment: Add an output device to a microcontroller board you've designed and program it to do something.
  • Class Notes

    Other People

    N/A. I wasn't in class so I have no idea. In my section I saw cool music notes, heels, and crests. Fun ideas for future projects.

    This Week

    Courtesy of Priyanka Chatterjee, who took notes in my absence.

    [w9_notes1.PNG]

    [w9_notes2.PNG]

    Training Summary

    None. Be competent.

    Assignments

    Individual Assignments

    I was gone last week on the Executive Visiting Days trip by MIT's Science Policy Initiative, so I'm still catching up, but I was happy to get in a bit more work on my metronome. This link is interesting: link. It talks about making your own speaker. I felt like I knew how speakers worked since I'd used them last semester in my electronics class but I was a bit skeptical since the ATTiny is going to give out digital pulses and I didn't know if those would produce the same response and if the LED would be okay with "high" frequencies. Two things happened to help me figure it out: (1) At a functional near infrared spectroscopy training event at the Martinos Center in Charlestown (just to be specific), David Boas talked about how filtering out light effects had been easy/not a problem until they started getting LED room lighting which operates at higher frequencies than either incandescent or fluorescent light. This let me know that my LED would probably be fine. My LED was in series with my speaker because I wanted it to turn on with the buzzer so there is audio and visual input. The switch allows the user to turn off sound and just see the light. (2) I took an extra speaker over to a function generator and ran different frequency sine waves and square waves through it. Square waves gave a much louder response. I took the speaker all the way up to 5V and it still did fine. The speaker on my board is at a much lower voltage since it is in series with a 1k resistor and an LED. Hopefully it still makes sound, but I did show that a square wave will be fine.

    So as you can tell, this week I'm starting to incorporate my speaker into my design. To start I just made the very simple change to my code that the LED blink at a 500 Hz rate, which though impossible to see with the eye would give the speaker sound to buzz with. I was a little nervous to try it on my board for fear of having to remake it (I'd much rather focus on fun software things than redoing hardware things over and over), but after playing with the signal generator as described above I felt confident enough to give it a go. And fortunately, it worked though it was very quiet as I anticipated. I can perhaps change out the resistor or else redesign the board with an OPAMP or something. I will start with the replace a resistor approach. The LED datasheet states a max current of about 40 mA, so I could go down as far as 125 ohms and be okay. I'll probably test it out on a breadboard with the function generator first to find something suitable. I do want to stay a bit above 125 ohms just in case.

    Function-wise I would like to build a library of notes so I can write songs. Which I guess means I could set up a playlist. And then I could cycle through songs with my button. The LED would have to sing along, which might be a neat unintentional effect. I also would like to set up actual metronome functionality with a for loop or something to get bigger loops for each tick and pause. I could use the button to cycle through the basic time standards: 60, 100, 120, 190 (at least the ones I like to use). I'd also like to set up an external battery attachment so that I don't need to use my computer with it all the time.

    Fun side note: when I opened up the bag that houses my PCBs I found that the ISP header had been torn off, taking some of the copper pads with it. I cannot explain how many other things were going on in my life at the time but it was an exceedingly unsavory surprise. Fortunately I was able to use all of my molding errors and mill time to multitask with solder surgery. The current setup is rather precarious but it will program, which is great. Gavin recommended that I use resistors as makeshift pads if it breaks again. I'm not 100% sure how to implement that but it may involve cutting the resistors in half or standing a zero ohm kid on its edge. Really it just gives me another way to get creative. But hopefully it doesn't come to that before I get to move on to my final project board. Or that cool LED board someone made a few weeks ago that I still want to do (though maybe not during the span of the course). I keep my boards in a tupperware box now. In case you were curious here is what a board with ISP headers and pads torn off looks like:

    [torn_isp.jpg]

    Great welcome home adventure, I know. Another angle I think would be fun in the future would be to build the board I used for my undergraduate embedded programming class and see if it can run all my old projects. It was an MSP430 setup. Not entirely sure how I would do that but it would probably involve looking at pictures from old lab reports to reverse engineer the thing. I feel like that would be a final project level endeavor and I would much rather do my lamp.

    More comments on this later but I did button press octave jump with my speaker:

    Okay, those "more comments" was really just to say that in 6.341 we did octave band filtering and I realized that by having the button alter the frequency by halving it, I was doing an octave jump. It was a neat revelation because I knew as a musician that'd I'd done an octave jump but I wasn't sure why. I never knew that octaves were related by frequencies in multiples of 2. How neat!

    Blinking LED code

    Speaker button press code

    Group Assignments

    None.