Dec 31, 2011

Cosview MV200UM Digital Microscope Test Pics

Christmas has passed and I was lucky enough to receive some new test gear and a couple other items that will eventually find their way to this blog. It’s looking like 2012 will be an exciting year on To the Rails. For this post I decided to put up some test pictures from my new Cosview MV200UM digital microscope (featured in my Christmas Wish List). Check ‘em out.

This first picture is a little calibration photo I took using my new Neiko Digital Calipers. The software that comes with the Cosview microscope allows you to measure distances/radii based on your photos. You have to run a little calibration to begin with and enter your magnification scale manually in the process.
 







This picture is a close up (57x) of one of the random PCB solder practice boards I have lying around my bench. The large metal squares are the connecting pads for surface mount resistors/capacitors while the copper circles are vias that connect signal traces between different layers on the PCB. Just about any PCB with any level of sophistication has these all over the board.
 





Here is a shot of an IC wafer I got from Electronics Goldmine some time ago. I am still trying to figure out how to take decent pictures so this one didn’t turn out as well as I was hoping, but you can make out the etched traces of each individual IC on the wafer. We will go into IC manufacturing at some point in 2012.
 







Pretty standard still frame of a populated PCB here. This is the sort of image I expect to take a lot of going forward. I mainly wanted this microscope camera so that I can check for solder bridges and short circuits so if I find anything interesting or worth showing I will definitely post it. Eventually, I want to incorporate some teardowns on this blog so I am hoping to master these circuit close ups.





In my last test image you can see another IC die. This one is different from the first because it zoomed in on the traces of a single IC rather than looking at wafer, which contains many complete IC etchings. If you don’t know or don’t care to know what any of that means then just stare at the pretty colors for awhile. The blue dot in the center is a mark to indicate that the IC is defective in some way.

Dec 27, 2011

EE Fundamentals: Voltage Divider Quiz

There are a couple things you need to remember to be able to do this quiz. Luckily, everything you need we have covered in this blog.

First: This circuit is a simple comparator, which I have done a whole entry on in the past. The comparator will output a high voltage when the non-inverting(+) input voltage is higher than the inverting(-) input. When the output goes high, the LED will turn on.

Second: There are two voltage dividers setting the voltages on both input pins of the comparator.

Third: If you watched the video on schematics I posted, please realize that wires only intersect in a schematic where you see a dot. For instance, the voltage divider setting the voltage on the non-inverting pin is not connected to the inverting pin in any way even though there is a wire going from the 4.7k resistor to the mystery resistor that passes over the negative input.



Quiz Question: What is the minimum resistance necessary on the ??? resistor to turn on the LED? In other words, what is the lowest value resistor you can place in the ??? spot to make the non-inverting input voltage higher than the inverting input voltage?

Good Luck!

Dec 26, 2011

EE Fundamentals: The Voltage Divider

After a long hiatus I think it’s about time to get back into some circuits concepts with these EE Fundamentals posts. Today’s topic is voltage dividers/voltage division. I know last time I promised to go over RC circuits (“next time, we solve RC circuits”), but when I started writing that entry I realized this one would make more sense to put first. We will start easy since we are just getting back into circuits stuff.

Voltage dividers are not so much a special type of circuit but more a property of voltage itself. In any closed loop circuit, the sum of the voltage drops around the loop must equal the voltage being supplied by the voltage source. For example, if your circuit contains a 10V source and two resistors in series, the voltage drops across the two resistors will be equal to 10 volts. Knowing this is a helpful tool for quick circuit analysis because it lets you determine the voltages, and subsequently the currents, at every point along the closed loop. As it turns out, voltage tends to split up according to predictable ratios based on the impedance of the elements in the circuit under analysis. Engineers use the simple equation below to determine the voltage across multiple series circuit elements:
where Vx is the voltage, Vs is the source voltage, Rx is the impedance of the element in question, and the denominator is the sum of the all the impedances in the circuit. For reference, let’s look at the circuit in Figure 1 to delve into this concept a little deeper.

 Figure 1. Sample series circuit

