40106 Oscillator Continued

40106 Oscillator Schematic

I left my last post (40106 Triangle Waves) on a bit of a cliff hanger. I had shown how to pull a triangle wave from the circuit and identified some issues with the oscillator as it stood. Today I’d like to go over those issues and how I corrected them to get this oscillator up and running.

I do want to mention the oscillator design above is still in a somewhat rudimentary form. I expect there will be quite a bit of optimization that can be done on it as time goes on.

Buffering

Since we are pulling our outputs directly from the loop which sets the frequency, any elements we add to the circuit which draw current will affect the frequency. This is not ideal. What we need to do is isolate the oscillator circuitry from any further additions to the circuit. For the square wave this is extremely straight forward. Since the signal is binary (digital) we can simply send the output through a second inverter on the 40106 chip. Take note: this will invert the signal (when the original oscillation was high the buffered oscillation will be low) however since this is a repeating signal it won’t cause any impact.

The triangle is slightly more difficult to buffer since we need to concern ourselves with a range of analog values. I accomplished this by feeding the signal through an LM324 op-amp set up as a voltage follower with an additional 10uF capacitor on the output.

Amplification

After the buffering stage I was still left with dramatically different amplitudes for the two wave forms. The square wave after the buffer sat at almost 9V while the triangle was only 1.4V (The output voltage of the LM324). There’s a number of ways you can approach this inconsistency however I found myself somewhat limited by the parts I had on hand and by my decision to run this oscillator on a single 9V battery supply.

How I ended up overcoming this was by using voltage dividers to lower both signals to about 1V peak to peak. From here the selected input is sent into a very basic LM386 power amplifier.

This solution does introduce a large amount of noise into the square wave signal so you may choose to bypass the amplifier with the square wave and only use it on the triangle.

Set up this way I got both signals to reliably output approximately 5Vpp.

Decoupling

One issue I ran into a lot with this circuit, especially building on breadboards was noise. The frequency would bounce around and the wave-forms would not be crisp. This can be largely overcome by adding decoupling capacitors between the negative and positive supply lines. An excellent overview of decoupling (and many other common capacitor uses) can be found over at SparkFun.

LM386 Modifications – Yamaha PSS-30

circuit bending LM386 modifications
While completing my first set of mods on my Yamaha PSS-30 I noticed that the internal amplifier driving the mini keyboard was a 386D amplifier chip. This chip has an identical pin out and seemingly identical function to the popular LM386 which gave me some ideas for possible bends I could try. If I was able to apply some common modifications or adjustments which work with the LM386 in amplifier applications like the LM386 guitar amp I may be able to further expand the versatility of the instrument.

circuit bending

The first modification deals with the gain of the amplifier. If you’ve worked with LM386s in the past you may already know that the gain of the amplifier is set using pins 1 and 8 of the chip. Essentially by placing a resistor (usually 1 ohm – 10K ohm) and a capacitor (typically 10 uf) between these two pins you can set the gain. The higher the resistance of the resistor, the lower the gain. Upon inspection of the circuit I could see this is exactly how this 386D chip was set up. Pin 1 is connected through a 10 uf capacitor, which connects to a 1.1K ohm resistor (immediately to the left of the chip) And then to pin 8 of the chip. In order to replace this system with a variable gain control I removed the 1.1K resistor and replaced it with a 5K ohm potentiometer. By reducing the resistance you can get a slightly crunchier and more distorted sound, and by raising the resistance you can get a cleaner more polished sound. Note the gain level will influence the volume of the output so you will need to compensate for this either at the volume control added in Part 1 or at your mixer/amplifier.

circuit bending

While I was under the circuit board attaching the leads for the gain pot I also connected a few more wires for use with my second mod. I connected the first wire (yellow) to pin 1 (gain control pin) and two blue wires to pin 5 (output). These will be used for the second modification I had in mind. This is a slightly less used LM386 circuit modification but still one which is fairly well documented. By sending a signal from the output pin (5) through a small capacitor and resistor to the gain control pin (1) you can create a bass boost effect. To accomplish this I attached the first blue wire to a switch on my panel. I then ran it through a 0.1 uf capacitor and a 10K ohm resistor. I attached the yellow wire to the other side of the resistor completing the circuit. Now by flipping the switch you connect the bass boost circuit.

Though the bass boost is audible I am not overwhelmingly impressed with it. It is far from the thumping low end I was hoping for. This may be a limitation of the device itself but I feel like further experimentation is needed. I will be going back in to experiment with some other cap/resistor values and other circuit options to see if I can get a better effect. I will report back here if I find better results.

