Jul 14

Fully Programmable Modular Bench Power Supply – Part 6

In Part 5 I talked about the target ranges that the PSU module should be able to support and expanded in detail on the voltage range calculations, and I said the next part would be looking at the DAC control circuitry. However, I really need to do the same exercise for current limit control in order to understand the required current control voltage range and resolution we need to ensure our DAC selection is appropriate for our current limit control too.

Current sensing starts with a “current shunt” which is simply a low value resistor in series with the load inside the power supply that will drop a small amount of voltage across it that is directly proportional to the current flowing through it. Selecting the right value is critical to ensure that your current sensing circuit operates in the correct range while making sure that the power dropped across the shunt resistor does not take the component outside of a reasonable thermal range, ideally you want your shunt resistor to run at ambient room temperature under the largest supported load. The PSU design calls for current handling of up to 5A. Just like in the DAC calculations we want to aim for nice round numbers so we pick a resistor value that is going to meet all of these requirements. In the design I have chosen a value of 0.1 ohms which if you do a simple OHMS LAW calculation “E = I / R” you will see that for a 0.1R resistor we get 500mV dropped across it when 5A of current is flowing. The amount of power dissipated in the shunt resistor at 5A can be determined by the formula “P = E x I” which works out to be 2.5W so we need to make sure that our chosen resistor is able to deal with that power and adequately dissipate the two and a half watts of heat generated.

A 0.1R resistor is a common high-power resistor value, and for 5/10W resistors they are typically a wire wound construction. However, the tolerance on these resistors is around the 5-10% mark which we need to take into consideration. Just like the potential divider in the voltage sense circuitry, the current sense resistor is the only component in the circuitry that has a direct bearing on the accuracy of the the current sensing, so a 5% tolerance is really not good enough for what we want. Unfortunately, as soon as you need precision at low resistor values things start to get very expensive. Think about this, if you want a 0.1R resistor at 1% precision then our tolerance needs to be +/- 0.01 ohms which is very hard to make, hence the cost. I do wan’t the precision but without the cost, and am happy to be within 1% for the current sense, so a nice solution is to use 10 x 1R 1% 250mW resistors in parallel to create a 2.5w 0.1R 1% resistor. These resistors are cheap at just a couple of cents each and the tolerance will be tight enough that any error can be easily trimmed out in software calibration. The prototype I built uses through-hole parts that are soldered in but mounted about 5mm above the surface of the board providing airflow around them to help keep them cool. In production I may opt for using SMT resistors and a larger copper area to help dissipate the heat. Here is a photo of the construction described.

If accuracy beyond 1% is important you can hand pick resistors from different manufacturers batches and try to match the resultant restore created. If you fall slightly above the desired resistance you can trim it down by adding higher values in parallel. Or you can go down the “buy an expensive precision shunt resistor route”. In testing my own shunt though, I found I was within a few miliohms of 0.1R which is about what I would expect for 1% tolerance resistors. When measuring these resistances you need a meter that has a Relative or Null mode because you need to compensate for the meter leads and the mechanical contact. I used decent fluke leads and the supplied heavy duty croc clips, I used two different meters and nulled on the croc clips being shorted together before measuring the resistor. Here are the results…

Measured with a Fluke 289 on the low ohms range

Measured with a HP34401A on the ohms range

Now we know that our current sense resistor is good this will give us 0 to 500mV for 0-5A of current we need to sense that voltage and scale it up so we can do something useful with it. The MAX4080F I talked about in Part 4 does both of these things for us. This device is a purpose made high-side current sense amplifier and precision x5 gain amplifier with a buffered output. Being a high-side device its powered from the +V rail so we don’t need to do anything special. In our configuraiton and the x5 gain of the MAX4080F part we now have a buffered output voltage in the range of 0-2.5v for the current range of 0-5A. This control voltage is fed to the constant current error amp on the negative input creating a control loop that prevents the regulator from delivering any more current than is programmed. The current is set by applying the same voltage on the + input of the current error amp as the voltage that will be seen on the output of the MAX4080F device. If we provide a reference voltage of 500mV then the regulator will limit output current to 1A – Nice…

I thought it worth covering the two main schemes you can use to measure DC current in a power supply when using a current shunt resistor – these are known as high-side and low-side sensing.

        
NOTE: The above illustrations are from maxim-ic.com and are Copyright © 2012 Maxim Integrated Products

