Create a simple Audio Amplifier (LM386) part 1

While waiting for some components for Experiment 23 of Make: Electronics I decided to create a simple Audio Amplifier. I had a LM386 chip lying around which is more than adequate for this purpose. My first goal was to create an amplifier circuit with it on the breadboard and do some experimenting with it. Maybe I can use this set-up later as a simple amplifier for my sons ipods or android phones.

The LM386 is a low voltage chip making it ideal for a battery operated device. It has a OpAmp built in. See the image below for the pin layout. When pin 1 and pin 8 are not connected the gain is 20 but this can be increased to 200 if a 10uF capacitor is placed between these pins. Pin 4 and 6 provide supply voltage for the chip. Pin 3 is the input and a potentiometer connected to it will act as a volume control. Pin 5 is the output and can be connected to a speaker.

There is plenty of literature and schematics on the LM386 on the internet. For now I choose the one used by HackaweekTV on YouTube (https://www.youtube.com/watch?v=3KyBrAoHMX8). It uses a 10K potentiometer for volume control and a 10uF capacitor to increase gain.

Only a few components were needed so building it on a breadboard was straight forward. While testing it the amplification is excellent and the music sounds ok. Next time I will try to improve the circuit.

Pinout diagram of the LM386

Schematics of HackaweekTV used for this experiment 

Circuit on the breadboard with the audio jack and the speaker. On the left the 100uF smoothing capacitor.

Close-up of the LM386 and the connections to all the components.

Make: Electronics Experiment 22

Experiment 22 of the book Make: Electronics is a simple experiment to demonstrate use the 74HC02 logic chip as a flip-flop. The 74HC02 is a logic chip with four NOR gates. The schematic of this experiment can be found in figure 4-98 on page 21 of the book. A SPDT switch is used to flip the circuit in one of the two possible states. The state is indicated by two LED’s connected to two different NOR gates. Other input, in this case pulling a wire from the switch out of the breadboard, is ignored by the circuit (debounce).

Building this circuit is simple by now. I already soldered wires to the SPDT switch for the previous experiment. When the circuit is powered one of the LED’s lights up. Flipping the switch lights the other LED. When I turn the switch a positive current is send to the a NOR gate. The negative current of this NOR gate crosses over to the input of the other NOR gate creating a positive output on this gate. The circuit can be rewired with NAND gates (74HC00 logic chip) and negative switched input.

A video of this experiment can be found on my YouTube channel at https://www.youtube.com/watch?v=ovMBXPhbJjw.

Breadboard with simple flip-flop circuit based on the 74HC02 logic chip. 

Close-up of the flip-flop with two LED’s green and orange, indicating the state of the circuit. A connection between pin 3 and 4 is invisible on this image due to the (green) connection between pin 1 and pin 6 above it. These connections function as cross overs between the two NOR gates.

Make: Electronics Experiment 21

Experiment 21: Race to Place from Make: Electronics describes a circuit useful for a quiz show like Jeopardy. Pushing a button lights an LED and locks the button of the other player(s). The two player schematic is depicted in figure 4-95 on page 208 of the book and is built around the 74HC32 logic chip (with four OR gates) and two 555 timer chip in bistable mode. The circuit can easily be extended to three players (figure 4-94). Pushing a button (e.g. S2) triggers pin 2 of the first 555 timer. The output from this timer locks pin 2 from the other timer by keeping the voltage high.

Compared to the previous experiment this circuit is relatively easy to build on the breadboard. Nevertheless, I made a mistake. I forgot to connect the output of the second OR gate of the 74HC32 chip to the second 555 timer. As a consequence pushing S3 didn’t light up the second LED and the other button was not locked.  After comparing the circuit on the breadboard with the schematic I discovered my mistake and corrected it.

I uploaded a video on this experiment to my YouTube channel at https://www.youtube.com/watch?v=NbgLElHG3l8.

Close-up of the circuit on the breadboard.

Overview of the circuit with the two tactile switches, S2 and S3 and the SPDT switch S1.

Cryptolocker removed

A friend of mine brought in his PC that had, according to him, some issues. I’m not an IT security expert but I’m the guy that family and friends turn to if they have problems with their computer. These problems can vary from malware, adware, slow computer and so on. I decided to boot the PC and take a look. After start-up it was clear that his PC (generic ASUS laptop with Windows 7 installed) had been infected with CryptoLocker.

I’ve red about it but had never seen in the ‘wild’. My normal strategy when I encounter malware/adware is to run MalwareBytes first and then AdwCleaner. Just to be save I also run DrWeb Cureit!. However in this case, because of the severity of the problem, I started with Kaspersky Rescue Disk 10. I created a bootable CD (on a Mac) with the Rescue Disk iso file. I booted the PC with the CD and a full day of scanning the Rescue Disk only found a few infected files (see image below). After I rebooted the PC with Windows 7 CryptoLocker was still very alive.

So I decided to return to my regular Malwarebytes/AdwCleaner strategy. Malwarebytes came up with hundreds of infected files but was not able to remove CryptoLocker. Next I tried booting in Windows Save Mode. Normally this is F8  but somehow the PC didn’t respond to that (due to CryptoLocker?). A bit desperate I interrupted the next boot process. This gave me the option to Launch Startup Repair (from the Error Recovery Window). This brought me in the Advanced Boot Options Window and from there I could start Windows Save Mode with Networking.

Next I ran Malwarebytes (update first) and Adwcleaner. This time Malwarebytes did detect CryptoLocker and could remove it. From then on it was simple to remove the other unwanted programs. With CCleaner I fixed issues e.g. with the registry. The PC is clean again however all document (jpg, docs etc) are encrypted. Luckily my friend had a back-up disk of the documents. I scanned with Malwarebytes and McAfee (which was on his PC).

Cryptolocker in the wild.

Results Malwarebytes with Windows 7 in Normal Mode already gives 326 infections.

Malwarebytes in Safe Mode finally nails CryptoLocker.

All documents on the PC are encrypted.

Experiment 20: A Powerful Combination part 2

After having done most of the circuitry of Experiment 20 yesterday today I connected the relay and all loose wires from the keypad to the circuit. I had to read the description of some of the experiments with relays earlier in the book Make: Electronics (e.g. experiment 7) again to be able to wire the relay correctly. I added a yellow LED indicating that the relay is flipped in the off state and a green LED relay indicating that the relay is flipped to the on state (see image below).

The circuit now functions as follows. When the asterix is pressed the LED on the right side of the circuit is lit. While this key is pressed the code 1-4-7 is pressed. Next the LED just above the 555 is lit for a brief moment. Then the relay flips on and the green LED lights up. To flip it off again I have to press the hashtag on the keypad, the relay flips off and the yellow LED lights up.

I noticed on YouTube (https://www.youtube.com/watch?v=owvgzOeLOo0 at 2:30) that another reader of the book needed a 2N2222 transistor to amplify to signal from the 555 timer. I had no such problem.

I made a short video of this experiment. You can find it on YouTube at: https://www.youtube.com/watch?v=ZIwcqI1z7N0

The yellow arrows indicate the wires from the hashtag on the keypad and the output of the 555 timer to the relay.

The yellow arrow on the left indicates all other wires from the keypad (0,2,3,5,6,8,9) to the first inverter on the 74HC04. The other yellow arrow indicates the LED that is lit after the asterix is pressed on the keypad.

Experiment 20: A Powerful Combination part 1

Experiment 20 of Make:Electronics describes a hardware device that protects a computer (or any other electrical device) from being used unless a specific numeric code is entered on a keypad. The experiment is built around two 7400 logic chips (74HC08 and 74HC04). These chips process the input from the keyboard and trigger a 555 chip if the three digit input is correct. The 555 chip in turn switches a (latching) relay.

Initially I had a problem finding a numeric keypad suitable for this experiment. The Velleman 12 keys Keypad KP-12 wasn’t available at my local supplier. Luckily I found an alternative that is fulfilled the requirements (and looks suspiciously similar to the Velleman).

Breadboarding was done according to figure 4-84 of the book. I double checked all the connections. At this stage I left the relay out and tested the circuit. After punching 1-4-7 the LED on the output the 555 timer lit up however with further testing I discovered a problem. Every numeral code that includes 1 and then 7 lit up the LED (e.g. 1-9-7). After comparing the circuit on my breadboard with figure 4-84 I discovered that I mistakenly had pin 4 and pin 5 of the 74HC08 logic chip connected (see image below). Also digit 4 of the keypad was connected to pin 5 instead of 4. After I corrected the mistakes everything worked fine. Next I’ll try to connect the relay to the circuit.

Overview of the circuit on the breadboard. Relay is disconnected from the rest of the circuit.

The mistake that I made visible in the ‘fish eye’

Make:Electronics, Experiment 19: Learning Logic

With experiment 19 of Make:Electronics I’m entering the world of pure digital electronics. This experiment explains the basics of the 7400 family chips. It is also a prelude to experiment 20. First an LM7805 voltage regulator is used to to provide precisely 5 volts DC. Then a simple circuit is built around the 74HC00 chip (the NAND chip of the 7400 family). This circuit (figure 4-46 of the book), shown on the image of the breadboard below, demonstrates the function of one NAND gate (out of four on the chip). Two tactile switches provide input on the NAND gate and the LED provides a visible output. As expected the the LED lights up if none or one tactile switch is pushed. If both tactile switches are pushed the light of the LED goes out.

Next I replaced the 74HC00 with the 74HC08 chip, which is the AND chip. This chip functions opposite to the NAND chip. So only when I push the two tactile switches simultaneously the LED lights up.

In the last part of this experiment a diode is introduced. It connects the output of the first AND gate with an input of the same gate (figure 4-79 of the book). There is only one tactile switch left since the first pin is connected directly to the positive voltage. Once the tactile switch is pushed the LED lights up and stays on even if the switch is let go (like a latch).

Overview of experiment 19 with the LM7805 on the right. 

With 74HC00 NAND chip.

Latch configuration with pin 1 connected to positive voltage and a diode connects pin 3 to pin 2.

Atari Punk Console part 3: finished

I finally finished the Atari Punk Console (APC) that I blogged about previously. This time I worked on the external connections and the enclosure. First I took a cheap grey project box and drilled holes for the two potentiometers, speaker and LED into the lid. I also drilled a hole for the perf board and a switch into the bottom of the project box. I soldered all the external connections and glued a small speaker on the inside of the lid. At this stage I tested the APC for the last time. Then I inserted everything into the project box and closed it with four screws. To give you a sample of the noise that can be created I uploaded a video on YouTube. Everything including a 9V block battery fitted nicely into the enclosure.

Perf board connected to all the external connections.
The perf board nicely fits into the project box.

Making music or noise with the end result.

DIY planter for tiny kitchen garden

My wife asked me to build two wooden boxes and a planter for her vegetables and herbs. She has become serious about having her own tiny kitchen garden. So I bought some cheap 14 cm wide and 15 mm thick pinewood. I cut the wood at the desired length and connected it with 4 x 40 mm chipboard screws. The inside of the boxes were covered with anti-root fabric. The planter was made of the same wood as the boxes. I got the idea of the planter on the YouTube channel of Steve Ramsey at https://www.youtube.com/watch?v=T8-IlmLA27g. I simplified his version since I only needed two tiers instead of three. It’s easy to build, cheap and transportable. Now I just have to wait until these delicious radish are finding there way to my plate.

A more recent image of the kitchen garden. The vegetables are all doing well (we’ve already eaten the radish).
Two tier kitchen garden without the boxes. Easy to build and transportable.

Wooden box for kitchen garden 60 by 27 cm (length x width). The inside is covered with anti-root fabric.

Experiment 17: Set Tour Tone revisited

While working on the Atari Punk Console I reread the part of chaining chips in Experiment 17 of Make:Electronics (pg167). I then realised that I didn’t do all the experiments that are described in the book. Since Experiment 17 contains a lot of information and chaining 555 chips is common practice in electronics I decided to at least one of the remaining experiments. This experiment is described in figure 4-30 (pg169). In this experiment the output of the first 555 chip is connected to the control (pin 5) of the second 555 chip. Both timers are in astable mode. The second chip drives a speaker. The first 555 chip, that oscillates slowly, slowly decreasing the pitch of the of the sound generated by the second chip until the cycle of the first chip ends and the frequency drops. This results in a slow whoop like the sound of a siren.

After building the circuit the sound produced was very distorted and unlike the slow whoop I was expecting. The LED connected to the first chip performed as expected with about one pulse per second. After inspection of the circuit I noticed that the 100 ohms resistor in series with the speaker had become very hot. I changed it for a resistor of 180 ohms and now the circuit worked fine. I substituted a 10K potentiometer (see images below) for the R7 resistor (1K) which made some interesting changes in the slow whoop (higher or lower pitched).

At this point in the book I believe the use of an oscilloscope would become interesting even helpful.  I would be able to analyse the waveform on several pins of the circuit. The oscilloscope is however an expensive piece of equipment which I don’t own yet. It will put it on my wishlist. Something I noticed with this hobby that there appears to be an ever increasing need for space, equipment and components.

A video of the experiment, with several tweaks of the circuit, is available at https://www.youtube.com/watch?v=d_ADg2LS3fA

Complete circuit of figure 4-30. R7 is substituted with a 10K trimmer.

Close-up of the circuit.