VU Meter (LM3915) – B2P20

The LM3915 is another popular IC that can be used to build interesting circuits. It is designed to drive 10 LEDs depending on the analog voltage signal applied to the input.

VU meter

The LM3915 has an adjustable voltage reference and each of the LEDs represent a 3dB step, this makes it a perfect chip to build a volume unit meter or VU meter.

VU meter

It can only handle one input at a time, so we use two LM3915 ICs to handle both the channels. The audio signal from the Bluetooth receiver is of low amplitude and we use an LM358 op-amp to amplify this.

VU meter

Since the LM358 contains two individual op-amps, a single IC is sufficient for both the channels. The circuit for the right and left channels are identical so we can simply look at the right channel for now.

VU meter

The audio input is first fed into the op-amp which increases the signal amplitude by approximately 8 times. The signal is then passed through a capacitor to block the DC component and is then passed through a trimpot, the output of which is fed into the LM3915 IC.

VU meter

As we will see later, the trimpot allows us to adjust the output signal and this would only need to be done once. Resistors R10 and R11 set the reference voltage which is about 450mV when the circuit is powered with 5V. R12 is used to set the LED brightness.

VU meter

This is what the assembled PCB looks like. Let’s connect the audio output from the Bluetooth speaker PCB to the VU meter and let us switch ON the power supply. We can adjust the audio level that is fed to the LM3915 by adjusting the potentiometers. By default, the LM3915 represents the audio level by illuminating a single LED corresponding to the audio level, but since the actual audio signal level changes rapidly, we not only see the peak, but also the lower audio levels that build-up to the peak.

VU meter

Adding a jumper to the mode pin will switch the LM3915 into the bar mode, which illuminates the LED corresponding to the peak audio signal level and all the others below it. One thing to note is that even though we have the same amount of current flowing through the LEDs the green LED appears to be much brighter than rest. One way around this would be to add individual current limiting resistors for the green LEDs.

Bluetooth Speaker System (Audio Blobs) – B2P19

Building a Bluetooth speaker from the ground-up is a challenging task, but thankfully, we have pre-programmed modules that can be used to make it much simpler. We will use one such Bluetooth audio module to build a Bluetooth speaker.

Bluetooth Speaker System

The BBox 2 contains two modules called blobs, which further simplifies the building process. One consists of a pre-programmed Bluetooth audio module and the other consists of two class D amplifier ICs. The Bluetooth audio blob consists of a CSR8645 Bluetooth receiver that handles all the Bluetooth related tasks and gives us the audio output.

Bluetooth Speaker System

The Bluetooth audio blob is represented as U$1 in the schematic. We connect the power pins, two status LEDs along with the volume control switches.

Bluetooth Speaker System

The MFB pin acts like an enable pin and the RC circuit consisting of R3, R4 and C3 creates a short delay which is needed as per the design spec for the CSR8645 module. The audio output is sent to the two individual amplifier ICs after passing through a capacitor which is used to block any DC component contained in the signal.

The amplifier ICs themselves are extremely simple. All they need is power and a bypass capacitor to produce an output. We add some filtering and reservoir capacitors to absorb any surges in the current, particularly at high volumes. The control pin can be used to mute the audio output and we connect this to a switch. The output from the audio amplifiers is fed directly to the speakers.

The PCB also contains 4 probe points that can be used to extract the audio signal from the Bluetooth receiver and use it in external circuits. We will be using these in the next project which creates a visual effect from the audio signal.

Bluetooth Speaker System

Assembling the PCB is not difficult but please ensure that the capacitors are placed with the correct polarity. You will also need to solder the header pins to the two blobs. Please ensure that you insert the blobs with the correct orientation and there are hints on the main PCB to help you with this. The Bluetooth audio blob requires 3.3V while the amplifier uses 5V, so ensure that you have connected the correct voltages to each of the screw terminals.

Bluetooth Speaker System

When the PCB is powered ON, the two LEDs will start to flash quickly indicating that no device has been paired with the receiver.

Bluetooth Speaker System