High side sensing is done on the hot regulated rail, often before the regulator pass device, whereas low-side sensing is done on the ground return path from the load. I have used high-side current sensing in this design because its the significantly better of the two schemes for a number of reasons, and its simple to implement because the MAX4080F makes it so. In the absence of such a useful single low cost purpose made device, then it could be tempting to go with low-side sensing because of simplicity. However, low-side current sensing designs introduce problems that our design will probably not tolerate. In low-side sensing the current sense resistor is placed in the load’s return path to ground, this has the undesirable effect of disturbing the common ground of the overall system when under load which can lead to stability problems, especially if we are doing remote sensing. Even worse than that is the risk that in a lab setup you are using a ground referenced PSU and in your test setup you ground your negative terminal of the PSU that has low-side current sensing which will effectively bypass or at the very least degrate the current sensing capability of your PSU which could cause a lot of damage, especially if your short circuit protection depends on the current sensing. Another problem with low-side sensing is as the current increases the ground reference and sense point will move apart as more voltage is dropped across the current sense resistor, this will introduce offset errors in voltage sensing. Low-side sensing is easy to do and easy to measure with a cheap op-amp but high-side current sensing brings so many advantages that $2 for the MAX4080F or another device like is money well spent I think.

One minor problem with the MAX4080F for this design is the common mode range of the device, the data sheet says it only goes down to 4.5V which is likely to be a problem in the case of a short circuit on the PSU output, really the common mode range needs to be able to extend to zero. I will need to test further to determine if it will be a problem in this design and possibly identify an alternative device – if anyone knows of any that are worth looking at please add a comment.

So back to the PSU, a quick recap on the ranges we are woking towards but this time with a focus on current sense and control.

RangeCurrent
Range
Current Set
Resolution
Full Scale
Sense voltage
Volts per
Milliamp
Current
Steps
A0-5A1mA2.5V500µV5000
B & C0-2A1mA1V500µV2000
D0-1A1mA500mV500µV1000

As you can see from the table above we have a more limited control range requirement so one configuration covers all ranges. However, there is a slight problem inasmuch as the design only gives us 2.5v out of the high-side amp at full scale, which is only 500µV per step which is half of what we get from our DAC at 1mV per step with a 4.096v reference. I can divide down the DAC output by x2 but then I fall short of the target range of 5A so I am going to have to rely on increasing the DAC’s resolution by modulating the DAC output – only measuring this physically will verify if thats good enough. Now we have a good sense of the control ranges need, in Part 7 I will work up a circuit, get a micro controller talking to the DAC chip and do some some perormance measurements to see what we come up with…. I know I said that in Part 5, but this time I mean it :)

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.

Jul 11

Fully Programmable Modular Bench Power Supply – Part 5

I have set the regulator aside for a while, its time to turn to the control circuitry. However, before we get into the circuitry we need to do some pretty important calculations to help us select the right parts for the job. If you recall one of the aims for the power supply module is to be able to set its personality (supported voltage and current range) to suit a variety of voltage ranges. I have chosen a number of ranges to work within and specified them in the table below. Obviously its a relatively trivial task to add other ranges in the future so long as we stay within the confines of the working ranges of the components we have used in the system.

RangeVolt
Range
Volt
Resolution
Volt
Steps
Current
Range
Current
Resolution
Current
Steps
Approximate
Power
Regulator
Gain
A0-6v1mV60000-5A1mA500030Wx2
B0-16V5mV32000-2A1mA200040Wx5
C0-20V5mV40000-2A1mA200040Wx10
D0-30V10mV30000-1A1mA100030Wx10

The values in the table above are what we use to establish the correct control circuitry so they probably deserve a bit of explanation. The voltage and current range columns speak for themselves, they tell us what the expected programmable range of the regulator will be. The voltage and current resolution columns tell us the size of each step in the range, so for example in range “A” which has a resolution of 1mv/1mA we can program the output volts from 0V to 6V in 1mV steps, and for the current we can program the limit from 0A to 5A in 1mA steps. The volts and current steps columns tell us how many digital codes are needed to represent the desired output voltage and resolution.

Getting our Voltage under Control

In oder to get a digitally controlled voltage we need to use a DAC (Digital to Analog Converter). A DAC takes a digital “code” and translates this directly to a static voltage. However, DAC’s typically operate in the 3.3v to 5.5v range so to control higher voltage ranges we need to ensure that the regulator circuit has gain. This is achieved by simply dividing the measured output voltage using two precision resistors before feeding back into the error amplifier. The column called “Regulator Gain” shows the gain factor required for the specified voltage range. You will see in the Part 4 schematic the gain has been set to x10 by R4 and R5. It is also with noting that these two resistors are the only two components in the entire regulator circuit that have any impact on the accuracy of the programmed output. The effects of inaccuracies in the other components are automatically and fully compensated for by the DC Servo effect created by the control loop. It is critical that R4 and R5 are accurate (I am using 0.1% tolerance resistors) and also have good temperature stability.

