Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 5 months ago.
Soundgenerator
Dear Ladies and Gentlemen,
I have a question concerning a project Í need to do at my university.
Is it possible to connect a PC keyboard with a mbed hardware and a speaker to create/program sounds (like creating a keyboard instrument)? And how it would be possible to connect the PC keyboard and speaker with the board?
If yes, can you please tell me or recommend me a mbed board and components?
Best regards
Gabriel Kraemer
1 Answer
8 years, 5 months ago.
Hi Gabriel,
Yes this is perfectly possible.
What i would do is select the platform https://developer.mbed.org/platforms/mbed-LPC1768/
With this platform you can attach a USB device to the platform, https://www.engineersgarage.com/arm-projects/usb-host-keyboard-lpc1768
From there i would use the PWM output of the device into a simple speaker or audio jack, to generate noises.
Regards,
Andrea, team mbed
Andrea has provided information on using your lpc-1768 as a USB host for keyboard input.
There is a simple example using the lpc-1768 to output notes using PWM in Exercise 7 of the Embedded System Design Course "Pulse Width Modulation" notes.
https://developer.mbed.org/cookbook/Course-Notes
This example has a partial table with the mapping of musical notes to nearest integer frequency values. You can find more complete tables on the internet.
The Embedded System Design Course example assumes a piezoelectric buzzer as the output device. These devices should be compatible with the 0 - 3.3 V PWM output from mbed. Note that the PWM output will have a 1.65 V DC offset. You probably do not want to connect the PWM output directly to a conventional speaker or earphones without some sort of AC coupling filter or AC coupled amplifier.
posted by 12 May 2017