I was tinkering with electronics since i was 10 years old. My father, a radio technician teached me the basics and how to use a soldering iron. I owe him a lot. One of my first circuits was an audio amplifier with a microphone and for a while i loved to hear my voice through the connected loudspeaker or sounds from the outside when i hung the microphone out of my window. One day my father came around with a coil he removed from an old transformer and he said, "Connect this instead of your microphone". I did it and this was one of the most amazing moments in my life. Suddenly i heard strange humming sounds, hissing noise, sharp electronic buzzing and some sounds that resembled distorted human voices. It was like diving in a hidden world that was lying right before my very ears which i wasn't able to recognize up to this moment. Technically there was nothing magical about it. The coil picked-up electromagnetic noise coming from all kind of household devices, refrigerators, washing machines, electric drills, TV-Sets, radios, street light a.s.o. But the experience was crucial to me. There was something around me i couldn't perceive but with some electronic mumbo-jumbo i was in!
Some years later i thought about it again and one idea came to my mind. What would happen if i'd connect a fototransistor to the amplifier? Would i also hear vibrations that my eyes were too lazy to recognize? I did it and again the experience was awesome! The human eye is a very sophisticated organ. It provides the greatest information bandwidth of all our organs but this comes with some costs. The ability to perceive changes is pretty limited. If the visual information changes more then 11 times per second things are starting to get blurry. This is the reason why we can watch movies in the cinema or on our TV. Our eyes can't follow the changes anymore and all those single still pictures are melted together into one continuous movement. But if we change light into sound our ears might perceive those oscillations perfectly up to several thousand oscillations per second!
I devised a little electronic to turn my smartphone into a lightsound receiver, giving me also the ability to record those sounds. Because the electronic is very simple i want to show you the basics of electronic design on this example. So we're gonna dive pretty deep into transistors, resistors and capacitors. But don't worry, i'll keep the math simple!
Step 1: Electronic Part 1: What Is a Transistor?
Now here is your quick and not-dirty introduction into bipolar transistors. There are two different kinds of them. One is named NPN and this is the one you can see on the picture. The other type is PNP and we won't talk about it here. The difference is just a matter of current and voltage polarity and not of further interest.
An NPN-transistor is an electronic component that amplifies current. Basically you have three terminals. One is always grounded. In our picture it is called the "Emitter". Then you have the "base", which is the left one and the "Collector" which is the upper one. Any current going into the base IB will cause an amplified current floating through the collector IC and going through the emitter back into ground. The current must be driven from an external voltage source UB. The ratio of the amplified current IC and the base current IB is IC/IB=B. B is called the DC-current gain. It depends on the temperature and how you setup your transistor in your circuit. Furthermore it's prone to severe production tolerances, so it doesn't make very much sense to calculate with fix values. Always keep in mind that the current gain may spread a lot. Apart from B there is another value named "beta". Wile B characterizes the amplification of a DC-signal, beta does the same for AC-signals. Normally B and beta don't differ a lot.
Together with the input current the transistor also has an input voltage. The constraints of the voltage are very narrow. In normal applications it will move in an area between 0.62V..0.7V. Forcing a voltage change on the base will result in dramatic changes of the collector current because this dependency is following an exponential curve.
Step 2: Electronic Part 2: Designing the First Stage of the Amplifier
Now we're on our way. To convert modulated light into sound we need a fototransistor. A fototransistor resembles very much the standard NPN-transistor of the previous step. But it is also capable not only to change the Collector current by controlling the base current. Additionally the collector current depends on light. Much light-much current, less light-less current. It's that easy.
Specifying the power supply
When i'm designing hardware the first thing i do is to make-up my mind about the power supply because this affects EVERYTHING in your circuit. Using an 1,5V battery would be a bad idea because, as you learnt in step 1 the UBE of a transistor is around 0,65V and thus already on half the way up to 1,5V. We should provide more reserve. I love 9V batteries. They're cheap and easy to handle and don't consume much space. So let's go with 9V. UB=9V
Specifying the Collector current
This is also crucial and affects everything. It should be not too small because then the transistor becomes unstable and the signal noise is rising. It also must not be too high because the transistor always has an idle current and a voltage and that means it consumes power that is turned into heat. Too much current drains the batteries and may kill the transistor due to heat. In my applications i always keep the collector current between 1...5mA. In our case let's go with 2mA. IC=2mA.
Clean your power supply
If you're designing amplifier stages it's always a good idea to keep your DC-power supply clean. The power supply often is a source of noise and hum even if you use a battery. This is because you usually have reasonable cable lengths connected to the supply rail that may work as an antenna for the all abundant power hum. Normally i'm routing the supply current through a small resistor and provide a fat polarized capacitor at the end. It short-cuts all ac-signals against ground. In the picture the resistor is R1 and the capacitor is C1.We should keep the resistor small because the voltage drop it generates limits our output. Now i can throw in my experience and say that 1V voltage drop is tolerable if you're working with 9V power supply. UF=1V.
Now we have to anticipate our thoughts a bit. You'll see later we will add a second transistor stage that also needs to get it's supply current clean. So the amount of current flowing through R1 is doubled. The voltage drop across R1 is R1=UF/(2xIC) = 1V/4mA = 250 Ohms. You'll never get exactly the resistor you want because they are produced in certain value intervals. The nearest one to our value is 270 Ohms and we will be fine with that. R1=270 Ohms.
Then we choose C1=220uF. That gives a corner frequency of 1/(2*PI*R1*C1) = 2,7Hz. Don't think too much about this. The corner frequency is the one where the filter starts to suppress ac-signals. Up to 2,7Hz everything will get through more or less unattenuated. Beyond 2,7Hz the signals get more and more suppressed. The attenuation of a first-order lowpass filter is described by A=1/(2*PI*f*R1*C1). Our nearest enemy in terms of interference is the 50Hz power line hum. So let's apply f=50 and we get A=0,053. That means only 5,3% of the noise will get through the filter. Should be enough for our needs.
Specifying the collector voltage bias
The bias is the point where you put your transistor in when it is in idle mode. This specifies its currents and voltages when there is no input signal to amplify. A clean specification of this bias is fundamental because for example the voltage bias on the collector specifies the point where the signal will swing around when the transistor is working. Laying out this point erroneously will result into a distorted signal when the output swing hits ground or the power supply. These are the absolute limits the transistor can't get over! Normally it's a good idea to put the output voltage bias in the middle between ground and UB at UB/2, in our case (UB-UF)/2 = 4V. But for some reason you will understand later i want to put it a little lower. First we don't need a big output swing because even after amplification in this 1st stage our signal will be in the range of millivolts. Second, a lower bias will do better for the following transistor stage as you will see. So let's put the bias on 3V. UA=3V.
Calculate the collector resistor
Now we can calculate the rest of the components. You'll see if a collector current flows through R2 we will get a voltage drop coming from UB. Because UA = UB-UF-IC*R1 we can extract R1 and get R1 = (UB-UF-UA)/IC = (9V-1V-3V)/2mA = 2,5K. Again we choose the next norm value and we take R1 = 2,7K Ohm.
Calculate the base resistor
For calculating R3 we can derive a simple equation. The voltage across R3 is UA-UBE. Now we need to know the base current. I told you the DC-current gain B=IC/IB, so IB = IC/B, but what's the value of B? Sadly i used a fototransistor from a surplus package and there is no proper marking on the components. So we have to use our fantasy. Fototransistors don't have so much amplification. They're more designed for speed. While the DC-current gain for a normal transistor can reach 800 the B-factor of a fototransistor may be between 200..400. So let's go with B=300. R3 = (UA-UBE)/IB = B*(UA-UBE)/IC = 352K Ohm. That's near to 360K Ohm. Sadly i don't have this value in my box so i used an 240K+100K in series instead. R3 = 340K Ohm.
You may ask yourself why we drain the base current from the collector and not from UB. Let me tell you this. The bias of a transistor is a fragile thing because a transistor is prone to production tolerances as well as a severe dependency from temperature. That means if you bias your transistor directly from UB it will likely drift away soon. To cope with that problem hardware designers use a method called "negative feedback". Take a look at our circuit again. The base current comes from the collector voltage. Now imagine the transistor becomes warmer and it's B-value raises up. That means more collector current is flowing and UA decreases. But lesser UA also means lesser IB and the voltage UA is going up again a bit. With B decreasing you have the same effect the other way around. This is REGULATION! That means by clever wiring we can keep the transistor bias in limits. You will see another negative feedback in the next stage too. By the way, negative feedback normally also decreases the amplification of the stage, but there are means to get over this problem.
Step 3: Electronic Part 3: Designing the Second Stage
I did some testing by applying the lightsound signal from the preamplified stage in the previous step into my smartphone. It was encouraging but i thought a little more amplification would do better. I estimated an additional boost of factor 5 should do the job. So here we go with the second stage! Normally we again would set up the transistor in the second stage with it's own bias and fed the preamplified signal from the first stage via an capacitor into it. Remember capacitors don't let dc through. Just the ac-signal may pass. In this way you can route a signal through the stages and the biasing of each stage will not be affected. But let's make things a little more interesting and try to save some components because we wanna keep the device small and handy. We will use the output bias of stage 1 for biasing the transistor in stage 2!
Calculating the emitter resistor R5
In this stage our NPN-transistor gets directly biased from the previous stage. In the circuit diagram we see that UE = UBE + ICxR5. Because UE = UA from the previous stage we can extract R5 = (UE-UBE)/IC = (3V-0.65V)/2mA = 1,17K Ohm. We make it 1,2K Ohm which is the nearest norm value. R5 = 1,2K Ohm.
Here you can see another kind of feedback. Let's say while UE remains constant the B value of the transistor increases due to temperature. So we get more current through collector and emitter. But more current through R5 means more voltage across R5. Because UBE = UE - IC*R5 an increase of IC means a decrease of UBE and thus a decrease again of IC. Here again we have regulation helping us to keep the bias stable.
Calculating the collector resistor R4
Now we should keep an eye on the output swing of our collector signal UA. The lower limit is the emitter bias of 3V-0,65V=2,35V. The upper limit is the voltage UB-UB=9V-1V=8V. We will put our collector bias right in the middle. UA = 2,35V + (8V-2,35V)/2 = 5,2V. UA = 5,2V. Now it's easy to calculate R4. R4 = (UB-UF-UA)/IC =(9V-1V-5,2V)/2mA = 1,4K Ohm. We make it R4 = 1,5K Ohm.
What about the amplification?
So what about the factor 5 of amplification we want to gain? The voltage amplification of ac-signals in the stage as you can see it is described in a very simple formula. Vu = R4/R5. Pretty simple huh? This is the amplification of a transistor with negative feedback over the emitter resistor. Remember i told you negative feedback is also affecting the amplification if you're not taking proper means against it.
If we calculate the amplification with the chosen values of R4 and R5 we get V = R4/R5 = 1.5K/1.2K = 1.2. Hm, that's pretty far away from 5. So what can we do? Well, first we see that we can't do anything about R4. It is fixed by the output bias and the voltage constraints. What about R5? Let's calculate the value R5 ought to have if we would have an amplification of 5. That's easy, because Vu =R4/R5 this means that R5 = R4/Vu = 1.5K Ohm/5 = 300 Ohm. Ok, that's fine but if we would put a 300 Ohm instead of the 1.2K in our circuit our bias would go screwed up. So we need to put both, 1.2K Ohm for the dc bias and 300 Ohms for the ac negative feedback. Take a look at the second picture. You'll see that i divided the 1,2K Ohm resistor in an 220 Ohm and 1K Ohm in series. Besides, i chose 220 Ohms because i didn't have a 300 Ohm resistor. The 1K is also bypassed by a fat polarized capacitor. What does this means? Well for the dc bias that means the negative feedback "sees" a 1,2K Ohm because dc may not pass through a capacitor, so for the dc bias C3 just doesn't exists! The ac-signal on the other hand just "sees" the 220 Ohm because every ac-voltage drop across R6 is short circuited to ground. No voltage drop, no feedback. Only the 220 Ohm remains for negative feedback. Quite clever, huh?
To get this working properly you must choose C3 so that it's impedance is very much lower than R3. A good value is 10% of R3 for the lowest possible working frequency. Let's say our lowest frequency is 30 Hz. The impedance of a capacitor is Xc = 1/(2*PI*f*C3). If we extract C3 and put in the frequency and value of R3 we get C3=1/(2*PI*f*R3/10) = 53uF. To match the nearest norm value let's make it C3 = 47uF.
Now see the completed schematic in the last picture. We're done!
Step 4: Making the Mechanics Part 1: List of Materials
I used the following components for making the device:
- All electronic components from the schematic
- A standard plastic case 80 x 60 x 22 mm with an embedded compartment for 9V batteries
- A 9V battery clip
- 1m 4pol audio cable with jack 3.5mm
- 3pol. stereo socket 3.5mm
- a switch
- a piece of perfboard
- a 9V battery
2mm copper wire 0,25mm isolated strained wire
The following tools should be used:
- Soldering iron
- Electric drill
- Digital Multimeter
- a round rasp
Step 5: Making the Mechanics: Part 2
Place the switch and the 3,5mm socket
Use the rasp to file in two half-holes in both parts of the casing (upper and lower). Make the hole wide enough for the switch to fit in. Now do the same with the 3.5mm socket. The socket will be used to connect earplugs. The audio outputs from the 4pol. jack will be routed to the 3.5mm socket.
Make holes for cable and fototransistor
Drill a 3mm hole at the front side and super-glue the fototransistor into it so that its terminals are going through the hole. Drill another hole of 2mm diameter on one side. The audio cable with the 4mm jack will run through it.
Solder the electronic
Now solder the electronic components on the perfboard and wire it to the audio cable and the 3.5mm jack as shown in the schematic. Look at the pictures showing the signal pinouts on the jacks for orientation. Use your DMM to see which signal from jack comes out on which wire to identify it.
When everything is finished turn on the device and check if the voltage outputs on the transistors are more or less in the calculated range. If not try to adjust R3 in the first stage of the amplifier. It will likely be the problem due to the widespread tolerances of the transistors you may have to adjust its value.
Step 6: Testing
I built a more sophisticated device of this type some years ago (see video). From this time i collected a bunch of sound samples i want to show you. Most of them i collected while i was driving in my car and placed the fototransistor behind my windscreen.
- "Bus_Anzeige_2.mp3" This is the sound of an external LED-Display on a bus passing by
- "Fahrzeug mit Blinker.mp3" The blinker of a car
- "LED_Scheinwerfer.mp3" The headlight of a car
- "Neonreklame.mp3" neon lights
- "Schwebung.mp3" The beat of two interfering car headlights
- "Sound_Flourescent_Lamp.mp3" The sound of a CFL
- "Sound_oscilloscope.mp3" The sound of my oscilloscope screen with different time settings
- "Sound-PC Monitor.mp3" The sound of my PC-monitor
- "Strassenlampen_Sequenz.mp3" Street lights
- "Was_ist_das_1.mp3" A faint and strange alien-like sound i catched somewhere wile driving around in my car
I hope i could wet your appetite and you'll go on to explore the new world of lightsounds on your own now!
Participated in the
Electronics Tips & Tricks Challenge