Alright, get to the point, what about the DAC!

In order to select the right DAC resolution and voltage reference (more on that later) we need to establish the range and resolution of the required control voltage. This is important because we must include the gain of the regulator which in turns affects the resolution requirements of the DAC. The following table expands on this with a key values we need to consider.

RangeOutput
Range
ResolutionStepsRegulator
Gain
Reference
Range
Reference
Resolution
A0-6v1mV6000x20-3v500µV
B0-16V5mV3200x50-3.2v1mV
C0-20V5mV4000x100-2V500µV
D0-30V10mV3000x100-3V1mV

We calculate the control voltage range by dividing the target voltage by the gain multiplier value. For example, on range A, in order to obtain an output voltage of 6V we need a control voltage of 3V, calculated as 6 ÷ 3 = 2. To work out the reference control voltage resolution required we simply take the maximum controlling reference voltage needed and divide it by the number of steps required, in this case its 500µV per step.

From the above table we can clearly see that we need a maximum of 6000 steps to cover all ranges, which requires a DAC resolution of at least 13-bits. That is really inconvenient because DAC’s increase in price as the bits go up and there is a very notable jump in price as you go above 12-bits. A potential solution to this problem is to increase the step size on the 0-6v range from 1mV to 2mV which would half the resolution but would bring me nicely into range for a 12-bit DAC but I did not want to do that, its not what I set out to do, I needed to maintain the target resolution of 1mV on the 6v range. Thinking about it some more I thought that I could probably increase the resolution of the DAC in software using a technique whereby the DAC output is continuously set to a series of values at high speed to create an average voltage that can sit between between steps, this is known as dithering or modulating the DAC output. The downside to doing this is you introduce a peak ripple which reflects the continuously changing voltage level. However, filtering this out a straightforward affair because the amplitude of the ripple created is actually very small, so as long as we have enough current drive from the DAC a simple second-order passive low-pass filter is all that should be needed. Something worth noting though – the amplitude of the ripple voltage as an overall percentage of the output voltage is not linear; at lower voltages the ripple constitutes a larger proportion of the overall signal and therefore introduces more error. In practice though this should still end up well within tolerance, and if not we can always put in a higher resolution DAC!

One final thing is we need to decide on a reference voltage to use. DAC’s require a reference voltage in order to provide an accurate output voltage. Think of a DAC as a programmable potentiometer where the output is the wiper, the reference voltage is strapped across the two outer pins and the code sets the position of the potentiometer. If we have a 12-bit DAC that gives us 4,096 steps so if we use a reference voltage of exactly 4.096V we will have a theoretical output of 0-4.096V in 1mV steps which are nice round numbers that make software easier to develop, so that’s what we will go for.

So in summary, we have a design plan, we have our calculations and we know we need at least a 12-bit DAC. I am going to start with a DAC from Microchip MCP4822 which is a dual 12-bit DAC, its low cost and seems a reasonable starting point to do some experimenting, it also has a built in 2.048v reference and a x2 amplifier giving us the 0-4.096v @ 1mV steps.

In Part 6 I will work up a circuit, get a micro controller talking to the DAC chip and do some some perormance measurements to see what we come up with.

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.

Jul 09

Horizontal and Vertical flip transformations of a QGraphicsItem in Qt QGraphicsView

I have been reviewing and assessing Qt for a small software project. Having only spent a small amount of time with the development environment I have managed to create a small program that allows me to draw 2D graphics. I have been using C++ for many years and for GUI related work I have mostly used MFC. I like C++ for UI’s because it makes programs that are fast and responsive, I plain to post an article comparing .NET, Java and C++ for building desktop applications in the near future.

Back to the library evaluation, one of the things I needed to be able to do was to flip a vector graphic item either horizontally or vertically around its center axis, meaning after the flip the object should be in the exact same place on the world view as it was before the transformation. There are built in functions for doing rotations around a center point but not this specific function. The 2D graphics system in QGraphicsView/QGraphicsItem uses matrix transforms which are at best very complicated – you need a good understanding of mathematics and a lot of patience to be able to comprehend this staff – I needed to understand this: –

Matrix

