Sound Controlled Lighting System

Mal Weightman

New Member
Some GCSE students of mine want to use a PICAXE 08M or 18A based circuit to respond to an analogue sound input and as the sound signal gets larger, for more output LED's to be turned on. Can anyone suggest the simplest possible input sensor circuit that will allow this to happen. Everything I've found so far seems to double the size of the circuit, which for 16 year olds doing a GCSE course is not good.

Cheers for any help
Mal
 

hippy

Ex-Staff (retired)
[ Moved to Active Forum ]

Depending upon what the input is from a simple diode-resistor-capacitor input may be all that's needed.
 

Dippy

Moderator
Suggestions may vary based on your requirements.

What sort of sound level range?

1. Screaming kids.
2. Muttering.
3. whispering.
4. Clapping
5. D&T teachers thinking :)

A mic with a bit of gain could just be rectified a la hippy.
Hasn't this been covered before?

Also, what is your experience with electronics ? - this may help people to pitch the response.
 

vttom

Senior Member
I suggest the following approach, which requires very little interface circuitry...

Use a commercially available microphone and audio preamplifier (eg. a simple audio mixing panel will do). Connect the "line out" of the preamp. to an ADC input on the PICAXE in a capacitively-coupled fashion:


Code:
                        VDD
                        -+-
                         |
                        +++
                        | | R=10k
                        | |
                C=100uF +++
Amplifier's       | |    |
Line Out >---+----| |----+----> PICAXE ADC Input
             |    | |    |
            +++         +++
            | |         | | R=10k
            | |R=1k     | |
            +++         +++
             |           |
            -+-         -+-
            GND         GND
In software on the PICAXE, create a pair of nested loops.

The inner loop simply takes some number of samples of the ADC, keeping track of the minimum and maximum values.

The outer loop takes the difference between the maximum and minimum values from the inner loop, and uses the information to drive LEDs connected to the outputs.
 

vttom

Senior Member
If you need to directly interface with a microphone (e.g. just realized that perhaps they want to create a small, self-contained circuit that would be attached to a robot or somesuch), then Googling for "microphone preamplifier" will turn up lots of suggestions involving Op Amps and/or transistors.

There's really no way around needing an amplifier, since the voltage swing output by a "naked" microphone it too small for a PICAXE to detect.
 

Mal Weightman

New Member
Sound activated lighting

Thanks for the replies.

Sound source would be something like a drum kit or a CD player eg sound goes up and down more LED's come on at preset signal levels.

As the students are at GCSE level, most inputs in the form of sensors are very simple potential divider types (most of the time for example an LDR and resistor)

What I was looking for was some kind of sensor that allows the student to easily interface it with a 'standard, school level' PICAXE circuit (and if posible an indication of where to look for a circuit diagram- no luck in my searches for the students so far)

My own level of knowledge I would optimistically say is medium to low (at least compaired with the level of a lot of the conversations on the forum!)

Mal
 

Dippy

Moderator
So are you looking at a microphone+amp+PICAXE+flashyLEDs. A portable thing?

Or, would the PICAXE be fed from an existing pre-amp, or CD machine line-out, or something like that?

What I'm trying to say (badly) is what have you got already?
Will this thing be plugged into something you already have?
Or is this thing meant to be a wave-it-around portable flashy thing?
 

vttom

Senior Member
Sound source would be something like a drum kit or a CD player eg sound goes up and down more LED's come on at preset signal levels.
It looks to me like you're talking about connecting the PICAXE to the headphone output of an audio device. In this case, the circuit from my earlier post applies.
 

mickm2au

