UPDATE: I added a 25mA discharge (which took forever) to really highlight where Alkaline starts to shine, under light loads like in a TV remote or smoke detector for example. Given, you can't recharge them when they finally do die, but still, light loads are their specialty.
My brother was in town over Thanksgiving and we got going on a conversation about batteries. After talking I realized although I have done post in the past about discharging different brands of batteries, It can be beneficial to just have a very simple comparison between battery chemistries
Below are the plots comparing Alkaline AA cells with rechargeable NiMh AA cells under 4 different loads. The voltage during discharge is plotted with the capacity in milliamp hours (mAh) on the bottom. All charts are the same scale for easy comparison.
When I was a kid, I think the first thing I ever did playing with electricity (not counting sticking stuff in the electrical outlet) was take a flashlight apart and light the bulb outside of the case using bent paperclips to complete the circuit. This was long before LED flashlights so I didn't even need to observe polarity. shortly thereafter I connected up a small motor to the same battery. By this point I was in total amazement "Wow! Light, Motion, is there nothing electricity can't do!?"
I think the next really big milestone (at least for me) was the day I built a simple small signal amplifier. It was a class A amplifier and I had to learn many things before I was ready to build one (one that worked!). When that day finally came (after I don't know how many failed attempts) I was so excited I could hardly contain myself. Who are we kidding, I didn't contain myself, it was too exciting!
Nowadays, when I need gain, I use op-amps almost exclusively. Very rarely do I use discrete transistors for amplifying signals anymore. Not that they don't have their place, it is just that most of the stuff I do an op-amp is a better fit. That being said, there are still situations, usually when going for the absolute lowest noise possible, when you still can't beat a physically large BJT or JFET transistor as your first stage of gain.
What is a Transistor?
At this point, if you are wondering "What is a transistor?" A transistor is an electronic component that allows a relativity small signal to controller a much larger flow of electricity (electric current or flow of electric charge). The input signal can be either voltage or current (this is more of a black box point of view rather than a semiconductor physics point of view) depending on the particular type of transistor. A transistor works very much like a valve used to control the flow of water. Vacuum tubes (which transistors are the semiconductor equivalent of) were often referred to as valves for this very reason.
A valve used to control water flow allows a small exertion of energy (a person turning it) to control the flow of a lot more energy (a lot of high pressure water).
Compare that to what I said about a transistor and hopefully you can see the similarities.
The valve analogy also demonstrates another very important characteristic of transistors... their ability to amplify!
There is lots of great info (and some not so great) available on the internet about how transistors work, including; diagrams, animations, equations, analogies and more. For now I will leave it up to you to go deeper if needed.
What is a Class A amplifier?
So if you made it this far but are wondering what a Class A amplifier is I will try and give you the shortest explanation I can. Basically a Class A amp is a trick to allow a single transistor to amplify bipolar signals (signals that go + and - like AC, audio, RF, etc.). A Class A amp doesn't have to be only one transistor, but if you only have one transistor then a Class A amp is the only amplifier you can build to handle AC signals. The general idea is you turn the transistor halfway on (or so, depending on need) and the signal gets amplified around this New baseline. So when the input signal is at 0 the transistor is not at 0, but rather partially on (again, the amount "ON" is need dependent but rarely ever goes above halfway). Negative parts of the signal don't go negative relative to ground anymore, instead they go negative relative to this new baseline of partially on. If a sine wave came in that had a peak to peak voltage (Vpp) amplitude of 100mV, 50mV to -50mV, and was then amplified by a Class A amp to be 10x bigger, the output would be 1Vpp BUT it would be from say 1V to 0V not 0.5V to -0.5V. So what you have coming out is this new, larger, gained up signal riding on a DC offset of however much the transistor is turned on and/or is needed for the whole signal to be amplified without being clipped. This DC component of the signal can then be blocked by using a capacitor or transformer, or both, allowing only the now amplified AC signal through.
Below is a Class A amplifier in all it's simplified glory!
Oh great, a new term "Common Emitter" what is that? There are different kinds of transistors and different kinds of amplifier layouts. The transistor used above is a NPN Bipolar Junction Transistor or BJT and the pins from top to bottom are known as the Collector, Base and Emitter. I will just say there are three main BJT amplifier topologies: Common Emitter, Common Collector, Common Base and let you read about them.
Single Transistor Class A
Using only 1 transistor was a big guiding factor for this test. Current sources and more stages will almost always give you better linearity and in turn less distortion, but also require using more transistors. I feel like, "Yes you can make it better with more transistors... but at what point do you just use an op-amp?" That is why op-amps are so great, they are a whole bunch of transistors all well matched, all in one tiny package. Now as I said earlier, being Class A does not mean it has to be only 1 transistors but instead describes "how" those transistors are used, biased and/or operated. Building a Class A amplifier is because I only wanted to use 1 transistor.
BJT and JFET
Now to the meat of the whole post! The two most common transistors used in the first stage of amplifiers (including op-amps) are BJT and JFET. MOSFET's are only used in special cases of insane input impedance. For this test I wanted to compare the harmonics (caused by transistor nonlinearities) of both BJT and JFET transistors in the simple Class A amplifier (common emitter for BJT and common source for JFET).
A test like this is a lot like compare apples and oranges (both fruit, both transistors but that is where it ends) and so I tried to find parameters that would allow me to draw the best comparisons I could (not necessarily the way you might see them compared elsewhere). In the end, all of this testing was for my own purposes and is only presented here in case it can be enlightening, educational or otherwise useful by anyone else.
The above list is general! Like when I say "Lowest input impedance" for BJT's, it doesn't necessarily mean their input impedance is always low, it only means no matter how you use them they will always have a lower input impedance compared to FET based transistors.
I built a simple Class A amplifier as diagrammed two pictures up with the only variation being the omission of the top left resistor for the JFET version. Both transistors were of the small signal variety but not necessarily a perfect match for this test. almost all resistor values where adjusted as needed in order to give the desired output as you will see below.
A Clean Sine Wave
First off, if you are going to be looking at the harmonics of amplifiers you better have a nice clean sine wave to start with. I have a function generator but for this test I decided to build an op-amp based colpitts oscillator due to its very low distortion.
Yes, I know it is not much to look at but it preformed its job beautifully! Below is the output as measured on my oscilloscope
Next is a run through of the outputs from the different transistors at various output amplitudes (adjusted by changing the amplitude of the input). In my opinion don't spend too much time comparing these first set of plots as there are so many factors that don't put them on a level playing field (hence the reason for the "Magnitude of Harmonics" section farther down). The main purpose is so you can see generally how the two setups respond as a sort of baseline.
For all the plots below those from the BJT are on the Left and those from the JFET are on the Right
The amplifier is adjusted to obtain 1Vpp output with the baseline set in about the middle of the working range of the transistor.
Now I could have increased the linearity of the BJT by increasing the value of the emitter resistor which would have in turn decrease the gain, but that wouldn't have really made much of a difference in the next section when it is adjusted based on harmonic amplitude so instead I just kept it the same when testing the two transistors.
To measure gain I adjusted the input sine wave amplitude until the output of the amplifier was 2Vpp and then measured the input and compared. Gain is the ratio of the output to input or in other words output/input. With the current setup the BJT had a gain of about 54.4 volts per volt while the JFET only had a gain of about 6.3. In general BJT's can give more gain in a single stage than JFET's (doesn't mean it will be all good and distortion free, just more gain).
This is all great stuff but to Really compare two different transistors you need to pick parameters that exist more independent of gain or resistor values or baseline...
Magnitude of Harmonics
In my opinion it is more insightful when comparing transistors for small signal amplification, to purposefully drive the amplifier into distortion, adjust the parameters of the amplifier based on the magnitude of the harmonics present and then go back and look at the output waveform. It is still apples and oranges but hey, it's a step in the right direction.
For this first test I adjusted the top right resistor (the collector resistor for the BJT and the Drain resistor for the JFET) as well as the amplitude of the input signal until I had an output with the smallest 2nd order harmonic I could and an amplitude of about 2Vpp. Now the point here is not to look at the absolute magnitude of the harmonics, but rather the ratio of the harmonics and the shape of the waveform that gives them.
In this case it takes a tiny bit of clipping (visually more like smooshing) on the bottom of the JFET output and I can make the 2nd order harmonic completely disappear. With the BJT this is as small as I could get it.
For this one you might noticed that the BJT plot is the same as above. Well the 2nd harmonic was hitting the middle so I thought it would be interesting to in turn see what it would take to get the JFET's 2nd order harmonic to hit the middle. The results are below.
This time we kick up the amplitude until there is a lot more distortion and the 3rd harmonic reaches the mid point.
And taking the 3rd all the way to the top.
as you can see Vpp doesn't match between the two but they are still in the same ballpark.
Symmetrical Clipping and the 5th Middle
Now we are going to drive the amplifier really hard while trying to maintain a symmetrical clipping of the output waveform based on holding a duty cycle reading of 50%. We are going for a 5th order harmonic touching the middle.
Asymmetrical clipping and "Warm" Audio
Up until this point we can say that the BJT has always had more even order harmonics present than the JFET. If you are into audio you may have heard people say "Vacuum tubes have a warmer sound" This has nothing to do with the temperature they operate at but rather the fact that old Vacuum tube amplifiers (as a system) tend to exhibit more even order harmonics. The JFET is really the transistor version of the vacuum tube. So why then does it have less even order harmonics in the tests above? A transistor by itself is not an amplifier. You have to look at the whole system, like how is the transistor biased? Are there transformers in use? How is it clipping when it is clipping? Below is an example of when JFET's have more even order harmonics and almost no odd order harmonics, it is when they are clipped asymmetrically.
Early amplifiers tended to be very under powered and so they were often driven into clipping. It is in this clipping that the extra boost of even order harmonics comes out and adds a bit of "warmth." At the same time another big (maybe even a lot bigger) part of this so called warmer sound came from the output transformers that were needed in vacuum tube amps. Vacuum tubes in general need to be operated at much higher voltages than transistors. On top of that, Vacuum tubes struggle to deliver power to low impedance loads so often an output transformer was employed when driving a loudspeaker. These output transformers arguably added a lot more even order harmonics (clipping or not) than a directly driven transistor amp. Which one sounds better?... not the point of this post!
So which Transistor is better?
The amount of distortion in regular operation and the overall effectiveness of an amplifier in a particular situation has a lot more to do with its overall design than what type of transistors are used. There are still generalities that we can say about amplifiers based on a certain technology (single stage gain, input impedance), but the differences between them can sometimes be much smaller than between different designs utilizing the same technology. So when looking through amplifier designs or even op-amps, don't pick a particular one just based on the type of transistors used (or tubes), there is soo much more to amplifying little signals.
Just to prove a point
And just for fun, the BJT setup below has a lot more 2nd order harmonics than the JFET on the right... under these particular circumstances : )
It's been a long time since I posted an update on my battery charger project (in fact it has been a long time since I have posted anything!). I have been Very Busy with projects for my work and when I am not working for work, I am working on battery chargers. When I am not working on battery chargers I am trying to be a good husband and father as well as find time to do things like mow the lawn or fix the handle my son broke off the faucet.
"The Best NiMh Charger" Some may say that is quite the claim, but wait until you see all it can do (mostly thanks to the software Mark my programming friend wrote for it).
First, I will just get it out of the way, the part that really makes this charger so cool is that it is basically a super highly sophisticated battery analyzer that you can set every parameter of everything (or if that sounds too overwhelming just leave it all at default) and then watch it log all the data real time (from many chargers at once and for many many cycles)!
Below are just a few screen shots of the PC software. I want to play with the look (deep down inside I am a graphic artist) but Mark reminds me that the look is very low down on the to do list. The Manager Software only works with windows right now (although you can still monitor the raw serial stream on any platform).
View every plot from every cycle from every cell
Multiple chargers at once (Good application for a powered USB hub).
Some major hardware/firmware chagnes include a change to Micro SD, addition of USB to the computer (FTDI chip), operating the buck converter at a faster frequency (now silent charging), no more 2GB limit on the SD card and.. it's just better! It even looks better from the bottom... although I forgot to take a picture of the bottom.
It's pretty great. I am sad things didn't go better with the LCD version (really low yield, bad batch of LCD's, MCU issues)... but then again, I like this one paired with the computer software many times more!
It's a clear night, the light pollution isn't so bad, you look up at the stars and think wow, I wish I could take a picture! So you do... and it looks something like this:
Don't be so hard on yourself, it's better than your last one:
You realize you might need to let more light into your camera. One way to do this is by leaving the shutter open longer. This allows more light to reach the image sensor (or film) and in turn capture very faint or dim objects. Applied to this scenario you might be able to get a picture that looks something like this:
Unfortunately without tracking hardware this is the best you can get using long exposures. So if you are not interested in taking star trail pictures then the only other option is a larger aperture and high ISO.
Hey, is that the Orion Nebula in the middle? It would look a lot better without all that noise.
So what is one to do? You are finally able to image the stars without them being blurry, but they are buried in a sandstorm of noise. Well if you read my last post on noise... you average! The first part to successful averaging of images is to understand the types of noise you are dealing with. The first and most obvious is random noise. Random noise is fine and averages out great with enough samples. The next is fixed pattern noise, this is the fixed variation inherent to the image sensor. Most of this noise comes from non-uniformity and non-linearity of the individual pixel elements across the image sensor but also includes manufacturing defects, damage or even dust. This noise can often be best dealt with by taking dark frames and flat field frames that allow you to in many cases cancel out these effects. The last source of noise that you might think belongs in the previous set is Hot pixels. The reason why hot pixels are different is that although their location is fixed, their affect on the image changes over time, exposure length and how warm your image sensor is getting. In general hot pixels get worse the longer you keep taking pictures in succession (the pixels get hot!).
This is where some of you might be thinking "succession!" I thought I was taking "a" picture of the stars. You are! However to get "a" Good picture without tracking, you are going to need to take a lot of them.
So How do I do it?
The easiest way to do this is take lots of pictures! Then to avoid having to take dark frames and flat fields like mentioned above, simply move the subject around to different locations on your sensor (thus turning fixed noise and hot pixels into random noise). The trade off is a narrower field of view in the final image.
After you have all of your images, you need to align them all on top of one another and then average them all together. This can be done in Photoshop or Gimp, or it can be done using a program like DeepSkyStacker. The final image no matter how you choose to average your images is always lower noise (and if you re-size them larger before stacking you can even squeeze out greater resolution). The end result, although not perfect, proves the point.
Below you can see it close up and side by side for easier comparison.
So what can you do (and could I have done) to make it even better? Besides taking even more images, you can also be sure to rotate the camera some between successive images. This helps get rid of the noise that appears to be in stripes across the picture. Other than that the best thing you can do is go out and try it yourself!
The battery charger project has definitely had ups and downs, however lately it has been up. I will post a more thorough update in a week. Below is a shot of the latest board design that includes on board the ability to monitor the charger and control it from a computer over USB. Everything going on during charging and discharging can be plotted and viewed real-time!
Analog-to-digital converters (ADC) are used to convert real-world signals into more convenient digital signals for use by digital devices (computers, cell phones, media players, test equipment, the list is almost endless). How well they can do this conversion is based on many factors including speed, input impedance, noise and one of the most important parameters, the number of bits. A lot of microcontrollers will often include a 10 or 12 bit ADC built right into them for reading sensors and interfacing with the world. A 10-bit ADC effectively slices up the analog signal range it can handle into 2^10 (1024) slices from the smallest reading to the largest. A 12-bit ADC would give you 4 times the resolution with 4096 possible steps. The more bits, the more accurately you can capture (and also reproduce) the original analog signal. Below is a low resolution image (the irony) that I found on the internet which demonstrates this idea.