WTF! – does this mean anything to you? No, me either, thank heavens for those bright folk that work this stuff out for us…. if you do need to know more about the maths behind this you check out this document: http://en.wikipedia.org/wiki/Transformation_matrix which from what I can tell gives you the explanations, but I have to confess I switched off very quickly.

Having read that document I wanted to give up – too hard – or I am too lazy, either way i got a beer from the fridge and got nowhere – but not being one to give up so easy I decided that instead of learning the maths I would go back to debugging and good old-fashioned trial and error! Actually the Qt library has done most of the hard work, the fact that I can achieve my goal with a little bit of debugging, trial and error is testimony to that.

I did search around for examples and while there were lots of questions about this, there would appear to be very little in the way of answers, perhaps I am just a maths luddite or maybe there are many more people that shy away from the maths involved and say nothing :) In the end I came up with this which appears to work very well, and given there would not appear to be much information out there on this particular requirement, I thought I should make this example available. Having all the individual variables makes for easy debugging, you can see whats going on. I also included a simple debug function for dumping the transform matrix data.

+1 for Qt – check it out http://qt.nokia.com/products/

void MyGraphicsItem::flipHorizontal()
{
    // Get the current transform
    QTransform transform(this->transform());

    qreal m11 = transform.m11();    // Horizontal scaling
    qreal m12 = transform.m12();    // Vertical shearing
    qreal m13 = transform.m13();    // Horizontal Projection
    qreal m21 = transform.m21();    // Horizontal shearing
    qreal m22 = transform.m22();    // vertical scaling
    qreal m23 = transform.m23();    // Vertical Projection
    qreal m31 = transform.m31();    // Horizontal Position (DX)
    qreal m32 = transform.m32();    // Vertical Position (DY)
    qreal m33 = transform.m33();    // Addtional Projection Factor

    // We need this in a minute
    qreal scale = m11;

    // Horizontal flip
    m11 = -m11;

    // Re-position back to origin
    if(m31 > 0)
        m31 = 0;
    else
        m31 = (boundingRect().width() * scale);

    // Write back to the matrix
    transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);

    // Set the items transformation
    setTransform(transform);
}

void MyGraphicsItem::flipVertical()
{
    // Get the current transform
    QTransform transform(this->transform());

    qreal m11 = transform.m11();    // Horizontal scaling
    qreal m12 = transform.m12();    // Vertical shearing
    qreal m13 = transform.m13();    // Horizontal Projection
    qreal m21 = transform.m21();    // Horizontal shearing
    qreal m22 = transform.m22();    // vertical scaling
    qreal m23 = transform.m23();    // Vertical Projection
    qreal m31 = transform.m31();    // Horizontal Position (DX)
    qreal m32 = transform.m32();    // Vertical Position (DY)
    qreal m33 = transform.m33();    // Addtional Projection Factor

    // We need this in a minute
    qreal scale = m22;

    // Vertical flip
    m22 = -m22;

    // Re-position back to origin
    if(m32 > 0)
        m32 = 0;
    else
        m32 = (boundingRect().height() * scale);

    // Write back to the matrix
    transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);

    // Set the items transformation
    setTransform(transform);
}

void dump_transform(QTransform& t, const char* name)
{
    qreal _m11 = t.m11();    // Horizontal scaling
    qreal _m12 = t.m12();    // Vertical shearing
    qreal _m13 = t.m13();    // Horizontal Projection
    qreal _m21 = t.m21();    // Horizontal shearing
    qreal _m22 = t.m22();    // vertical scaling
    qreal _m23 = t.m23();    // Vertical Projection
    qreal _m31 = t.m31();    // Horizontal Position (DX)
    qreal _m32 = t.m32();    // Vertical Position (DY)
    qreal _m33 = t.m33();    // Addtional Projection Factor

    qDebug("================ %s ==================", name);
    qDebug("m11: %f, m12: %f, m13: %f", _m11, _m12, _m13);
    qDebug("m21: %f, m22: %f, m23: %f", _m21, _m22, _m23);
    qDebug("m31: %f, m32: %f, m33: %f", _m31, _m32, _m33);
}

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.

Jul 01

Low-cost Temperature Measurement

As part of the Fully Programmable Modular Bench Power Supply project I needed to measure the temperature of the heat sink in order to provide some thermal protection. The aim is simple enough, monitor the temperature of the heat sink and if it gets too hot shut it down until the temperature returns to an acceptable level. As it turns out there is more to this than one might think.

Firstly I needed to decide on a sensing device. There are numerous options to choose from falling into three main categories of passive, active linear and active digital.

