Tinkerlog header image 2

Tinkerlog

Alex’ blog

DIY Tengu on a breadboard

October 22nd, 2007 · 43 Comments · avr, led, sound

When I first saw Crispin Jones Tengu, I was sure, I must have one. If you don’t know tengu and don’t want to follow the link, it’s a small face, made of LEDs, that reacts to music and sound.
It did not take long until I decided to clone this funny little device. All it needs is a microcontroller, an LED matrix and a sound sensor.

Tengu clone

Parts

  • ATmega48, 4kb flash memory, 512 bytes main memory
  • crystal, 10 MHz
  • Everlight 8×5 LED dot matrix display
  • electret microphone, taken from an old mobile phone head set
  • LM386 op-amp
  • 5 x 1k resistor
  • 1 x 100k resistor
  • 1 x 10k potentiometer
  • 1 x 100k potentiometer
  • 3 x 0.1u capicitor
  • 2 x 22p capicitor

All parts should be available for less than US10$.

Sound sensor

To get a good and robust signal out of the microphone, an amplifier is needed. I found an really easy schematic of an amplifier at Jose Pino’s site. It is based on the LM386, an op-amp, often used in small music amplifiers, e.g. Cracker box Amp in Make 09.

I assembled it on a small breadboard and tested it with my new Arduino.

Sound sensor with Arduino

It worked great, but I had to use an alternative power source. When I used USB as power supply, the on- and off-switching of the monitoring LED lead to additional noise. 4 AAA cells solved that problem. For the first test you can use a small speaker attached to pin 5 of the LM386. Be sure to add the 220u capicitor between the LM386 and the speaker as shown in the schematic, otherwise you may blow your amplifier.

Here is a little sketch, that I used to test the sound sensor.

/*
 * Monitor for sound sensor
 */

int potPin = 2;    // select the input pin for sound sensor
int ledPin = 13;   // select the pin for the LED
int value = 0;
int amp = 0;

void setup() {
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
}

void loop() {
  val = analogRead(potPin);
  amp = (val >= 512) ? val - 512 : 512 - val;
  if (amp > 100) {
    digitalWrite(ledPin, HIGH);
    delay(20);
  }
  else {
    digitalWrite(ledPin, LOW);
  }
}

Controller and LED matrix

The Everlight LED matrix with its 40 LEDs is big enough to display a small face. The matrix needs 5 1k resistors for every row to limit the current.

tengu clone

The sound and its amplitude is sampled by the ATmega48 with one of its analog input pins (ADC). Then the suitable face is choosen to display. The faces are stored as simple bitmaps.

Conclusion

This small thingy is fun to watch. And it was fun to build. Maybe I’ll try to put it on a prototype board to be able to carry it around.


Video thumbnail. Click to play.
Click To Play

Yes, I know. My camera sucks.Links

Downloads

Add this to:Del.icio.us Del.icio.us Digg! Digg