Head over to your Bluetooth device and select the receiver which would either show up as CSR8645 or F-3188. Once paired, the LEDs will stop flashing continuously. You will now be able to play audio from your Bluetooth device and this should playback on your speakers.

One thing to keep in mind is that the speaker enclosure plays a huge role in determining audio quality. Leaving them on your table is certainly not going to give you the best sounding audio. In fact, simply holding them with your hands and rotating them will change the way they sound. We recommend placing them in an enclosure to enhance the audio quality.

Bluetooth Speaker System

Bluetooth Speaker System

There are many ways by which you could create a DIY enclosure, you can even cut a few holes in the box and add the speakers, PCB and battery inside to create a portable Bluetooth speaker.

Bluetooth Speaker System

Alternatively, you can add the speakers to either end of a can for a better-looking system.
With that being said, lets now work on the final project which helps us create a visual effect.

Voice Recorder (ISD1820) – B2P18

We will now use the ISD1820 IC to build a voice recorder. The ISD1820 is a dedicated voice recorder IC and we will be using the reference circuit contained in the datasheet.

Voice recorder

The ISD1820 works at a maximum of 3.3V, so make sure you connect the right voltage output before powering it ON. An electret microphone is used to capture audio and the output from this is passed to the IC. We have 3 switches that are used for recording and playback along with a status LED.

Voice recorder

Resistor R2 is used to set the recording duration and sample rate. A higher sample rate produces a much better recording but this sacrifices the recording time.

Voice recorder

The IC starts recording audio the moment the REC button is pressed and the RED LED is used to indicate this. Pressing the PLAYE button will cause the audio to play till the end, while pressing the PLAYL button will cause the audio to play, as long as the button is pressed. The PCB also contains holes for a header pin which can be used to interface the IC to a microcontroller. This will allow you to trigger the recording and playback remotely.

Combination Lock (XOR + NOR Gates) – B2P17

We will now look at two new logic gates and we will use them to create an extremely basic combination lock.

Combination lock

The 74HC86 consists of 4 XOR gates which have 2 inputs each. The output of an XOR gate is LOW when both the inputs are the same (either HIGH or LOW) and the output is HIGH in all other cases.

Combination lock

The 74HC02 consists of 4 NOR gates which have two inputs each. The output of a NOR gate is HIGH when both the inputs are LOW and the output is LOW in all other cases.

The combination lock works on the following principle. We have a known good combination, also called the key which is compared to the user input. If the two are a match, then the green LED will glow, otherwise, the red LED will glow.

Combination lock

Let’s assume that SW1 is the key, while SW2 is the user input. We’ve added pull-down resistors to give us a known LOW state and all these switches are connected as inputs to the XOR gate in pairs. This means that switch 1 from both SW1 and SW2 are connected to the same XOR gate and so on. The outputs of all 4 XOR gates are connected to 4 diodes which are then connected to a pull-down resistor. If all 4 user input switches match the reference key, then the outputs of all 4 XOR gates will be LOW. In all other cases, the combined output will be HIGH which will cause a voltage drop across R10. This output voltage is used as the input for the 74HC02 NOR gates.

Combination lock

The output is first fed into both the inputs of the first NOR gate. This results in the signal being inverted and this is fed into input A of the second NOR gate. Input 2B is connected to the switch which pulls the pin LOW when pressed. NOR gate 2 is responsible for controlling the ERROR LED. If the user input did not match the key, then the output from the XOR IC would be HIGH. This is inverted by the first gate to give us a logic LOW. This logic LOW will be compared with the logic LOW input from the switch, and the resulting NOR operation would give us a logic HIGH which would cause the ERROR LED to glow. In all other cases, the ERROR LED would receive a logic LOW, keeping it OFF.

Input 3A directly receives the output from the XOR gate, while input 3B receives the input from the switch. If the user input matched the key, then the XOR IC output would be LOW. This LOW value would be compared with the LOW value from the key and the resulting NOR operation would be a logic HIGH which would cause the OK LED to glow. In this way, we can demonstrate the working of a very simple 4-bit combination lock.

Combination lock