Passive devices like RTD’s and Thermister’s are available in all sorts of types and are basically resistors that change value with temperature. These devices need circuitry around them and can be complicated to use mainly because their rate of change is expressed as a percentage per degree which in practice means a very non-linear response curve to temperature change. For my needs this was too complicated, at best I would need some kind of signal conditioning, feed into the micro controlled ADC and a software map of temperature vs. voltage to get a reading.

Digital devices such at the Dallas DS1821 can be connected to a micro-controller or in the case of the DS1821 a 1-wire serial bus. The device can be queried and it will return information about the current temperature it is sensing. These are very nice all digital devices but carry the penalty of cost, they are not cheap, costing upwards of $2 a piece. Because of cost I decided not to pursue the use of these

Analog devices are solid state devices that provide a variable voltage out that directly relates to temperature being sensed and are basically linear. These devices are typically low cost, simple three pin devices with power in, ground and volts out. The following are good devices to look at: –

I was thinking about the Bill of Materials for my project and was not really wanting to add yet another part. I had read somewhere that silicone has a very linear temperature co-efficient of around -2mV/°C of temperature change, which means if you measure the voltage drop across a diode or transistor junction you will see a 2mv decrease in voltage dropped for every degree of temperature rise. As my circuit was already using some PN2222 devices which are general purpose NPN transistors and LM358‘s I thought it would be an interesting exercise to see if a simple discrete temperature sensor could be built.

Pen, paper, breadboard, some bits and an hour yielded the following circuit:

Temperature Sensor

This curcuit provides a voltage swing of +1.5v to +3.5v for a temperature range of -50°C to +150°C. I was only able to test it down to a few degrees below zero but it tracked all the way up to 150°C without any problems. The data sheet for the PN2222 states it will operate down to -50°C so I have no doubt it will track downwards. Room temperature was at around 2v, I used a type K thermocouple and a Fluke 289 meter to calibrate it. The results of this circuit are surprisingly good and I did not add one single item to the BOM on the project, every component was already in use elsewhere in the circuit.

Average rating  1 2 3 4 5You must login to vote
IMG_5277
IMG_5283
IMG_5288
IMG_5292
IMG_5270
IMG_5275
IMG_5277
IMG_5283

Unfortunately the problem came when I needed to couple the device thermally. The main heat generating device on the project in question is an IRF540 in a TO-220 package. Bonding the PN2222 to the heat sink close to the device was my plan but in testing what I found was the lag between the IRF540 junction temperature and the heat skink temperature was enough that under extreme conditions the device will self-destruct long before the heat skink is hot enough to tell the control circuitry to shutdown. I found that the temperature on the plastic front of the device was much hotter than on the heat sink so I think the sensor really ought to somehow be mounted on the front of the device where the thermals are closer to the junction temperature than the heat sink. This exercise also convinced me to change the device to a bigger IRFP240 which is physically bigger and has better thermal properties. Although the data sheet for the IRF540 puts the device well within spec, I am more comfortable with the bigger package, more surface area must mean better thermal properties.

Back to the BOM – the PN2222’s that are in use in the project are in an SMT package so there was no practical way to thermally couple the two devices which meant I would need to add a TO-92 packaged device to the BOM and that really took away any advantage I had gained by using components already in the BOM for the project. I thought it still worth publishing the circuit as it may be of some use to others, pretty much any op amp and any silicon diode or transistor will yield much the same results.

In the end I opted to use the MCP9700A device from Microchip Technology, this is accurate enough for what I need and costs around $0.50 for a one-off. Still more expensive than the discrete design but I am trading that off for simplicity. The MCP9700A has a known temperature range and a known voltage output so interfacing to the MCU is as simple as connecting it to one of the ADC channels and measuring 10mV per degree of temperature – easy…..

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.

Jun 24

The Good, the Bad and the Ugly – Schematic and PCB Software

I have recently been using Diptrace for schematic capture and have just hit the 300 pin limit so I am looking at my options including alternative packages. Why am I looking at options? Having read numerous forums and reviews, based on other peoples experience it would appear that Diptrace is an improvement over Eagle and other low end solutions, I have tried Eagle In the past and I would have to agree, but Diptrace far from perfect, in fact its so poor in some areas I am now thinking about sinking time into evaluating other applications. Perhaps the EDA/CAD world has lower expectations that I do but even Diptrace which would appear to be the more intuitive of the bunch, the user interface, and more specifically the usability really sucks, it could be Sooooooooo much better.

Diptrace Screenshot

