One of the most important things to have when working with uC systems is a clean and stable power supply. Since we are talking about using uC in effect electronics you will want to get the uC on to a bread board and eventually into an final project. When leaving the development environment first and foremost we have to look at the power needs of the uC system as they are different then most of the effect circuits you have probably seen up until this point. We now have to deal with these power supply issues to ensure we have that clean and stable power supply.
Now I know what your thinking. Did you he use six volts or only five ? Probably most of the logic based circuits you have seen in effects have used logic families like the 4000 series. The reason for this is that these logic ICs can run at nine volts or higher so you do not need to deal with as many power supply issues. The reality is most logic hardware run at five volts or less. This creates a problem for us musicians in our nine volt centric world.
You have a few options. One is to use a separate supply for the uC system. Another is to branch off the incoming supply that is feeding the rest of the effect circuit to create a secondary supply for the uC system. This means dropping the voltage down and filtering it properly to keep the uC system happy.
Most of the time we are caught up thinking about voltage in effect circuits forgetting the other part of the equation, current. Voltages are typically low and fixed in a logic environment so voltage becomes less of an issue for the circuit and current becomes the bigger variable. The logic control circuitry seen in simpler discreet gate based circuits uses little current from the power supply compared to typical effect circuits that we tend to ignore it. The uC itself will probably not need much current for its own needs but often you are going to need other hardware connected to the uC so the hardware's current needs have to be taken into account. With a uC and other hardware in the system you have to pay more attention to current needs of the whole system.
A good habit to get into when designing a system, and you will make a rough design before doing anything, is to come up with what I call a "current budget". Look at all the pieces of your design and figure out roughly how much current you will need. You have to think about all possible loads. Think about static loads like the uC and that LED. You also have to the think about momentary loads like that relay or external memory. Figure out what will be the maximum current pull of the system like driving that relay with the LED on at the same time.
With this budget you can start to figure out some of requirements of the power supply to fit your needs. Do you want to run this off a battery ? Will you be able to run this off of a battery ? Will you need a larger power supply ? What type of power supply will you need ? Will there be noise issues with the power supply type ? Will the power supply be happy running over long periods of time ? Will the power supply last for years ? Will the power supply work over a range of environmental conditions ?
Once you sort out the power supply you can then figure out if the processor will be able to deliver the current needed to any hardware it is driving directly. A uC can only supply so much current at a certain voltage. For example lets say from the datasheet of your uC at 5v you can supply 20mA of current on each of the I/O pins. You may want to drive a relay but the relay needs 110mA so you can't drive the relay directly off the I/O pin. Another thought is you have eight pins in the port so that is 160mA. You need 140mA for the hardware you are connecting to so everything looks good. Go back and read the datasheet again, all of it. Notice the part that says that the whole port of pins can only deliver a 100mA total. Little details like that can cause huge headaches. When you run into something like then its time to look at your design again.
If you surpass the uC current delivering ability you may have to think about other hardware or options like hardware drivers. These things were probably not in the original plan but since you did your home work you now know you need them which is better then finding out later after you have already built the final project.
Note: If you run the uC at a lower voltage it will probably not be able to deliver as much current as it can at a higher voltage. Hardware tends to need different amounts of current at different voltages too. Make sure that when you calculate the current budget you are using the correct voltage ratings.
Now that we know how much current we need at the chosen voltage lets look at some our power supply options.
There are many power regulating options but really with the cost, size, draw backs, and complexity of some other methods a voltage regulator is good way to go. Four factors to look at when researching voltage regulators is the output voltage, output current, drop out voltage, and quiescent current. Other factors to be aware of is package type, cost, and complexity of the circuit needed for the regulator.
The output voltage is the final voltage that the regulator delivers on the output. The output current is how much current can be delivered by the regulator at the output voltage. The drop out voltage is how much extra voltage is needed above the output voltage for the regulator to provide properly regulated voltage. The quiescent current is how much current the regulator uses. Ideally we want the drop out voltage and quiescent current to be as low as possible while delivering the target output voltage and output current.
Note: Make sure to pay attention to the heat dissipating needs of the voltage regulator.
Note: Make sure you follow the proper filtering requirements of the regulator you have chosen.
There are different types of voltage regulators available to us so lets take a quick glance at some of them to see what our options are.
When you saw "voltage regulator" you probably instantly thought of some linear voltage regulator (i.e. 78xx, 317, etc. They are cheap, are readily available, work well, have lots of built in safety features, and are easy to use. They are usually good for 500mA or higher. For their higher current delivery ability they tend to come in larger packages. If you don't need that much current, or in the case of a battery you simply cannot deliver that much current, they might be overkill. There are "low power" linear regulators. They usually are capable of delivering around 100mA and come in smaller packages.
The drop out voltage on linear regulators tends to be high around a couple or so volts. The quiescent current at no load of linear regulators tends to be high as well measured in lamps.
Low Drop Out (LDO) regulators are part of the linear regulator family. They have a lower drop out voltage thus require less voltage on the input to regulate properly. They also have low quiescent current often in the uA range (that's micro amps not milliamps). Otherwise they are pretty similar to normal linear voltage regulators. They usually are capable of supplying anywhere from 10mA to 300mA.
Another type of voltage regulator are called switching regulators. The are called switching regulators because of the methodology it uses to generate voltage switches a transistor on the output. There are switching regulators that can step up (boast), step down (buck), or invert voltage. Switching regulators are in general more efficient then linear regulators. For these reasons they tend to be more versatile then linear regulators which generally can only drop voltage. Switching regulators also tend to cost more.
They are small switchers that can supply a fair amount of current with a fairly small and simple circuit. Larger switchers can generate more current but require more parts, sometimes specialized parts, more space, and more work to get them to operate properly. Switchers also tend to be sensitive to their design and board layout so unless you know what you are doing you may not want to attempt the larger more complicated switchers.
Charge pumps use a switching cycle involving charging a capacitor to produce an output. Like switchers they can step up, step down, and invert voltage. They are simpler parts but tend to be not very efficient and cannot supply much current so they are relegated to low current battery uses. Not all charge pumps provide a regulated output either. Some interfacing ICs will have internal charge pumps to generate the necessary voltages needed when the signals do not need alot of current. They are not used very often for uC supplies that demand any sort of substantial current.
That normally would be end of discussion but as we are inherited an analog audio group we have other issues to address that pure digital or non-audio people do not have to deal with. Digital people don't have as many concerns with noise in their system as digital is inherently noise resistant. As long as the noise is kept within design specifications everything will work normally. Us audio analog folks do not have such leeway. We will quickly know of just about any noise occurring in a system just by listening. Thus we may not be able to drop in any part that fits our needs.
During operation switching supplies and charge pumps switch quickly. Often these cycles occur at audio frequencies which can radiate into the audio signal. For these reasons unless you know what you are doing I would recommend keeping away from switching and charge pump regulators when in the vicinity of audio signals. For the time and effort that it would be needed to make a switcher or charge pump work correctly it would be much easier to use a linear or LDO regulator.
With our power supply needs specified we can look at our options. Things to take into consideration include, voltage, current, size, cost, complexity, noise, availability. I'll make the assumption that you want 5v from 9v either from a battery or a external power supply depending on the application needs. All these parts are available in other output voltages if needed.
To make assemble easier I will keep away from surface mount packages and instead stick with packages that are familiar and we can design and solder easily. Two common package type are the TO-92 and the TO-220. The TO-92 is the package type that you see most modern plastic case transistors used in effects in. The TO-220 is a larger flat case with a tab extending from the top that has a hole. These are intended to be mounted to some type of heat sink to dissipate the heat generated from circuit operation. The larger package sizes can be alittle comber some when trying to stuff all that circuitry into a enclosure.
With their higher drop out voltage and quiescent current I would not recommend standard linear voltage regulators for battery applications. If you start out with a fresh battery it will work but there will be issues when the battery voltage starts to drop over it's life span. Speaking of the battery's life span the quiescent current being in the milliamp range will greatly reduce the battery's life. When requiring 1A of output current a few milliamps does not seem worth talking about but in battery applications a milliamp can mean months in battery life. Linear regulators are better suited for applications that use external power supplies.
If you need between 100mA to 1A of current, have the space, and have the heat dissipating ability the common 7805 is a good choice. It typically comes in the TO-220 package. If you need 100mA or less I would go with the 78L05 which is a "low-power" version of the 7805 series. It comes in the TO-92 package which takes up little space.
The drop out voltage on the 7805/78L05 is approximately two volts so for a 5v final output you need 7v or more to regulate properly. The quiescent current at no load is 5mA for the 7805 and 3mA for the 78L05.
Having low drop out voltages and low quiescent currents make LDO regulators a good choice for battery based applications. For 100mA or less I like the 2950 series which have a drop out voltage of 0.38v and 75uA quiescent current at no load. They come in the TO-92 package. They are fairly available, relatively cheap, and being similar to the 78xx series are easy to use.
For larger current needs that require an external power supply you can switch over to a regular linear regulator.
If your system is not going to be near any audio signals switching regulators become a good option. A good switching regulator is the MAX603. It is a step down switching regulator that comes in a 8-pin DIP package and includes a shutdown feature to turn it off when it and the hardware powered from it is not needed. There is no need for external MOSFETs, diodes, inductors, etc. It has almost everything needed for operation built into the package making the circuit very simple. All you need is two capacitors so using it is alot like using a linear regulator. It is capable of delivering 500mA with only a 15uA quiescent current with a drop out voltage of 0.32v at it's 500mA max load.
The low drop out voltage and low quiescent current in a small nearly self contained package makes it good for battery use and medium current supplies when using external power supplies. It is unlikely you will exceed the 500mA output with a battery so there is plenty of room for most current needs when using a battery.
For larger current needs you will have to look at more complex switchers probably using an wall power supplied input which will be a long and painful exercise or you can just buy a supply. Complete switching supplies the feed from wall AC can be bought pretty cheap these days so say yourself the time. They come already safety approved with lots of nice features that you don't have to add yourself if you were designing the supply from scratch.
For their cost, complexity, limitations, and sometimes difficulty in locating it is not worth the bother with charge pumps for our application. You might as well use a switching regulator.
This may be the time we have "the talk". No not about that. About something more important then that. We are going to talk about decoupling in very quick detail. You'll hear about decoupling talked about in digital designs.
Decoupling is putting a small capacitor near the IC on the power rails, meaning from positive supply to ground. The capacitor removes higher frequency noise from the power feeding the IC. Another, and often more important, function is the capacitor cuts down on noise and spikes caused by the fast and sudden switching of the IC which can effect the operation of the system. Without the capacitor when the IC switches states it may pull current all the way back to the voltage regulator very quickly causing a power spike in the system. To prevent this a small capacitor near the IC will serve as a "mini-battery" so when the IC switches states it will get the current it needs from the nearest source, that being the capacitor, so it will not need to go all the way to the voltage regulator that feeds the rest of the circuit. That is why the capacitor should be as close as possible to the IC.
Ceramic capacitors of 0.01uF to 0.1uF are usually used.
Your Tone God,