Designing a Microcontroller Board Which Allows Me to Connect and Use a Speaker as an Output
After Emma’s lecture on output devices, I started to design my microcontroller board. I decided to work with a speaker and a LED connected to the same pin in order to visualize sound. Probably, I would use a speaker and a LED in a similar way for my final project. Using Eagle, I started from the hello echo-world sample and drew my schematic and my layout.
The PCB production worked well. The end mill got old and the traces weren't milled smoothly. The traces felt rawly.
Photos of production
I properly soldered all board components. Running the avrdude -c usbtiny -p t44 Terminal command, I initialized the MCU board which seemed to work.
Programming the MCU Board to Do Something
After testing the microcontroller once again, I burned the bootloader and wrote and uploaded a simple Arduino script. The script faded a PWM signal and produced a kind of siren sound. Unfortunately, the LED was always on. It was wrong connected and I had to reconnect it using some wires. I removed the MOSFET connected to the LED and linked the LED directly to the microcontroller’s speaker pin 7 (PA7) and GND. Connecting the MCU board to my computer's 5V USB port (via the FabISP), all worked well. Connecting the MCU board to a big variable external power supply, I burned the speaker. I had to connect another one.
Finally, I used four 3V batteries to externally supply my MCU board. I used VCC and GND of the FTDI 6 pin connector. The designated 2 pin power header linked to the regulator didn't work. The batteries didn't give enough power to produce a loud siren sound but the setup independently worked as a unit.
I figured out that I connected LED to MOSFET upside down. Besides, I would need a H-Bridge in order to improve a speaker’s sound performance.