First of all, Mac OSX support. They claim it runs on Windows and OSX which is true. But on OSX its actually running the Windows version of the software under a windows emulator called WINE. Worse than that, WINE runs under Quarts X11 which is yet another layer of abstraction before it hits the actual screen. Trust me, the thing is crappy, actually bad enough that I want to use it in Windows instead, which is tearing me away from my beloved MAC. Integration into the Mac is non-existent, files and folder structures are ten folders deep as the WINE emulator creates a Windows-like folder structure. Novram should be ashamed of their claims of OSX support, its really terrible. The software also randomly hangs which causes work to be lost, the UI is slow and cumbersome and the keyboard shortcuts sometimes stop working so you are restricted to right-mouse context menus for cut/copy/paste delete until they magically come back from time to time. So if you are going to use Diptrace, use it on Windows not a MAC. If you have a Mac, install Oracle’s virtual box, run a copy of Windows 7 and use it as a native Windows app (I am going to give DipTrace one more try under Windows to see how I go).

In terms of the hanging, they have actually added a menu option called “Recover Schematic” which mostly gets back your last changes. They have added this at some point I imagine to deal with the fact that the software is buggy and can crash/hang. It would have been better to improve the software so it never needed an option to “recover” anything…

Now onto the features of software. I have to say at this point, I don’t much like CAD software, it all seems to have “its own way” of working, seemingly much of this is a hangover from Autocad which was made before a mouse was even commonplace, so lots of strange keyboard shortcuts etc. DT reacts strangely to the mouse mostly so while people seem to think its intuitive I can only imagine other packages must really be bad. If you are used to using Windows or Mac UI’s and you have not had any CAD experience then DT will feel alien and it has a long learning curve to get you past that. I have used it (schematic capture) to create a project and it does work once you get to understand its oddities. Being a software guy I know how easy it would be to make considerable usability improvements with little effort which makes it all the more frustrating – I first came across DT about four years ago and I have to say its not really moved on from then, and that is even more frustrating. The lack of development progress and the poor usability does not say a great deal for Novram.

Here are my top 10 specific bugbears…

1. No control over what component elements get displayed or printed. For example, on screen I see the pin names (B,C E) for the Discrete/NPN item, or A/B on the RES item, I don’t want to see them but I can’t turn them off without also turning off the pin numbers for IC parts which I do want to see. Any electronics engineer knows which pin is the emitter of a transistor, displaying E is ridiculous. Control of this should be a properly of the part not a global view property, although you might want that too.

2. Netports appear in the BOM, I have to manually remove them from the BOM after the export to a file, there would appear to be no way to control this. It would appear that NetPorts are just another 1-pin component which is why this happens, perhaps a simple attribute on the component property called “Exclude from BOM” might help.

3. The sheet connectors are stupid, Place one and it defaults to place a bus, try to place a wire and it sort of works but the wire does not align correctly. Strange behaviour….So don’t use “Sheet Connectors” to connect your circuits across sheets, use NetPorts instead – obvious really – NOT!

4. The library selectors on the toolbar are a little odd, the names are untidy, just a lack of attention to detail. Why call something that will be displayed in the UI Con_Sch, thats the sort of name you would expect to see in code, not presented to a user. Once you select a library you get the components down the left-hand side to select from – scroll up and down this enough selecting items (as you do when you are finding your way around the libraries) and you will get it to hang the whole program. Clicking an item puts you into place mode meaning you have to press escape if you were just browsing. Right click also cancels it but you also get a right click context menu. The little drop down on the library bar drops down a scroll bar so you can scroll through the library buttons – this compensates for a poor UI design making it even more unusual. The software could do with a decent library browser and some better organisation for the actual libraries. Trying to manage parts, copying between libraries etc, all very confusing and counter intuitive.

5. Create multiple sheets which is great, but then you want to change the oder of the sheets to more logically represent the flow of your project. Tough, you just can’t do that – at least I have not found a way so far.

6. A “Save All” button would be nice….instead of having to go to each sheet and save it separately.

7. There is a need for much better schematic annotation. Single line text is really not good enough. Ideally multi-line post-it style boxes would be good.

8. When drawing a schematic with a large IC you need to be able to re-organise the pins on the component to suit the schematic you are drawing – there is no option to do this apart from create your own library, copy the part into it and re-organise it for your specific schematic….rubbish….

9. Ever hear of smooth drawing using anti-alias? No! – neither have Novram – you could argue this is not needed but I would say if you are going to stare the the thing for hours on end you want it to be easy/soft on the eye – you could argue that it will make things slower – all true but I would still like to see my creation looking nicer.