Here’s what the assembled PCB looks like. Please ensure that the ICs are placed with the right orientation. This project demonstrates the principles of logic gates and in reality, the combination lock would have to have much more than 16 combinations for it to be effective. It would be much easier to use a numeric keypad along with a microcontroller to set and verify the user entered key. All logical operations can be carried out with software, preventing the need for external logic ICs. Let’s move on to the next project.

LED Heartbeat Circuit (LM358) – B2P16

The heartbeat or breathing circuit is a nice little LED project that makes use of a relatively simple circuit. We’ve used the LM358 op-amp in the previous project and to quickly recap: it’s an analog device whose output is the difference between the voltages at its two input terminals.

LED heartbeat

Transistor Q1 is used to control the LEDs and it will switch from the cut-off to linear, to saturation region depending on the voltage applied at its base terminal. Internally, the LM358 contains two op-amps which are both being used in this circuit. The op-amp section is designed to give us a ramp-like output that is fed to the base of the transistor which in turn controls the LEDs.

LED heartbeat

The positive terminal of U1G1 is connected to a voltage divider network consisting of R1 and R2. The values of R1 and R2 keep the positive terminal at a fixed voltage that is half of the supply voltage. The negative terminal is connected to the capacitor C1. When first switched ON, the output of U1G1 is HIGH and this causes the capacitor to start charging with the polarity as shown. The ramp waveform is in its rising phase which causes the LEDs to start glowing brighter.

LED heartbeat

The ramp output voltage is also fed back to the positive terminal of U1G2, while the negative terminal of U1G2 is held at the same reference voltage from the R1-R2 voltage divider network. The output of U1G2 will increase as the voltage difference between its input terminals increases. This output is connected to the left terminal of C1 and eventually, it will be at a higher potential compared to the right terminal. At this point, the output of U1G1 will start decreasing and the capacitor will start to discharge and charge with the opposite polarity. The output ramp voltage enters the falling phase, which causes the LEDs to fade away.

LED heartbeat

This ramp cycle repeats continuously and VR1 can be adjusted to change the ramp speed. Here’s what the assembled PCB looks like. Please be sure to place all the LEDs with the right polarity.

Electronic Candle Circuit (555 + LM358) – B2P15

We’re going to now build an electronic candle using a 555 timer and an op-amp.

To give us a candle-like effect, we will be using a flicker LED which has two terminals and can be used as a standard LED.

Electronic Candle

This is what the schematic looks like. We configure the 555 timer in the bistable mode, meaning it has two stable states – SET and RESET, just like an SR flip-flop. The state of the 555 timer is controlled by the voltages at pins 2 and 6.

We use a voltage divider consisting of an LDR to trigger the timer IC. When we bring a flame close to the LDR or if we shine a bright light on it, it’s resistance will decrease and this will reduce the voltage at pin 2. If this voltage falls below 1/3rd of the supply voltage, then it will cause the output of the timer IC to go HIGH, switching ON the LED.

The voltage at pin 6 is responsible to RESET the timer IC or switch OFF the LED. If the voltage at pin 6 rises above 2/3rd of the supply voltage, then the timer IC will be RESET. The circuit consists of an op-amp, whose output is connected to pin 6. The inputs of the op-amp can be connected to two voltage divider circuits. One consists of a 100 Ohm resistor and thermistor, while the other is made up of a 2.2K resistor and 10K trimpot. The op-amp we are using is the LM358 whose output voltage is the difference between the two input voltages. The output of an op-amp is analog in nature, i.e it gives us the actual difference in the inputs, while the output of a comparator is digital in nature as it gives us a logic HIGH when the positive input is at a greater voltage compared to the voltage at the negative input.

The idea behind the design of the electronic candle is that one could blow air over the thermistor which would change its resistance and this could then be used to trigger the comparator. There are two hurdles that must be overcome to achieve this. Firstly, blowing air over the thermistor is only going to change the resulting voltage divider output by a few hundred millivolts. This means that the other input to the comparator must be matched closely to the ambient output voltage. This can be done by adjusting VR1.