The circuit above shows a 10V source in series with a 2 kohm and 1 kohm resistor, making the total series resistance 3 kohms. If we want to find the voltage across the 2 kohm resistor, we use the equation and find that it is equal to:
You could apply the same process to find the voltage on the 1 kohm resistor or subtract the voltage on the 2 kohm resistor from the source voltage and arrive at the same answer. You could also scale these resistors in any direction and end up with the same voltage on each provided that the ratio between the two remains the same. In other words, there would still be 6.67 volts across a 200k resistor provided the other resistor is 100k, but the current through the circuit would be 100 times lower (Ohm’s Law).

In case you still are not convinced, I built this circuit to show the voltage split between the resistors. As you can see in picture below, a 10V source places 6.65 volts on the 2 kohm resistor and 3.351 volts on the 1 kohm resistor. Yes, these numbers are slightly different from the predicted values, but the reason for that is a combination of the voltage source not being exactly at 10V, the resistors not being precision values, and the measurement error of the multimeter I am using. For all practical purposes, however, voltage division can be easily proven.

************************************

So how do circuit designers making use of voltage dividers? Often times you will see voltage dividers used to set reference voltages or create DC bias conditions in various places throughout a schematic, like in Figure 2.


 Figure 2. Voltage divider setting comparator input voltage

Conceptually, the voltage divider resistor network is very simple and easy to implement. When put into practice though these sorts of voltage references often suffer from excess power loss and can drift out of spec with temperature variations. Still, they are widely used and offer hobbyists an easy way to create a specific voltage for their circuit.

But voltage divider circuits can only be used as references provided that the load using the reference has a significantly higher impedance than the divider itself. I believe this is one of the least talked about subjects in electronics education, but it has a huge impact on the functionality of analog circuitry and introduces the concept of loading/attenuation.

Look back at the circuit in Figure 2. Knowing nothing else about electronics other than what has been discussed in these EE Fundamentals posts, you would probably expect the voltage applied to the input terminals of the comparator to be 3.33 volts. While I am not disputing this assumption, I want to point out that there are other issues to consider. First, think back to what happens to a circuit when two resistors are put in parallel: the equivalent resistance drops to a value lower than either of the original two resistors. If that is true, then consider Figure 3.

Figure 3. Voltage divider with low impedance load

This new circuit is virtually identical the divider used as a reference input to the comparator. However, instead of the high impedance of the comparator in parallel with the 1kohm resistor, we have now put a 10 ohm load instead. Without this load attached to the voltage divider, we would see roughly 3.33 volts on the output, but with the 10 ohm load attached the output drops to about 0.05 volts. The higher the load resistance on the divider, the less change we should see in the expected value. This, my friends, is an example of loading down a circuit and I am going to show you how.

************************************

Above is a picture of my build of the circuit from Figure 3. I have placed a 10 ohm resistor in parallel with 1 kohm resistor. As you can tell from the measurements, the voltage across the 1 kohm resistor is significantly lower than it was in the previous tests. This is because we have loaded down the circuit with the 10 ohm load resistor and made the voltage divider equation:

 
There is clearly a strong correlation between the expected value and measured result on the 1kohm resistor. The voltage across the 2 kohm resistor is equal to the source voltage (10V) minus the measured value (0.05V), or roughly 9.95 volts with measurement error.

Conversely, placing a 1megaohm resistor in parallel with the 1kohm resistor does not significantly affect the equivalent resistance because it is three orders of magnitude greater than the 1 kohm resistor. For reference, I measured the effects of this new load resistance. You can see them in the picture below.

************************************

This demonstration has attempted to make clear two distinct and often undervalued concepts: loading and attenuation. I “loaded” the circuit when I placed an additional load resistor onto the output of the circuit such that it had a significant impact on the circuit behavior. When the circuit was loaded down with the 10 ohm resistor, the output voltage decreased severely compared to the intended output of the voltage divider, which we call attenuation. Hence, when you hear someone say the signal is being "attenuated", it means that there is a loss of fidelity at some point along the circuit resulting in a loss of information or signal strength. This same concept applies to AC waveforms like music streams. If, for instance, you loaded an amplifier circuit with a resistance too small for its output impedance, it would result in a weaker signal and thus a quieter song in your ear.


Pop Quiz
I am going to post the quiz for this subject in a separate entry because this one has run a little long and I want to mock up my quiz circuit to make sure it does what I think it should. This quiz is all my own and it requires knowledge from my previous entry level tutorials to figure out. Look for the question before the end of the year.

