Monday 12 March 2012

Power Supplies - Part 2

In the last post I wrote about some of the design considerations that are needed in designing a linear power supply and how mains ac voltage can be 'stepped down' and rectified into dc using diodes.  The next thing that most people do when designing power supplies is called 'smoothing'.  This is where the output waveform which is regular but not flat is made more flat and smooth.

The first question one might ask is why do we need to smooth the output?  One answer is because the designer is trying to replicate the output of a chemical cell (battery).  The output of a battery which is direct currrent (dc) is very smooth and flat.  This is because batteries work on the principle of electrolysis and electrons travel from the negative terminal to the positive terminal through the circuit in a constant stream.  The flow of electrons (current) is only slowed down (resisted) by the total circuit resistance which includes the internal resistance of the battery.  There is no switching or quick changes of polarity like there is with an ac power source (no 50Hz power cycle here) and because there is no switching unless introduced in the circuit on purpose (oscillation) the output of the battery will be completely smooth and flat.

Another reason for smoothing the power supply output is to prevent the circuit from reacting strangely to the constant change of voltage coming from the not smoothed supply.  Suppose we have a circuit that is using a change in voltage to detect something like a temperature sensing circuit.  If we use a smoothed dc supply the circuit will measure the current temperature accurately because the supply voltage is in a constant steady state.  If we use a not smoothed dc supply the sensor output will fluctuate with respect the changing voltage of the supply and the sensor output would be meaningless.

The upper circuit above shows a 12.3V battery supply connected to a simple voltage divider made up of a 10k resistor and a temperature sensor.  For the simulation the temperature has been set to 27 degrees C.  The output voltage and current is shown in the yellow box.  The output is also connected to an oscilloscope.

The lower circuit shows a 14.8V 50Hz ac supply (the output from a linear transformer secondary winding) connected to a bridge rectifier made up of four diodes.  It is then connected to the same voltage divider made up of a 10k resistor and a temperature sensor.  The ambient temperature is also set to 27 degrees C.

The top circuit will accurately measure the temperature because the voltage supply to the voltage divider is constant and smooth.  The lower circuit's measurement will fluctuate considerably because the voltage supply to the divider is not smooth.  If only the average temperature measurement is required then there would be no problem using this power supply but if the user were logging the data regularly - lets say every 1ms then the bottom circuit's measurements would be incorrect and the temperature would look to be varying with the same frequency as the power supply input.




So that is the reason that smoothing is applied to the rectified output of a linear power supply.  It is to make the output constant, regular and as similar to the output of a battery as possible.  It prevents strange measurement errors and erroneous circuit behaviour occurring.

In order to smooth the output from the diode rectifier section capacitors are added to the circuit across the supply.  To remove the low frequency 'ripple' large value electrolytic capacitors are required.  For high frequencies medium value ceramic capacitors are normally used.  The large electrolytic capacitor charges up from the applied voltage from the rectifier when the output rises the capacitor charges.  When the output from the rectifier lowers the capacitor then discharges.  Because there is not enough of time between the rectifier output fluctuating and the capacitor charging and discharging the dc voltage output remains more constant and therefore becomes smoother.  The charging / discharging time for a capacitor can be found by two formulas.  I will go into more detail on the charging and discharging of capacitors in another post.  The formulae are:

Vc = Vs * (1-e^-t/C*R) - For a capacitor charging
Vc = Vs * (e^-t/C*R) - for a capacitor discharging

There is a very good section on the hyperphysics website which discusses capacitors charging and discharging in the DC circuits / capacitors section - http://hyperphysics.phy-astr.gsu.edu/hbase/hframe.html

The updated circuit diagram for the linear power supply that we are designing is shown below:

It should be noted that almost any large value of electrolytic capacitor could be used and the higher the value the more low frequency 'ripple' will be removed from the power supply output.  The capacitors selected must be rated to withstand the supply voltage - in our case this would be anything above 32 Volts dc.  The 100nF capacitor can be of the ceramic type and should also be rated to work at voltages greater than 32V dc.  The type of capacitor is related to it's dielectric material - another subject for another post.