Member
How many levels (LED's) do you want to display. This will determine whether you drive the LED's directly from your Picaxe or will require some decoding circuitry. An 08m could drive up to 3 LED's direct while using 1 ADC input, an 18A could drive up to 8 LED's direct.

Cheers,
Mick
 

MFB

Senior Member
I developed a simple (two component) opto isolated approach to drive sets of coloured 'disco lights' many years ago; this consisted of mounting a 12 volt bulb at one end of a tube and an LDR at the other. The bulb was connected across the speaker output of a power amp and the LDR was wired in place of the control pot of a standard mains light-dimmer. The correlation between volume and modulated light level was very effective and, by using passive speaker filter networks, it is possible to drive more than one dimmer channel.

Unfortunately this approach is not suitable for students because the dimmer pot modification entails connecting to main voltages. However, the basic bulb/LDR tube could still be used to drive a PICAXE adc input
 

Texy

Senior Member
I was down the old portobello road a few weeks back and one of the shops was selling a tee-shirt with sound activated leds on the front. This was a
spectrum analyser rather than a single channel and I thought it would make a cool picaxe project. I guess it would require a single picaxe for each frequency band, so would end up consierable more expensive than the shop
price tee-shirt (but then as always its the fun of the challenge).

Texy
 

hippy

Ex-Staff (retired)
You can filter the audio signal through op-amp filters giving bands of frequency levels which could each be read by a separate ADC channel. Normal disco lights use three or four channels, a full spectrum analyser may use 10 or more.

If it's just for 'impressive' effect, you might not need a high number of filters, if any at all. Sound-to-light doesn't have to be very accurate; any LED flashing can usually be fitted to the music by the human mind, even when it isn't. Old flickery mains neon 'on' indicators are particularly accurate ;-)

You could probably take a very basic signal and get some impressive action with a bit of lateral thinking ( aka faking it ).
 

vttom

Senior Member
I developed a simple (two component) opto isolated approach to drive sets of coloured 'disco lights' many years ago; this consisted of mounting a 12 volt bulb at one end of a tube and an LDR at the other. The bulb was connected across the speaker output of a power amp and the LDR was wired in place of the control pot of a standard mains light-dimmer. The correlation between volume and modulated light level was very effective and, by using passive speaker filter networks, it is possible to drive more than one dimmer channel.

Unfortunately this approach is not suitable for students because the dimmer pot modification entails connecting to main voltages. However, the basic bulb/LDR tube could still be used to drive a PICAXE adc input
Warning: Wondering way off topic here...

For some reason this post caused me to think of the following... Take a standard dimmer, the kind with a circular knob, and affix it to something upright. Attach one end of a long stick to the knob and the other end of the stick to the dome of a speaker such that when the speaker vibrates, it causes the knob to rotate. Voila! You've got an audio-controlled light!
 

Dippy

Moderator
You must have a hard wearing knob!

I should add that with a precise specification this task should be easy.
 

Mal Weightman

New Member
Sound activated LED lights

Re. Dippy's comments
The idea the students have is to have a stand alone system. One wants something he can put on or near his drum kit, the louder his drums are the more LED's come on. Another student wants to place it near a CD player with again the same effect. Typically the students will be using an 18A PICAXE chip with 8 outputs (each probably driving 4 LED's via a transistor array from each output)
I was looking for the easiest and smallest microphone input system/circuit that could feed an input to one of the analogue pins. I've seen circuits that use a small speaker (typically 64 or 80 ohms) but the signal produced by the circuit is digital for triggering something like a 555 timer circuit. As I have said my knowledge level isnt massively high and I'm just trying to see if this apparently simple idea can be easily achieved at a level appropriate to the students (and it would appear me!)
 

BeanieBots

Moderator
The problem with detecting sound is two fold.
Firstly, the signal from a microphone (or loud speaker used as one) is very small and needs amplification.
Secondly, sound is a highish AC signal and needs to be converted into a voltage which represents the overall amplitude of that signal.

There is also another aspec which you will need to consider.
The human ear's response to sound is logrithmic. That means that you require nearly 10 times the volume for it to be perceived as twice as loud. However, you could take care of that in your code.
(that could be a good part of the learning experience)

Either way, you are going to need 'amplification' and 'detection' between a microphone and a PICAXE analogue input. Hence, the 'complexity' you have found with published circuits for such use.

The irony is that the circuit could be simplified but only if you are quite skilled with transistor circuit design and it would need to be tailored to the EXACT (not just type of) transistor being used.
 

BeanieBots

Moderator
Despite the description claiming it to be suitable for connection to a micro ADC input, I can see nothing in the circuit which suggests it is suitable for such an application. (except maybe dsPIC FFT application or similar)

(The datasheet would not download for me but the schematic did).
Just looks like nothing more than a basic op-amp amplifier.

Also, note the maximum voltage of 3.6v.
A detector circuit would still be required between that circuit's OP and a PICAXE IP for the desired function. The max supply voltage would limit the range.
 
Top