The second concern is that the response of the thermistor will depend on the ambient temperature relative to the temperature of the air being blown. If the air being blown over the thermistor is cooler than the ambient temperature then the resistance of the thermistor will increase as it has a negative temperature coefficient. This will cause an increase in the voltage divider output. On the other hand, if the air being blown over the thermistor is warmer than the ambient temperature, then it will decrease the thermistor resistance and the output of the voltage divider.

Electronic Candle

Based on this, you can configure the jumpers to send the correct signal to the op-amp inputs in order to generate a positive output when you blow over the thermistor. One way to determine this is by powering ON the circuit and measuring the voltage at the NTC output. You can then blow some air over the thermistor to watch how the voltage changes. In my case, there is an increase in the output voltage and this means that I need to connect the NTC output to the positive input of the comparator. The trimpot output should be connected to the negative of the comparator and it should be adjusted such that the output voltage is about 100mV below that of the NTC. This way, the comparator output would be LOW under normal working conditions and the LED can continue to glow. When you blow some air over the thermistor, it will cause the thermistor voltage to increase and when this voltage rises above the voltage at the negative input of the comparator, it will cause the comparator output to go HIGH and it will RESET the timer IC, switching OFF the LED.

This circuit is a wonderful example of why a software solution is sometimes better than a hardware solution. If we could use a microcontroller then we would be able to detect a sharp rise or fall in the NTC output when air is blown over it. We would then be able to switch OFF the LED and we wouldn’t have to keep adjusting the trimpot when the ambient temperature changes. We will explore microcontrollers and programming in BBox 3.

Electronic Candle

Here’s the assembled PCB in action. A gaslighter flame is used to trigger the IC and switch ON the LED. Blowing air over the thermistor resets the timer IC. Let’s move on to the next project.

Reaction Timer Circuit (555 + 4026) – B2P14

We’re now going to look at two new components – the CD4026 counter and the 7-segment display and we’re going to use them to build a simple reaction timer circuit.

Reaction timer

A 7-segment display is nothing but 7 LEDs grouped and arranged in figure 8 along with another LED that acts as a decimal point. Together, these can be used to display the digits 0-9 and a decimal place.

Reaction timer

The 7 segments are labelled a to f and there are two common types of 7 segment displays – a common cathode display and a common anode display. As the name implies, a common cathode or CC display has all the LED cathodes connected together so we need to apply a positive voltage to each of the segment pins to switch them ON. A common anode or CA display has all the LED anodes connected together and so we have to apply a negative voltage or ground to each of the segment pins to switch them ON. The kit contains a common cathode display.

Reaction timer

The 4017 counter IC we’ve used previously can only drive individual LEDs, but the 4026 counter is designed to drive these 7 segment displays. So instead of counting the individual LEDs we can simply read the number on the display.

Reaction timer

Here’s what the schematic looks like. We simply connect the individual display segments to the corresponding pin and connect the common terminal to ground. We supply power to the 4026 and pull up the display enable pin as we want the display to be ON at all times. The 555 timer IC is used in the astable mode with a frequency of about 15Hz. The output is directly fed into the clock signal of the 4026 which means that it will start counting as soon as power is applied.

We have two switches in the circuit. Pressing the start switch will reset the 4026 and it will be held in the reset state with the digit 0 as the output. As soon as the start switch is released, the 4026 counter will start counting at 15Hz and it will only stop once the STOP switch is pressed. Pressing the stop switch asserts the clock inhibit signal which prevents the clock signals from passing into the internal counter section, and this means that the count will be frozen at the last value.

Reaction timer

Here’s what the assembled PCB looks like, please ensure that the 7 segment display is inserted the right way around. Pressing the START button will take the counter to 0 and releasing it will start the count. Pressing the STOP button will freeze the count.

Since we only have 1 segment in the circuit, it can only count from 0 to 9 and it will then wrap around, back to 0. You can add more segments to extend the digits by using the carry-out signal as the clock for the next display. Alternatively, you can add a potentiometer to vary the 555 timer frequency and you can adjust it depending on the count frequency that is needed.