Dec 21, 2011

A To the Rails Christmas

It’s holiday time so I have put together a sample of things that made my Christmas list this year. Given the theme of this blog, all the items are in some way related to hobby electronics. In my noob days I often looked through personal blogs to find out what kind of equipment they owned for doing electronics work. For any aspiring DIYers out there, I hope my list gives you some new places to go for test gear and inspiration.

I first found out about this microscope from the YouTube video review posted on the website (all items are hyperlinked to their online purchasing sites). It lets you get close up images and video of circuit components and solder connections with minimum hassle. I have a standard microscope that I have used a few times for checking solder bridges on smaller components, but getting a compatible camera will cost around $150. This one seems to do the job just fine and I can use it for blog photos. Win, win.





This is a relatively cheap ($153) function generator from Instek that is capable of generating sine, square, and triangle waves. The triangle wave function is limited to 1MHz, but the sine wave and square wave functions can go as high as 3MHz with a peak-to-peak voltage of 10V at 1% resolution. This particular piece of equipment generates the waveforms digitally, which means with a high enough sampling rate you should be able to see the step changes in the output waveforms on an oscilloscope. If I can get my hands on this it will make demos far easier in addition to adding some firepower to my test equipment arsenal for doing filter testing.



A friend/artist once told me that LEDs were my medium considering my tendency to do LED-centric projects. Admittedly, I do think of LED projects before anything else, but that is mostly because they can be appreciated by anyone regardless of background. This meter is not something I consider essential to any home workbench, but I do like experimenting with LEDs and have plans to do some custom lighting designs in the future. I think this meter could help me out. I also want to test batches of LEDs for brightness using a standard test current to see if I get a Gaussian curve similar to Dave Jones’s recent resistor tests.



You might remember that I did a whole breakdown on my new BK Precision 2709B Multimeter a few months back. So why would I want another multimeter? Well the simple answer is that you can never have too many multimeters. The reality is that I would like to be able to measure input voltage and current as well as output voltage and current on certain power electronics to test for efficiency. I could do this with two meters by switching the connections, but ultimately I would like to get four meters so I won’t have to put in the effort. Plus, this meter is only about $60 and won Dave Jones’s $50 multimeter shootout.



My recent failure with my Halloween project pointed out to me how little I actually understand about wireless communication. From what I have read online Zigbee is a good protocol to start with if you are trying to learn wireless data transfer. They are a bit on the expensive side so I haven’t had the nerve to buy them for myself. Look for some blog entries on my experiments with these radios if they find their way into my lab.

Dec 14, 2011

Halloween Build Part 5: Bill of Materials

In this final installment of my build log for my Halloween LED Flasher project, we will look at the BOM tables for this build. When I first started out in electronics, I often used BOMs from others online to get a sense of how the circuit worked as well as a feel for what are considered “jellybean” parts. If you don’t know that means, it basically refers to parts that have become the defacto standard when you are trying to create a particular piece of your circuit that is well researched and has been perfected over the years. For instance, switch-mode power supplies often use the TL431 programmable shunt regulator as a replacement for an op-amp in their feedback paths. The part gives you all the functionality of an op-amp with lower power consumption and, in most cases, faster transient response. It is widely recognized among power electronics engineers as a necessity in voltage-mode feedback power supplies.

My hope is that with this last piece I will have given enough information for someone to easily reconstruct this project to meet their own needs. I have tried to give out every piece of information I could think of related to my build, but leave comments if you are looking for more (type of solder??). Now…the final tally…