circuit bending

The second blue wire I connected through a resistor to an LED and tucked it behind the circuit board. Because I used a transparent panel this creates a cool back lit effect and since it is powered from the amplifier output it pulses along with whatever is being played on the keyboard.

That about raps it up for the PSS-30 for the time being. I really love the small form factor of this device and would love for it to make it’s way into my regular instrument lineup. In spite of this circuit being a bit limited as far as bend points and options, I still had a lot of fun and got to try out some interesting new things on the circuit. I’m going to keep this device in the back of my mind as I work on other projects and hopefully I can return to it down the road with some new ideas to further mangle it’s square wave outputs. That’s all for tonight but thanks for reading and happy soldering!

Toy Keyboard Salvage

Scrap Keyboards
So I’ve been tinkering away in my workshop on a very cool new project I think you’ll enjoy, it is still a work in progress but I should have it finished up and online next week for you guys to check out. In the meantime though I wanted to share some keyboard salvage pictures I took while tearing apart some toy keyboards I had kicking around my shop.

As someone who compulsively buys cheap used electronics from thrift stores every so often I find the random chunks of plastic lying around my shop are starting to pile up and get in my way. When this happens my destructive tendencies get a chance to come out and play. I can spend some time reducing these large monstrosities to their small and easy to store component parts.

Further I know if you’re anything like me you want to see what’s inside every toy you encounter. I’m very much of the mind that the more photos of toys and devices opened up with their innards exposed there are out in the world the easier it will be for us as circuit benders to judge toys at thrift stores or garage sales without the weird looks you get when you start taking things apart in public. Today I have three keyboards I’m going to pull apart and let you have a look at.
Simba Super Concert

The first is a “Simba Super Concert Keyboard”  which works relatively well but I have had very little luck bending. The buttons on the face seem to have been poorly constructed and many are not working very well. When I trigger these buttons directly from the board the sounds are still there so it seems this is just a mechanical issue with the keys. This is reassuring as there are a number of interesting sound samples on the board (animal sounds and different instruments) which I may incorporate into a future build.

From the board you can see there is very little going on, the small vertical board holds a black blob IC and a pitch resistor but little else. The reverse of this board simply contains a large button matrix.

Chinese Keyboard
Next up is a cheap toy keyboard from China I picked up at a discount store. There is no brand printed on it but it appears to be made by Jinjiang Shengel Toys ltd. I have to admit I did not have high hopes for this one, it sounded foul and felt worse. The plastic was extremely lightweight and poorly constructed. My favorite feature was the USB port on the right side of this photo, which is to say the rectangular hole in the body labelled USB with no port or supporting electronics to be found.

20170116_191044_HDR
I did have one pleasant surprise when I opened this keyboard up though. It’s probably a bit hard to make from this photo but this is a fully functioning LM386 amplifier which was used in the keyboard. I was  pleased to find an LM386 as it is a chip I am fairly familiar with and one I have worked with in the past. With some simple modifications I should be able to add gain and a volume control to this amplifier and re-use it in a future project.

20170116_175907_HDR
Last up for this keyboard salvage session was a Kawasaki Pro-37 keyboard. Unfortunately this keyboard was in pretty rough shape. It was given to me used and the sound circuit had been essentially destroyed from battery corrosion. I didn’t get a picture of the inside for this reason but it was not a pretty sight. That being said I was still able to salvage some useful hardware from the toy.

Spoils
20170116_190233_HDR

So at the end of the day I walked away from these three keyboards with several large button matrices, Some small sound generating circuits, an LM386 amplifier, a few speakers (of varying quality), several battery compartments (cut out from the keyboard bodies), several sets of keys, a small pile of switches and buttons and most importantly some space on my shelf. Hope you guys enjoyed these keyboard salvage pictures. I should be back next week with an exciting new build.

LM386 Power Amplifier

LM386 complete 10-20

Before we start building strange noise makers or outlandish guitar effects we are going to need something to use to play them. If you have a background in music you may have an amplifier or two lying around but I like to have something small and low powered I can keep on my workbench for testing and playing around with new devices before I roll out my admittedly oversized guitar amplifier. This is where the LM386 Power Amplifier comes in.

The LM386 is a popular little power amplifier chip which can be very easily turned into a versatile DIY desktop amplifier. This lightweight amplifier is easy to build and can be run on a 9V battery making it simple, portable and perfect for beginners to audio DIY. It also features options to control the amplifier gain and add bass boost functionality allowing you to customize your circuit and output the sound that best suits your application.

Click here to get started!