10. Float the mouse over a connection and see the net highlight – nice – what about across sheets? Nothing doing, leaving you to manually check the net names to make sure your schematic has integrity across sheets. I thought computers were meant to make less work – not more (Microsoft, please take note of this point too..)

All in all it does work and its alright I suppose but after serious use I am left with a compelling desire to find an alternative – why is that, I don’t have the same feeling after using my e-mail program or my word processor. All of the pro’s seem to favour Altium designer http://www.altium.com/ but I can not bring myself to spend $3000+ for a piece of software that is really overkill for my limited use…I would love to evaluate it one day though – not sure Altium would want me to :)

I am about to try AutoTRAX DEX, you can find it here http://kov.com/. I bought this about four years ago and Oh-my-god, it was the most buggy and terrible piece of software I could ever imagine. It was cheap enough though that I did not loose any sleep over it when I just chalked it up to experience and uninstalled it. The author was defensive and it was pretty clear things were not going to get addressed and it was even more abundantly clear with the very regular, sometimes daily releases that there was absolutely no quality control, one new fix and another things broken etc, I gave up after a couple of weeks. At the time the guy developing it was focused on this next generation written in .NET and an all new design, this is now 4 years in the making and I recently had another go with it. On the back of a 20 minute play around I went and paid $49 and renewed the licence I already had.

I will evaluate AutoTRAX and write a detailed review with what I find. At a glance I can say is that a lot of attention to detail when it comes to look and feel, the schematics look really nice, they print well and the component libraries appear to be reasonably comprehensive. If it works well I think it could be a good contender for Diptrace, its a lot cheaper too, $99 for totally unlimited pins, layers etc…has 3D rendering and so on….

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.

Jun 14

Fully Programmable Modular Bench Power Supply – Part 4

After a fair amount of playing about, measuring and trying things I finally arrived at a working design. I am happy I have what I think is a good starting point of rest of the project. I have something that is working and feels much more stable under a varying capitative and resistive loads, I have a high degree of confidence that I am now on the right track. Having resolved the issues with stability I have now added a current shunt, high-side current sense amp and current error amp for current regulation, I have also added a couple of amps in comparator mode to sense the regulation state to show if the regulator is in constant volts or constant current mode or out of regulation all together.

PSU Schematic Version 0.4a

To sense current I have used a high-side current sense amp type MAX4080F, this is a really nice single chip solution designed for the exact purpose, it has a wide supply range and the “F” version has a x5 gain factor. Using a high-side current sense amp means that I do not need to sense in the ground return path which in turns helps keep things simple. The MAX4080F reads the voltage dropped across the current shunt which is made up of 10 x 1R resistors in parallel. The voltage read is multiplied by 5 and delivered to the output pin. In this configuration a load of 0-5A gives me a voltage output of 0-2.5v which is fed back to the current error amp limiting current to what has been set on the CC_REF input.

Here is a quick video taken to show the constant current limiter kick in as a filament lamp warms up and current demand drops. Turn the PSU output on and the cold lamp draws current beyond the limit set (indicated by the red LED), but as the lamp warms up and draws less current the PSU transitions from CC mode to CV mode smoothly.

In Part 3 I mentioned the idea of having a very stable low-power full voltage range regulator, this is what I created around Q5 and Q6, with R8 acting as its load. The IRF540 Q4 is then simply acting as a voltage follower which scales up the power handling, its source simply follows the voltage on the collector of Q5. This configuration works really well and is much more stable (more on that in a second), but its not perfect. I am not entirely convinced about the use of a FET as the final pass device any more. Its easy to drive because of the low drive current needed, but being a linear regulator circuit the output FET never does the one thing that its really good at which is being turn hard on, so despite having a positive grid bias supply that will allow this, its never used. The FET device is perfect for the pre-regulator switch (Q2) so I don’t need to change that but it would seem like there is an opportunity to simplify this circuitry further in the final output and driver section, so this is not yet a finished design, but its certainly a workable one. The decision may well come down to the bill of materials in the production, if we are using the FET for the pre-regulator, then we may as well use the same device as the pass transistor – we shall see….