Bill of Materials
ITEM BASE PRICE QTY TOTAL PRICE LOCATION      
Large Craft Pumpkins $4.00 4 $16.00 Oriental Trading
Plastic Art Containers (LED Diffusers) $1.00 4 $4.00
Artifical Pumpkin Carving Kit $4.00 1 $4.00
0.33uF Electrolytic Capacitors $0.26 4 $1.04 Allied Electronics
LT1121CZ-5 Voltage Regulator  $2.60 4 $10.40 Digi-Key
JST Connectors $0.75 4 $3.00 Adafruit
PCBs $2.19 2 $4.38 Radio Shack
SPST Switches $3.19 2 $6.38 Radio Shack
Papers Bowls $1.98 1 $1.98 Walmart
Matte Black Paint $0.97 1 $0.97 Home Depot
9V battery holders $1.19 2 $2.38 Radio Shack
Machine Screws (#6-32) $0.47 2 $0.94 Home Depot
Nuts for #6 machine screw $0.48 1 $0.48 Home Depot
Enercell 9V battery $11.00 1 $11.00 Radio Shack
1/4W Resistors $0.64 2 $1.28 Parts Express
Various Colored LEDs $0.89 12 $10.68 Evil Mad Scientist Labs
20-pin IC socket $0.59 4 $2.36 Radio Shack
Microchip PIC16F690 $1.19 4 $4.76 Microchip
Heavy Duty 9V Snap Connectors $3.00 1 $3.00 Radio Shack









TOTAL PROJECT COST:      $89.03


A few notes on this BOM before we wrap this project up completely. First and foremost, notice that I have listed two different prices for each of the elements in this design. The first is the cost of the package to get the components regardless of the number I used. For instance, I put 1 for the ENERCELL batteries because I got four 9V batteries in 1 pack. Therefore the cost associated with that pack is for four batteries instead of one. Likewise, I listed the total price of two packs of ¼W resistors even though I only used one full pack and two from another pack. I was only able to buy the resistors in sets so the unused parts still contributed to my overall project cost. In the past I have ignored these kinds of costs and just used the “per component” cost in my BOMs. From now on I am going to list the total cost to procure each item regardless of the quantity they are sold in.

Secondly, you can save a fair bit of money by switching to the MCP1702 voltage regulator from Microchip instead of the one I used here. With that regulator the total project cost drops to $80.55, just under 10% lower than the current BOM estimates.

Be prepared to spend some money on shipping if you decide to tackle a similar project. I did not include shipping costs or tax in my BOM because a lot of it varies based on location and method. Plus, I am way too lazy to look back and figure out how much I paid for shipping on each item. My personal feeling is just that it doesn’t make sense to include shipping costs in these sorts of things.

That’s all folks. I have taken this project from an idea to a tangible piece that I can improve on and build from in the future. I think we can finally put Halloween behind us at To The Rails and move on. Cheers to the next step…

Dec 4, 2011

Halloween Build Part 4: Board Layout

Are we still talking about Halloween? The tryptophan from Thanksgiving has worn off and Christmas is right around the corner yet this blog seems to be stuck in October. I am not one to live in the past so let’s wrap this project up and move on to bigger and better things. Two more entries on my Halloween project and then it’s on to RC circuits like I promised back in September.

If I had any confidence in my printed circuit design abilities, I would have a custom PCB fabricated through SeedStudio or BatchPCB like the one pictured to the right. Despite having written tutorials on how to use Eagle software for PCB design, I actually have limited experience when it comes to generating boards. I have played around with programs like Eagle, DesignSpark, Altium Designer, and DipTrace in the past, but haven’t ever taken the time to learn one thoroughly (my EAGLE tutorials were pretty lacking). Instead, I go to Radio Shack each time and pick up some overpriced protoboard to solder all my components together. This project alone is enough to make me want to avoid doing that ever again. My next goal is now to design and fabricate my first solo PCB.

From my previous posts, you know by now that there aren’t that many functional pieces to this circuit. There is power, shown in the red box in the picture, the PIC microcontroller, in blue, and the LEDs in orange. For some circuit designers, they like to layout schematics the way their board will eventually be laid out. Others prefer having all their inputs on one side and all the outputs on the other. Personally, I don’t see a benefit with either approach because outside of simple boards your final board design won’t look much like the schematic even if you try. In my case I did try and follow the schematic pretty closely in terms of the layout, but things never turn out quite how you expect when it comes to these projects. 



It’s one thing to draw connecting lines on a schematic and know how the circuit should function, but it’s quite another to realize a physical design. For instance, I wanted to be able to replace the battery easily when it died so I soldered a heavy duty 9V snap to a JST connector and mounted the female end to the board (highlighted in purple in the picture). JST connectors are really nice for easily disconnecting batteries from the system and you can find them a lot in RC car designs and similar battery powered toys. The downside is that the heads of the connector are only two terminals, which means anything that needs to be tied directly to power or ground has to end up connected to the JST in some fashion. If you look at the soldering on the underside of the board, you can see that none of the copper pads are connected to each other. For this reason, it becomes pretty difficult to create a bus line without using a lot of bridged solder joints. Since I had no other choice, I went that route and ended up with a bunch of large solder blobs and wires running along the top connecting several areas of my board.

One other problem I ran into was the placement of the LEDs. Originally I had intended to use four LEDs, but when I started soldering on the first three I realized I wasn’t going to be able to fit a fourth and still have them in a semi-cluster. Because I was anticipating a fourth LED on the left side of the microcontroller, I mounted it in the middle of the board and that meant that I had to bend the LEDs awkwardly to fit through the cutout in the top of paper bowls (shown in Part 1 of this build log).

In the end, all the boards worked as expected and I was able to finish out the project. As much as I am in this for the electronic design, I have become really interested in the form versus function aspects of my final products. Companies like Apple have made a fortune off the way their products feel when people hold them and have gone out of their way integrate form and function as much as possible. I am still trying to get a handle on that concept in my own designs, but I have come up with some new ideas to try in the future. Look to wrap up this build log in my next post with the bill of materials (BOM).

Nov 27, 2011

Halloween Build Part 3: Full Schematic

Below you can see the rest of the schematic integrated with the voltage regulator from my last post. As I explained previously, the PIC16F690 is the brains of my system. This PIC is a mid-range option for hobbyists and has much more functionality than I made use of in this project. I originally thought I would make better use of it when I was in the planning stages but everyone who has been following me knows how things turned out. You can see in the schematic I left 15 of the 20 pins open, which is a colossal waste of space. A better controller to use would have been the ATTiny10 from Atmel or a 6 pin micro from Microchip. Even the 16F84 that I had lying around could have saved some space and provided the same functionality (flashing an LED).
I was able to program the chip using an in-circuit configuration with a PICKit 2 and could have included programming headers in the design if I intended to reprogram these devices in the future. I have included another schematic of the in-circuit setup I used for the programming. You can substitute a small signal diode for the 47kohm resistor if that is handier for you. From what I can gather this setup is pretty standard across different families of microcontrollers and you can integrate this header into your printed circuit board design for on-the-fly reprogramming. You just have to make sure that the circuit isn’t operating while you are trying to program it and that no power is supplied to the programming pins when you do want to test the circuit. This is less of a problem if you don’t have anything else connected to pin RA3 (configuration specific).


The software is brain dead simple and written in C using the MPLABX IDE from Microchip (GUI pictured below). All it does is call a delay function by passing an integer to represent the number of cycles through a 100ms countdown. I varied the timing for this function with each different pumpkin to create different patterns. The code I have uploaded to this post is based on a 20Hz flasher to create a strobe effect. I have linked a zip file to this post with all the necessary header files if you want to play around with lighting up some LEDs yourself. You can download it here.

If you look at the datasheet for the 16F690, you will see that PORTC corresponds to the RC0, RC1, RC2, and RC3 pins on the chip so you must first configure PORTC as outputs before running the main piece of the code. By setting these pins high in software, you place the chip’s supply voltage on the pins in question (RC0-RC3) and start to source current to whatever loads the pins are tied to. In my case, they are all tied to LEDs with current limiting resistors. I have assumed Red LEDs in the schematic so different resistor values are necessary for other colors/source voltage combinations. I wanted to drive the LEDs at around 15mA so I used ohms law to determine the correct resistor based on the turn on voltage of the LEDs. You can find online resistor calculators that will tell you what resistor to use based on your LED color and the current you desire. Otherwise, look up the forward drive current calculation for a diode.

That’s about all I have to say concerning this design. It is easy to see why this project doesn’t amount to much more than a glorified LED flasher. Some obvious improvements are software upgrades to lengthen battery life, decreasing the size/pin count of my microcontroller, and adding external triggering options to cue up the light sequences based on movement. My final two posts dealing with this project will look at the circuit board design and the highly anticipated bill-of-materials (BOM).

Nov 25, 2011

Intro to Schematics

I am going to post my full schematic for my Halloween build soon, but before I do I thought it might be worth some of the noob's time to check out this short video from Collin Cunningham of MAKE magazine. He goes through a quick description of each of the component symbols and talks about what a schematic is and what it is not. I doubt I will be posting anything soon that is overly complicated, but it never hurts to brush up on the fundamentals. Enjoy!

Nov 23, 2011

Halloween Build Part 2: Power

The heart of my circuit design for this Halloween display is the PIC16F690 microcontroller from Microchip. The 16F690 is a 20-pin, 8-bit flash micro that comes with a 4MHz internal RC oscillator and a 10-bit analog-to-digital converter across 12 channels. I have generated the schematic in DesignSpark so I can easily talk about each piece and its function. This entry will entirely focus on the power piece of my design, hence the modified schematic in the picture below.

First and foremost, every circuit needs power in one form or another. In my post “Power Your Next Project” I took a high level look at how best to power each of the micros in the system and decided to use a 9V battery with a 5V voltage regulator. Like I stated in that post, I will do a full blog on voltage regulators in the future if for now you can accept that its purpose is to turn higher voltages into lower voltages. However, selecting the right regulator proved to be harder than I initially anticipated. One of the good things about being rooted in power electronics is that I know more about the ins and outs of various regulators than the average electrical engineer. Unfortunately, this can sometimes make it harder to sift through the noise and choose the right part. My biggest concerns were the package size, the output voltage, dropout voltage, and the rated current of the regulator. For simple projects like this those are generally going to be the driving factors. Others like tight line and load regulation are nice to have but I am not switching any heavy loads and the micro can operate on a range of 2V – 5.5V so it is not going to shut down because the power supply is lagging.

I wanted a regulator with a constant output voltage of 5V, a rated current of at least 200mA, and the lowest dropout voltage I could get in a TO-92 package to save on size (I will do a blog on IC packages someday). The standard 5V regulator that meets most of these criteria is the LM7805, but it has a 2V dropout voltage meaning that if the battery voltage drops below 7V the entire system will cease to function as originally intended. The LEDs would start to dim and most likely the timing would start to drift even further out of whack. On the other hand, low dropout regulators (LDOs) can keep drawing energy from the battery down to as little as 5.5V, which increases battery usability. You can see the comparison between the two in the annotated picture from my last post to the right.

After spending a few hours on FindChips, Octopart, and Digi-Key’s parametric search I came across a part I thought would do the job. I chose the LT1121CZ-5 from Linear Technology. The regulator has a dropout voltage of 0.4V and outputs a stable 5V signal with an input voltage up to 30V. It also sports a shutdown pin which can lower the quiescent current consumption from 30µA to 16 µA. The regulator is only rated up to 150mA, but after checking the maximum current the microcontroller would consume in my application I felt comfortable with that figure.

Another downside is that the regulator was about $2.60. LT has a reputation for making quality but expensive parts so I was not surprised the see the cost come out so high. While I know this does not sound like much, it is quite a lot to spend on a single component that doesn’t have any programmable intelligence. Still, I decided I was going to splurge on this part because it has some interesting properties that could be useful in future applications and it provides a stable output with only a single 33µF capacitor on the output. I also needed a 33µF capacitor for an LED driver I am working on so ordering this regulator did save me a little money on capacitors. After the part showed up, I did a quick test with my power supply to confirm that it worked the way I expected. You can see the results in the Figure above.

After I placed my order for this voltage regulator I decided to keep looking for something else that might have worked in its place and almost immediately found an equally matching part for far less money. The Microchip MCP1702 provides a 5V output with a dropout voltage around 0.1V at my loading conditions. It comes in a TO-92 package and operates with input voltages up to 10V (though the datasheet says it can go up to 13.2, roughly a 12V battery + float voltage). Since I only planned on using a 9V battery for this project, I figured the 10V limit would be enough even with the batteries inherent float voltage. Like the LT1121CZ-5, this regulator is stable with an output capacitance of 1µF to 22µF with higher values possible for electrolytic capacitors. The best feature of this other regulator…I was able to get it from Allied Electronics for about $0.48 – roughly 1/5th the cost of the LT1121CZ-5. I bought a bunch of these as well to use in throw away projects like this one. It definitely was not worth splurging on the extra special regulator when this one can do the job for a much lower price. I like putting in the effort to find the lowest cost solution even on one-off boards because it gets me in the right mindset for consumer product design. Look for the full schematic and the software in my next post.