Eagle PCB Experiments: Regulator and ATmega328p

As I wait for my first PCBs to come in, I’ve been trying to keep busy in Eagle. As I said before, the first PCBs that come in will teach me a lot, mostly about sizing and spacing. I hope I’m not being mislead too much with the design blown up on my screen.

Anyways, I’ve been working on two designs that will fit on one 5x5cm board. These designs are meant to work together but will be separate, much like my first PCBs.

1The first design is a voltage regulator that will produce fixed 5v and 3.3v outputs. This design uses SMT parts to keep it small, instead of using LM7805 through-hole voltage regulators. I did do it a couple of times in college but we used actual solder paste (no stencil) and a toaster oven. I will have to use my soldering iron this time which may or may not turn out to be a complete disaster. We’ll see.

Quick note, it’s actually AMS1117. I keep mixing it those letters. It’s since been fixed on the board.1Anyways, the regulator is to be used with this ATmega328p breakout board. Using the same terminal block components for 5v out on the ASM1117 board and the Vin for the ATmega328p board, you could solder them together with a male/male header if you chose to use the regulator for the ATmega328p board. I kind of want to add 5v out pins on the ATmega328p breakout board but I want to keep it small. The space beside Vin is so the other half of the regular board has somewhere to go and possibly some text so I can’t really put it there. Again, we’ll see. These designs are still in the making and won’t be sent off until I can see how the first ones turned out.


Eagle PCB Update

Over the weekend, I finalized the design of my first PCB and sent it off to be made through dirtypcbs.com. The site does a render of your gerber files. Here is the top view:ec64a60ec95740b6910d5a389a8d128c-911_topAs you can tell, a lot has changed since the last time I talked about the design. I squashed the Attiny85 programmer and breakout board because I thought there was a lot of empty space. The bottom portion is a breakout for a couple of shift registers. It has input and output pads for the data and clock and all that, positioned in a way where it can be chained in a row. That’s the theory anyway. I’m waiting with the expectation that nothing works as I don’t want to get my hopes up too much with this being my first time using Eagle and getting PCBs manufactured. I still have a lot of questions, mostly about sizing and spacing, which I think I can get answers to even if the board doesn’t work.

Tutorial: Full-Wave Rectifiers

IMG_0747In my first tutorial about power supplies, I mentioned I picked up this adapter by accident. This adapter has an AC output which is pretty useless to me, unless I build a rectifier for it. That’s what this second tutorial is going to be about.

I was taught about rectifiers by this guy who just threw up a whiteboard of equations every lecture. The labs didn’t help because they were boring (ie. Get the circuit working, get a signature, go home, wonder what I’m doing with my life). While I sort of understood what was going on, I definitely needed some time to register it all, even if that time is like two years later. Looking up information online to refresh my memory was difficult because it was the same formulas being thrown back at me.

In this tutorial, I’m going to show you how a full-wave rectifier works. It changes an AC signal into a DC voltage. My goal with this tutorial is to explain how it works with little to no formulas, enough so that you could practically use everything here if you happened to be stuck with an AC output adapter like me.

ewb_posWhenever you’re analyzing a schematic, the best thing to do is group components into blocks and figure out what they do, and then see how they work together. This is what the first piece of the rectifier looks like. When the sinusoidal input is above the x axis (positive values), the current takes the path of the red line starting from the top of the source (the circle). For now, think of the two dots as the places where you’d put your oscilloscope probes to see what’s happening.

ewb_negWhen the source voltage is below the x axis, you can think of the source as flipped upside down so that current is now coming out of the bottom of the source and following the blue lines. Notice how the flow of the current is going through your top oscilloscope probe and exiting the bottom again as it did in the previous diagram.

ewb1This is what the waveform now looks like with the AC source going through that diode configuration. The negative values of the sine wave is flipped over the x axis so all of the values of the signal are positive.ewb2When you add in a capacitor, the capacitor charges once the input signal is applied and then stays at a certain voltage (the voltage level will be discussed later). Since there is no load, it doesn’t discharge so the voltage remains a nice DC output. Obviously, this is useless to us, but it shows the reason for the capacitor.ewb3Once a load is added (the resistor in the diagram), you start to see ripples in the voltage. The peak-to-peak value of the ripple is known as the ripple voltage. This ripple happens because the capacitor discharges as the input signal heads toward zero. The capacitor charges again as the signal heads back toward its peak.

The reason I did the simulation is because I don’t have an oscilloscope. I still did it on a breadboard with my multimeter in hand, where I did a couple simple calculations. Let’s go through it.

IMG_0792The source measurement is giving us 14Vac…IMG_0793… at 60Hz.

The 14Vac that we’re seeing is an RMS, or root mean square, value. Any value taken by a multimeter is an RMS value. All you need to know is that if you are given an RMS value, the peak is actually the RMS value multiplied by √2. To go the other way if you are given the peak value, the RMS value is the peak voltage divided by √2. If you’re unsure what to do with √2, just remember that the RMS value is always less than the peak.

IMG_0794 So, with our 14 volts read by the multimeter, the peak is actually 19.8v. If we account for the two diodes that are conducting for each half of the cycle, that’s a 1.4v drop (each diode is a 0.7v drop). That leaves us with an 18.4v output. How satisfying. Remember that we have to use the peak value because the capacitor charges up the peak, not the RMS level (which is 70.7% of the peak).IMG_0795And obviously, with a DC output, the signal is 0Hz.

IMG_079618.4 volts is still pretty high for the applications I have for my supplies. The LM7805 voltage regulator can handle input voltages between 7-35 volts to produce a 5 volt output. You can use other voltage regulators to have other DC levels for your projects.IMG_0798For an example of a practical use, here’s the rectifier and 5v regulator driving one of my new blue LEDs.

So that’s it! Hopefully you understood everything in this tutorial. While I probably wouldn’t use this in a project (for space issues, primarily), it’s good to understand this concept as it is basically what’s going on in some DC output adapters.