43 responses so far ↓

  • 1 Sven // Oct 23, 2007 at 02:05

    Du bist ein Spielkopf und solltest lieber in einer E-Technik Bude schaffen gehen wie ich früher :-) Ich finde das Ergebnis erstaunlich gut - Respekt !!!

  • 2 Tengu Clone | Start Tech News // Oct 23, 2007 at 05:36

    [...] sent in his clone of [Crispin Jones]’ tengu. The tengu is essentially a funky visual sound meter that looks [...]

  • 3 Andrew // Oct 23, 2007 at 06:20

    Nice project. Your track selection was superior as well. Congrats on getting on “hackaday”.

    ~~Andrew

  • 4 davr // Oct 23, 2007 at 08:01

    That’s pretty neat use of a LED matrix. I might see about doing something like that myself. I currently have a 8×8 bicolor LED matrix hooked up to an AVR, so far I’ve written a simple pong game.

    A video is included here: http://blog.davr.org/2007/09/24/avr-project-update/

  • 5 DIY Tengu on a breadboard » Developages - Development and Technology Blog // Oct 24, 2007 at 09:11

    [...] Tinkerlog » Blog Archive » DIY Tengu on a breadboard - [via] Link. [...]

  • 6 DIY Tengu on a breadboard // Oct 24, 2007 at 11:54

    [...] Tinkerlog » Blog Archive » DIY Tengu on a breadboard - [via Link. [...]

  • 7 A Sound-Responsive Face for your Furniture « Making Furniture Interactive // Oct 24, 2007 at 13:53

    [...] A Sound-Responsive Face for your Furniture Filed under: Course Materials, Examples — jet @ 7:53 am Probably a few tricks you can learn from this audio-responsive LED bank. [...]

  • 8 steve // Oct 24, 2007 at 17:41

    Wow! I must make one!

    I have been looking for a “light organ kit” for a while. This is it for sure.

    nice work.

  • 9 steve // Oct 24, 2007 at 18:37

    Let me know if you ever do a PCB layout for the whole thing.

    cheers,

    steve

  • 10 Techzi » Blog Archive » DIY Tengu on a breadboard // Oct 24, 2007 at 21:05

    [...] Tinkerlog » Blog Archive » DIY Tengu on a breadboard - [via] Link. [...]

  • 11 Trikinhuelas » Blog Archive » Día de la ciencia y la tecnología // Oct 26, 2007 at 18:18

    [...] segundo es un proyecto para los amantes de los LEDs, una carita que “canta” según la intensidad de la música. El nombre de tales juguetes es tengu y no se pierdan el video, ahí es donde verdaderamente se [...]

  • 12 Tutorial « Experimental Media // Nov 9, 2007 at 16:29

    [...] http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/ [...]

  • 13 Electronics-Lab.com Blog » Blog Archive » DIY Tengu on a breadboard // Nov 20, 2007 at 20:26

    [...] Tengu on a breadboard - [Link] Tags: DIY, Led, matrix, Microcontroller, Sound, Tengu Filed in Audio, Led, [...]

  • 14 Seb // Dec 13, 2007 at 17:29

    Is the Arduino and integral part of the project or was it just used to test it out? I’d like to get started in microcontrollers and I’m wondering whether it’s better to order an arduino or a programmer and some chips to tinker with.

  • 15 Alex // Dec 14, 2007 at 01:38

    Hi Seb,
    I used the Arduino for testing only. Nevertheless, the complete Tengu could be build with the Arduino.
    If you are trying to get started with microcontrollers, I would recommend to use the Arduino, because it’s really easy to get things going. No programmer, no soldering, only a breadboard to assemble your first cicuits.
    Cheers,
    Alex

  • 16 Seb // Dec 14, 2007 at 18:30

    Thanks for the reply. I think I will order an Arduino. Am I correct in assuming that if I use the Arduino as a testing ground for a project, that once I have things working the way I want, I can use the code on a standalone chip, in its own circuit? Basically, the Arduino is so that i don’t have to build a voltage regulator or connections or whatever else is needed for a microcontroller to function in a circuit, everytime I want to tryout an idea. Is that an accurate assesment?

  • 17 Alex // Dec 15, 2007 at 09:12

    Seb,
    the Arduino uses a C as a programming language with some libraries, based on Wiring. If you want to use another micro for your final project, you may have to adapt your code.
    Cheers,
    Alex

  • 18 Seb // Dec 18, 2007 at 15:29

    Alex,
    Thanks a lot for your responses, you’ve been very helpful.

  • 19 David // Dec 21, 2007 at 03:28

    This is awesome stuff. I am thinking about getting an Arduino for christmas and this is the first project I want to build. What needs to be adapted from your design for this project to work on the arduino? I have never done any “electronics” stuff before and wanted to know if you could make a more detailed writeup of your procedure. im just wondering, but yeah this project is super awesome.

  • 20 Alex // Dec 21, 2007 at 08:44

    Hi David,

    if you are absolutely new to electronics, I would recommend to start with an Arduino and a breadboard to build the first simple things. Have a look at Boarduino: http://www.ladyada.net/make/boarduino/
    After that, take a look at the schematic above. Everything right side of the ATmega is needed for the Arduino version. Additionally the code has to be adapted. Reading the sound sensor is straight forward. Programming the LED display may be a bit harder.
    I am not sure, if I find time to do a Arduino version of this. We’ll se.

    Cheers,
    Alex

  • 21 David // Dec 22, 2007 at 15:49

    Thanks. What are the advantages of using the Boarduino and the Diecimella Arduino? From what I gather, couldnt you just “jumper” the arduino to a breadboard?

  • 22 Alex // Dec 22, 2007 at 19:04

    Hi David,
    yes, you could “jumper” the Arduino to the bredboard. But if you did that once or twice, you would love to have an Arduino that sticks to the breadboard.
    Cheers,
    Alex

  • 23 David // Dec 24, 2007 at 03:28

    I’m looking at your sound sensor, and I just want to know what parts are being used in the sound sensor/amp part. I think this would be a great instructable :D

  • 24 Alex // Dec 24, 2007 at 09:46

    Hi David,
    if you take a look at the schematic, all parts that are at the top are needed. There is a single wire that connects the amplifier with the microcontroller.
    Cheers,
    Alex

  • 25 David // Dec 24, 2007 at 19:10

    i did look at the schematic earlier, but I was confused because in the schematic you show a 220u capacitor and a speaker. Both not listed on the parts, and the only question I have now is what is the speaker component?

    So far my dive into microelectronics has been good. I’ve been collecting parts, and have been testing out things on the breadboard. Thanks for all teh feedback.

  • 26 Alex // Dec 24, 2007 at 23:50

    David,
    the capacitor and the speaker are used for a first test of the amplifier. They are not need for the final circuit.
    Cheers,
    Alex

  • 27 Mark "booyaa" Sta Ana // Jan 6, 2008 at 13:53

    Hey Alex, this is a cool project. Thanks for sharing! Sorry for the off-topic, but what wordpress plugin do you use to display the source code?

  • 28 Alex // Jan 6, 2008 at 14:31

    Hi Mark,
    check out the “?” at the top of each source code section.
    Or have a look at: http://code.google.com/p/syntaxhighlighter/
    Cheers,
    Alex

  • 29 Thanos // Jan 16, 2008 at 16:25

    Hi,

    Awesome project. Any chance to sent me the already compiled HEX file? I tried to compile it and program it, but the only thing I got is all the leds lighten up dimmly… :-( No face!!

    Regards, Thanos

  • 30 Thanos // Jan 16, 2008 at 16:30

    Oh, and something else, I used a ATMega88 as I could not find ATmega48 here in Greece easily… Do you think that makes a difference?

    Regards, Thanos

  • 31 Alex // Jan 16, 2008 at 22:18

    Hi Thanos,
    I zipped it again and put the hex file into it. Please try it.
    Have you tried it on a breadboard? That will be easier to track down bugs in that setup. Try to activate a single face and see if that will light up.

    The ATmega88 is pin compatible with the ATmega48. But I am not sure if it will work.
    Cheers,
    Alex

  • 32 David // Jan 18, 2008 at 14:46

    Hey:

    I put the amp+mic portion of the circuit together, and hooked it up to my arduino. However, all I get is an led that stays on.

    David

  • 33 Alex // Jan 18, 2008 at 19:23

    Hi David,

    please check if the mic is connected the right way. It has a polarity so you might want to try it the other way round.
    Next thing would be to hook up a multimeter at the output pin of the amplifier and see if it changes its value when you shout or touch the mic. Also try to adjust the potentiometers for amplification and volume.
    I used a small speaker to “debug” the circuit. For that you will need the 220u capacitor.
    HTH.

    Cheers,
    Alex

  • 34 jfmateos2 // Jan 30, 2008 at 19:16

    Hello Alex, using your experiment as a base, I have developed my own PCB Tengu using a PIC microcontroller.
    This video is a brief presentation of PIC-Tengu (http://www.youtube.com/watch?v=MnFP4FNVE-I). It is in spanish but subtitled in english.
    Thank you very much for your inspiration; I have enjoyed very much developing ti.

  • 35 Alex // Jan 30, 2008 at 22:37

    jfmateos2,
    man, this one is fantastic. Really good work, much nicer than mine one. Thanks for stopping by.
    Cheers,
    Alex

  • 36 Μία ηλεκτρονική φατσούλα που ανταποκρίνεται στην μουσική και γενικά στους ήχους του περιβάλλοντος « GRobot // Feb 12, 2008 at 12:35

    [...] Περισσότερα εδώ: http://tinkerlog.com/2007/10/22/diy-tengu-on-a-breadboard/ [...]

  • 37 Tengu – today and tomorrow // Mar 5, 2008 at 16:06

    [...] music, your voice or … Neat! The brave out there who want to build one themselves should go here. DIY, hardware, led, music, physical computing, [...]

  • 38 Shevy // Apr 9, 2008 at 17:50

    Nice project. I want to make this on a uC board that I already have. It has an LCD screen, a microcontroller and a built in microphone. Is there anything I would need to modify or add to get this to work?

  • 39 Alex // Apr 11, 2008 at 15:07

    Hi Shevy,
    that should be sufficient to get everything to work. Be sure to get a signal out of the microphone, that is strong enough to measure it with the microcontroller.
    Cheers,
    Alex

  • 40 Elektronik - Pic - CCS C » CCS C ile Pic Tengu // Jul 4, 2008 at 17:00

    [...] gösterilen avr ile yapılmış versiyonu ve devreyle ilgili şema, baskı devre, hex dosyasına buradan [...]

  • 41 Make a Tengu - An LED Face that Reacts to Music | Hack N Mod // Jul 21, 2008 at 02:14

    [...] pretty simple project to follow and costs $10. The origin of the project, can be found in the Tengu breadboard page. Then, the inventor sent his design off to be made into PCB’s which can be viewed here. To [...]

  • 42 Migue // Aug 25, 2008 at 12:59

    Hello,
    I was trying to order Atmega48P, but finally they sent me Atmega48 in TQFP, same but diferent pinout and SMD format.
    I have adapted pinout and assemble all components, but Only I get is all leds lights.
    I have double cheked all, and looks like all right.
    Any advice?

    What compiler do you recommend to make some changes in .c and after compile to program via ISP?

    Thanks and Good job. :)

  • 43 Migue // Aug 25, 2008 at 17:00

    Hahahahahaa….
    I answer myself
    Stupid mistake, I made the Led Matrix in wrong way, Anode where Cathode and viceversa, the strange thing is all led lights :)

    Thanks anyway and best regards.

Leave a Comment