There is a formula for selecting the smoothing capacitor to remove 10% of the ripple and it is as follows:


Smoothing capacitor for 10% ripple, C =5 * Io   
Vs * f

C  = capacitance in farads (F)
Io  = output current from the supply in amps (A) - yet to be selected in our case!
Vs = supply voltage in volts (V), this is the peak value of the unsmoothed from the rectifier output
f  = frequency of the AC supply in hertz (Hz)
 


Lets set the value of Io (current output) to 1A.  If we plug in the values from our design we get:

C =  5   *   1
       32 *  50

C = 0.003125 or 3125uF so the closest real value would be 3300uF which must be rated for 32V.  To be on the safe side I would use a 50V rated 3300uF electrolytic capacitor.  If a lower capacitance is used the ripple will be greater than 10%.  The capacitor must be rated for the supply voltage!

The oscilloscope output for the smoothed and not smoothed circuit is shown below.  It is pretty obvious that adding the capacitors makes the voltage output very smooth and flat which is what we were looking for.  The red trace is the not smoothed rectifier output and the blue trace is the smoothed output after the capacitors.


The next post will discuss power supply regulators - what they are and how they work.  That's all for now folks!  Take Care - Langster!





Sunday 11 March 2012

Power Supplies! Part 1

Hi people...I know I have still to finish the chess clocks.  For now though I though I would do a post on power supplies.

I recently donated my bench top power supply to my local Hackspace - HACMan at Madlab!....As usual I then needed it to do some prototyping work.  One thing every budding electronics engineer or hardware hacker needs is a good power supply.  Rather than trek to the Hackspace to get mine back I'm going to design and build another!

There are many tutorials out there for building a power supply but seeing as I need one I thought I would write my own after having to go through it for myself.

There are some design considerations to choose before making a power supply:

  • Type - Linear or Switch-mode
  • Variable voltage or fixed
  • Variable current or fixed
  • Over current protection
  • Short Circuit protection

Most of these things are dependent on the type of regulation that is chosen.  I have decided to use a linear supply in my case.  These are power supplies which use a linear transformer - a device used to convert the ac mains voltage from 230V UK Mains voltage down to a more useful and safer low voltage.  In this case I would like a supply that has variable voltage and current control from around 3V up to 30V with at least 1A current.  I also will need a way of displaying what the actual voltage and current setting is so we will be adding some panel meters.

How do these things work?  Electricity comes out of the UK mains socket as 230V r.m.s. alternating current or ac at 50Hz.  What exactly does that mean??  Well it means that the electricity has a maximum electrical pushing force of 230V and that the polarity changes direction every 10ms or 25Hz.  For definitions on basic electrical theory and general physics here is an excellent website:


It covers everything in a lot more detail than I intend to go through in this post.  So back to the subject.....

For those who don't know electricity is generated by rotating a permanent magnet in a coil of wire.  The magnet  turns in a circular motion.  The more the magnet moves the more electricity is generated.  The speed of the magnet turning is directly related to the frequency of the current.  Every time the north and south of the magnet are reversed the current changes polarity.  The circular motion causes the output to be sinusoidal and if we were to plot a graph of the output it would look like the picture below:

I have put several scales on the x axis so that it can be seen that the voltage changes polarity with respect to time and therefore frequency.  Frequency is the inverse of time or frequency (Hz) = 1 / time (seconds).  I also put degrees and radians on the graph as the change in polarity can also be related to angular motion (the magnet rotating in the coil).  This is known as alternating current and it is the type of waveform that would be seen if you were to take an oscilloscope and measure the output of a mains outlook socket.  (I don't recommend doing this unless you have a suitable high voltage ac scope probe!!!)

The ac waveform that comes out of the sockets will be 'stepped down' or transformed into a smaller voltage using a linear transformer.  A linear transformed is an electronic component with the symbol shown below:

It is really two inductive coils placed next to each other with a laminated iron core running through each ring.   For a step down transformer the first inductive coil known as the primary will have more turns than the second coil or secondary.  The difference between the coils is known as the turns ratio and this can be used to calculate how much the voltage will be 'stepped down'.  The formula - helpfully known as the turns ratio is as follows:

     Np : Ns = Vp : Vs    

Np = Number of turns on primary coil
Ns = Number of turns on secondary coil
Vp = Voltage at primary coil
Vs = Voltage at secondary coil

So lets use the formula to calculate the turns ratio of the transformer that I need for my 3-30V transformer.  We know that the mains voltage is 230V and we know that we want at least greater than 30V at the output.  To make things easy lets say 32V.  Lets plug those values into the formula:

Np : Ns = 230V : 32V

Set Ns = 1 and therefore

Np = 230V / 32V

If we then calculate the ratio we find that:

230/32 = 7.1875 

So from this we find that we need a transformer with a turns ratio 7:1.  This will 'transform' the mains voltage from 230Vac to 32Vac.

If we were to draw a schematic diagram of what we have done so far it would look like this:

If we were to attach an oscilloscope to the circuit and measure the input and output we would see the waveforms below:


Note: The Y scale or volts / division setting on the oscilloscope is the same for both graph traces (200V/div).  The red trace is the mains input or Vp and the blue trace is the 'stepped down' output or Vs.

Now that we have the voltage at a more manageable and safer lower level we need to convert it from alternating current (ac) to direct current (dc).  There are several methods of doing this and most of them involve using semiconductor rectification or diodes.  

The diode is an electronic component which acts like a kind of electrical gate.  It only allows electrical current to flow through it in one direction.  They are made up of something called a PN junction.  What is a PN junction?  Well this can get complicated but in its most basic form a diode or PN junction is a two pieces of silicon (or germanium) sandwiched together.  Before the two pieces of silicon were joined together they were treated in a special way in order to make one side more positive (P-type material) and one side more negative (N-type material).  The process is known as 'doping' and to make the semiconductor more positive the molecular structure of the silicon has had electrons removed to create 'holes'.  The N-type semiconductor material does not need anything added to it to make it more negative.  The silicon already has electrons present which make it negative.
The anode is the positive terminal and the cathode is the negative terminal.  We are going to use diodes to turn the ac output of the transformer secondary into direct current (dc).  The diodes will stop the current alternating and going negative.  It should be noted that diodes will only do this once they have 0.7V present at the anode.  It also means that our output circuit will lose 0.7V every time we add a diode.  In the circuit below a diode has been added to one of the transformer secondary outputs.  The resistor is purely a load for the electronic circuit (spice) simulator.


The oscilloscope output looks like this:


The output is now always positive in the positive portion of the sine wave or positive half cycle.  The negative half cycle is not present.  This is known as half-wave rectification  Adding more diodes to the circuit causes the negative portion of the sine wave to be rectified.  This is known as full-wave rectification.  To get full wave rectification for our circuit we will need to make what is called a diode bridge or bridge rectifier.  It is possible to buy bridge rectifiers as single parts but we are going to make one from four separate diodes:

The oscilloscope output will now look like this:


As can now be seen all of the output from the transformer is now positive.  If we were making a rugged battery charging circuit or we needed a dc current supply for welding we could use a circuit similar to this.  For most electronic applications the output will need to be smoother and more like the output of a battery.

Well....That's all for now folks.  The next post will go through smoothing and regulation!  The final post will go through realising the circuit and actually building the power supply.  Have fun as much as possible but be careful!!!

       
   

Friday 2 March 2012

A long time since I posted...sorry!

Ok people...it has happened before and may happen again!  I apologise for not writing more about what I have been up to!  Its because I'm always busy!

I have still not finished the Chess clocks!  I will I promise.  I have made progress though!  PCBS are built and tested just not in proper finished boxes.  I will write up on the use of rotary encoders and some of the design decisions I had to make!

I recently made a PCR machine for the Manchester DIYBIO group.  I will write about that on here and go through the project.

Lastly I was interviewed by EE Web.  The link to the interview for those who are interested is here:

http://www.eeweb.com/spotlight/interview-with-alexander-lang

Please excuse the horrible photograph!

Thats it for now....

Langster