7 segment displays and ICs like the 4026 that can drive them can be used to create all sorts of counters. Let’s move on to the next project.

LED Roulette Circuit (555 + 4017) – B2P13

Another interesting circuit that can be built using the binary counter is a roulette like LED wheel. It’s pretty much based on the same principle as before so let’s take a look at the schematic.

LED roulette

The 4017 is used like before but we add a total of 10 LEDs which share a single current limiting resistor. A 555 timer is used to generate the required clock pulses but the RC network is slightly more complicated like before.

Q1 is a PNP transistor which means that it’s base has to be negative for it to switch ON. When switch S1 is pressed, it pulls the base to the ground and this switches Q1 ON. R1 and R2 form a voltage divider network whose output voltage charges C1. The 555 timer IC works in the astable mode to generate the required clock pulses. When the switch is released, the charge held by C2 keeps the transistor ON and the capacitor discharges through the voltage divider network. As the capacitor discharges, the transistor moves from the saturation to the linear region and the bias voltage keeps reducing as it proceeds to enter the cut-off region. The voltage across R1 & R2 decreases as the transistor switches regions and this also reduces the voltage across the capacitor, C1. The end result is that we see a trail like effect once the switch is released. The LEDs continue to illuminate at a lower frequency until the clock pulses come to a halt and this occurs when the capacitor C2 is fully discharged.

LED roulette

Here we have the assembled PCB and we can see the LEDs being lit as we press the switch. The LED trail effect is not that easily seen with the standard 1uF value of C2 so we can increase this to lengthen the delay.

LED roulette

Here’s what it looks like when C2 is changed to 10uF and you can tweak the circuit values to suit your application. Let’s now learn about a new type of counter in the next project.

Electronic Dice Circuit (555 + 4017) – B2P12

A binary counter can be used to create some interesting circuits and an electronic dice is one of them. The circuit is very similar to the previous one so let’s start by taking a look at the schematic.

Electronic Dice

We have a 555 timer configured in the astable mode, but instead of the 1Hz frequency used previously, we increase it to about 48Hz so that you can’t easily manipulate the result. Instead of feeding the clock directly, we add a switch in between which means that the 4017 counter will only count when the switch is pressed and it will hold on to its count when the switch is released.

Since a dice has 6 outputs, we connect 6 different LEDs to the output pins and we connect the 7th output back to the reset pin. This way, the 4017 counter will reset itself and start counting from 0 after 6. In digital electronics, we start counting from 0, so when I say that we connect the 7th output to reset, I mean we connect output pin 6 to the reset pin as shown in the schematic.

Electronic Dice

Here’s what the assembled PCB looks like. Pressing the switch allows the clock pulses to reach the 4017 counter and the result can be viewed when the switch is released.

LED Runner Circuit (555 + 4017) – B2P11

We will now use a new IC to help us count events. The CD4017 is a binary counter that has 10 output pins.

LED runner circuit

Initially, the first output will be 1, but when a clock pulse is sent to the clock pin, the second output will be a 1, while the others will be 0. Once the next clock pulse is sent to the clock pin, the third output will be 1, while others will be 0. This cycle continues till the 10th clock pulse is sent, after which it will cycle back to the first output.

LED runner circuit

The clock pulse is nothing but a square wave that can be generated using a 555 timer IC in the astable mode.

LED runner circuit

This is what the schematic looks like. We have a timer IC with a frequency of 1Hz and whose output is used as the clock signal for the 4017 counter. The CD4017 has an active HIGH reset pin, which means that the pin needs to be LOW to keep it out of reset. The clock inhibit pin can be used to stop the count, but since we want it to count continuously, we connect this to ground.

If we were to connect 10 different LEDs to each of the 10 outputs, then we would be able to see the LEDs glow from 1 to 10 and then back to 1, but since we want to create a LED runner, we connect them as per the circuit. This gives us a sequential, back and forth effect.

LED runner circuit

This is what the assembled PCB looks like. Be sure to observe the polarity for the LEDs and both the ICs. You can watch the 4017 sequentially illuminate the LEDs and you can change the RC circuit to change the clock frequency.