For now I am not expecting to use the pre-regulator, it is in effect wired out by being switched on by default, If you were to build this circuit as as and do not wan’t pre-regulation (as would be the case in the 0-6v configuration) you would simply exclude Q2, Q3 and their associated bias resistors and put a link on the board between the drain and source pins where Q2 would have been. The pre-regulator will be introduced later and is specifically required to lower the overall heat dissapation of the regulator circuit under certain load conditions. The pre-regulator switching control will be done by the micro processor in the main but I do need to add some direct analogue feedback mechanism to ensure the regulators dynamic response is not impacted by any software or hardware latency the micro controller would introduce in this setup. Basically the idea is to sense any significant change (ac coupled) on the control point at the junction of D8 and D9 and if detected turn the pre-regulator hard on for a set period of time, lets say 250ms or so which will ensure full power is immediatly available to the drain of Q4 which will regulate as required. During this forced on time, Q4 will dissipate all of the heat generated by the power dropped across the regulator. Because of this forced on time, the micro controller will have time to sense the large amount of power being dissipated by Q4 by sensing the voltage differential between PRV_MON, I_MON and V_MON and will start driving PRE_REG to take over, in effect this is a lazy pre-regulation control that will only kick in once the load has stabilised, the micro controller will slowly wind down the power delivered into the resevour caps by switching the 100Hz drive from the bridge rectifier on the rising and falling slope of the half cycle, keeping a reasonable differential across Q4 for the given load. The pre-regulator control switching will be synchronised to the line frequency which will be sensed via the AC_SENSE signal.

Average rating  1 2 3 4 5You must login to vote
IMG_5178
IMG_5180
IMG_5181
IMG_5182
IMG_5146
IMG_5147
IMG_5148
IMG_5149

Back to the regulator stability topic, I have removed all the capitative loading around the driver and output circuit and instead reduced the bandwidth of the control loop by including frequency-dependnat negative feedback on both the voltage and current error amps. The aim was to significantly lower the gain of the loop above the point where the feedback becomes positive and the servo action becomes unstable. The simple first order filtering built around R33/C11 and R34/C12 provides a very stable control loop in this configuration. DC conditions remain in tact but as the frequency rises in the circuit, then the negative feedback starts to kick in via C11 and C12 lowering the gain in the feedback loop. The filtering could be improved and there is definitly some improvements I need to make at very low output voltages (0-50mv). The basic regulator circuit I have ended up with is pretty classic and has been done many times before so there is nothing new, but for me what I have achieved is creating a circuit from the ground up and getting my own understanding up to a level that allows me to properly comprehend the behaviour and problems that can occur with such a circuit and some basic ideas on how one would tackle the problems when they do arise.

The regulator in the configuration shown means there is a x10 voltage gain, so for 0-3v in I get 0-30v out, and for current limiting, for 0-500mV in I get a 0-1A current limit. Doing some basic testing I was able to drive a load well above the rated power of 30W (almost 50 watts) without a problem and with good load regulation. The regulator tracks very accurately according to my Fluke 289 and Agilent 34401A into both load and no load conditions. I was able to short the output out while it was driving into a half load, full load and no load with no damage or noise problems – the current limiting works nicely. I have yet to do any testing around dynamic response, I don’t have a programmable DC load so I need to work up a simple test rig to do this which I will leave for another article.

I have based the entire design on a single rail power supply for the op amps, using single supply op amps type LM358, these are common, low cost devices. I have tried using LT1013 precision op amps in this circuit but there is not any improvement over the LM358’s, primarily because the circuit remains accurate because of the control loop that ensures this, so precision op amps are not needed.

As a final check, I was measuring the output noise on a scope which was looking pretty disappointing, I was getting 25-60mv of white noise and some very minor high frequency ringing, I think the latter could well have been scope leads etc. Slugging the output with a big electrolytic cap helped reduce the noise but it was still present. Having tried a few things I suddenly realised that my test setup was flawed in relation to noise testing. I was using the 0-6V range on my Agilent E3631A to derive my CV_REF control voltage which is bad. Firstly the Agilent PSU generates some noise, about 2-3mv worth of it and secondly, my regulator circuit is a x10 amplifier so i was amplifying whatever noise the E3631A was generating by a factor of ten. I tried the same test but driving the CV_REV signal from a 1.5v AA battery cell and low and behold the noise figures plummeted to below 2mv on the output into a load at 16v – lovely. I have not carried out tests of any substance yet but the early results are very encouraging.

So I now have a working regulator, what next? In Part 5 I am going to set the regulator aside for a while and turn my attention to the digital control circuit. I am going to use a micro controller with a DAC and ADC to try to create stable and accurate control reference voltages to drive the regulators CV and CC reference inputs as well as relatively accurate and high resolution metering to measure the output volts, current delivered and pre-regulator voltages. I want to achieve good accuracy for both reference voltage generation as well as metering but plan to try various configurations, DAC/ADC’s and software approaches to see see what can be achieved at a sensible component price point.

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.