Dangerous Prototypes

In development => Project development, ideas, and suggestions => Topic started by: garak on August 11, 2010, 05:15:15 pm

Title: Computer controlled PS/function gen/multimeter
Post by: garak on August 11, 2010, 05:15:15 pm
I love the bus pirate and other opensource tools. I think the next step is to replace all the expensive bench equipment needed for analog electronics with one device.

I've always wanted a programmable/tracking power supply but they are very expensive. Any one got any ideas on building an inexpensive digitally controllable power supply? I'm thinking of an output range of .7-12 volts at 1A+. Could we get clean DC using PWM? To keep cost low an external PS would take care of knocking the mains down to low voltage DC.

Lots of measurement inputs is a must(multimeter functionality). The ability to measure DC & AC signals to at least 40khz and up to 220v with good auto ranging. So we need a good A2D converter, I'm thinking at least 16 bits and 96khz sample rate. I'd like to target 1Mhz. Any one got any ideas on how to handle over voltage, get good isolation and how to do the auto ranging?

For a function generator we could use something like the DS1077 programmable oscillator and a series of OPAMP circuits(filters, integrator and differentiator) and  to produce various waveforms. That would produce signals from 16khz to 133Mhz. Lower frequencies could be done with a DAC maybe or the micro-controllers PWM output.

The applications I'm thinking of are like graphing the curve of a diode or transistor. Scripting events for testing the limits of components and circuits. General testing and troubleshooting.

A serial console interface like the bus pirate would work ok. I'd like to see similar binary mode features and scripting.

I'd like to target under $100 but still keep the specs up.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 11, 2010, 05:46:16 pm
I love it. I've wanted to make a digitally controlled adjustable power supply for a while. I always thought using a digital potentiometer on a LM317 would be a way.

One thing I'm reticent to do is work with line voltage, that's a little too dangerous for me.

It sounds like there'd be lots of analog work on the measurement and signal generators.

Maybe a lot could be done with crystals and programming counters/PLLs for the generator. I bet an FPGA or CPLD would help a lot.

I bet there's some existing open source stuff out there we can build on too.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: rct on August 11, 2010, 05:55:17 pm
[quote author="ian"]
One thing I'm reticent to do is work with line voltage, that's a little too dangerous for me.
[/quote]

Probably lots of people would suggest this but I think an ATX power supply would be a good starting point.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 11, 2010, 07:09:55 pm
[quote author="garak"]To keep cost low an external PS would take care of knocking the mains down to low voltage DC.[/quote]One thing to keep in mind as a possibility is an AC adaptor instead of DC.  They're rare, but I have seen some products which come with a wall-wart adaptor that outputs AC instead of the typical DC.  Something around 20 V AC or less.  For some circuits you can do more with AC, especially if you want to generate a wide range of voltages.  Basically, an AC adaptor saves you from obtaining a high-voltage transformer and soldering 120 V AC yourself, but you still retain a wide range of options.

I subscribe to the Maxim newsletter, where they have recently mentioned articles on power monitoring systems.  You might be able to get some ideas from the following link: Signal conditioning for a sigma-delta ADC in industrial multichannel data acquisition systems (http://http://www.maxim-ic.com/app-notes/index.mvp/id/4655)
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: dpropicweb on August 12, 2010, 01:32:49 am
[quote author="garak"]
Lots of measurement inputs is a must(multimeter functionality). The ability to measure DC & AC signals to at least 40khz and up to 220v with good auto ranging.
[/quote]

Some parts of the world exceed 220v (our line voltage downunder is officially 240v - in reality it is closer to 260v most of the time to account for peak load). See http://www.controlledpwr.com/help-inter ... ltages.php (http://www.controlledpwr.com/help-international-voltages.php) for a good summary of official line voltages. A number of grey-market 220v rated computer peripherals have gone up in smoke round these parts :)
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 12, 2010, 06:50:26 am
[quote author="Trev"]Some parts of the world exceed 220v (our line voltage downunder is officially 240v - in reality it is closer to 260v most of the time to account for peak load). See http://www.controlledpwr.com/help-inter ... ltages.php (http://www.controlledpwr.com/help-international-voltages.php) for a good summary of official line voltages. A number of grey-market 220v rated computer peripherals have gone up in smoke round these parts :)[/quote]Good point.  There's also the fact that even 120 VAC is an RMS measurement, not a peak measurement.  Circuits must handle peak voltages, so 170 V is the positive peak, and 340 V is the peak-to-peak total!

So, for 240 VAC, the peak-to-peak is 680 V !!  You might want to plan on 736 V if that 260 VAC is really RMS.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: tayken on August 12, 2010, 09:08:06 am
I think we can use a transformer to decrease the mains voltage to a more suitable level, like 110VAC->20VAC (which makes 110VAC->20VAC, manageable IMO)and then use that to obtain the output voltages. This way we can output AC or DC and any voltage we like if we throw in a dsPIC, we can interface it with a PC to update the firmware, control the power supply etc. I think it was a good decision to bring my power electronics book with me when I moved to Japan. :)
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 12, 2010, 10:24:05 am
[quote author="tayken"]
I think we can use a transformer to decrease the mains voltage to a more suitable level, like 110VAC->20VAC (which makes 110VAC->20VAC, manageable IMO)and then use that to obtain the output voltages. This way we can output AC or DC and any voltage we like if we throw in a dsPIC, we can interface it with a PC to update the firmware, control the power supply etc.[/quote]I'm not sure I understand what you're saying when you jump from high-power transformer to mentioning DC, unless you're talking about the power supply function separately from the function generator.  DC does not translate through a transformer.  But if you limit the transformer to stepping down the AC mains, and use separate technology for medium voltage DC function generation, that works.

dsPIC is probably a good choice, or at least some kind of DSP.  I've not used the dsPIC yet (I have more experience with the TMS320).
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: garak on August 12, 2010, 04:01:36 pm
My thoughts about the primary power supply is that it should be user supplied 12-24v. Most everyone has a few left over wallwarts and other power supplies from broken devices. Laptop PSU  are typically in the range of 18-24v and supply up to 5A. Also by the user supplying it them selfs there are no issues of the different voltages/line frequencies/connectors used world wide. Another plus is that it could be run of batteries for off grid hacking. With good A2D this device could be also used to monitor a solar or wind install.

I'm thinking the regulator should be a switching regular to keep heat dissipation and waste down. I my mind it seems really simple, PWM driving the input of a fairly fast MOSFET, a few caps to filter the output and then feed the output back into an A2D converter and have a software feedback loop adjust the PWM to get the desired voltage or current. But power control electronics are not my strong area. I have no idea what PWM frequency would be suitable nor what its going to take to make that chopped waveform nice steady DC. While at the same time keeping a reasonably low output impedance.

Another application that just pop'd in my head is battery charging. If this thing can do constant current output and has extra inputs that can monitor cell voltage and temperature (using say LM35) it would make a great battery charger. Maybe it could have different loadable profiles for different types of batteries.

The more I think about this thing, I think the function generator part could be a separate project, its more related to a scope anyway. I'm thinking the goal should be maybe a computer controlled current/voltage supply(maybe 2 independent outputs) and maybe 8 channels of high impedance, high resolution analog inputs.

It would be nice if 2 of the analog inputs could handle AC mains voltages and the rest be 0-12v DC. Sampling speed would be variable depending on the number of inputs used.

Just created a wiki page with a temporary name http://dangerousprototypes.com/docs/Potential_Pirate (http://dangerousprototypes.com/docs/Potential_Pirate)
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: tayken on August 13, 2010, 07:37:51 am
[quote author="rsdio"]
I'm not sure I understand what you're saying when you jump from high-power transformer to mentioning DC, unless you're talking about the power supply function separately from the function generator.  DC does not translate through a transformer.  But if you limit the transformer to stepping down the AC mains, and use separate technology for medium voltage DC function generation, that works.
[/quote]

I was just talking about the power supply function. Of course I know a transformer is no good for DC, my logic was Mains -transformer-> ~20VAC -SMPS circuit-> DC output.

[quote author="rsdio"]
dsPIC is probably a good choice, or at least some kind of DSP.  I've not used the dsPIC yet (I have more experience with the TMS320).
[/quote]

We need some sort of DSP as these guys can handle the calculations needed pretty well. I remember my professor saying that one needs a 32bit controller for driving motors (which is similar to SMPS) but I think we can handle this pretty well with a 16bit controller. I said dsPIC as I am familiar with them (I use mostly 24F and they share a lot in common) and also it was used in the Web Platform so Ian knows them.

[quote author="garak"]
My thoughts about the primary power supply is that it should be user supplied 12-24v. Most everyone has a few left over wallwarts and other power supplies from broken devices. Laptop PSU  are typically in the range of 18-24v and supply up to 5A. Also by the user supplying it them selfs there are no issues of the different voltages/line frequencies/connectors used world wide. Another plus is that it could be run of batteries for off grid hacking. With good A2D this device could be also used to monitor a solar or wind install.
[/quote]

That passed through my mind but if we make the input connector an IEC-C5 (http://http://en.wikipedia.org/wiki/IEC_connector#C5_and_C6_connectors) one can buy an input cable from their own country to connect to the mains. Also a laptop PSU is a SMPS (specs of mine are Input: 100-240VAC 1.5A 50-60 Hz Output: 19VDC 3.42A) and we are connecting two SMPS in series which will decrease efficiency.

[quote author="garak"]
I'm thinking the regulator should be a switching regular to keep heat dissipation and waste down. I my mind it seems really simple, PWM driving the input of a fairly fast MOSFET, a few caps to filter the output and then feed the output back into an A2D converter and have a software feedback loop adjust the PWM to get the desired voltage or current. But power control electronics are not my strong area. I have no idea what PWM frequency would be suitable nor what its going to take to make that chopped waveform nice steady DC. While at the same time keeping a reasonably low output impedance.
[/quote]

A switch mode regulator is a good idea as with a linear regulator the efficiency decreases as the difference between input and output voltage increases. Generally 100kHz is used as far as I can remember but that depends on the inductor and FET you are using. I am no power electronics engineer too but I am a grad student in robotics and control and some of the motor drivers I use are just variable voltage sources.

[quote author="garak"]
The more I think about this thing, I think the function generator part could be a separate project, its more related to a scope anyway. I'm thinking the goal should be maybe a computer controlled current/voltage supply(maybe 2 independent outputs) and maybe 8 channels of high impedance, high resolution analog inputs.
[/quote]

I think we should stick to this too. I don't know if Ian can spare some time and maybe turn this into a Dangerous Prototypes project but I will be happy to contribute.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 13, 2010, 08:57:04 am
I'm even more excited, thanks for adding it to the wiki. I have to stuff some boards today and order parts, but after that I'll try to put some ink on paper for this project.

If we use a dsPIC we get high resolution ADC/DAC with some extra math crunching algos if we need them. The Bus Pirate firmware framework could be ported to a dsPIC if you wanted similar features.

How fast does the PC connection need to be? If you want to push lots of data live an integrated USB chip could be in order. If not, I think a UART with opto-isolation to a FTDI232 chip could provide a modicum of isolation for the PC.

If we keep the scope of the prototype and v1 at the minimum specs (with a wiki wishlist), we could get something out quite quickly.

My concern with the SMPS is getting a smooth supply. Joe at the Yahoo Switchmode list could point us in the right way. Here's a simple spreadsheet that can calculate the idea rise and fall time for a given inductor:
http://www.instructables.com/id/High-Vo ... teristics/ (http://www.instructables.com/id/High-Voltage-Switch-Mode-Power-Supply-SMPSBoost/step2/Inductor-characteristics/)

Here are some issues I don't know about (yet):
*Autoranging from high voltage to low voltage without killing the ADC input
*Constant current supply/load?? (recent EEVblog is helpful here: http://www.eevblog.com/2010/08/01/eevbl ... y-testing/ (http://www.eevblog.com/2010/08/01/eevblog-102-diy-constant-current-dummy-load-for-power-supply-and-battery-testing/) )
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 13, 2010, 09:38:49 am
Just peaking at some PICs:

http://www.microchip.com/ParamChartSear ... &pageId=75 (http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=8010&mid=14&lang=en&pageId=75)

dspic: 24 x 10-bit @ 4000 (ksps) 4-D/A; 1 x 10-bit @ 640 (ksps) 2-A/D; 4 -Std. PWM 16-bit PWM resolution; 4 x 16-bit, 1 x 32-bit timers

If we're looking for 16bit DA or ADC then this isn't enough. Pretty impressive though. External parallel or SPI ADC/DAC options are possible too. The timers are nice, and the 16bit PWM x 4 is really handy.

http://www.microchip.com/wwwproducts/De ... e=en532303 (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en532303)
9 x 10-bit @ 1100 (ksps) 1-D/A; 2 x 16-bit @ 100 (ksps) 1-A/D; 4 -Std. PWM 16-bit PWM resolution; 5 x 16-bit, 2 x 32-bit timers.

Fast 10bit DA, 16bit ADC is faster than your minimum, but only 2 of them. 4 16bit PWM, lots of timers.

I don't know if 1MSPS ADC is realistic without going to some parallel interface external ADC. Even a 1MSPS serial interface ADC with 16bits resolution will have to go 16Mhz+ SPI for the PIC to get the data at 1MSPS. And that's just for one ADC. I'm reticent to do that on a new design because the routing and sourcing gets so difficult that it's no fun to work on anymore. I'll try to find some PICs with multiple 16bit ADCs.

Anyone know of any ARM options? I don't want to get locked into PIC prematurely.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 13, 2010, 09:46:54 am
ADCs by PIC family:
24FJ family has 10+ 10bit @ 500ksps
24H has 10+ 12bit @ 500ksps
30F 12bit @200ksps, 10bit@1000ksps (1Msps)
33F 12bit @ 500ksps, 10bit @ 1Msps (some with DAC, some with 1-2 16bit ADCs @ 100ksps)

Also... For the function generator - Sjaak and I have something up our sleeves :)
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 13, 2010, 10:25:23 am
Sorry, I seem to have forgotten the wiki that I just read... updated with your values.
Quote
Ideas for the Potential Pirate:
    * Bus pirate like USB/Serial interface
    * Two tracking power outputs that can either be voltage or current sources.
    * Several analog inputs.
    * Full multimeter like functionality on at least 2 analog inputs.
    * Low cost

Applications:
    * Curve tracing (diodes and other semiconductors)
    * Battery charging
    * General purpose bench power supply
    * Alternative energy monitoring
    * Instrumentation

Power supply objectives:
    * At least 1A per output
    * 0.7-12v range
    * Input of 12-24v DC
    * User supplied DC supply (reuse old laptop power supplies for example)
    * Software controlled constant current or constant voltage
    * Script-able control
    * Ability to set limits on current and voltage output (software breakers)
    * Any input can be used for current or voltage control/limits

Analog input objectives:
    * Ability to measure AC voltages up to mains
    * 16 bit resolution
    * High input impedance
    * 8 Inputs

Implementation ideas:
    * Atmega168 /w ft232 for usb/serial and 8channel SPI adc
    * Use 16bit PWM for power control
    * Use the 6 onboard A2D to monitor input voltage, 2 output voltages, 2 output currents (poor resolution, only 10bit, maybe good enough for input voltage and output current, but not output voltage)
    * Power switching MOSFETs???
    * Filtering Network???



Quote
a computer controlled current/voltage supply(maybe 2 independent outputs) and maybe 8 channels of high impedance, high resolution analog inputs.

Great description. It makes it a very definable, doable project.

We should define some goals/features:
*voltage source (0-12volt, 1A max)
*current source (0-1A)
*constant current load (0-XmA)
*voltage measurement (Xvolts max)
*current measurement (XmA max)

ADC
How many for:
current measurement
voltage measurement
internal feedback
internal voltage monitoring

We have a huge selection of PICs with up to 32 500ksps ADCs, but only at 10 or 12bits of resolution. A 16bit external ADC with serial interface for the channels that need high resolution is a good idea, did you already have a chip in mind?

I need some help on this part:
There will be voltage supplies with adjustable current and voltage. We'll need to measure voltage and current from there. I found this interesting page (http://http://scienceshareware.com/bg-current-monitoring.htm) about using a coil of 12AWG wire for measuring current. We can probably auto-calibrate whatever resistive element we use (couple more ADCs, maybe 16bits...).

The measurement probes will be connected to an ADC. They also have a (switchable) current measurement feature that enables a resistive load that would need another ADC (and maybe calibration ADCs).

How about a constant current load?

[s:]My initial inclination is to start very small, maybe 2 or 4 16bit external ADC channels. Would current measurement be on separate channels/probes, or something that can be enabled from the PC? Or does each measurement channel have both voltage and current measurement all the time (since we're already supplying the power, we supply the ground, or I'm confused...)? (There really isn't an IC that provides this kind of data? Is there a vocabulary for what we're doing? I'm tongue tied trying to describe it).[/s:]

Power supply
Maybe it could have 0-37volts 1A with a adjustable regulator. It is a cheap, easy, and clean without a lot of engineering, heat is a problem at high currents. I'm not sure how much this is a bench supply and how much it is a testing instrument. I've been thinking of it more as a test instrument, my considerations are biased by that.

Quote
It would be nice if 2 of the analog inputs could handle AC mains voltages and the rest be 0-12v DC.
0-12vDC might be a good goal for the first prototype. Then the AC mains adapter circuit can be developed over time using the v1 hardware, used as an accessory, and added to a future version. I'm also nervous about DP being involved in anything that encourages you to stick it into live mains.

Constant load
This follows from the EEVblog link above. I'm not sure if this was a proposed feature, but it could be useful for component profiling.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: Sjaak on August 13, 2010, 10:45:05 am
[quote author="ian"]
Also... For the function generator - Sjaak and I have something up our sleeves :)
[/quote]

Sssst that [s:]is[/s:] was a secret!!!

For a autoranging voltmeter do a google on 'nuts and volt autoranging voltmeter' Then you'll directed to a small article which basicly uses a resistor with an 4066 analogue switch to switch between the different voltages. To prevent damage two diode restrict the voltage to +/-0.7V for the DAC and 4066. All you need are a couple of comparators to shift the voltage in the 0-xV range.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: tayken on August 13, 2010, 01:13:48 pm
I'll do some application notes search and some number crunching tonight. I'll include both DC input and mains input in my calculations just to be able to see if AC is manageable for future revisions (Actually I still prefer mains supply). I think I saw an app note which is used for increasing ADC resolution with oversampling, if it is feasible, we can use that.

For computer connection: It will be used for firmware upgrades for sure but we can use it also for sending commands as in BP. Shall we also include a user panel?

One other thing: Only DC output or shall we include also AC output?

We can include the circuit in the EEVblog as a basis for constant current sink and maybe constant current supply.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 13, 2010, 01:28:32 pm
I'm generally against control panels in cheap designs, but a few buttons would be nice. It could be used by the PC software as a trigger for tests. Maybe a header too so you could probe around with tip press or button triggered tests.

If the difference in design is a few components, why not include AC. If it creates a secondary system or major design pain, then my vote is for DC only in v1 to keep it doable and quickly rewarding.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: garak on August 13, 2010, 05:26:29 pm
My understanding of constant current supplies is that the only difference from voltage supplies is that you use current for feedback rather than voltage. Since the loop is in software it should be simple to switch between the two.  I may be way off here, I didn't do much power electronics in college. The limit of the constant current output is going to depend on the load impedance and the supply voltage. 

My idea is that with this device you could hook up a circuit and then run a script. This script would say vary the voltage and at each step record a number of parameters. At the same time it would make sure the current stays within allowable limits. So in all I'm thinking its going to need 12-16 adc channels. They all don't have to be high resolution, but at least 4 of them do. I'm thinking the feedback from the PS outputs needs at least 12bit if not 16 and two universal inputs.

I'm thinking this should be just a board with screw terminals for power in and outs and just .1" headers for the analog inputs, maybe two 5x2 headers so it can use the same breakout cables as the bus pirate. All of the left over IO should be broken out to headers for   user expansion.  Oh and it really should have mounting holes on the PCB, it bugs me that both my bus pirate and usbtinyISP  are missing mounting holes.

We should encourage people to design their own cases or panels for this project. I like the way projects like the bus pirate and many other open source projects leave that to the end user. This also keeps initial cost low.

Has anyone looked in to doing ncurses like implantation on a micro-controller? It would be cool if the measured values could be constantly updated on screen without scrolling. Time to  go read up on how terminal emulation works....
 
I would like to see an AVR used just because the code could be built in Linux. We don't need the PIC's assignable IO pins features that the  bus pirate requires. Now if it comes down to it and there is a far more suitable PIC for the same price as the AVR, PIC it is.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 13, 2010, 05:58:22 pm
What AVR did you have in mind? Just the Atmega168?

I didn't mean to step on any toes. I looked at PICs because the mention of recycling the Bus Pirate interface. I'm willing to design with any chip that's readily available. What AVR debugger do you use? Do you recommend it? I trashed my "cheap" ebay mkii clone and need to get/build a new one.

How about the 16bit external ADC - did you have a chip in mind? I'm curious what affordable options there are for 4-6 (8) channel 16bit serial ADCs, and how fast we can actually drive them.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: tayken on August 13, 2010, 07:33:34 pm
Just made some quick calculations for selecting inductor and capacitor values, the excel file is attached. It is zipped as I cannot attach xls files (learned the hard way, all post was deleted. :( ) I'm just thinking about a buck converter with 12-24VDC input and 0-12VDC output. I didn't do anything for AC output as it requires 3 more MOSFETs, but can be done with H-bridge topology. The book I'm using somehow differs from the Microchip application notes but I based my calculations on my book. Down is a list for application notes from Microchip:


For Linux programming, I'm working on porting the latest C30 compiler to Linux. I finished most of it, just have to check if libraries are correctly arranged and do some final tests then I'll post it on my blog. You can check out here (http://http://www.electricrock.co.nz/blog/microchip-c30/), I'm doing this because had major problems with Wine and I also have access to a Windows computer both at home and lab. Just need a little time though, next week I have major exams, but after that I'll have enough time for it.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 14, 2010, 09:59:02 am
Great work on the C30 compiler, I'm going to post it up. If you want to keep it in our SVN you're welcome, it's also easy to start your own Google Code project or GIT Hub project.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: tayken on August 14, 2010, 05:38:23 pm
[quote author="ian"]
Great work on the C30 compiler, I'm going to post it up. If you want to keep it in our SVN you're welcome, it's also easy to start your own Google Code project or GIT Hub project.
[/quote]
Just to be clear, that blog is not mine, I'm merging his patches with another method which was stopped around v3.11 I guess. I'm just getting rid of the dust of that outdated method which suits me more as I have one Windows laptop for general stuff, and another eeePc for Linux based codes, tests etc.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: ian on August 14, 2010, 07:25:50 pm
Ah, sorry, I misunderstood. Still a great resource, and your progress is exciting. Thanks for the update.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 14, 2010, 10:16:12 pm
[quote author="ian"]I don't know if 1MSPS ADC is realistic without going to some parallel interface external ADC. Even a 1MSPS serial interface ADC with 16bits resolution will have to go 16Mhz+ SPI for the PIC to get the data at 1MSPS. And that's just for one ADC. I'm reticent to do that on a new design because the routing and sourcing gets so difficult that it's no fun to work on anymore. I'll try to find some PICs with multiple 16bit ADCs.[/quote]Texas Instruments has the ADS7951 series A/D with 1MSPS and 4 to 16 inputs (multiplexed).  I'm using the 8-channel version on a custom board, and you're right about the serial SPI speed needed.  I had to run at 18 MHz, which includes a stop bit or gap between the 16-bit command words.  In this case, my main CPU is the TMS320, which happens to have SPI ports capable of 16-bit and even more than 18 MHz.

As far as routing, I'm actually sending the 18 MHz SPI signals across flex cable between multiple boards.  I have pad for RC tuning of the clocks and data, but have not needed to use them.  In other words, 18 MHz serial doesn't seem to be too challenging, at least not with these TI parts.

P.S. The ADS7951 is 12-bit, so I'm mostly using it as an example of a high-speed serial, multi-channel A/D.
Title: Re: Open source project idea: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 14, 2010, 10:26:45 pm
I'm not sure how appropriate the following article might be, but perhaps there are a few tricks to be learned from MAXIM:

App note: Variable resistor and temperature-indexed lookup table (LUT) compensate for regulator output

This application note shows how a variable resistor controlled by an integrated, programmable, temperature-indexed lookup table (LUT) is used to offset the temperature drift of regulators. In this application the variable resistor changes value every 2°C based on the LUT. The variable resistor thus effectively nulls any temperature changes (-40°C to +85°C) in a voltage regulator's output, and improves critical system parameters. The DS1859 dual variable resistor serves as the example device.

More Info (http://http://www.maxim-ic.com/app-notes/index.mvp/id/4324)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 16, 2010, 02:46:46 pm
Great resource. I attached the resulting graph they made. If we're going to measure with high accuracy, this looks like a good way to go. It would be nice to find some more generic options, as Maxim has a rep for poor availability.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Pisami on August 18, 2010, 01:26:56 pm
Sorry, didn't have time to read the whole topic yet, but I've long wanted to make something like this. Here is a link to what I've found. Hope it helps :) http://www.tuxgraphics.org/electronics/ ... unit.shtml (http://www.tuxgraphics.org/electronics/200707/bench-power-supply-unit.shtml)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 18, 2010, 10:48:01 pm
An idea just popped into my mind: Maybe we can use a DC/DC converter IC and a digital potentiometer IC for feedback resistor divider. I attached a picture from MC34063EB datasheet. Instead of the resistor divider pair R1 and R2 we can connect a digital potentiometer to set the output voltage. Another possibility is to use PWM output of a PIC as a DAC and feed it to feedback input. This might save time IMO.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 19, 2010, 03:52:07 am
[quote author="tayken"]Maybe we can use a DC/DC converter IC and a digital potentiometer IC for feedback resistor divider. I attached a picture from MC34063EB datasheet.[/quote]Not a bad idea.  That chip supplies up to 1.5 A
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 19, 2010, 03:27:08 pm
I draw a block diagram of the system. You can find it below. There are dsPICs with 16-bit DAC output but they have a maximum ADC resolution of 12 bits as far as I can see. Because of that I didn't draw any type of controller as ADC/DAC can be another IC with high resolution. We need 2 for output voltage measurement, 2 for current measurement, 8 general inputs (no voltage dividers drawn) which makes a total of 12 ADC inputs. If we include a current sink, we will need another DAC channel for each current sink (for giving the sink current).

Connection can be made with microcontroller connected directly to USB or with an FTDI chip as a converter. If we connect the lines between microcontroller and FTDI chip  to a header people can use it to connect some kind of a display and control box. If FTDI chip is not used, it might be a good idea to have a header where UART output is sent and even a jumper for selecting communication channel.

For DC/DC buck converter sections an MC34063ECD can be used (SO-8 package) however, the thermal resistance between junction and ambient is quite high (160 C/W) but the thermal resistance between junction and casing is the lowest in the datasheet (20 C/W). There is also DIP package variant (MC34063ECN) with JA thermal resistance of 100 C/W and JC thermal resistance of 42 C/W. DIP package variant is a little cheaper (Digikey price for 1 ECD is 1.06$ and 1 ECN is 0.72$).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 19, 2010, 10:39:36 pm
How does current measurement work in your diagram?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 20, 2010, 08:19:36 am
I only included output current measurement for simplicity. Rsense can be 0.05 Ohm resistor, at 1.5 A output, the voltage on the resistor is just 0.075 Volts (75mV). To get more resolution we have to amplify it, to be on the safe side lets map 1.5A to 3V ADC input, if we calculate 3/0.075 = 40 is the gain of the Amp section which is just an op-amp.

Another thing to add will be this: We have to equalize Vref to 1.25V at the correct voltage, so the algorithm is kind of a digital potentiometer.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 20, 2010, 11:13:54 am
Ah, now I think I see.  At first, I thought that Rsense would only measure the output voltage, but I guess you intended that the Vout/Output blocks are two terminal connections where the external device would see the hot side of Rsense as a kind of virtual "GND" when the actual GND is truly 0 V on the "cold" side of Rsense.

As long as the external device has isolated ground, this will work.  But if chassis ground shorts out anywhere, then the Rsense voltage might be 0 V or some ground loop voltage.

I was originally asking because I was thinking that you should move Rsense to the hot side, between the DC/DC Converter-1 Vout and Vout1.  Then the brain would simply set Vout to be 75 mV higher than the actual Vout desired, and the two ADC inputs could still measure the current in Rsense.  This allows GND to be the same for the PS and all connected equipment, and there's less worry.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 20, 2010, 11:55:19 am
I draw this in Simulink quickly and I didn't had any kind of output terminals so I created a block for output terminals. We can still set output voltage 75mV higher than requested but we might not need it. Or we can just move Rsense to the hot side and measure 2 voltages, one before and one after it, and use that to calculate the current. This way we can just simply use the voltage at the terminal for output voltage measurement. This saves us some parts (Instead of 2 op-amps we need just 2 voltage dividers) but how about resolution? I think we still need those op-amps (or differential amplifiers) for current measurement with enough resolution. The new block diagram is as below then:
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 20, 2010, 02:28:01 pm
If we only had one 16bit ADC (MSP430 anyone?) we could use a 4066 analog switch to connect to different channels and measure in turn. It could effect accuracy terribly, I'm not sure. IT has a maximum 15volts, otherwise we could mux it into the OP-AMP too and only have one of those with settings changed by the uC. There's probably a part that does something similar (op-amp in a UC, or a analog mux with >15volts).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 20, 2010, 04:37:19 pm
MSP430F471xx series microcontrollers have 16 bit ADC, you can check out my results from here (http://http://focus.ti.com/paramsearch/docs/parametricsearch.tsp?&familyId=342&uiTemplateId=PP-T-GSPA_T&techFamId=null&rootFamilyId=null§ionId=95&tabId=1200&appId=null&viewDeviceCallingPage=null&totalCount=252&showAdditionalParameters=no¶meter=2443604406¶meter=2443604394&lc=2000062&lc=2001227&lc=2001220&lc=2001219&lc=2000886&lc=2000121&lc=2001132&compare=yes&download=yes&sort=yes&customize=yes¶mResults=yes¶mCriteria=yes&familyTree=yes&military=no&baSystem=yes¶mTable=no&sortOption=PA_SUB_FAMILY_NAME&sortMode=DESC&searchPaths=1000342&pageId=342&templateId=0&navigationId=0&family=mcu¶mTable=no&military=no&&uiTemplateId=PP-T-GSPA_T&techFamId=null&rootFamilyId=null§ionId=95&tabId=1200&appId=null&viewDeviceCallingPage=null&resetCompare=true#sdp). We need one with 6 or 7 channels and 4 channels directly connected to DC/DC converters, and the rest can be connected to 4066 analog switches for measurement probes. But I have no idea about the accuracy, might try and find out. For DAC, any microcontroller with PWM ability will do, we can smooth out the signal with an RC filter to get a stable DC value. Going with MSP430 might be a good idea, if it gives us good results, no need to insist on dsPIC or 24F series as DC/DC converters have their own chips.

What about any other blocks included like voltage probes? Shall we also include a current sink? We can simply use the one built by Dave with simple modifications.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 20, 2010, 05:22:42 pm
Is there a simple schematic for the 'Dave sink'? I have only seen the video, making a schematic for it is on my to do list.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 20, 2010, 06:38:26 pm
I checked out but no one has it on paper. So here is the DaveCAD drawing in the attachments. 1R resistor is actually ten 10 Ohm 1% resistors connected in parallel for better accuracy. Maybe we should do the same for the current sense resistor but too much space taken and also differential amplifier gain will surely set us off from 1%.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 20, 2010, 10:56:20 pm
[quote author="tayken"]we can just move Rsense to the hot side and measure 2 voltages, one before and one after it, and use that to calculate the current. This way we can just simply use the voltage at the terminal for output voltage measurement. This saves us some parts (Instead of 2 op-amps we need just 2 voltage dividers) but how about resolution? I think we still need those op-amps (or differential amplifiers) for current measurement with enough resolution.[/quote]I like the new diagram.  It's exactly what I was suggesting, although you've optimized it a bit.

As for resolution, the problem is exactly the same with Rsense at GND versus on the hot side.  Either way you have to measure 75 mV very accurately.  Perhaps the differential amplifiers can also apply gain to expand the 75 mV to (nearly) the full range of the ADC, within the supported voltage range of the op-amp.  Just make sure that the maximum current, and therefore maximum Rsense voltage is accounted for.  With careful op-amp selection, the gain should not add noise.

[quote author="ian"]
If we only had one 16bit ADC (MSP430 anyone?) we could use a 4066 analog switch to connect to different channels and measure in turn. It could effect accuracy terribly, I'm not sure. IT has a maximum 15volts, otherwise we could mux it into the OP-AMP too and only have one of those with settings changed by the uC. There's probably a part that does something similar (op-amp in a UC, or a analog mux with >15volts).
[/quote]One of my favorites is the $0.25 74HC4067D, which can mux 16 channels into one.  I've even ganged them up, with separate enables, to mux 64 channels into one ADC!

The NXP parts only handle 10 V or 11 V.  If you need more voltage, parts like the Intersil DG411, DG412, and DG413 can handle up to 44 V.  Multiple companies make DG508B and DG509B.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 21, 2010, 06:19:58 am
For the amplifier we can use AD620 Instrumentation Amplifier, just need a resistor to set the gain, but it is a little overpriced (6.91$ per chip at Digikey). Something similar would be used so that we get good responses with current measurement.

I liked 74HC4067D, probably there is one with 8 inputs? This way we can save one analog channel for AC voltage measurement expansion board. We can put the voltage divider after the multiplexer so that board design is more simple. I'll update the block diagram tonight. And I'll also add important IC names for the blocks.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 21, 2010, 07:23:12 am
[quote author="tayken"]I liked 74HC4067D, probably there is one with 8 inputs?[/quote]The DG508 has 8 inputs and handles up to 44 V.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 21, 2010, 09:59:40 am
Thanks for the DG508 recommendation, I'm going to use it instead of a 4066 in a project I'm working on. Here's two sheets I looked at:
http://www.siliconix.co.uk/docs/49949/2_vmn_pt.pdf (http://www.siliconix.co.uk/docs/49949/2_vmn_pt.pdf)
http://www.vishay.com/docs/64821/dg508b.pdf (http://www.vishay.com/docs/64821/dg508b.pdf)

It looks like 44v is the maximum power, but the maximum analog is still -15/+15.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 21, 2010, 11:22:25 am
Right: It's not fair of me to quote the absolute maximum ratings, but that 44 V would translate to -22/+22 in analog signal terms.  The rest of the ratings chart shows that V- can go as low as -25 V referenced to GND, and the rest of the pins like V+ can go as high as 44 V above V-.  Of course, it's never good to push a chip to the absolute maximum ratings, because the slightest error will be out of spec.

Page one does list a Benefit of Wide supply ranges including +/- 20 V (down to +/- 5 V).

In dealing with +/-15V signals (the typical test conditions), that's still a 30 V range from V- to V+.

It almost seems strange that the chip has both GND and V-, except that the digital inputs need a GND reference.  Thankfully, the logic swing works with anything outside 0.8 V to 2.0 V, and the analog signals can go negative.

P.S. The DG506A is the first 16-channel mux I discovered, and for the longest time they were very expensive (still are) and I was not aware of anyone else making anything like it.  I still have my original Siliconix data book from March 1985, and it happens to show the Analog Devices AD7506 as pin compatible.  I've always wanted to use one in a design, but usually opt for the really cheap alternatives with much narrower supply ranges.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 21, 2010, 06:04:25 pm
Here is the updated block diagram, a few notes and questions:
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 21, 2010, 10:01:49 pm
[quote author="tayken"]For DAC, any microcontroller with PWM ability will do, we can smooth out the signal with an RC filter to get a stable DC value.[/quote]PWM is certainly one of the cheapest ways to implement a DAC, but I think that the output is not as accurate.  My impression (and I have not confirmed this) is that there is always more ripple than with a "real" DAC chip, because a 1-pole RC filter is not very efficient with square waves (i.e. the cutoff slope is not steep enough).  But I could be wrong.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 21, 2010, 10:05:10 pm
[quote author="tayken"]1R resistor is actually ten 10 Ohm 1% resistors connected in parallel for better accuracy. Maybe we should do the same for the current sense resistor but too much space taken and also differential amplifier gain will surely set us off from 1%.[/quote]The differential gain could be set with the same precision resistors, using an op-amp that is accurate enough that gain errors won't make the measurements too far off.  Not sure how precise that can be, since there probably isn't a budget for instrumentation amplifiers.

For the parallel resistors, a resistor array would be quite small.  They're also probably better-matched than any random number of discrete resistors.  You might only be able to get 8, though.

EDIT: Resistor arrays don't seem to come in small enough resistances, and their power ratings are still low.  The US$0.18 Panasonic EXB-2HV1R0JV has 8 discrete 1 Ω resistors, and the total package could handle 1.5 A, but it seems each individual resistor could not.  A pair of these might work.

A better choice seems to be a purpose-built current sensing resistor.  The US$0.19 CTS Thick Film 73L5R10J is a 0.10 Ω 5% resistor that can handle 5 A.  They make 2% and 1% versions of these (recall the article about missing values in the distribution), but Mouser doesn't seem to stock the precision resistors.  Maybe Digikey...

I also found some current sensing resistors that are 0.02% or even 0.01% accurate.  No pricing on those, as they are non-stock items.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 21, 2010, 10:14:57 pm
[quote author="tayken"][/quote]
A power supply with a negative rail is certainly needed, but it doesn't necessarily need to use a DC/DC switcher to run from a positive-only supply.  The circuit would require op-amp level-shifting before the ADC input so that the negative voltages are gone by the time they hit the positive-only ADC.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 21, 2010, 10:19:45 pm
[quote author="tayken"][/quote]Consider one of the Texas Instruments precision A/D chips.  Some of them can run at the 1 MHz sample rates mentioned in the original goals.  Most are SPI, but require 16-bit SPI instead of just 8-bit.  That probably rules out PIC, unless Microchip has one capable of going beyond 8-bit SPI.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 22, 2010, 08:04:54 am
We can ask for precision resistor prices from Seeed, as they might have contact to some other distributors.

[quote author="rsdio"]
A power supply with a negative rail is certainly needed, but it doesn't necessarily need to use a DC/DC switcher to run from a positive-only supply.  The circuit would require op-amp level-shifting before the ADC input so that the negative voltages are gone by the time they hit the positive-only ADC.
[/quote]

rsdio, can you explain this a little more? Between mux and ADC we can use 2 options, one being a simple voltage divider as some ADC have also a negative voltage reference input, the other one is an op-amp level shifter for a positive only ADC input.

Ian suggested MSP430 and I just did a research to find MSP430F471x6 (with 6 ADC inputs) series will fit our needs. I checked out TI site, the cheapest 6 channel 16bit ADC is ADS8556 which is 16$. But it might be a good idea to use an DAC chip, lowest priced 4 channel 16bit ones are 6.75$ which is manageable I think.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 22, 2010, 08:42:48 am
[quote author="tayken"]
[quote author="rsdio"]
A power supply with a negative rail is certainly needed, but it doesn't necessarily need to use a DC/DC switcher to run from a positive-only supply.  The circuit would require op-amp level-shifting before the ADC input so that the negative voltages are gone by the time they hit the positive-only ADC.
[/quote]

rsdio, can you explain this a little more? Between mux and ADC we can use 2 options, one being a simple voltage divider as some ADC have also a negative voltage reference input, the other one is an op-amp level shifter for a positive only ADC input.[/quote]I probably should have asked a few questions before making my earlier comments.  I'm not surprised they seem confusing, since I was confused myself.

I assumed first that you were pointing out that negative analog voltages require a negative power supply rail to feed the op-amps and mux chips.  In that case, DC/DC switchers can generate negative voltages from a positive-only supply, which is very useful with USB or in a car stereo (12V), but it might be simpler to just require a bipolar supply and leave out the expensive chips.

I also briefly considered that you might have been talking about using the LTC1044A or ICL7660S to shift the signals being measured.  I couldn't quickly find specs on those chips, so I just guessed based on their names in the Mouser cross reference match.  But that seemed like an odd thing for you to suggest, so perhaps I never figured out what you were alluding to.

In any case, your question is valid: Are negative voltages needed?  If so, then a negative supply rail will be needed, along with op-amps to level-shift the voltages between the mux and the ADC, although that could get messy if some channels were positive-only and some were bipolar.  I can't really say whether negative voltages are needed because I've kinda lost track of the original goals.

It does seem prudent to allow multimeter function in this project since all of the precision will be there to measure the power supply output.  Once you have multimeter functions, you might as well allow negative voltages, or at least protect against them so that the user can reverse the leads.  Maybe some sort of indicator LED that would light up when the voltage goes negative?

Quote
Ian suggested MSP430 and I just did a research to find MSP430F471x6 (with 6 ADC inputs) series will fit our needs. I checked out TI site, the cheapest 6 channel 16bit ADC is ADS8556 which is 16$.
Keep in mind that most multichannel ADC chips are really just a single-channel ADC with a built-in mux.  Rather than look for a 6-channel 16-bit ADC, just look for any 16-bit ADC and add your own mux.

For one thing, the MSP430 probably has a register address select for the analog input channel, and that will require a step in the firmware to select.  Whenever I design a board which needs more ADC inputs than the MCU provides, I usually just wire to the first channel and provide an external mux, so that the firmware only has to select one address.  This usually frees up the other MCU ADC inputs are GPIO.  Looking at your diagram, the MSP430 code would have to select ADC5 and set the address for the mux.  That process is simpler if the firmware is hard-wired for ADC1 and always sets the mux address.

Of course, this degree of optimization is not really necessary, so I really only focus on it because of the savings realized when you can buy a single-channel ADC and expand it with a mux.

By the way, if negative voltages are needed, then it might be more convenient to use two mux chips - one with positive-only inputs and the other bipolar.  Then the level-shifting op-amp can be added after the bipolar mux, but not after the unipolar.  To keep the firmware simple, the address bus can be shared over the two mux chips so long as the Enable pins are separated.  As I mentioned before, you can build a 64-channel mux from smaller chips if you manage the enables correctly.

Note: The exception to the above is that 20-bit and 24-bit ADC chips are generally not usable with a mux, due to the oversampling math involved.  So, most multichannel systems that operate well above 16-bit use single-channel or dual-channel ADC chips, and place multiple ADC chips to achieve the channel count.  But those kinds of ADC are not appropriate here, because the LSBs are not reliable anyway, which puts us back to considering ADC chips that are compatible with mux chips.

Quote
But it might be a good idea to use an DAC chip, lowest priced 4 channel 16bit ones are 6.75$ which is manageable I think.
It's also possible to use a mux chip to expand a single-channel DAC to many channels.  However, this starts to get expensive in terms of PCB size and parts count.  The total cost for large channel counts can be a lot less with a mux chip plus sample-and-hold, but for this project a 4-channel DAC might be perfect.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 22, 2010, 08:53:53 am
[quote author="ian"]If we only had one 16bit ADC (MSP430 anyone?) we could use a 4066 analog switch to connect to different channels and measure in turn. It could effect accuracy terribly, I'm not sure. IT has a maximum 15volts, otherwise we could mux it into the OP-AMP too and only have one of those with settings changed by the uC. There's probably a part that does something similar (op-amp in a UC, or a analog mux with >15volts).
[/quote]Those are all important considerations.

One thing to keep in mind is that A/D inside an MCU (like the MSP430, PIC, etc.) will suffer more from digital noise than an external A/D.  The PIC has a special sleep mode for it's internal 10-bit A/D, so that the processor is not actually running while the analog voltage is being digitized.  Unfortunately, this A/D function is not compatible with USB, because the PIC sleeps too long to keep USB happily serviced (at least in my experience with the Microchip USB Stack).

It's good to be mindful of the accuracy effects of analog switches or a mux.  Again, keep in mind that most MCUs with multiple A/D input pins actually have an internal mux which is more complex than the 4066.

If you consider both of the above, I suppose it might rule out an internal A/D.  This seems like a good time to read all of Texas Instruments' literature on the 16-bit A/D inside the MSP430.  They must have PCB layout and firmware guidelines, otherwise 16-bit performance is unlikely.

Another option is to design for both external A/D and internal, and then the shipping product can leave off the external ADC chip if the internal one is accurate enough.  Designing this way can be difficult, though, if there are different voltage ranges for internal and external A/D, because the entire analog circuits are determined by the maximum voltages expected.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 22, 2010, 10:15:43 am
Quote
Most are SPI, but require 16-bit SPI instead of just 8-bit.  That probably rules out PIC, unless Microchip has one capable of going beyond 8-bit SPI.

16bit PICs do have a 16bit SPI mode, but 16bits is just two 8bit bytes, so there's no reason an 8bit micro can't do it either.

Quote
Ian suggested MSP430 and I just did a research to find MSP430F471x6 (with 6 ADC inputs) series will fit our needs. I checked out TI site, the cheapest 6 channel 16bit ADC is ADS8556 which is 16$.

That was a bit tongue-in-cheek. I don't mind any uC, I just said the MSP430 because TI relentlessly markets the 16bit sigma-delta ADC on the low pin count MSP430 chips. As I understand, a 16bit sigma delta ADC is a much cheaper ADC to build, and it's more accurate than a 10bit ADC on a PIC, but not better than a 'true' 16bit ADC. $16 is epic for us, my rule of thumb is 1 major chip from $3-$5, an optional second chip from $2-3, and some passives that are almost free in the grand scheme.

Quote
But it might be a good idea to use an DAC chip, lowest priced 4 channel 16bit ones are 6.75$ which is manageable I think.

That's also a pretty epic cost. It depends on the speed and bits of resolution needed, but there are small SOT23-5 I2C ADC and DACs for under a $1.

With all these expenses adding up, it looks like it makes sense to integrate as much stuff into a cheap uC as possible. This is a pretty specialized test device, I'm not sure we can count on a big volume discount. Any thoughts on how much you'd like to spend on something like this?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 22, 2010, 11:03:02 am
Long explanation rsdio, but I enjoy this brainstorming. :D So there are my answers:

Quote
For one thing, the MSP430 probably has a register address select for the analog input channel, and that will require a step in the firmware to select.  Whenever I design a board which needs more ADC inputs than the MCU provides, I usually just wire to the first channel and provide an external mux, so that the firmware only has to select one address.  This usually frees up the other MCU ADC inputs are GPIO.  Looking at your diagram, the MSP430 code would have to select ADC5 and set the address for the mux.  That process is simpler if the firmware is hard-wired for ADC1 and always sets the mux address.

My thought was this: I was mostly thinking about something I did before. Output voltage and current measurements are critical so they have to be done at every ADC conversion interrupt. The other 8 inputs are just measurements. We can set ADC to give us an interrupt after 5 conversions, get them from the buffer, adjust DAC output according to the control method (voltage or current), update display buffers and increase mux channel select counter. This way output voltages and output currents can be measured at each interrupt but each one of the 8 Analog inputs will be updated after 8 interrupts. I don't know if we can do this with MSP430 but we can do this with any 24F.

I was mentioning these voltage converters to produce the negative supply voltage needed for the analog mux. But if we include support for negative voltages then parts count gets out of control as we need negative voltage supply, signal conditioning circuit after mux etc. I think it is best for us to only support 0-12V input. We can add negative voltage protection but one needs his own additions for negative voltage measurement.

For ADC, I did some quick calculations for resolution. They are at the table below:


10 bit12 bit16 bit


12 V11.72 mV2.93 mV0.18 mV


1.5 A1.47 mA0.37 mA0.02 mA



These are rough calculations but I think we can manage with a 12 bit ADC as this is a prototyping tool. We can use a dsPIC or even a 24F series microcontroller as we will include DC/DC converter chips. The expenses are really adding up, so we might even have to get rid of DC/DC converter chips. So I'll write major parts that I am suggesting, and we can continue from there.
We can get rid of DC/DC converter, but I need a suggestion for a FET. Also we might need a driver for FET, but not so sure about it.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 22, 2010, 11:46:53 am
[quote author="tayken"]For ADC, I did some quick calculations for resolution. They are at the table below:
10 bit12 bit16 bit
12 V11.72 mV2.93 mV0.18 mV
1.5 A1.47 mA0.37 mA0.02 mA

These are rough calculations but I think we can manage with a 12 bit ADC as this is a prototyping tool.[/quote]If the budget is tight, it seems like even 10-bit would do.  That still allows 85 steps per volt, so you can dial in common voltages with reasonable accuracy.  I think that's equivalent to 3.5 digits.

Quote
  • 2x MC34063EC DC/DC converter: Nearly 1 dollar at Digikey. We can omit this but will probably save some time during programming phase as we just have to deal with a simple calculation.
We can get rid of DC/DC converter, but I need a suggestion for a FET. Also we might need a driver for FET, but not so sure about it.
The MC34063EC is probably a good choice.  I found one in a $3.99 auto USB charger from Meritline, so they must be available cheaply in China.

What exactly would the FET need to do?  Can you outline the circuit first?  The gate voltage is probably going to be the tricky part.  I can try to help, as I've used a number of different high-current FET parts for LED drivers, but 1.5A might be a little more of a challenge.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 22, 2010, 12:01:07 pm
I was thinking about current measurement when I suggested a 12bit ADC. It is pretty standard in 24F series micros.

FET is needed if we don't want to use MC34063EC, that part was pretty vague I think. You know, instead of a separate IC we drive a MOSFET with PWM to get the output voltage we want. A simple buck topology converter. Gate voltage is an issue, there are driver IC's but I don't know...
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 23, 2010, 08:24:12 am
[quote author="ian"]
Quote
Most are SPI, but require 16-bit SPI instead of just 8-bit.  That probably rules out PIC, unless Microchip has one capable of going beyond 8-bit SPI.

16bit PICs do have a 16bit SPI mode, but 16bits is just two 8bit bytes, so there's no reason an 8bit micro can't do it either.[/quote]So far, I've only used the Texas Instruments 16-bit SPI A/D chips with their DSP MCBSP ports.  The thing is that the peripheral generates the word frame sync signal, which is the Chip Select, and times the signal to start before the first bit and end after the 16th bit.  It would be a little awkward to implement as two normal 8-bit transfers, because that would entail two word sync transitions.

Depending upon how the 8-bit PIC SPI is implemented, you couldn't actually talk to the TI A/D without bit-banging the Chip Select, which adds overhead and pretty much prevents DMA.  The TMS320 allows the MCBSP to handle all the SPI pins automatically, with precise control over the timing of the word sync (/CS).  I haven't looked at the MSP430, but it seems likely that it would be compatible.

As you say, though, the 16-bit PIC has 16-bit SPI mode, so I should probably look into that.  Thanks.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 23, 2010, 09:22:52 am
I believe MC34063A (note A) is the 'standard' part, I'm not sure about EC (extended temperature?). I use them in a few upcoming designs, and they are very cheap (pennies), even from mouser etc.

0-12V input was mentioned. Will this be a buck or boost converter (lower or higher)? Maybe there's one that does both that I don't know about (SMPS is not my expertise).

Out of curiosity, has anyone designed an SMPS for high-current and low ripple? It seems like we'll need a really clean supply for component testing. The ADCs might measure 1mV increments or better, but with 10-500mV ripple in the supply it's kinda moot. My guess is the SMPS (not software of the other analog design part) will be the most intensive part of this design. It'll probably need a lot of attention to board layout and a good O-scope to get it working well.

Here's a 34063A design tool:
http://www.nomad.ee/micros/mc34063a/index.shtml (http://www.nomad.ee/micros/mc34063a/index.shtml)

----

Saw the post on the SPI above: I didn't think of auto frame sync, that's a great point.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Sjaak on August 23, 2010, 09:38:20 am
Isn't a big capacitor enough to 'remove' the rimple?

If you use the nomad tool and fill in different rimples only the capacitor on the output vary. Less rimple, big capacitor.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 23, 2010, 11:45:27 am
[quote author="ian"]
I believe MC34063A (note A) is the 'standard' part, I'm not sure about EC (extended temperature?). I use them in a few upcoming designs, and they are very cheap (pennies), even from mouser etc.
[/quote]

AC and EC series are standart temperature parts (0 to 70 C), the others are extended temperature: AB is -40 to 85 C, EB is -40 to 125 C. A version is not recomended in new designs, so thats why I was talking abot EC series but if AC is cheaper, we can use that. The only difference is that start-up voltage and supply current is a little bit higher in A series.

[quote author="ian"]
0-12V input was mentioned. Will this be a buck or boost converter (lower or higher)? Maybe there's one that does both that I don't know about (SMPS is not my expertise).
[/quote]

Input is 12-24V, output is 0.7-12V with 1A max. We have 0-12V with 1.5A max which may be better. This is a buck topology but we can use a buck-boost for also getting higher voltages but is it really needed?

[quote author="ian"]
Out of curiosity, has anyone designed an SMPS for high-current and low ripple? It seems like we'll need a really clean supply for component testing. The ADCs might measure 1mV increments or better, but with 10-500mV ripple in the supply it's kinda moot. My guess is the SMPS (not software of the other analog design part) will be the most intensive part of this design. It'll probably need a lot of attention to board layout and a good O-scope to get it working well.
[/quote]

At my power electronics course, I had to design a couple of converters for projects where we chose from our supply of parts at the lab. We can put a zener diode near ADC as a voltage reference, that can solve our problem. I'll meet with the folks at Tokyo Hackerspace tomorrow, maybe they have an o-scope there.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 23, 2010, 12:00:50 pm
Good deal, the oscope is key. I think there will be issues that require access to solve easily.

I'm sorry, I read 0-12 in the post above and misunderstood. That makes sense - 12-24v input, 0-12V output. No, I don't think we should tackle higher voltages for now :) I'm all for an ultra simple, stripped down v1 to work out the kinks before committing to a compact and expansive layout that takes a lot of effort.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 23, 2010, 12:09:26 pm
[quote author="ian"]
Good deal, the oscope is key. I think there will be issues that require access to solve easily.

I'm sorry, I read 0-12 in the post above and misunderstood. That makes sense - 12-24v input, 0-12V output. No, I don't think we should tackle higher voltages for now :) I'm all for an ultra simple, stripped down v1 to work out the kinks before committing to a compact and expansive layout that takes a lot of effort.
[/quote]

It would be better to have a somewhat working version, even if it is just for developers so that we can find the weak links and focus on them. So is everybody ok with the final block diagram and parts list? I'll think someting about the amplifier part tonight. After it is also decided, I think we can start with a schematic.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 23, 2010, 12:17:18 pm
Yup, and Seeed is willing to do the green label stuff, so we can probably have 10 prototype boards made if you (or anyone else listening who wants in) don't solder.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 23, 2010, 04:49:17 pm
Differential amplifiers seemed pretty expensive to me and I checked out Sparkfun to see what they are carrying. There are two current sensor boards, one is ACS712 Low Current Sensor Breakout (http://http://www.sparkfun.com/commerce/product_info.php?products_id=8883) board, the other one is AttoPilot Voltage and Current Sense Breakout (http://http://www.sparkfun.com/commerce/product_info.php?products_id=9028) board which is using INA169 by Texas Instruments. We can also use INA139 which is cheaper than INA169. With both options there might be a need for an extra op-amp, as an amplifier for the first one, and as a voltage buffer for the second one. Couldn't find any current sensor in Seeed. Suggestions?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 23, 2010, 08:46:14 pm
Well, something stated bugging me and I started digging deeper. And I found this (http://http://freecircuitdiagram.com/2009/04/23/current-sense-circuit-a-classic-design-using-positive-rail-sensing/) article. I checked out LT1637 datasheet (http://http://cds.linear.com/docs/Datasheet/1637fd.pdf) and hurray! On page 13, there are some application examples and we can use top left or bottom right ones. They are not perfect but cost effective methods and maybe we can find a way to hack them to our needs. More to come tomorrow!
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 24, 2010, 06:26:08 am
[quote author="tayken"]I was thinking about current measurement when I suggested a 12bit ADC. It is pretty standard in 24F series micros.[/quote]Perhaps I'm oversimplifying, but it seems like the differential amplifier can boost the sensitivity so that you don't need an expensive ADC.  Current measurement is actually voltage measurement across a precision load, and even with values in the mV range you can set a gain of 100 to get the voltage into the range of a 10-bit ADC.  Then again, as you say, PIC24F has 12-bit, but I still think it would be better to boost the voltage well above the LSBs, so long as the gain does not introduce noise or otherwise reduce the signal-to-noise ratio, because a 12-bit ADC inside a PIC is not going to be free from digital clocking noise.

[quote author="tayken"]Differential amplifiers seemed pretty expensive to me[/quote]As you probably know, any op-amp can function as a differential amplifier, given the right configuration.  I suppose the real problem is that every component degrades the accuracy, which means lots of ultra-precision resistors.  I also haven't done the calculations yet to determine whether the gain would amplify the inaccuracy of the resistors.

[quote author="tayken"]I found ... LT1637[/quote]Great links!  Linear is a good company, but I have found them expensive and almost as difficult to source as Maxim.  But if the price is right and the supply is available, then go for it.

Based on the schematic diagram so far, I don't think we need to worry about rail-to-rail op-amp performance.  With a 24V supply, we can just select an op-amp that can handle 24V, and then the 12V common mode voltage on the differential op-amp will be no problem for a standard op-amp.  No need for the rail-to-rail premium (although there are some really cheap rail-to-rail op-amps).

There are plenty of cheap op-amps to choose from, with lots of parameters to select upon.  Current noise and voltage noise stats are relevant depending upon the circuit.  In this case, low noise voltage specs are probably more important than current stats, because the current will be converted to a voltage.  I have worked with op-amp buffers that directly measure current, and there you want low noise specs for current.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 24, 2010, 10:09:40 am
Because of all that noise probability, I'm thinking about an averaging function inside the PIC. I just want to convert 1.5A to 3V so that we can use the full potential of the converter and 0.3V left for just in case.

Yes, we can use an op-amp as a differential amplifier but they introduce some problems. There is the accuracy problem, plus bom increases as we need 3 op-amps for one differential amplifier (2 are used as voltage buffers). We can introduce a calibration routine in the program and people can run it once a while to calibrate the gain constants in the code.

Just the datasheet, otherwise any op-amp will do. The only thing that bothers me is that 3V to 44V writing on the voltage input (lower left schematic). I'll do some price comparisons tonight, but I'm thinking about a precision resistor and 2 channel differential amplifier (or a cheap instrumentation amplifier if there is any).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 24, 2010, 10:29:43 am
Another option: AD8293G80/160 from Analog Devices. The datasheet (http://http://www.analog.com/static/imported-files/data_sheets/AD8293G80_160.pdf) has a current measurement example on page 12, it has a fixed gain of either 80 or 160 which is factory calibrated so it is pretty accurate and Digikey price is 1.88$ for a single one, manageable in my opinion. I'll suggest this, and if nobody says anything against it, I'll update the wiki page to include the final block diagram and major parts list.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 24, 2010, 10:40:25 am
It would be good to have a block diagram we can all draw on and modify. Could you please attach the original file too?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 24, 2010, 10:48:23 am
Original file? I'm using Matlab/Simulunk to quickly draw them, then I do some cleanup work in paint. I can attach the file when I get back home if you want. Do you have a tool suggestion for block diagram drawing?

Note: I found this program (http://http://live.gnome.org/Dia) and I'm planning to use it for future work if you are ok. Lets set a common program if there is not any.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 24, 2010, 10:55:26 am
Looks good, I got it too.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 24, 2010, 12:47:18 pm
[quote author="tayken"]AD8293G80/160 from Analog Devices. The datasheet (http://http://www.analog.com/static/imported-files/data_sheets/AD8293G80_160.pdf) has a current measurement example on page 12, it has a fixed gain of either 80 or 160 which is factory calibrated so it is pretty accurate and Digikey price is 1.88$ for a single one[/quote]Very nice!
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 24, 2010, 03:09:29 pm
There's a new development page for this project. It has a lot of the resources that have been posted in the last 5 pages of this thread, all in one place:
http://dangerousprototypes.com/docs/Leo ... multimeter (http://dangerousprototypes.com/docs/Leon:_Computer_controlled_power/current_supply,_multimeter)

It's a publicly editable wiki, so feel free to add stuff I forgot.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 24, 2010, 06:44:50 pm
Thanks Ian, I checked it out and I'll finish and upload the latest block diagram and maybe some other stuff. You listed all the options for current sensing modules under parts, I think we can just list them as other current sense options and put my last suggestion as the current sense amplifier. I'll deal with them tomorrow and maybe add some stuff that pops into my mind.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 25, 2010, 10:35:27 am
I finished drawing the block diagram, you can find it in the attachments. I'm also including the original file (inside the zipped file as I cannot attach *.dia files), if you want to edit the diagram, you can easily do it with that. Dia has a good learning curve. :) I'll also do the suggested corrections on wiki page.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 25, 2010, 11:03:18 am
This looks great, and the design is becoming very clear. I'm learning a lot about analog stuff!

Is the plan still an external USB chip? It would be great to opto-isolate the connection between the uC and the USB chip, which would be pretty easy with a simple UART.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 25, 2010, 11:29:02 am
Hmm, I don't know. All PIC24 series microcontrollers have build in USB support as I know and it would be great to use that. I have never used USB as it was not needed in many projects but if it is possible, I prefer doing this without an FTDI chip. But on the other hand we should consider opto-isolation in case something goes wrong and using FTDI chip is much easier.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 25, 2010, 12:07:14 pm
[quote author="ian"]It would be great to opto-isolate the connection between the uC and the USB chip, which would be pretty easy with a simple UART.[/quote]That's an interesting question.

Considering that you're not supposed to connect the shield to ground, that USB bus power is optional for self-powered devices, and that the remaining two wires on USB are differential, it sure seems like you could isolate any USB connection, regardless of whether it's PIC or FTDI.  I think that the PIC has separate pins for powering the internal USB components, so you could isolate the USB bus power to only those pins, and have the rest come entirely from the external power source.  I suppose that still makes the PIC a weak link, since it could conduct across the internals.

Does any company make a PHY-style component designed to isolate USB?

Another thing to consider is that the PIC is capable of functioning with an external USB transceiver, which might be cheaper than an FTDI, and more powerful because of the extended programmability of the PIC USB.  If such an external USB transceiver chip were also isolated, that could fit the bill perfectly.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 25, 2010, 12:45:26 pm
Here's an update (doesn't have to be used, just wanted to try the program). It includes a dummy load, a voltage reference, and a temperature reference.

I did a single PWM for the dummy load, not sure of the full requirements yet.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 25, 2010, 01:52:35 pm
[quote author="ian"]
Here's an update (doesn't have to be used, just wanted to try the program). It includes a dummy load, a voltage reference, and a temperature reference.

I did a single PWM for the dummy load, not sure of the full requirements yet.
[/quote]

Yeah, couldn't had the energy yesterday night to try out the program but today I tried it and loved it! We can also use the same program for deciding how the program will function.

Dummy load is Dave's constant current sink right? He connected an LCD which can measure voltage but we can throw that out and just drive it with PWM+LPF.

One other thing: Shall we use a PIC24H or dsPIC33? If there is no huge price gap lets use dsPIC and change PWM with DAC. Also we can connect the rest of the pins to headers for future expansions. For example I always put in ADC6 which is reserved for AC measurement circuit.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 25, 2010, 01:56:15 pm
A dspic33 seems like a good fit because there's so much it can do on-chip. I'm not sure there are USB pic33s though if that part is important.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 25, 2010, 02:54:07 pm
If we want 16 bit architecture and USB, we cannot have 12 bit ADC; if we want 12 bit ADC, we cannot get USB. The same is for 32 bit architecture. If we want USB and 12 bit ADC, our option is limited to PIC18F series. dsPIC33 + USB chip looks like a good combo.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 25, 2010, 04:56:14 pm
[quote author="tayken"]If we want 16 bit architecture and USB, we cannot have 12 bit ADC; if we want 12 bit ADC, we cannot get USB. The same is for 32 bit architecture. If we want USB and 12 bit ADC, our option is limited to PIC18F series. dsPIC33 + USB chip looks like a good combo.[/quote]Keep in mind that you might not achieve 16-bit or even 12-bit accuracy within the PIC chip, where digital noise is prevalent.  You may end up finding that you need an external ADC anyway, freeing up your PIC selection options.  Also, with accurate differential gain on the current sensing resistors, you may not need 12-bit anyway, and could make do with 10-bit.

At the very least, I'd place an SPI ADC pinout on the PCB in case you need it, to save time and money on PCB revisions.  That suggestion does entail some time spent on selecting a likely candidate, schematic entry, and layout, but it might be prudent unless someone here has experience with getting a full 16-bit accuracy within a PIC.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 25, 2010, 05:58:34 pm
dsPIC might add an extra function or two in the future. I know that there is no way to get 12 bit resolution because of all that noise but we might reduce it a little with some filtering inside. I'll probably order a board where I saw the DC/DC converter chip and play with it a little to prove the concept of driving reference input with PWM. We might get some insight from that. However, to do that I need some time for the board to come, for me to hack it blah blah...

rsdio, can you suggest me a 16 bit ADC chip? But keep in mind that we are not trying to make it an equal version of some other power supplies in the market. It will be merely a test tool for hobbyist purposes. Maybe a wall wart with on steroids with more brains. Plus there are application notes from Microchip about making an SMPS with an 8 bit PIC.

Ps: I gave links to some application notes in the previous submissions, can you check the one about oversampling? I have never used it before but maybe we can use it somehow?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 26, 2010, 01:00:12 am
[quote author="tayken"]I know that there is no way to get 12 bit resolution because of all that noise but we might reduce it a little with some filtering inside.[/quote]Although I prefer the PIC to handle USB because the communication protocol with the host can be more intelligent and more efficient, one advantage of using a PIC without USB is that you have access to the PIC feature which puts the processor to sleep while running the A/D.  This supposedly reduces a lot of the noise from the on-board digital clocks and other circuits inside the PIC.  I've only tried this on a PIC18 with USB, and USB failed during sleep, so it wasn't an option.  But as long as another chip is handling USB, and there is adequate flow control allowing the PIC to sleep for periods of time, then the internal A/D could be a lot better.

Then again, we may not need extreme accuracy with sufficient differential gain.

Quote
rsdio, can you suggest me a 16 bit ADC chip?
I would just search Mouser and sort by price.  First, I'd try to prove to myself that 16-bit is really needed, or at least pick a pin-compatible A/D where 12-bit and 16-bit can both fit on the same pads.  Another variable is the maximum sample rate, but I think the PS will not need a very high rate.  I guess part of the problem is not knowing how fast is enough.

Another consideration is: What are you going to do with 16 bits of input data?  If your PWM output is only 10 bits, then it doesn't do much good to calculate a very precise 16-bit calibration value that gets truncated to 10 bits by the PWM.  In other words, match your input to your output, based upon the math involved.

Quote
Ps: I gave links to some application notes in the previous submissions, can you check the one about oversampling? I have never used it before but maybe we can use it somehow?
I believe that will work quite well.  The current and voltage measurement is almost pure DC, so even the slowest A/D could oversample.  The only limit is that if the oversampling period is too long, the power supply output might oscillate due to delayed feedback.

If oversampling can add bits, then even an 8-bit A/D could be expanded to 10 bits to feed the PWM control.

P.S. I haven't read all of the application notes, so merge my comments with the rest.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 26, 2010, 01:54:25 am
Hmm, the more I think about it, perhaps external A/D would not be needed.  At least it seems very unlikely if the dsPIC is used with 256x oversampling and FIR filtering.

I haven't looked at the dsPIC specifications in detail.  Could someone recommend a particular model that might be used for this project?  The dsPIC33 does seem cheaper than the dsPIC30 by US$1.20, at least for certain models.

The dsPIC33FJ32GP302 has 16-bit PWM.  The A/D can be switched between 10-bit 4-sample/hold and 12-bit 1-sample/hold.  Although I previously stated that multichannel chips usually just have a mux inside, the dsPIC actually can sample 4 channels at the same time in 10-bit mode, but you have to select the right combination of 4 pins because not every pin is available to every channel.  There is no mention of the PIC18-style sleep-during-A/D feature for reduced digital noise.

256x oversampling would bring the 12-bit 500 kHz rate down to just under 2 KSPS.  Seems like a PS should be able to maintain a steady output with about two thousand samples per second.  That will be reduced further since there are multiple channels.

But, yes, even a simple 8-bit PIC could handle this reasonably well.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 26, 2010, 04:49:33 am
Ok, it's good that we are finding a common ground. :) I only designed circuits to be used in research projects I had or for hobby use, so this is a good exercise for me to design circuits for commercial purposes (kind of). I will search dsPIC33 series, I remember one had DAC but which one I cannot remember. I will also try to see if it is possible to sleep during A/D conversion for noise reduction.

Quote
I believe that will work quite well.  The current and voltage measurement is almost pure DC, so even the slowest A/D could oversample.  The only limit is that if the oversampling period is too long, the power supply output might oscillate due to delayed feedback.

Definitely something that might cause some problems. I specialize in control so I know how delay in the system can cause catastrophic things. But my guess is as we are not controlling the switching part, only transient response might be slow if our sampling rate is slow.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 26, 2010, 09:41:34 am
I don;t have any specific PICs in mind, but I wanted to note that the 33F is cheaper (I think) because it it 3.3volts, the 30F is a (up to) 5volt part and they are more expensive. The 16MIPS/8KSRAM/64Kflash PIC24Fj64Ga002 is even cheaper than many 18F pics.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 26, 2010, 10:46:28 am
So 33F it is? I'll search for a suitable parts and update wiki with the new microcontroller.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: garak on August 26, 2010, 02:42:55 pm
Wow, its great to put a project idea out there and see people run with it.

One suggestion. Rather than get really precise components for the current measurement. Use cheap ones and have a calibration mode in the firmware where adjustments can be made. Calibration could either be done by the end user or manufacture. You would just need a good multimeter and  a few different known loads(one in a bind).

I'm kind of busy this week, things should slow down soon and I'll be back at it. I'll be checking in when I can.

The block diagram looks great. Its exactly what I had in mind.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 26, 2010, 08:22:39 pm
Guys, don't forget to learn from what the masters have designed before.

http://www.home.agilent.com/agilent/fac ... c=eng&sm=g (http://www.home.agilent.com/agilent/facet.jspx?t=80101.k.3&co=153731.i.1&cc=US&lc=eng&sm=g)

Check out a couple of the older (<2005) service manuals, they almost all have a solid Theory of Operation
description, block diagrams *and* schematics.

Usually high-power units use a switching topology where the driver elements are controlled by a
combination of voltage & current feedback, and digitally controlled analog control signals. None of that
is in any way "trivial" !

Other interesting PSUs have a switching pre-regulator (often SCRs feeding a rectifier bridge)
to slightly reduce the input voltage to a standard, linear series regulator. You simply cannot get the same
kind of precise regulation with a switching topology.

However, in the interest of power efficiency, it would be possible to have an initial buck regulator with
switchable feedback resistors allowing software-selectable steps, for example 14V, 10V and 6V which then feeds
a series regulator which regulates to a finer DAC- or PWM-controlled V and I setting.
Something like this
(http://http://img832.imageshack.us/img832/125/buckprereg.gif)
Note that the additional PNP transistor above the MC34063 probably wouldn't be necessary (it's just leftovers
from an old schematic I had).
The linear post-regulator would be rather simple, 2-3 drive+power transistors and one quad op-amp to do
the voltage/current sensing and regulation.

I don't mean to burst any bubbles, but I think that aiming for a software-controlled switching regulator
right off the bat for a v01 is a bit over-optimistic... keep it simple !
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 26, 2010, 11:27:41 pm
Thanks for the tip, I'll check out the manuals definitely!

So if I understood correctly: First an switch mode regulator with software controlled settings for coarse adjustments, and then a linear regulator for finer tuning. The switch mode regulator will have switchable resistors to adjust it coarsely and (I'm giving LM317 as an example) adj pin of LM317 will be driven by DAC for fine tuning. Can be a good idea! Problem (may not be important) is that we can only go as low as 1.2 V with LM317 + increased complexity for board layout.

We are going with baby steps, no worries there. I'm planning to play with MC34063 to see if my theory will hold, how much voltage swing will be present etc. Before v01, there will be an alpha, beta, gamma... versions for sure! :D
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 26, 2010, 11:51:34 pm
I looked at Microchip site for a microcontroller selection and dsPIC33FJ64GP802 or dsPIC33FJ128GP802 looks good. They have 1-A/D 10x12-bit @ 500(ksps) 1-D/A 2x16-bit @ 100(ksps), 16-bit PWM resolution and 2 UART (one for USB interface, other for debugging or LCD-control console connection). Digikey price: ~7$

This is not a final choice, feel free to suggest any other controller. There were some other choices as well, I attached a screenshot for my selection criteria, other candidates are there.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 27, 2010, 12:04:37 am
[quote author="tayken"]
So if I understood correctly: First an switch mode regulator with software controlled settings for coarse adjustments, and then a linear regulator for finer tuning. The switch mode regulator will have switchable resistors to adjust it coarsely and (I'm giving LM317 as an example) adj pin of LM317 will be driven by DAC for fine tuning. Can be a good idea! Problem (may not be important) is that we can only go as low as 1.2 V with LM317 + increased complexity for board layout.
[/quote]

Almost, but using a LM317 is probably not the best choice. It's mainly meant to be used with resistive dividers, not a complex feedback path like what we need (current limiting). It would probably be better to use a large transistor as a series pass element and drive it a bit like the HP E3620 does. I've screenshotted the section, but note that it's a bit more complex than what we need because it isolates sensing and power grounds & supplies. The important parts are the current limiting op-amp U19A and the voltage-setting U19B. The diodes CR21 and CR22 act as an analog OR-gate.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 27, 2010, 12:31:07 am
So it is something like Dave's tutorial (http://http://www.eevblog.com/2010/05/29/eevblog-90-linear-and-ldo-regulators-and-switch-mode-power-supply-tutorial/) (kind of). As we will be measuring output voltage and current by ADC, maybe we can do without the op-amps and drive the transistor according the set voltage/current output. It kind of worries me as there might be oscillations due to poles and zeroes of the op-amp section as Dave shows in this video (http://http://www.eevblog.com/2010/06/20/eevblog-95-linear-regulators-closed-loops-simulations-brand-shenanigans/).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 27, 2010, 01:59:15 am
[quote author="tayken"]
I looked at Microchip site for a microcontroller selection and dsPIC33FJ64GP802 or dsPIC33FJ128GP802 looks good. They have 1-A/D 10x12-bit @ 500(ksps) 1-D/A 2x16-bit @ 100(ksps), 16-bit PWM resolution and 2 UART (one for USB interface, other for debugging or LCD-control console connection). Digikey price: ~7$

This is not a final choice, feel free to suggest any other controller.[/quote]The dsPIC33FJ32GP302 that I mentioned earlier is $4.56 from Mouser in single quantity.  It seems to have everything needed, including 5V tolerant I/O (using O.C.).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 27, 2010, 05:18:26 am
[quote author="tayken"]As we will be measuring output voltage and current by ADC, maybe we can do without the op-amps and drive the transistor according the set voltage/current output. It kind of worries me as there might be oscillations due to poles and zeroes of the op-amp section as Dave shows in this video (http://http://www.eevblog.com/2010/06/20/eevblog-95-linear-regulators-closed-loops-simulations-brand-shenanigans/).
[/quote]

You're right, that was my next point (and the video explains it nicely) - a big feedback loop needs to be carefully designed to avoid oscillation and instability. Running the voltage regulation loop through software is probably a bad idea in this case, and will also tie up the uC in a critical task that a 0.50$ op-amp will carry out better. We'll need op-amps in the current sensing part anyway, so the best would probably be a quad op-amp handling all of the regulation and sensing.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 27, 2010, 06:08:01 am
[quote author="fenugrec"]Running the voltage regulation loop through software is probably a bad idea in this case, and will also tie up the uC in a critical task that a 0.50$ op-amp will carry out better. We'll need op-amps in the current sensing part anyway, so the best would probably be a quad op-amp handling all of the regulation and sensing.[/quote]Exactly.  Remember that op-amps were used like analog computers when they were first invented (and still are today).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 27, 2010, 08:42:46 am
[quote author="rsdio"]
The dsPIC33FJ32GP302 that I mentioned earlier is $4.56 from Mouser in single quantity.  It seems to have everything needed, including 5V tolerant I/O (using O.C.).
[/quote]

They share the same datasheet, so I'll expand the options. The one I suggested has DAC, that was the main reason for choosing it. But there is the possibility that 3+ PWM might be enough (2 for regulators, 1 for current sink)

[quote author="fenugrec"]
You're right, that was my next point (and the video explains it nicely) - a big feedback loop needs to be carefully designed to avoid oscillation and instability. Running the voltage regulation loop through software is probably a bad idea in this case, and will also tie up the uC in a critical task that a 0.50$ op-amp will carry out better. We'll need op-amps in the current sensing part anyway, so the best would probably be a quad op-amp handling all of the regulation and sensing.
[/quote]

So we will change the reference voltage for op-amp to control the output voltage? I'll try to do some experiments as soon as I can but let's go step by step. If driving the switch mode regulator gives good results, then we might not need the linear regulator part. Also trying to digest all that information at one hurts. :)

An addition: Remember that we are only designing a hobbyist product and keeping it as simple as we can will make the end user understand the inner workings of the product better, keep the parts cost low and finally keep the end product cost low. This is Dangerous Prototypes and most of the people here are hobbyists on a budget. I wish I was rich enough to buy myself an oscilloscope and a proper benchtop power supply but I have to buy food. :D
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 27, 2010, 11:13:27 am
Quote
The important parts are the current limiting op-amp U19A and the voltage-setting U19B. The diodes CR21 and CR22 act as an analog OR-gate.

Great stuff. Can it be done without the -5 and -12 volt rails? If not, is a voltage inverter like a MAX660 (http://http://www.maxim-ic.com/datasheet/index.mvp/id/1140) clean enough to supply it (I'd guess no, depending on part).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 27, 2010, 11:27:58 am
[quote author="ian"]
Great stuff. Can it be done without the -5 and -12 volt rails? If not, is a voltage inverter like a MAX660 (http://http://www.maxim-ic.com/datasheet/index.mvp/id/1140) clean enough to supply it (I'd guess no, depending on part).
[/quote]

MAX660 can only support up to 5.5V as I know. I think I found some other one for the negative supply of the analog mux chip. It can go up to 12V but these use switch in action too so the voltage output may not be clean.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 27, 2010, 11:49:23 am
[quote author="ian"]Can it be done without the -5 and -12 volt rails? If not, is a voltage inverter like a MAX660 (http://http://www.maxim-ic.com/datasheet/index.mvp/id/1140) clean enough to supply it (I'd guess no, depending on part).[/quote]I humbly suggest that if you need a bipolar supply, then it would be better to make it external and not try to derive negative voltages from the USB power.

If you're talking about an external power supply anyway, and just want a unipolar input that is used to generate bipolar with an inverter, then I'm thinking that's probably more expensive in the long run than a simple bipolar supply without any fancy inverters.  Inverters are great when you're in a car with a fixed +12VDC power source, but if you're going to require a wall wart at a minimum, then why not a cheap bipolar supply?

I'm still assuming that a wall wart with ~20VAC or more can be obtained at a reasonable price.  I've seen these used with some electronics that I've purchased retail, and it made me realize how cheap the parts would be to go from 20VAC to a bipolar supply (using just diode rectification, medium-sized caps, and a pair of dirt-cheap regulators).  The AC wall wart saves you from dealing with 120VAC or more, and gets you UL listing, etc.  The only problem is that I have not tried to source such a thing, so it may be nothing more than a pipe dream.

I guess the more imminent question is whether you need negative voltages, and then go forward from there.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 27, 2010, 12:19:09 pm
Our input will be a laptop PSU with 12-24 V DC output. It was on the project guidelines. The only way we can get a negative voltage from these guys is to use an inverter chip. Lets keep things as simple as possible for the initial prototype, see how it goes, than we can add stuff or modify the hardware for the release version.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 27, 2010, 05:37:22 pm
Quote
If driving the switch mode regulator gives good results, then we might not need the linear regulator part.
Sure, but the basic regulator I've drawn can only generate 3 levels, so you'd need a more complicated circuit. Some SMPS ICs (TL494 for instance)
may allow more flexibility by using our own voltage reference for the error amp instead of an internal fixed voltage
(MC34063 uses 1.25V).  But then it becomes a full-blown SMPS design... I would avoid it on a first version.

Quote
Great stuff. Can it be done without the -5 and -12 volt rails?
Most probably. It will of course require some re-work on the circuit, but we were going to do that anyway p-)
Regulating the output down to 0 volts is a bit tricky, and negative supplies make it easier. But there should be
a way... As I said, the E3620 is a high-end tool with a complex design.

Quote
I'm still assuming that a wall wart with ~20VAC or more can be obtained at a reasonable price.
Maybe, and a 15-0-15 supply would be nice but I think they wanted to use a single supply voltage.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 27, 2010, 05:52:40 pm
[quote author="fenugrec"]
Quote
If driving the switch mode regulator gives good results, then we might not need the linear regulator part.
Sure, but the basic regulator I've drawn can only generate 3 levels, so you'd need a more complicated circuit. Some SMPS ICs (TL494 for instance)
may allow more flexibility by using our own voltage reference for the error amp instead of an internal fixed voltage
(MC34063 uses 1.25V).  But then it becomes a full-blown SMPS design... I would avoid it on a first version.
[/quote]

Yeah, because of that, I'm planning to drive the reference pin with an analog signal instead of connecting it directly to output voltage with a voltage divider. There will be a dynamic voltage divider inside the dsPIC, it'll adjust itself according to user settings (voltage or current required, voltage or current source) and the output voltage. That is the plan in my mind but I'll try it if it works (with a prototype made at home) and if not, we can always add the linear regulator part in the first official prototype.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 27, 2010, 06:03:56 pm
I'm pretty fascinated by the idea of a big transistor with current and voltage set by an op-amp. In our case I think there would still be a lot uC control and feedback in setting the op-amps and maybe calibrating everything. It seems like a super nifty solution.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 28, 2010, 12:57:58 am
[quote author="tayken"]I'm planning to drive the reference pin with an analog signal instead of connecting it directly to output voltage with a voltage divider. There will be a dynamic voltage divider inside the dsPIC, it'll adjust itself according to user settings (voltage or current required, voltage or current source) and the output voltage.[/quote]The key to regulation is feedback.  The question then becomes whether a dsPIC can possibly be as fast as an op-amp.  The A/D and DAC each have latency, plus the process is not continuous but must be scheduled on a periodic basic, which adds to the latency as well.

Is there a way to combine the feedback and the dsPIC control voltage so that the feedback it still instantaneous?

One answer may be expensive: A digital controlled potentiometer like the AD5204 at $3.42 for the AD5204BRZ10.  These have 256 taps.

Another option would be to literally sum the two, feedback and control voltage, but that would require negative voltages from the dsPIC DAC.  You might be able to fake that with a virtual ground above 0V.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 28, 2010, 03:12:11 am
Of course there is the latency problem. And because of that I want to test my idea first. I ordered the board from Sure, plus some other stuff for future projects, when they arrive, I'll try to implement my suggestion with constant voltage setting.

I checked out digital potentiometers, they are expensive. Maybe the latency will be so small that the effects will not be important, but again, we have to do trial runs first.

[quote author="rsdio"]
Another option would be to literally sum the two, feedback and control voltage, but that would require negative voltages from the dsPIC DAC.  You might be able to fake that with a virtual ground above 0V.
[/quote]

DAC has a negative output, positive output and a middle value pins. Maybe we can use them to implement something like this. This way we would chance the control voltage but the feedback is directly to op-amp, which decreases latency significantly. One thing to look out for might be a possible oscillation of this system. Again, we need trials.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 28, 2010, 03:43:54 am
[quote author="tayken"]
[quote author="rsdio"]
Another option would be to literally sum the two, feedback and control voltage, but that would require negative voltages from the dsPIC DAC.  You might be able to fake that with a virtual ground above 0V.
[/quote]DAC has a negative output, positive output and a middle value pins. Maybe we can use them to implement something like this. This way we would chance the control voltage but the feedback is directly to op-amp, which decreases latency significantly.[/quote]Nice, I hadn't looked at that part of the dsPIC data sheet yet.  The two signed outputs could be sent to the + and - inputs of an op-amp that has a bipolar supply, and then the output of that op-amp would go negative.  This would also expand the +3.3V dsPIC DAC output to twice the range, as +/-3.3V (I think that the 3rd DAC output would not be used at the same time)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 28, 2010, 07:31:21 am
I don't have an idea to how to use that! :) I'm just giving some key information so that you "experts" may give the best advice to me. I will check DAC reference manual to see some examples and how it can be used etc.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 28, 2010, 07:57:09 am
You can set up an op-amp in a differential configuration, where the output is basically the voltage on the + input minus the voltage on the - input (there will be precision resistors ahead of each actual input pin).  The DAC in the dsPIC can only put out positive voltages from 0V to 3.3V, but the DAC is configured to basically send the positive half to one output and the negative half to the other output.

When you send the maximum positive value to the signed DAC, the positive output is at full 3.3V and the negative output is at 0V.  The output of the op-amp will be A-B=C, or +3.3V - +0V = +3.3V.

When you send the maximum negative value to the signed DAC, the positive output is at 0V and the negative output is at +3.3V.  The output of the op-amp will still be A-B=C, but this time +0V - +3.3V = -3.3V!

At mid scale on the signed DAC, both the positive and negative outputs will be at 1.65V, and the op-amp will output 0V because +1.65V - +1.65V = 0V

At values between these interesting points, the outputs remain complementary to each other - basically a fully balanced signal.  A nice side effect of this is that much of the DAC switching and power supply noise can be cancelled out by a proper balanced design like this.

In order for this to work, the op-amp needs at least +/-3.3V on its power if it is capable of rail-to-rail outputs, or hopefully substantially more.  If you put +/-5V on the op-amp power, then it will certainly be able to output negative voltages down to -3.3V, even though it's inputs from dsPIC are always positive.

One thing to keep in mind is that both DAC outputs will never be +3.3V at the same time, nor will they ever both be 0V at the same time.  If you look at the implementation of the DAC, it actually uses each bit to direct current to either the negative output or the positive output, making the DAC actually run faster because current is always flowing no matter what the bit value is.  The trick is that this sort of DAC is actually current output internally, so there needs to be a current-to-voltage conversion in there somewhere.  Thankfully, Microchip seems to have handled this for you.  I've used a Texas Instruments DAC, the THS5671A, where you have to deal with the current output directly.  Makes things even faster, I suppose, but the circuitry is even trickier, especially if you don't have a negative supply.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 28, 2010, 10:34:53 am
I'll be digesting rsdio's post for the rest of the weekend. I'm starting to sketch some circuit ideas on paper, but I need to do a lot of reading before any of it is more than a guess.

For pots (I forget the context of the discussion, sorry if this is irrelevant) - Microchip has a 7bit I2C pot, and most PICs have an internal 64 step+ CVRref. I just found out the Bus Pirate PIC had it yesterday, didn't know...
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 28, 2010, 01:46:28 pm
After that long description of how a typical differential DAC works, I read the fine print in the dsPIC data sheet:
Quote
The DAC module is designed specifically for audio applications and is not recommended for control type applications.

p.265

This makes total sense because the dsPIC DAC is delta sigma.  Therefore, you will want either an external DAC, which could be differential as described above and/or SPI, or you can change from dsPIC to a PIC with a standard DAC that is compatible with control type applications.  In other words, the differential output aspect of the dsPIC DAC is not a problem, but the delta sigma (∆∑) is a problem.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 28, 2010, 11:07:53 pm
I would definitely recommend against trying to route the feedback loop of a linear regulator through the PIC (i.e. ADC->processing->DAC). A DSP switching regulator is not as much of a problem because you're not relying on a precise operating point (perfect equlibrium of feedback input and control output), you're rather just controlling a switching element between two states, or in the case of a buck regulator simply the PWM ratio.
In contrast, if you're - for example - driving the base of transistor from a DAC output, the slightest discrete change in DAC value can change the output considerably. An op-amp will definitely do a better job at this since it's infinitely variable, and so much quicker than any software you can write.

Anyway, I hacked a bit at the problem and sketched up a simple linear regulator whose target voltage and current limit are controlled by any arbitrary DC voltage (DAC output, smoothed PWM output, etc.)

The circuit is heavily based on the E3620 topology, but I changed a couple of things to adapt to our context : no negative supplies, and voltage control instead of potentiometers.
Q1 is the pass transistor, and by default R2 tends to keep it conducting much more than necessary. Q3 is a kind of "choke driver" : the harder it's driven, the more it chokes the pass element, hence reducing the output voltage. This Q3 can be turned on by either the voltage control loop or the current limit loop.
Voltage regulating:
V2 could be a DAC output from a 3.3V PIC. Op-amp U3 multiplies its range to 0-13.2V, which will become the target voltage for U1, the voltage error amplifier. When the output voltage is higher than the control voltage, U1 increases its output, choking Q1.
Current limiting:
V3 is like V2 except it controls the maximum current. As it's configured , a 1V input will set the limit to 1000mA. This is simply I*R6. U4 is a type of difference amplifier : U4(output) = V(out) - V3
This shifted voltage is compared to the voltage drop accross the sense resistor. U2 accordingly chokes Q1 if the current is too high.

The circuit seems to simulate pretty well, but it would need to have a few things tweaked :
- op-amp selection. Rail-to-rail operation is essential, other characteristics will affect loop stability.
- pass transistor selection - many TO-220 or TO-3 devices will probably work, but some adjustment of R2 may be necessary.
- loop stability ! My pole / zero theory is very sketchy.
- current sensing -  to let the PIC read the actual current draw, there are two ways: measure voltages before and after R6 with voltage dividers and subtract the two in software, or add another op-amp (differential amplifier) which is more precise, but brings the total of op-amps to 5! So much for the quad.
One way of reducing number of op-amps would be to move the current sensing to the low side of the load, but then that complicates the ground configuration (power ground, sensing ground, chassis, etc..)
However, by taking each side of R6 and resistively dividing by 4, we get a sensitivity of 0.25mV / mA at the ADC input. I think this is plenty enough for the intended use, but some people might want more...
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 28, 2010, 11:53:49 pm
Ah, I thought there had to be a way. I simplified the current limiting a lot, now it needs only one op-amp instead of 2. So, the fourth amp in a quad package could be use as a diff. amp to measure the load current !
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 29, 2010, 01:41:34 am
[quote author="fenugrec"]- current sensing -  to let the PIC read the actual current draw, there are two ways: measure voltages before and after R6 with voltage dividers and subtract the two in software, or add another op-amp (differential amplifier) which is more precise, but brings the total of op-amps to 5! So much for the quad.
One way of reducing number of op-amps would be to move the current sensing to the low side of the load, but then that complicates the ground configuration (power ground, sensing ground, chassis, etc..)
[/quote]That's a very good point.  However, I really like the Analog Devices AD8293G80/160 with built-in gain that tayken found for the differential current sensing.  Using an low-cost part like that means you're back to 4 op-amps for the remaining circuits.  Plus, you get the benefit of way more current-sensing accuracy without worrying so much about ADC bit depth, quantization noise, or digital clock noise causing problems.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: MichaelZ on August 29, 2010, 03:32:25 am
For current sensing I have used  the Hall Effect-Based Linear Current Sensor IC (http://http://www.allegromicro.com/en/Products/Part_Numbers/0712/0712.pdf) from Allegro.  It is isolated and has virtually zero voltage drop so you can place it on the highside or lowside.  I have also used the Amploc/ (http://http://www.amploc.com/) sensors. They are isolated but they are for wire current sensing.

There is the SentronHall CSA-1V Current Sensor (http://http://www.sentronhall.com/)
Quote
The CSA-1V current sensor is placed on a
PCB directly over the current track. The
current track can consist of one or several
loops, depending on the maximum current
to be measured. The sensor measures the
magnetic field emanating from the current
flowing through the tracks.

I have not used it other than samples.

I have used the Allegro and Amploc in military qualified products.  They run on 5v and output 0-5v so I had to use a voltage divider to drive the ADC on a TI DSP.  Zero current is 2.5v output.  I did not have to use a buffer/opamp.  The ACS712's measured phase current of a three phase servo motor.  The TI DSP's internal ADC sampled at 12Mhz and used the current measurements to sense the rotor position in a FOV motor controller driver.

With the Amploc sensor the currents were 100++A so besides feeding the output to the DSP I used the TSM102A (http://http://focus.ti.com.cn/cn/lit/ds/symlink/tsm102.pdf) to scale the output and compare the voltage to the reference.  I have attached the schematic.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 29, 2010, 04:57:47 am
[quote author="rsdio"]
However, I really like the Analog Devices AD8293G80/160 with built-in gain that tayken found for the differential current sensing.  Using an low-cost part like that means you're back to 4 op-amps for the remaining circuits.
[/quote]
~ 2$ from Digikey
Quote
For current sensing I have used  the Hall Effect-Based Linear Current Sensor IC from Allegro.
~ 5$ from DK

Don't get me wrong,  they're nice devices, but they're a bit expensive ! I don't know the exact intent of this project, but I figure: if the goal is to have a multimeter section as well as a PSU, the current-measuring needs are different anyway. The current measurement from the power supply realistically doesn't need more resolution than 1 mA... Many, many lab PSUs don't measure current that precisely (or just have an analog gauge) either.
Also, since one quad op-amp would be enough to include a current sensing amp, we can use the whole ADC range. For example if Rs = 1 ohm, diff amp gain = 3 and max ADC = 3.3V, then a 10-bit sample will give almost exactly 1mA resolution while covering 0 - 1.1A. I know this is going to be affected by the precision of the resistors used in the diff amp stage, and the LSB of the sample is not very significative, but it's still a usable measure.

What I would suggest would be: to keep a simple current measurement directly off the current sense resistor to enable the PIC to determine the state of the linear regulator (current limiting is taking place, no load present, max power reached, etc.)  Then, as required, a better current bridge could be built in "multimeter" section and allow better flexibility, precision, electrical isolation, measurement range, etc..

Anyway, that's just my take on the project, I don't really intend to steer it either way.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: MichaelZ on August 29, 2010, 06:12:21 am
One thing you have to be careful of is parts cost vs labor.  Even if you are using a chip shooter,  each part counts as a labour cost.  Manually I can place and hand solder a 16 pin SOIC faster than I can 8x 805's.  On a chip shooter each part counts as a placement not the total number of pins.  A 16 pin part counts as one placement and the 805's count as 8 placements.  Eight times the duration of assembly.

I dont know Seeeds parts vs labour costs but any case it is a tradeoff.  In this case the 20+ discrete parts cost is probably very cheap in China so the labour is going to the big cost.

Another interesting area is reliablilty.  The more parts, the less the reliablity, obvious.  A 16 pin SOIC is more rugged than 8x 805's.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 29, 2010, 11:05:33 am
Hmm, lots of ideas, lots to try. The multimeter part is not so necessary I think, the real idea is to produce a cheap computer controlled voltage/current supply/sink. Current sink will be a different section (Dave's schematic from Eevblog, maybe change it a little). Maybe we should get an idea from Ian about part selection as he did some job with Seeed. Also he can contact them about parts cost and manufacturing cost and other stuff and steer us in the right direction.

The only thing that I am having trouble with is getting a constant current output. That is not maximum current setting, will we able to get a constant current even if the load changes by adjusting V2?

I'm waiting for some parts to come and can probably try some ideas after they come.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on August 29, 2010, 11:56:00 am
@fenugrec - this is fantastic and elegant, thank you for sharing. Would you be willing to attach the simulation file? In terms of the how-to article that goes with a design, it is a great teaching tool for so many concepts.

How many of the resistors need to be super precise? Can we compensate for any of them with calibration on the microcontroller?

In terms of cost - Last I heard our quotes are per pin. I do know that PCB complexity (size, holes, sides) does not figure in at all for the size things we do. I don't get a full breakdown of the quote basis though. I will ask, and make a wiki page with best practices to keep costs low. The placement time cost point is well taken, if only for the pareto efficiency. I've been trying to find a friendly (size, availability) multiple R package to use in general.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on August 29, 2010, 08:04:50 pm
[quote author="tayken"] Current sink will be a different section[/quote]
Yes, it would be complicated to re-use the regulator as a current sink. It might be possible with a bunch of relays, but I think the easiest would be an entirely seperate circuit with large power resistors and a bigger heatsink. The amount of watts we want to dissipate is going to be an important factor for that part.

Quote
The only thing that I am having trouble with is getting a constant current output. That is not maximum current setting, will we able to get a constant current even if the load changes by adjusting V2?
You can't force a certain current through a circuit if you have insufficient voltage. The way practically all constant voltage / constant current power supplies work is : 1- try to increase output to the requested voltage, whatever the current until 2- the current limit is reached. If you're trying to see how, for example, you could charge a pair of AA batteries, you'd have to set the voltage higher than necessary ; 2-3V above what's necessary, and set the current limiter to whatever charge rate you want.
See it the other way : it's a constant current regulator with a voltage limiter! Think about it.

Quote
How many of the resistors need to be super precise? Can we compensate for any of them with calibration on the microcontroller?
Some of them need to be matched, but none need to be absolutely precise. For example the four 4k7 resistors around the current sense resistor need to be nicely matched. You could use 1% 4k99 SMT resistors and that will probably be plenty good enough. The two resistors around U3 need to have the correct ratio (1:3) to accurately set the controlling voltage. Absolute value is not critical. Same goes with the four resistors around U4 (see the attached schematic), 5% will not be good enough. Usually SMT resistors are pretty well matched and are spec'd at 1%, that should be sufficient.  So we're looking at 10 resistors which need to be equal or better than 1% tolerance. For the current sense resistor, if we use 1 ohm, it should also be fairly precise and be rated @ 2W. But I guess even a 10% resistor could be dealt with in software. Calibration would require an external, precise current meter to establish a relation between set current on V3, real output current and sensed current at U4_output.


Note on the attached LtSPICE file : you'll need to copy the spice models to ???SwCadIIIlib or adjust the Include directives.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 29, 2010, 08:41:00 pm
How about a current sense resistor calibration routine like this: The user shorts the terminal to be calibrated, the power supply gives a known voltage say 1 V, we measure the current, it should be 1 A but we will measure something different because of the tolerance so the resistor value gets calculated and stored in the flash rom.

Another option is to use the current sink included. That will be fairly precise if we will use Dave's method.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: siklosi on August 30, 2010, 12:40:56 am
Has anyone seen this?
http://www.tuxgraphics.org/electronics/ ... unit.shtml (http://www.tuxgraphics.org/electronics/200707/bench-power-supply-unit.shtml)
 it's 22V / 2.5A and it's PC controllable

I made it couple months ago and here is how mine looks...

(http://http://siklosi.users.sbb.rs/ps.jpg)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 30, 2010, 07:37:24 am
[quote author="tayken"]How about a current sense resistor calibration routine like this: The user shorts the terminal to be calibrated, the power supply gives a known voltage say 1 V, we measure the current, it should be 1 A but we will measure something different because of the tolerance so the resistor value gets calculated and stored in the flash rom.[/quote]If you design your own power supply, then you cannot depend upon it producing a known voltage or a known current, at least not unless you use components that have built-in voltage references that are highly accurate.  Even using Dave's current sink, if your resistance is unknown, then the measured current is also unknown.

If you short the terminals on a power supply, it's very likely that you will burn it out unless it has rock-solid over-current protection.  But, even protection is not focused on precision.  The current limiter might kick in just about anywhere, so you cannot use it to measure a precise current.

About the only thing that might be self-calibrating about a power supply that you design yourself is offset.  There are basically two kinds of errors in an unknown circuit: offset and scale.  Since it's fairly easy to know that you have 0 A (apart from quiescent current), then you could feasibly calculate any offset error and correct for it.  However, the scale error would be impossible to determine without some kind of outside reference that is independently accurate.

i.e. I you express error as
Code: [Select]
e = a +bx
, then
Code: [Select]
a
is the error offset, and
Code: [Select]
b
is the error scale.  I'm probably using the wrong terms, or even incomplete terms, but hopefully the idea makes sense.

Basically, I can't see any way for a power supply to calibrate itself (unless one of the chips has an accurate voltage reference, but that's not going to be a variable power supply).  You need an external measurement.  That could come in the form of an accurate resistance meter so that you can then calibrate your current-measurement resistor manually.  Or you could just buy an accurate voltage or current meter for manual calibration.

P.S.  Because of quiescent currents in various chips, I don't think that it's really even possible to calculate and correct error offset without external references.  In other words, even when you expect 0 A of current, there might still be a small amount of current flowing in the power supply being dissipated as heat but not going to the "output."  Depending upon where in the power supply you are measuring the current, there could easily be errors that cannot be detected without an external reference.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 30, 2010, 04:33:41 pm
If we use a DAC and op-amp voltage supply part, I'm pretty sure that we can get a good voltage output with a known value. Maybe there is a way that current also could be calculated with an automated program. Otherwise, we can just put a calibration method where the user connects a multimeter and a resistor in serial configuration to the output. Then the program might just give different voltage outputs to calibrate the internal measurement unit, gives a voltage, asks for user to input the current supplied a couple of times so that it adjusts some gains. So the big problem is not about voltage output measurement but actually current measurement. Also we can just divide it into two parts, first calibrate voltage output, then calibrate current output.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 31, 2010, 12:16:52 am
I was basically talking about calibration to an accuracy which exceeds the parts used.  That would require an external reference.

However, you are correct that a DAC and op-amp voltage supply should start out quite good.

Caveats: The DAC power supply (which is different from the main power supply output) will affect accuracy, since all of the DAC output levels are a fraction of its supply.  Any resistors or other gain-setting components in the op-amp circuit will also affect accuracy.  If you're happy with being off by a few percent, plus or minus, then you don't need to worry about it.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ejeffrey on August 31, 2010, 09:48:24 am
In a "normal" dual bench supply the supplies are floating so they can be connected in series or parallel or run independently as required.  I think this is too much effort and cost for this application -- it requires ferrite transformers instead of inductors, auxiliary supplies, and opto-isolators for the feedback to the MCU.  However, for analog circuits it is really nice to be able to have a split +/- supply.  So, I am thinking that you could add a switch or relay to change the second channel from a buck to an inverting topology (you just switch the diode and inductor terminals) -- presto you have a split supply.  The tricky part then becomes measuring the voltage and current when the supply is negative.  The brute force approach here is to generate an auxiliary negative supply, but think you can avoid that.  The supply voltage can easily be measured with an inverting op-amp configuration, since the - input is at virtual ground.  You just have to supply a fixed bias current to set the output range to be entirely positive.  The current is a bit trickier.  Low side sensing won't work if the supplies are connected together, and high side sensing would probably have to be done with an expensive hall sensor.

Does anyone else think this is worthwhile?  Unless there is a cheaper alternative to the hall sensor it will add significantly to the BOM, but it would certainly improve the utility for anyone doing analog projects.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on August 31, 2010, 11:43:15 am
This power supply can give out +/- 6 V if you want. Just set V1 output to 12 V, V2 output to 6 V then V1+ connects to + supply of the circuit, V2+ is the "ground" and ground terminal is - supply. Of course there might be problems with this but this can support many hacker/maker needs.

[quote author="rsdio"]
I was basically talking about calibration to an accuracy which exceeds the parts used.  That would require an external reference.

However, you are correct that a DAC and op-amp voltage supply should start out quite good.

Caveats: The DAC power supply (which is different from the main power supply output) will affect accuracy, since all of the DAC output levels are a fraction of its supply.  Any resistors or other gain-setting components in the op-amp circuit will also affect accuracy.  If you're happy with being off by a few percent, plus or minus, then you don't need to worry about it.
[/quote]

Yep, a DAC is basically an ADC as inverse if you put it really simply. What I mean is there is the quantization and other effects present in an ADC. How about the second method I proposed, calibrating with a multimeter for first voltage, then current? Do you think it will work?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on August 31, 2010, 12:43:23 pm
[quote author="tayken"]How about the second method I proposed, calibrating with a multimeter for first voltage, then current? Do you think it will work?[/quote]Maybe allow for a couple of calibration methods.  If the user measures the current-sensing resistor with an accurate meter, then perhaps the software could allow a way to store this in Flash or EEPROM so that the chip could correct for it.  Other inaccuracies could possibly be calibrated as you say, by measuring the current externally and comparing the two.

I happen to have a current meter, so I would probably hook up the supply to a load while measuring the current, then adjust the DP PS current measurement calibration to match.  I just don't know how difficult that will be.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 01, 2010, 05:37:30 am
I thought of another simple way of controlling the output voltage: DAC outputs offset voltage, which shifts the voltage feedback routed to whatever SMPS regulator IC, MC34063 for instance. However, without a negative supply, it will be impossible to regulate to a lower voltage than the IC's fb comparator (1.25V in this case).
I'm rather busy these days, so I don't have time to further simulate, let alone build this, but I think it would be worth a try. Just wire up a potentiometer followed by an op amp buffer to replace V2.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 01, 2010, 08:14:46 am
@fenugrec: that looks great!  I was thinking there must be a way to combine instantaneous op-amp feedback with DAC control.  Personally, 1.25V as a minimum output would be fine with me.

I only have one device which uses 1.2V, and that is a core voltage which is not shared with anything else on the board, so it's best to have a dedicated supply for that.  Besides, it accepts 1.26V, so it would still work with your design.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 01, 2010, 02:36:58 pm
Yep, good design. Can you also include LTSpice files so that I can check them out? I'm also pretty busy these days but after I finish them, I'll try to restart working on this project.

I think 1.25 - 12 V is pretty good. Maybe we should include a FET as switch to turn the output on and off?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 01, 2010, 04:04:01 pm
Here's a schematic from the simulation. A schematic of the 'Dave sink' is also on the way.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 02, 2010, 01:50:07 am
[quote author="ian"]
Here's a schematic from the simulation.
[/quote]

Just note that the 100 ohms at the output was just there for testing, I would make it 2-10k just to make sure the filter capacitor doesn't stay charged for too long p-)
Remember the pass transistor and op-amp were very preliminary choices, you can probably use different / more available parts. It's an unfinished design ! Probably good enough for testing though.

Quote
Can you also include LTSpice files so that I can check them out?
Sorry, you'll have to draw it yourself - I didn't save the file. Should be pretty easy ...
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 02, 2010, 09:12:56 am
Thanks Fenugrec

Here's the Dave sink schematic (at least a preliminary one).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 02, 2010, 10:51:57 am
@fenugrec: OK, I'll try to draw the file and upload it after I'm finished. Maybe we need an svn page for this, might be easier to update, revise schematics and simulation files.

@Ian: Dave was using 10 x 10 Ohm 1% resistors in parallel for precision and power dissipation, do you think we have space for that, or should we go for a more precise 1 Ohm resistor?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 02, 2010, 12:07:46 pm
[quote author="tayken"]Dave was using 10 x 10 Ohm 1% resistors in parallel for precision and power dissipation, do you think we have space for that, or should we go for a more precise 1 Ohm resistor?[/quote]

Look back to page 4 of this [glow=red,2,300]lengthy[/glow] topic:
[quote author="rsdio"]The US$0.18 Panasonic EXB-2HV1R0JV has 8 discrete 1 Ω resistors, and the total package could handle 1.5 A, but it seems each individual resistor could not.  A pair of these might work.

A better choice seems to be a purpose-built current sensing resistor.  The US$0.19 CTS Thick Film 73L5R10J is a 0.10 Ω 5% resistor that can handle 5 A.  They make 2% and 1% versions of these (recall the article about missing values in the distribution), but Mouser doesn't seem to stock the precision resistors.  Maybe Digikey...

I also found some current sensing resistors that are 0.02% or even 0.01% accurate.  No pricing on those, as they are non-stock items.[/quote]... in other words, space should not be an issue.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 02, 2010, 02:58:07 pm
Yep, this topic got lengthy alright. :) I thought those were candidates for the current sense resistor. Dave's design is simple yet elegant, and 1 Ohm resistor is good as it has 1-1 ratio between amperes consumed and voltage on the resistor. We can go as low as 0.5 Ohms as our analog inputs are 3.3 V max but we can get around this with other things too.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 05, 2010, 07:50:55 am
I was working on a programmable battery charger - an independant project of mine - which is quite similar to what we're building here - and reading a few datasheets I put things back in perspective:
First, I'm assuming the main desirable feature of this project is a digitally-controlled CV/CC supply which should ideally be efficient, i.e. switching.
We're going to have an SMPS stage anyway, which means an IC, inductor, diode and probably a MOSFET, which also means doing some calculations to size things properly. An all-in-one chip like MC34063 and tons of others is certainly nice, but not as customizable as we need. I had suggested the idea of adding an op-amp stage in the feedback path, which is theoretically sound but not necessarily stable. As I drew it, no current-limiting was provided either.
***
Enter the TL494 and its compatible friends, KA7500, etc. They're dirt-cheap (like the MC34063), but include every thing needed for a custom regulator. They have two internal error amps with all inputs accessible, which means we can use one to control voltage (drive the reference pin with a DAC, smoothed PWM or whatever), and use the other EA to current-limit.
TI's datasheet for TL494 is "arid", at best, so the key is really the application note "designing switching regulators with TL494", which you can grab from http://focus.ti.com/lit/an/slva001d/slva001d.pdf (http://http://focus.ti.com/lit/an/slva001d/slva001d.pdf)

Pros:
*only one IC
*efficient
*no software feedback loop!
*high power
*passive soft-start is just 1-2 extra components
*full control:  0-100% output voltage @ 0-100% current.

Cons:
*Reference voltage from DACs may need to be scaled, which could mean an extra op-amp or two. A few were probably going to be necessary anyway to monitor voltage + current.
*Does not have an internal switching element, so an external MOSFET is required
*Output ripple. Some calculations will be needed, but <50mV is probably realistic.  The question is whether we need the extra-low ripple that a linear post-regulator provides. It may be possible to add a tracking post-regulator which just regulates the output down to, for example, 1V lower than the switcher's output. This could be as simple as an LM317 and a bunch of resistors.
*Current sense resistor on low side of the load is going to require a bit of thought with regards to signal/power grounds. Nothing that can't be managed.
*Minimum input voltage 7V. I guess we were aiming for a more typical 12-24V anyway. The TL494 will take up to 40V ! Universal input, anyone ?

So yeah, I'm sold to this idea, and I'm probably going to build one for my charger.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 05, 2010, 12:32:50 pm
I've been following this topic for a while, but I may have missed something, so feel free to point that out. I want to add my $0.02. I've made had to make similar choices myself (although my target are different, higher budget and higher quality).

I agree 100% with fenugrec that using the MCU in the feedback loop is a bad idea. I'm aware of the Tux Graphics design, I believe the ADC samples at 10kHz or so. This gives it a horrible bandwidth (5kHz, even the ancient uA741 is much better). The simplistic algorithm of 'add one DAC unit if ADC < target, subtract one DAC unit if ADC > target, output = 0 if short circuit' means that it would take about 100ms (10kHz * 1024) to go from zero to max, might as well strap a monkey to a pot (like the transistor man in AoE). It would have trouble tracking 50Hz ripple, let alone fast transients. The PIC ADC is faster, but a few cents worth of op-amps is just much better at this job. In my opinion, the DAC should provide a reference voltage for voltage / current (like a pot would), but comparing the output voltage / current to the reference should be done by op-amps.

I'm not a big fan of using a random SMPS brick as source. I can see the advantage in costs and size vs. transformer + rectifier + caps, but a transformer is much more stable. It's also much easier to make the supplies float and get extra voltages (eg. negative). Random switchers with all protection circuits removed to save costs might not perform very well as lab supply. An old Toshiba laptop PSU I evaluated had horrible intermittent noise between 50Hz and 1.5MHz. Some double-isolated bricks also have pretty bad leakage (http://http://www.aplomb.nl/SMPS_leakage/Doc_ie.html). Many of the three prong ones have a grounded output, which isn't what you want for lab supply. This means you can't really make a symmetrical power supply with 0V/6V/12V and connect the middle to ground. I believe there is also a case of a cheap SMPS committing suicide and killing an LM317 (those things are pretty bullet-proof) and OLS(?) somewhere on this forum. Not that there aren't any good ones, but given the nature of this project, most power supplies are probably from junk boxes with unknown design and specs.

What's the point of using a switching regulator in this design? It will obviously have better efficiency and less dissipation than linear, but this design will need a beefy heat sink for the dummy load anyway. Max dissipation would probably be something like 24V * 1.5A, which is not very hard to cool. You can even stick a thermistor on it and use a spare ADC of the PIC to do a shutdown in case of thermal overload. A linear regulator would be easier to design (like those fenugrec posted based on the Agilent power supply), would have less noise and would be easier to keep stable. The fact that this type of design has been used in tons of commercial applications and that most <5A lab power supplies are still linear suggests that this is a good idea. You'd only need a negative supply for the op-amp and base current, so you could probably use a charge pump. You don't need a higher output voltage (buck-boost) or higher current at low voltage in this application.

My target for noise/ripple is <1mVrms, like most commercial power supplies, so 50mV would be totally unacceptable for me. But it depends on your type of work. For most digital work, 50mV noise is probably not a big deal. When I use a lab supply, I want to rule out any supply issues, so I want a very clean and stable supply. I also consider it essential to regulate all the way to 0V, so I can generate voltages below one diode drop. A lab supply is not just a power supply, but also a voltage/current source. I also wonder how well constant current mode is going to work if it can't go below 1.25V or so, what if you connect a 1ohm resistor to the outputs?

It looks like the TL494 is designed for bipolar transistors (app note shows a Sziklai pair), which is probably not great for efficiency. Will it drive a MOSFET directly or does it need a MOSFET driver (either discrete or monolithic IC)?

Another possible source of inspiration for the dummy load is this ELV design (http://http://www.elv.de/output/controller.aspx?cid=683&detail=10&detail2=66150) (Bauanleitung contains full schematics). Text is in German, but the schematic should be self-explanatory. It is more complex that Dave's schematic, but it has some neat features like both constant current or constant resistor (works like a large variable power resistor), over temp protection, settable voltage threshold below which it will shut off (designed for discharging batteries) and internal and external modulation (nice for testing power supply transient response ;)). The basic idea is the same. Not saying that you should copy this design, but having more than one source for ideas is good in my opinion.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 05, 2010, 12:59:56 pm
I basically agree with everything you've written, but want to make a couple of comments.

[quote author="alm"]
I agree 100% with fenugrec that using the MCU in the feedback loop is a bad idea. I'm aware of the Tux Graphics design, I believe the ADC samples at 10kHz or so. This gives it a horrible bandwidth (5kHz, even the ancient uA741 is much better). The simplistic algorithm of 'add one DAC unit if ADC < target, subtract one DAC unit if ADC > target, output = 0 if short circuit' means that it would take about 100ms (10kHz * 1024) to go from zero to max, might as well strap a monkey to a pot (like the transistor man in AoE). It would have trouble tracking 50Hz ripple, let alone fast transients. The PIC ADC is faster, but a few cents worth of op-amps is just much better at this job.[/quote]I want to point out that the dsPIC is a DSP.  So the simplistic algorithm would hopefully not be used.  Instead of +0-, the dsPIC would implement a damped low-pass filter of some kind.  Sampling will create a group delay, but not the 100 ms that you imagine.  I believe that the dsPIC has a 500 kHz sample rate in 12-bit mode, and it could go from zero to max in 2 µs.  That's still not as fast as an op-amp though, and the dsPIC ADC is not really appropriate for multichannel use or control, but I wanted to illustrate that it's not a simple AVR/8-bit PIC.

Quote
I'm not a big fan of using a random SMPS brick as source. I can see the advantage in costs and size vs. transformer + rectifier + caps, but a transformer is much more stable.
I agree, but I think that Dangerous Prototypes wants to avoid the danger of manufacturing 120 VAC devices.  The brick as power source saves lives.  Perhaps an excellent workaround would be to design something that would accept a wide range of DC and AC inputs, and then the more adventurous could opt for the xformer + rectifier + caps.  I certainly would choose the latter.  I've already made my own power supplies, and the worst thing that happened was that I thought I burned myself with my soldering iron, only to find out that I was soldering the tranformer to the power leads with them still plugged into the wall!  Don't laugh, I was a teenager with little experience...

Anyway, I'm not sure whether designing for the SMPS brick source would necessarily prevent more advanced features - hopefully not.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 05, 2010, 01:47:25 pm
[quote author="rsdio"]
I want to point out that the dsPIC is a DSP.  So the simplistic algorithm would hopefully not be used.  Instead of +0-, the dsPIC would implement a damped low-pass filter of some kind.  Sampling will create a group delay, but not the 100 ms that you imagine.  I believe that the dsPIC has a 500 kHz sample rate in 12-bit mode, and it could go from zero to max in 2 µs.  That's still not as fast as an op-amp though, and the dsPIC ADC is not really appropriate for multichannel use or control, but I wanted to illustrate that it's not a simple AVR/8-bit PIC.
[/quote]
Point taken. You could also use a less brain-dead control algorithm in an 8-bit micro to work around the limited ADC bandwidth (I actually played with this idea before ditching the Tux Graphics design all together). If you want more sophisticated control, like PID (http://http://en.wikipedia.org/wiki/PID_controller), using a DSP might be a good idea. The group delay might compromise stability though (what's that going to do for your phase margin?). DAC speed might also be an issue, the cheap ones do only a few kS/s I think.

[quote author="rsdio"]
I agree, but I think that Dangerous Prototypes wants to avoid the danger of manufacturing 120 VAC devices.  The brick as power source saves lives.  Perhaps an excellent workaround would be to design something that would accept a wide range of DC and AC inputs, and then the more adventurous could opt for the xformer + rectifier + caps.  I certainly would choose the latter.  I've already made my own power supplies, and the worst thing that happened was that I thought I burned myself with my soldering iron, only to find out that I was soldering the tranformer to the power leads with them still plugged into the wall!  Don't laugh, I was a teenager with little experience...

Anyway, I'm not sure whether designing for the SMPS brick source would necessarily prevent more advanced features - hopefully not.
[/quote]
Sure about that saving lives? ;) (http://http://dangerousprototypes.com/forum/index.php?topic=576.msg5386#msg5386). I know, it was only some hardware, and might have been a freak accident or even bad wiring.

I don't think it would prevent advanced features, the only neat trick with a transformer is using a voltage doubler (or switchable winding) to limit dissipation, and it would probably offer lower noise without extensive filtering. I can see why DP doesn't want to sell 120VAC (or 230VAC) devices, and telling beginners to build one might not be a great idea either. I'm just not a big fan of using power electronics outside their specifications. A laptop PSU is designed for a specific load, and any part not necessary for that job is omitted to save the extra three cents. But I don't see any better options either, I don't think there are any common and cheap linear power supplies that deliver something like 12-24V/1A, or AC only wall-warts (although they do exist).

Providing PCB space for a rectifier and filter caps would probably eat a lot of real estate. An optional input R/C or L/C filter might be a good idea for noisy switchers.

Floating supplies would probably be grounded by the USB cable anyway. My supplies all isolate the computer interface from the outputs, which is actually quite easy for USB since it carries its own power source. It might be a good idea to offer some advice regarding wall warts in the manual (they may be grounded, might have significant leakage that can generate significant AC voltages that can kill sensitive electronics, don't feed them any RF, don't use cheap crap, don't use while showering ;) ).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 05, 2010, 02:15:46 pm
Ian especially requested that we don't build something that plugs in the wall socket. Some of us have enough experience to do stuff like that but some people using this thing can do stupid things. Plus in that case we have to design for 100 VAC to 240 VAC and 50-60 Hz input ranges. Will create lots of design issues. But I believe that we have to include a bridge rectifier as some laptop PSU's have center positive, some center negative. One way to get rid of this is to have jumper pads to solder for connecting the input jack to rest of the circuit, 2 wires 4 pads, simple!

Using a dsPIC is the best way in my opinion. These guys have application notes for creating SMPS with 8-bit microcontrollers, surely a dsPIC will give better and acceptable results. We might even go for getting rid of the DC/DC converter IC and using PWM to drive MOSFETs, we might need some MOSFET drivers (or a transistor) but this might give us waaaaaay better flexibility. If these tiny guys can crunch data for audio stuff, I am sure that we will be able to control a DC power supply.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 05, 2010, 02:38:11 pm
[quote author="tayken"]
But I believe that we have to include a bridge rectifier as some laptop PSU's have center positive, some center negative. One way to get rid of this is to have jumper pads to solder for connecting the input jack to rest of the circuit, 2 wires 4 pads, simple![/quote]
Using a bridge rectifier would certainly make it more fool-proof, although it will drop 2V or so. If it would be possible to provide pads for wiring in an electrolytic cap (not on the board), it would be easy to adapt for transformers.

[quote author="tayken"]
Using a dsPIC is the best way in my opinion. These guys have application notes for creating SMPS with 8-bit microcontrollers, surely a dsPIC will give better and acceptable results. We might even go for getting rid of the DC/DC converter IC and using PWM to drive MOSFETs, we might need some MOSFET drivers (or a transistor) but this might give us waaaaaay better flexibility. If these tiny guys can crunch data for audio stuff, I am sure that we will be able to control a DC power supply.
[/quote]
I'm sure it can work, the question is if it works better than tried-and-true analog. What kind of flexibility would the dsPIC give? What would it do better than a $0.30 LM324 in this application? To me this seems like a solution in search of a problem. It's not about number crunching, but about latency, and it's hard to beat analog electronics on that. No point in responding to a transient that's already over. Are there any good commercial lab supplies (who also try to save money and reduce parts count) using this?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 05, 2010, 05:57:15 pm
[quote author="alm"]
Using a bridge rectifier would certainly make it more fool-proof, although it will drop 2V or so. If it would be possible to provide pads for wiring in an electrolytic cap (not on the board), it would be easy to adapt for transformers.

Quote
Using a dsPIC is the best way in my opinion. These guys have application notes for creating SMPS with 8-bit microcontrollers, surely a dsPIC will give better and acceptable results. We might even go for getting rid of the DC/DC converter IC and using PWM to drive MOSFETs, we might need some MOSFET drivers (or a transistor) but this might give us waaaaaay better flexibility. If these tiny guys can crunch data for audio stuff, I am sure that we will be able to control a DC power supply.
I'm sure it can work, the question is if it works better than tried-and-true analog. What kind of flexibility would the dsPIC give? What would it do better than a $0.30 LM324 in this application? To me this seems like a solution in search of a problem. It's not about number crunching, but about latency, and it's hard to beat analog electronics on that. No point in responding to a transient that's already over. Are there any good commercial lab supplies (who also try to save money and reduce parts count) using this?
[/quote]

Alm you make some good points in this and your previous post. To restate one of them : if anyone is being put-off by the complexity of an analog-based supply (whether linear or switching), don't think that bringing it into software control will make things any easier. In fact, it's a pretty safe bet that it can become software hell. Tayken, I'd like to know what extra flexibility you're expecting by using a dsPIC ? Just remember that in some cases, application notes should also be seen as "proof of concepts", not recommended designs. Also remember that we'll need a customized but yet-inexistant USB stack !

As for the linear regulator I posted a few pages back, I just want to point out again that it's an unfinished design and while it should work, some thought needs to be given to loop stability. The op-amps doesn't magically make the thing work, and in fact minor component changes can easily make the regulator unusable ! A power supply like the HP3620 wasn't just slapped together in an afternoon...

alm you say a lab PSU should have an irreproachable output, I would tend to agree to that but I would opt for a linear post-regulator. The ability to source large currents at low voltages, without requiring a huge heatsink, can be useful in a number of cases.

Now, electrical isolation. This increases circuit complexity, especially since we have an USB interface. Fixed-output, offline PSUs often use voltage references on the output side coupled to the input side through optocouplers, but we can't really do that because our voltage reference from the PIC is necessarily on the non-isolated side. We can try to use optocouplers with calibrated networks on both side to get a usable voltage feedback.
Another way would be to try to separate the PIC from the DACs. This could be either by using an isolated DAC chip, or maybe route a PWM signal through an optocoupler, which would then get filtered on the Power side.
Or, use a dedicated USB chip (either FT232 or a generic PIC) which communicates to a very simple PIC to do the actual controlling. That is to say, one PIC would manage the USB protocol, and send data to the power section through an opto-isolated bus. This could be as simple as sending a 10-bit voltage word, a 10-bit current word, and receiving a  10-bit voltage reading and a 10-bit current reading. This means an extra PIC is needed, obviously, but this power-PIC can be pretty basic : it just needs a handful of ADC + DAC channels, plus 1-2 pins for communications. As a bonus it could also handle the dummy-load, which then becomes easy to isolate.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 05, 2010, 06:47:03 pm
[quote author="fenugrec"]
As for the linear regulator I posted a few pages back, I just want to point out again that it's an unfinished design and while it should work, some thought needs to be given to loop stability. The op-amps doesn't magically make the thing work, and in fact minor component changes can easily make the regulator unusable ! A power supply like the HP3620 wasn't just slapped together in an afternoon...
[/quote]
True, but there are various similar circuits available. Another ELV design (http://http://www.elv.de/Universelle-Netzteilplatine,-Komplettbausatz-(Ohne-Netztrafo-und-Kuuml;hlkouml;rper)/x.aspx/cid_74/detail_10/detail2_1931/flv_/bereich_/marke_) (I don't work for ELV, just think they have some solid well-documented designs) of a linear supply with the same basic idea. Same with digital control (http://http://www.elv.de/Prozessor-Netzteil-PPS-5330,-Komplettbausatz/x.aspx/cid_74/detail_10/detail2_18011/flv_/bereich_/marke_). In my opinion, the stability of this feedback loop is much simpler than that of a switching regulator, since it contains fewer components (if you count all the components in the SMPS controller).

[quote author="fenugrec"]
alm you say a lab PSU should have an irreproachable output, I would tend to agree to that but I would opt for a linear post-regulator. The ability to source large currents at low voltages, without requiring a huge heatsink, can be useful in a number of cases.
[/quote]
How well does a linear post-regulator work against switching noise? I'd expect switching noise to be around the PWM frequency, plus the harmonics from the fast edges. The NMRR of the likes of the LM317 decrease pretty rapidly beyond 60Hz. But it may work much better than I'd expect, I haven't actually tested it, but more experienced people have told me that it's pretty hard to get rid of switching noise. The extra current on lower voltages is an advantage, if this is a important feature, SMPS definitely is the way to go. For me, it's pretty rare to need more than a few hundred mA, but if you're working with motors or high-power LED, you might need much more. I don't think a post-regulator would actually need fewer parts (I know you didn't claim this). The extra parts for a linear supply are: power transistor, fairly large heat sink (can also be used for dummy load), few op-amps and some small components. Extra parts for a switcher w/ post-regulator are: switching controller, optional external MOSFET + driver, inductor, diode, LM317 and possible op-amps plus small stuff. If there's a solid case for a switcher, go for it, it seemed to me from reading the thread that the choice for switcher was somewhat arbitrary, and a linear design should be able to work just fine with lower complexity and similar cost.

[quote author="fenugrec"]
Now, electrical isolation. This increases circuit complexity, especially since we have an USB interface. Fixed-output, offline PSUs often use voltage references on the output side coupled to the input side through optocouplers, but we can't really do that because our voltage reference from the PIC is necessarily on the non-isolated side. We can try to use optocouplers with calibrated networks on both side to get a usable voltage feedback.

Another way would be to try to separate the PIC from the DACs. This could be either by using an isolated DAC chip, or maybe route a PWM signal through an optocoupler, which would then get filtered on the Power side.
Or, use a dedicated USB chip (either FT232 or a generic PIC) which communicates to a very simple PIC to do the actual controlling. That is to say, one PIC would manage the USB protocol, and send data to the power section through an opto-isolated bus. This could be as simple as sending a 10-bit voltage word, a 10-bit current word, and receiving a  10-bit voltage reading and a 10-bit current reading. This means an extra PIC is needed, obviously, but this power-PIC can be pretty basic : it just needs a handful of ADC + DAC channels, plus 1-2 pins for communications. As a bonus it could also handle the dummy-load, which then becomes easy to isolate.
[/quote]
I didn't claim that isolation is an essential feature for this design, just that I consider it an essential feature for my own designs, since they should float and I should be able to put them in parallel, plus I'd like my USB ports to survive bonehead mistakes. I wouldn't try to isolate the analog signals. I tend to put a small MCU (which is usually cheaper than a few channel ADC + shift register / port multiplier) plus the DACs on the floating side, and connect them to the 'main' MCU with SPI or I2C, the 'main' MCU is fed from an isolated transformer winding (not going to work here, unless you use some IsoPower like device). I isolate this bus (need special devices for I2C, SPI is easier). My other solution is using a dedicated USB chip (FT232 is fine, but USB MCU tends to be cheaper), this one is powered from the grounded USB connection, the rest is connected to the power supply output 'ground'. I don't use this USB chip for anything else, since it won't be powered if the USB cable is unplugged. The disadvantage of this is that I have to worry about dangerous potentials on the LCD and buttons (they also have real front panels, not an issue here).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Pisami on September 05, 2010, 07:43:59 pm
Sorry I bother you with my (dumb) question. I like this project very much and can't wait to buy it :) So, can it be used as battery charger for
1) Ni-Cd packs, like the ones on older power tools, about 9,6 Volts and so.
2) Single cells of Ni-Cd, Ni-MH, Li-ion, Li-Po,
3) Lead acid (6/12V)
4) you name it...

I think the circuitry is capable with those batteries, just want to make sure if you are developing software to watch the process, so I don't need to (hire a monkey) do it. Thank you :)

Edit: Could there be a pin or two for aux shutdown for example to stop the charging due to heating Li-Ion cell? Thanks again :)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 05, 2010, 09:19:01 pm
I'll examine this (http://http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en539797&redirects=acdc) for some ideas. Of course there will be latency more than an op-amp circuit but we might use it to create ac-like signals in the future with a firmware update. Also we might do some other stuff with a dsPIC. I voted first for a separate DC/DC converter IC but we might not need it, I don't know, still have to do some trials for all of the ideas for some suitable ideas. Even normal computer PSUs use SMPS, noise will not be that much of an issue IMO.

[quote author="asdf"]
Sorry I bother you with my (dumb) question. I like this project very much and can't wait to buy it :) So, can it be used as battery charger for
1) Ni-Cd packs, like the ones on older power tools, about 9,6 Volts and so.
2) Single cells of Ni-Cd, Ni-MH, Li-ion, Li-Po,
3) Lead acid (6/12V)
4) you name it...

I think the circuitry is capable with those batteries, just want to make sure if you are developing software to watch the process, so I don't need to (hire a monkey) do it. Thank you :)

Edit: Could there be a pin or two for aux shutdown for example to stop the charging due to heating Li-Ion cell? Thanks again :)
[/quote]

This may be for you to hack. :) But Li-Po is a no-go, as they need special chargers and if you don't monitor them carefully, there is a huge possibility of the cells getting ruptured and they will catch fire.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 06, 2010, 12:11:04 pm
[quote author="tayken"]
I'll examine this (http://http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en539797&redirects=acdc) for some ideas.
[/quote]
Of course the dsPIC designers want to show what it can do, I'm sure it can be very versatile, but that doesn't make it the best solution. Those two dsPIC's in there are probably more expensive than the ASICs would be. It would make software design much more fun: software bug = fireworks. Gives a new meaning to the halt-and-catch-fire instruction ;).

[quote author="tayken"]
Of course there will be latency more than an op-amp circuit but we might use it to create ac-like signals in the future with a firmware update.
[/quote]
How would it work better than a DAC/op-amp configuration? Unless you assume your load is constant and purely resistive (i.e. a power resistor connected to the output), you still need feedback to check if the output voltage tracks your intended signal. So a DAC outputting a sine and an op-amp regulating the power transistor base current / PWM duty cycle to track this voltage would work just as well if not better. The power transistor or low-ish PWM frequency will limit you bandwidth anyway, so I don't think the limited bandwidth of a DAC (which might be PWM + filter) is not really an issue.

If I understand it correctly, it might work almost as good as a $0.30 quad op-amp, if we're lucky? And we could get extra speed for an extra dollar or so from that op-amp (thousands of faster op-amps available), but getting a faster dsPIC would be much more expensive.

[quote author="tayken"]
 Also we might do some other stuff with a dsPIC. I voted first for a separate DC/DC converter IC but we might not need it, I don't know, still have to do some trials for all of the ideas for some suitable ideas.
[/quote]
So parts count is your main argument? That's the only pro I see for using the dsPIC. You better be really familiar with SMPS designs if you want to design it from scratch (not sure if you can use the Microchip example verbatim, both from design and from license point of view) as opposed to using a standard IC.

[quote author="tayken"]
Even normal computer PSUs use SMPS, noise will not be that much of an issue IMO.
[/quote]
And those are terribly noisy. All the important power (eg. CPU, memory) will go through a second DC-DC converter and filter on the mainboard anyway, so no point in producing a really clean 12V. Analog circuits, like high-resolution ADCs/DACs, can be much more sensitive. With a 10-bit ADC and 1.024V reference voltage, it only takes 1mV noise to change the LSB.

[quote author="tayken"]
[quote author="asdf"]
I think the circuitry is capable with those batteries, just want to make sure if you are developing software to watch the process, so I don't need to (hire a monkey) do it. Thank you :)

Edit: Could there be a pin or two for aux shutdown for example to stop the charging due to heating Li-Ion cell? Thanks again :)
[/quote]

This may be for you to hack. :) But Li-Po is a no-go, as they need special chargers and if you don't monitor them carefully, there is a huge possibility of the cells getting ruptured and they will catch fire.
[/quote]
Agreed. The other cells can be charged by just monitoring the voltage and current curves, which could be done by a special program for the PIC, or by the PC. The temperature could be monitored by one of the 'DMM' channels if they weren't removed from the design yet.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 06, 2010, 01:23:33 pm
That's just an example project. Of course we will not use 2 dsPIC's, we will use only one for the "brains" of the circuit. And nothing like copying their circuits, there are many manuals, books etc out there and I had to design my fair share of SMPS during my college years. Design goal is simple 12-24 V input 0-12 V max 1.5 A output so a buck converter is the solution. If we want isolation, that requires more complex designs.

I'm thinking about many aspects: BoM, board size, board routing hardness level, efficiency, final price etc. There are many many good design ideas in this topic but they are all ideas now. I'm sure that the SMPS will be noisy but think that: What is our goal here? Are we trying to produce a good hobbyist use power supply board that is hackable and affordable for lots of people or a pro-level power supply unit that is nearly noiseless? I'm not against op-amp + DAC or not against a DC/DC converter IC to handle all the switching (In fact, I first suggested this and will try this method when I get my supplies). IMO the goal is to provide a computer controlled (which means no pots or other stuff to adjust on a panel), cheap, hobbyist use power supply. Plus this design will become reference to other designs so keeping the schematic and other things as simple as possible will be good for us.

Possibly one of the problems here is that we didn't include anything about the noise in the output in the project requirements, maybe we should include something like that. For analog parts noise, I always use the zener diode + resistor method to get a clean reference signal. Plus I don't think anybody will use this to design a high-speed high-resolution analog design. If the circuit in trial is noise sensitive the user can include an LDO, this is for trying circuits and many other wall-warts out there are really noisy which someone usually uses their circuits with.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 06, 2010, 02:08:59 pm
[quote author="alm"]I can see why DP doesn't want to sell 120VAC (or 230VAC) devices, and telling beginners to build one might not be a great idea either. I'm just not a big fan of using power electronics outside their specifications. A laptop PSU is designed for a specific load, and any part not necessary for that job is omitted to save the extra three cents. But I don't see any better options either, I don't think there are any common and cheap linear power supplies that deliver something like 12-24V/1A, or AC only wall-warts (although they do exist).[/quote]This topic is really getting long, but I think that I suggested an AC wall-wart earlier.  I had a client who knew nothing about electronics, but everything about saving money, and they ended up with a shipment of 12 VAC output adaptors instead of 12 VDC.  That's anecdotal, but seems to indicate that they're not impossible to find cheaply.  Prior to that, I recall some equipment that came with AC-only wall-warts instead of the typical DC, and since then I've wanted to design with AC input instead of DC if I ever built my own supply.  That would seem to be the ideal source.

I think it's worth searching for a cheap source for an AC-only wall-wart to see whether anything would fit this project.  I just don't know where to look, because Mouser seems to charge way too much for anything in this category.  Maybe I should contact my old client and see if they still remember their source for those 12 VAC wall-warts - although we'd need at least 20 VAC, I'd imagine.

I've seen the rare power supply input circuit that would accept either AC or DC, over a fairly wide range of voltages.  If this PS could be designed to handle either a laptop PS (as originally envisioned) or AC-only wall-wart (as recent comments have been leaning towards), that would seem ideal.

[quote author="tayken"]Using a dsPIC is the best way in my opinion. These guys have application notes for creating SMPS with 8-bit microcontrollers, surely a dsPIC will give better and acceptable results.  ...  If these tiny guys can crunch data for audio stuff, I am sure that we will be able to control a DC power supply.[/quote]Be careful about your assumptions!  I am still concerned that the dsPIC Data Sheet states in Section 22, on page 265 that
Quote
Note: The DAC module is designed specifically for audio applications and is not recommended for control type applications.
This would seem to separate the dsPIC from the 8-bit MCU examples, at least in terms of the built-in DAC.

[quote author="alm"]Using a bridge rectifier would certainly make it more fool-proof, although it will drop 2V or so. If it would be possible to provide pads for wiring in an electrolytic cap (not on the board), it would be easy to adapt for transformers.[/quote]Now that we're living in the age of the LDO (low-dropout) regulator and power diode, is there any such thing as a rectifier that wouldn't drop 2V?  I realize that I have been looking at 5V polarity-reversal protection diodes intended for USB devices that draw 0.5A at most, but it seems like their high-current, high-voltage cousins might have managed to join the low-dropout world.

What about a half-wave rectifier?

[quote author="fenugrec"]
Now, electrical isolation. ...
Another way would be to try to separate the PIC from the DACs. This could be either by using an isolated DAC chip, or maybe route a PWM signal through an optocoupler, which would then get filtered on the Power side.[/quote]This could actually solve the problem with the built-in DAC on the dsPIC.  I think there are some models of the dsPIC without a DAC, so hopefully those are cheaper, and the external, isolated DAC could be one appropriate for control rather than audio.  A parallel DAC might have lower latency, assuming the dsPIC has an external parallel interface available.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 06, 2010, 02:36:04 pm
[quote author="rsdio"]
[quote author="tayken"]Using a dsPIC is the best way in my opinion. These guys have application notes for creating SMPS with 8-bit microcontrollers, surely a dsPIC will give better and acceptable results.  ...  If these tiny guys can crunch data for audio stuff, I am sure that we will be able to control a DC power supply.[/quote]Be careful about your assumptions!  I am still concerned that the dsPIC Data Sheet states in Section 22, on page 265 that
Quote
Note: The DAC module is designed specifically for audio applications and is not recommended for control type applications.
This would seem to separate the dsPIC from the 8-bit MCU examples, at least in terms of the built-in DAC.
[/quote]

Hmm, these 8-bit examples use PWM (as nearly all examples) for switching, not some kind of DAC output. Also the examples I found with dsPIC use PWM, none of them uses DAC. Some 16-bit microcontrollers have Parallel Master Port which can be used with an external DAC.

How about using solder jumpers for center negative-center positive input. Not something like SMD pads but actual wires. Or a switch maybe?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 06, 2010, 02:57:07 pm
[quote author="tayken"]
That's just an example project. Of course we will not use 2 dsPIC's, we will use only one for the "brains" of the circuit. And nothing like copying their circuits, there are many manuals, books etc out there and I had to design my fair share of SMPS during my college years. Design goal is simple 12-24 V input 0-12 V max 1.5 A output so a buck converter is the solution. If we want isolation, that requires more complex designs.
[/quote]
I wasn't implying that we'd need two dsPICs (we could completely skip the PFC, for starters), but that this wasn't a practical or commercially viable design. Agreed about the buck converter (or linear, which might be cheaper if we can use the existing heat sink). Isolation would be nice, but I don't think that the extra complexity and cost of a ferrite transformer is reasonable here, so I'd just rely on the user to use an isolated power source.

[quote author="tayken"]
I'm thinking about many aspects: BoM, board size, board routing hardness level, efficiency, final price etc. There are many many good design ideas in this topic but they are all ideas now.
[/quote]
It's obvious to me that it's hard to beat the dsPIC with just external MOSFET driver, MOSFET, diode and inductor (+ passives) on BoM and parts count. Not so sure about complexity and quality. The analog solution doesn't use that much or expensive parts in my opinion, and might allow for a smaller/cheaper MCU (do we need a dsPIC if we don't use it to control the power supply?).

[quote author="tayken"]
 I'm sure that the SMPS will be noisy but think that: What is our goal here? Are we trying to produce a good hobbyist use power supply board that is hackable and affordable for lots of people or a pro-level power supply unit that is nearly noiseless?
[/quote]
Both, ideally ;). Low noise is not the top priority, obviously, and it very much depends on what you use it for. For some uses, like powering an MCU for purely digital work, it doesn't really matter, for others, mainly analog applications, it does. But if we can get lower noisy without increasing costs or complexity, why not?

[quote author="tayken"]
I'm not against op-amp + DAC or not against a DC/DC converter IC to handle all the switching (In fact, I first suggested this and will try this method when I get my supplies). IMO the goal is to provide a computer controlled (which means no pots or other stuff to adjust on a panel), cheap, hobbyist use power supply. Plus this design will become reference to other designs so keeping the schematic and other things as simple as possible will be good for us.
[/quote]
Agreed. If it becomes a reference design, I would make sure it's very solid and stable, which in my mind is a tried and true solution, not something barely used outside Microchip's marketing department.

[quote author="tayken"]
Possibly one of the problems here is that we didn't include anything about the noise in the output in the project requirements, maybe we should include something like that. For analog parts noise, I always use the zener diode + resistor method to get a clean reference signal. Plus I don't think anybody will use this to design a high-speed high-resolution analog design. If the circuit in trial is noise sensitive the user can include an LDO, this is for trying circuits and many other wall-warts out there are really noisy which someone usually uses their circuits with.
[/quote]
I use a lab supply so I don't have to build a power supply (yet), if I'm going to use an LDO, I might as well use a wall wart. I either haven't designed a power supply yet (might want to test voltage and current draw first), or I'm troubleshooting and suspecting the power supply.

[quote author="rsdio"]
I think it's worth searching for a cheap source for an AC-only wall-wart to see whether anything would fit this project.  I just don't know where to look, because Mouser seems to charge way too much for anything in this category.  Maybe I should contact my old client and see if they still remember their source for those 12 VAC wall-warts - although we'd need at least 20 VAC, I'd imagine.

I've seen the rare power supply input circuit that would accept either AC or DC, over a fairly wide range of voltages.  If this PS could be designed to handle either a laptop PS (as originally envisioned) or AC-only wall-wart (as recent comments have been leaning towards), that would seem ideal.
[/quote]
Actually 12VAC might be enough, since it's increased by a factor sqrt(2) when rectified (and the available current is decreased even more), minus diode drops and regulator drop. You could also build a voltage doubler (bunch of diodes and twice the cap size). The advantage of using a random laptop PSU is that people can just dig one up from a long-dead laptop. Selling AC wall warts via SeeedStudio is probably not an option because of different mains voltages and safety, pointing people at a cheap source might work, although isn't great because of the international audience and shipping costs. Putting a bridge rectifier on the input and an optional capacitor (would probably need a fairly large value like 2200-4700uF/36V or so here = large and expensive) would be compatible with DC in any polarity and AC.

[quote author="rsdio"]
Be careful about your assumptions!  I am still concerned that the dsPIC Data Sheet states in Section 22, on page 265 that
Quote
Note: The DAC module is designed specifically for audio applications and is not recommended for control type applications.
This would seem to separate the dsPIC from the 8-bit MCU examples, at least in terms of the built-in DAC.
[/quote]
Any idea what this means? Is it legal CYA stuff, or is it because the DAC is crappy in a way that doesn't matter for audio (like fast glitches)?

[quote author="rsdio"]
Now that we're living in the age of the LDO (low-dropout) regulator and power diode, is there any such thing as a rectifier that wouldn't drop 2V?  I realize that I have been looking at 5V polarity-reversal protection diodes intended for USB devices that draw 0.5A at most, but it seems like their high-current, high-voltage cousins might have managed to join the low-dropout world.

What about a half-wave rectifier?
[/quote]
2V is a rough estimate, the actual number depends on current draw and temperature, but the first (2A/200V) bridge rectifier datasheet I found specified 1.1V max per element, so 2V is pretty close. Schottky diodes offer a lower Vf, for example CDBHD240-G (http://http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=641-1213-1-ND) (2A/40V, might not be enough for 1.5A DC) specifies Vf=0.5V at 1A at 25⁰C, they're pretty expensive at $1.19 each per 100. A half-wave rectifier would limit the amount of current (can't draw .6 * max. AC current, but even less), and wouldn't allow DC supplies of both polarities, which is a bit of a pain, and would require twice the smoothing capacitance. But it is an option, and would be cheaper (only one diode, either silicon or Schottky) than full bridge rectification.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 06, 2010, 03:41:33 pm
[quote author="alm"]Selling AC wall warts via SeeedStudio is probably not an option because of different mains voltages and safety,[/quote]A lot of products these days seem to work anywhere in the world.  I'm thinking of Apple laptop (ed: and iPod/iPhone/iPad) chargers, rechargeable electric razors, etc.  A 12 VAC wall-wart would just put out 24 VAC in Australia, so couldn't the DP PS be designed to handle 12 to 24 VAC?  Of course, the 12 VAC wall-wart would have to be rated to handle 240 VAC input, but that seems possible.  Granted, I have not looked for anything like this, but the marketplace seems to be growing for international power.

Quote
[quote author="rsdio"]Be careful about your assumptions!  I am still concerned that the dsPIC Data Sheet states in Section 22, on page 265 that
Quote
Note: The DAC module is designed specifically for audio applications and is not recommended for control type applications.
This would seem to separate the dsPIC from the 8-bit MCU examples, at least in terms of the built-in DAC.
Any idea what this means? Is it legal CYA stuff, or is it because the DAC is crappy in a way that doesn't matter for audio (like fast glitches)?[/quote]No, it's not legal CYA.  In fact, I found the note because I was looking for it, having expected it to be the case.

There are multiple technologies for implementing a DAC, and there are tradeoffs involved with each.

Lower bit depths tend to have lower latency, are usually parallel, but suffer from the potential for non-monotonicity, i.e., increasing the digital input might not increase the analog output, because of the weighted bits (although most every DAC chip corrects this problem).  The nice thing is that you can hook these up to an analog multiplexer because each conversion is completely independent of the conversions before and after.

Higher bit depths do away with the weighted bits and instead use oversampling and 1-bit or reduced-bit conversions.  These are delta-sigma converters.  You'd think that the oversampling would make them even faster, but they actually act like digital filters and have a long impulse response.  In other words, you don't get out exactly what you put in, but in audio terms the analog signal is equivalent.  The most critical problem is that delta-sigma technology makes each conversion depend upon the preceding conversion, and affect the subsequent conversion.  Thus, you cannot send independent channels through an analog multiplexer because the samples would bleed into each other.  Between the impulse response and the lack of multiplexer compatibility, Microchip are correct to warn that this DAC is not appropriate for control.

The dsPIC DAC might work in a single-channel (or stereo, since they have two DACs) control system, but in addition to the normal conversion latency you'd also have the impulse response of the ∆∑ system.

However, I did read an article recently about how to overcome this.  Basically, you must account for the impulse response and send several samples through a given channel until the previous channel has cleared out of the stream.  This severely limits the sample rate, though.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 07, 2010, 03:48:04 am
A worthwhile read :
http://www.national.com/an/AN/AN-1889.pdf&nbsp; (http://www.national.com/an/AN/AN-1889.pdf&nbsp;) "Application Note 1889 How to Measure the Loop Transfer Function of Power Supplies"
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 07, 2010, 01:40:17 pm
An appnote actually targeted at hobbyists and small labs that don't have all the expensive equipment, cool! Thanks for the link. Seems we might not have to totally rely on Spice for stability calculations after all ;).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 07, 2010, 09:32:52 pm
Downloaded the document, I'll review it. I'll also try to find a way that satisfies most people. :)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 10, 2010, 09:08:35 pm
Reviewed the document and loved it! Good way to analyze a system. Might be useful after we have some prototypes. :)

So dsPIC's internal DAC is out of the equation. It is good for audio applications but we don't know its performance for control cases. That leaves us with an external DAC or using the internal PWM of the dsPIC. There are advantages and disadvantages of both sides of course but I think we should go for PWM and maybe even getting rid of the DC/DC IC to save some board space and make it cheaper. We can still include the op-amp linear post-regulator stage if someone wants to work on it.

One thing about AC adapters: I have some adapters which have input rating of 100-240V 50-60Hz and constant output voltage. They are also becoming cheaper day by day. All thanks to SMPS! :D
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 11, 2010, 11:11:27 am
Here's a diagram based on recent discussions. It's pretty general. It shouldn't set anything in stone, I just had a good time sketching it out.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 12, 2010, 11:51:09 am
Just had an idea: We would better measure the input voltage, this way the regulator can give quick responses to changes. I was on vacation with no Internet but I'm back and probably will have some time to add some ideas to your sketch.

Shall we introduce some kind of deadlines, new design requirements or anything? I feel like we are running in circles. :(
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 12, 2010, 04:15:01 pm
You might want to check out Dave (http://http://www.eevblog.com/2010/09/10/eevblog-110-lets-design-a-dc-to-dc-switchmode-converter/).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 13, 2010, 02:55:36 pm
[quote author="tayken"]
So dsPIC's internal DAC is out of the equation. It is good for audio applications but we don't know its performance for control cases. That leaves us with an external DAC or using the internal PWM of the dsPIC. There are advantages and disadvantages of both sides of course but I think we should go for PWM and maybe even getting rid of the DC/DC IC to save some board space and make it cheaper. We can still include the op-amp linear post-regulator stage if someone wants to work on it.
[/quote]
I think a switching pre-regulator and a linear post-regulator would be the worst of both worlds: the complexity and stability of a switching regulator with the extra parts count of a linear regulator. But I'm willing to be proven wrong. I believe that you'd still need some sort of constant voltage/constant current circuit on the linear side (how would that work?). The only extra part for a fully linear regulator vs. linear post-regulator would be the larger heatsink, but we already have that one for the dummy load. There is an issue with needing extra voltages, but you probably won't be able to regulate a SMPS to 0V/0A without any negative voltages below the output common either. The major advantage of a SMPS is efficiency, which IMO is a non-issue here. A double LM317 linear supply might also be an option, since that give you over temperature protection for free, and you only need one negative voltage (not sure how much current), not a symmetrical supply for an op-amp (though rail-to-rail opamps might be able to fix that).

[quote author="tayken"]
One thing about AC adapters: I have some adapters which have input rating of 100-240V 50-60Hz and constant output voltage. They are also becoming cheaper day by day. All thanks to SMPS! :D
[/quote]
I think rsdio was talking about wall warts with AC output, they tend to be just mains transformers in a box, which is a nice compromise between safety (mains is safely isolated) and the simplicity and stability of a transformer (no extra noise and not much can go wrong as long as you don't exceed the maximum current). It also makes nasty leakages that produce dangerous voltages (for sensitive semiconductors) less likely, since they probably don't have EMI filters (no EMI to filter). The output voltage will be proportional to the input voltage, though.

[quote author="tayken"]
Just had an idea: We would better measure the input voltage, this way the regulator can give quick responses to changes.
[/quote]
This would increase the output impedance a lot, and would only work if you load is constant, or do you mean in addition to monitoring the output voltage (not sure what you would do with this information). If you use a stabilized power supply which doesn't produce more noise than the output of this power supply, most of the regulation will be to counter load changes. It probably wouldn't work very well for constant current operation with a SMPS, since there's no inductor between the input and the switching MOSFET. I don't think trying to reinvent the wheel is a good idea here. Not that I'm against reconsidering established ideas, but I don't think a simple, low-budget power supply for a broad public is the place for that. It's not like it's hard to make a power supplies unstable. I recently came across reports that old HP/Harrison power supplies became unstable when you turned the voltage quickly up and down (http://http://tech.groups.yahoo.com/group/hp_agilent_equipment/message/30809), which would be very easy in software. I'd be conservative to minimize the chance of something going wrong. IMO, this design should be bullet proof.

[quote author="tayken"]
Shall we introduce some kind of deadlines, new design requirements or anything? I feel like we are running in circles. :(
[/quote]
Agreed about the running in circles. It appears to me like you read the suggestions by me/rsdio/fenugrec, ignore most of it without explanation, and pick up a few that you do like. Fenugrec has posted multiple sketches, which you appear to mostly ignore by offering completely different ideas. As long as you're the one doing the work and with the knowledge/experience that's fine, I don't claim that you should listen to everyone that comes along. The most productive would probably be for you to choose whatever you like and for us to quietly accept that, since it doesn't look like we'll agree on the regulation.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 13, 2010, 08:05:02 pm
[quote author="alm"]
I think a switching pre-regulator and a linear post-regulator would be the worst of both worlds: the complexity and stability of a switching regulator with the extra parts count of a linear regulator...
[/quote]
That was one of my thoughts about using only a switching regulator. LM317 is noted, but is it possible to change its output by DAC or other means?

[quote author="alm"]
I think rsdio was talking about wall warts with AC output, they tend to be just mains transformers in a box...
[/quote]
I realized that, but I was talking about including a more sophisticated wall-wart with the kit (that was the discussion)

[quote author="alm"]
This would increase the output impedance a lot, and would only work if you load is constant, or do you mean in addition to monitoring the output voltage (not sure what you would do with this information).
[/quote]
That was a suggestion for the case of using switching regulator and implementing it without a discrete IC for it. Most of the switching regulators use that to find the Ton/Tswitching ratio quickly. Instead of slowly increasing this ratio until you reach the desired voltage, you just calculate the ratio.

[quote author="alm"]
Agreed about the running in circles. It appears to me like you read the suggestions by me/rsdio/fenugrec, ignore most of it without explanation, and pick up a few that you do like.
[/quote]
That makes me feel really bad. I am reading all explanations/suggestions and looking at the schematics and understand them. After that I'm trying to write my thoughts as clear as possible. Fenugrec's ideas are always noted, especially the last schematic he posted. There is no solid plan on how to build this project, it seems that there are lots of ideas about whether to use a switch mode or linear regulator or both; using a discrete IC for SMPS if we go that way... There are lots of people out there with more experience than mine, I somehow became like the project head (I have no idea how this happened :D ) and I'm trying to learn from the ideas posted here. Plus we are all posting ideas now, this is a project that depends mostly on the hardware so we have to try deciding the best option that is possible.

Now here is my suggestion: Lets go step by step. We have the initial project requirements and lets decide whether to go with a switch mode regulator or a linear regulator or both of them in cascade.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 13, 2010, 11:46:20 pm
[quote author="tayken"]
That was one of my thoughts about using only a switching regulator. LM317 is noted, but is it possible to change its output by DAC or other means?
[/quote]
You have a point there, that might be an issue, since they tend to use a resistive dividers, as opposed to reference voltage that op-amps use. We'd probably need digipots (more expensive than DAC/PWM), at least for the voltage.

[quote author="tayken"]
I realized that, but I was talking about including a more sophisticated wall-wart with the kit (that was the discussion)
[/quote]
The original idea was to use an existing one. Offering one would give us more control about voltage/current and safety, but might add extra costs and headaches (eg. safety). The advantage of AC out is that you can some need tricks like capacitor multipliers for generating higher/negative voltages, but you need a few extra parts (mainly the smoothing capacitor). We (Ian) would have to check with Seeed if offering a wall wart is even an option, and if they can source ones of reasonable quality.

[quote author="tayken"]
That was a suggestion for the case of using switching regulator and implementing it without a discrete IC for it. Most of the switching regulators use that to find the Ton/Tswitching ratio quickly. Instead of slowly increasing this ratio until you reach the desired voltage, you just calculate the ratio.
[/quote]
Ah, that could work, as long as the extra (muxed) ADC input is available.

[quote author="tayken"]
That makes me feel really bad.
[/quote]
I apologize, I wasn't trying to hurt you. My frustration was just that you appear to counter posts of mine and others that support a position with arguments with something like 'I think we should really do it the other way'.

[quote author="tayken"]
Plus we are all posting ideas now, this is a project that depends mostly on the hardware so we have to try deciding the best option that is possible.
[/quote]
Agreed, the software should be fairly straightforward (unless we go for the software SMPS), except for the USB stack (I think rsdio mentioned at some point that it's still vaporware?).

[quote author="tayken"]
Now here is my suggestion: Lets go step by step. We have the initial project requirements and lets decide whether to go with a switch mode regulator or a linear regulator or both of them in cascade.
[/quote]
I think most of the basic requirements are clear (this (http://http://dangerousprototypes.com/docs/Leon:_Computer_controlled_power/current_supply,_multimeter) is the current wiki page I believe?). There are some features like isolation and (relatively) low noise (<<50mv) that would be nice if they don't cost too much in my opinion, but are not essential. As far as I'm concerned, an easy to understand schematic and robust design (should be stable whatever you throw at it) are important, in addition to low cost. Regulation all the way to 0V/0A is essential in my opinion for a lab supply, but does require a negative voltage for any design I'm aware of (may be able to use an charge pump inverter like the MAX232 uses).

Regarding linear / switchmode IC / software switcher / linear post-regulator, I think we should make a rough design for each (as long as there's someone willing to do it). No need to waste lots of time with a detailed design, but it would give us an idea about parts count, cost, complexity and footprint. The software version might be just a dsPIC with a DAC/PWM filter and some hand waving that the rest is in software, but we'll see when we get there. Based on this, we can decide to continue with one or more, and do some simulations or build some (dangerous) prototypes.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 14, 2010, 12:53:57 am
[quote author="alm"][quote author="tayken"]One thing about AC adapters: I have some adapters which have input rating of 100-240V 50-60Hz and constant output voltage. They are also becoming cheaper day by day. All thanks to SMPS! :D
[/quote]
I think rsdio was talking about wall warts with AC output, they tend to be just mains transformers in a box, which is a nice compromise between safety (mains is safely isolated) and the simplicity and stability of a transformer (no extra noise and not much can go wrong as long as you don't exceed the maximum current). It also makes nasty leakages that produce dangerous voltages (for sensitive semiconductors) less likely, since they probably don't have EMI filters (no EMI to filter). The output voltage will be proportional to the input voltage, though.[/quote]That's exactly what I was talking about.  They're rare, but the couple I've seen were used with products that need a significant amount of current, which seems appropriate for this PS project.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 14, 2010, 02:04:46 pm
The AC adapter isn't a worry, it can be sourced. I have a few here, and I'm pretty sure I can get one at the junk market down the street. What I would worry about on an AC design is any coils, transformers, or other odd parts we might need for the circuit board. These don't really seems to be standardized, and at our quantities I worry we'll be tracking down stock and changing the board constantly for that type of part. Maybe with the adapter no coils/transformers would be needed at all.

This is a complex project, and we've been really fortunate to have some really knowledgeable people contribute great ideas. My original goal was to put a digital trim-pot on an LM317 :)

Fen's design seems like the conclusion reached by lots of engineers who really study these things. It's cheap, well worn, and uses common parts. It seems like the path of least resistance for the regulation block.

It seems now like we're moved onto other details:
*how to supply the regulation block (SMPS, external SMPS, AC adapter, etc)
*how much ripple is acceptable
*regulation of low voltages (1.25 or .6 to 0 volt range)
*how to set the I and V (DAC, external DAC, PWM, etc)

Some of these details are easier on different regulator typologies (1.25-0volts), especially when we adhere to some of the original goals (DC only).

At this time, I would propose that we suggest which features and goals we can defer, just until we get a rough prototype PCB. This gives us time to actually play with hardware, and a test platform to try different stuff.

For example, I feel it is inevitable to do very low voltages. I want to use this as a testing device, and for that it will need to go the full range. The additional difficulty of AC seems to be a snag though. If we leave the "INPUT" section of the diagram off the rough prototype, would it still give us the opportunity to test different input supplies? I'd be willing to accept a gap in a DC-only prototype just to get familiar with the regulator and parts. But, we might still be able to use the rough regulator/sink prototype with different breadboarded power supplies to test negative voltages (and ripple from SMPS supply, etc).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 14, 2010, 03:07:43 pm
[quote author="ian"]What I would worry about on an AC design is any coils, transformers, or other odd parts we might need for the circuit board. These don't really seems to be standardized, and at our quantities I worry we'll be tracking down stock and changing the board constantly for that type of part. Maybe with the adapter no coils/transformers would be needed at all.[/quote]I don't think that you'll need any coils or transformers on the PCB, at least not if you can find an AC adaptor (with AC or DC output).  If you do, then you can research a few alternate options and design the PCB for multi-site.  That way, if you need to alter parts it won't require a PCB change.

I have designed with medium-sized SMD inductors for driving something like 170 LEDs from a 26V boost regulator, but each size had a different shape for the pads.  After the second or third alteration (mostly to save my client money on the production parts), I realized that I should have tried to figure out a way to multi-site, even if I had to overlay the different SMD pad shapes.

You could always design for through-hole, but, again, I think you won't need inductors.

Quote
The additional difficulty of AC seems to be a snag though. If we leave the "INPUT" section of the diagram off the rough prototype, would it still give us the opportunity to test different input supplies? I'd be willing to accept a gap in a DC-only prototype just to get familiar with the regulator and parts. But, we might still be able to use the rough regulator/sink prototype with different breadboarded power supplies to test negative voltages (and ripple from SMPS supply, etc).
An input section should be possible which accepts both DC and AC, although the negative voltages might not be so easy with DC input.  I haven't done a search yet, but I think Low Drop-Out diodes can be found which might handle enough current for a PS.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 15, 2010, 12:48:53 am
[quote author="ian"]
Fen's design seems like the conclusion reached by lots of engineers who really study these things. It's cheap, well worn, and uses common parts. It seems like the path of least resistance for the regulation block.
[/quote]
Could you be more specific? I believe he posted a few linear designs based on HP lab power supplies, and a few ideas with various switch-mode controllers. I agree about using ideas that are widely used by smart people that have done a lot more research on this and have much more experience.

[quote author="ian"]
At this time, I would propose that we suggest which features and goals we can defer, just until we get a rough prototype PCB. This gives us time to actually play with hardware, and a test platform to try different stuff.
[/quote]
I think the regulation block (i.e. from the power input to the power input, plus the DACs) is the most interesting part of this project which is the easiest to screw up. The MCU side (unless it's involved in regulation) should be quite straightforward. So should the ADC inputs unless you want advanced features like auto ranging. That doesn't mean they can't go wrong, obviously. Isolated USB might be slightly challenging.

[quote author="ian"]
For example, I feel it is inevitable to do very low voltages. I want to use this as a testing device, and for that it will need to go the full range.
[/quote]
I agree.

[quote author="ian"]
The additional difficulty of AC seems to be a snag though. If we leave the "INPUT" section of the diagram off the rough prototype, would it still give us the opportunity to test different input supplies? I'd be willing to accept a gap in a DC-only prototype just to get familiar with the regulator and parts. But, we might still be able to use the rough regulator/sink prototype with different breadboarded power supplies to test negative voltages (and ripple from SMPS supply, etc).
[/quote]
With AC you mean AC input? It's just an optional feature that might allow some more flexibility like generating extra voltages with just diodes and capacitors. I don't see how this is complicated, just pads for a bridge rectifier/diodes and a cap should be enough if we want to use it like DC, and would allow any polarity (at the cost of some voltage drop). They're easy to bridge if we want to skip it.

[quote author="rsdio"]
I don't think that you'll need any coils or transformers on the PCB, at least not if you can find an AC adaptor (with AC or DC output).
[/quote]
Agreed. The only magnetics might be in the buck converter (if we choose a SMPS), and possibly for filtering the output or PWM signals.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 15, 2010, 09:56:26 am
I meant the linear designs using opamps. I forgot about the TL4xx design a few pages back though. The linear design seems well worn, and I tend to go with the flow when I'm not an expert (like in analog design).

Yes, I also meant AC input.  Can someone contribute a circuit for the AC input, and check the linear regulator design for any mods to use negative voltages?  Experience and knowledge are the practical barrier to getting this into a first prototype. A sketch or napkin scan is fine, though the Eagle schematic is somewhere around here:
http://dangerousprototypes.com/forum/in ... 29#msg9329 (http://dangerousprototypes.com/forum/index.php?topic=822.msg9329#msg9329)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 15, 2010, 11:16:17 am
[quote author="ian"]Yes, I also meant AC input.  Can someone contribute a circuit for the AC input, and check the linear regulator design for any mods to use negative voltages?[/quote]A rectifier circuit is dead simple, so I was thinking that finding a way to avoid the typical 2 V rectifier drop might be of use.  The NXP PMEG3010BEP (http://http://www.nxp.com/acrobat_download/datasheets/PMEG3010BEP_1.pdf) might work, and the NXP PMEG3020BER (http://http://www.nxp.com/acrobat_download/datasheets/PMEG3020BER_1.pdf) handles 2 A continuous, 50 A peak, with a typical drop of only 460 mV, 520 mV max.

The regulator circuit design might be a little tricky, depending upon whether we can rely upon having a neutral or center tap from the AC source.  Otherwise, a center tap reference would have to created some other way.  Maybe jumpers?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 15, 2010, 04:57:23 pm
[quote author="ian"]
I meant the linear designs using opamps. I forgot about the TL4xx design a few pages back though. The linear design seems well worn, and I tend to go with the flow when I'm not an expert (like in analog design).[/quote]
I like the opamp design, too. Would like to get some feedback from tayken, since he appears to prefer the SMPS design, preferably with a dsPIC doing all the work. I'll try to spend more time on the op-amp design later. If the schematic is correct, the schematic will do 0V to somewhat below Vinput without any extra supplies. That would be cool, since most of these circuits (including the HP/Agilent E3620A) require a floating symmetrical supply around the output voltage. But I think further evaluation of Fen's circuit is a good idea (I think he suggested this, too). This is a pretty significant modification of the design used by HP/Agilent and tons of others, which use extra supplies for bias and the op-amps.

[quote author="ian"]
Yes, I also meant AC input.  Can someone contribute a circuit for the AC input, and check the linear regulator design for any mods to use negative voltages?  Experience and knowledge are the practical barrier to getting this into a first prototype. A sketch or napkin scan is fine, though the Eagle schematic is somewhere around here:
http://dangerousprototypes.com/forum/in ... 29#msg9329 (http://dangerousprototypes.com/forum/index.php?topic=822.msg9329#msg9329)
[/quote]
My first idea would be to use two AC wall warts (unless something like a center tapped or double secondary will wart exists), that would be the easiest, but not very elegant. I think splitting the rectified AC voltage in two with something like an op-amp would be hard because it would need to sink and source up to 1.5A or so. Plus lots of dissipation.

Another idea might be to use a voltage doubler (fancy arrangement of diodes and large capacitors), like a singe Delon circuit (http://http://en.wikipedia.org/wiki/Voltage_doubler#Bridge_circuit). I'm not sure how happy the doubler is if you draw lots of current from the center and how stable its voltage is, but it would be a neat solution. Only downside is that you need twice the capacitance you'd normally need (probably about 2x2200uF for 1.5A), and obviously twice the current rating on the wall wart. This would definitely be harder with DC input (eg. laptop supply). I've attached a quick schematic of what I mean in gschem. The 7x12s represent the linear regulator blocks. I've not simulated or thought this through to check if it works at all, let alone works well.

With a symmetrical power supply, we would need a negative version of this regulator (just like the 78xx and 79xx pair), this is probably not worth the effort. With two separate windings, we could just use the same regulator twice (saves design effort and reduces BOM). This is what almost everyone including HP/Agilent does. But it would require a transformer with two secondary windings or two transformers, which I think would require two wall warts.

[quote author="rsdio"]
A rectifier circuit is dead simple, so I was thinking that finding a way to avoid the typical 2 V rectifier drop might be of use.  The NXP PMEG3010BEP (http://http://www.nxp.com/acrobat_download/datasheets/PMEG3010BEP_1.pdf) might work, and the NXP PMEG3020BER (http://http://www.nxp.com/acrobat_download/datasheets/PMEG3020BER_1.pdf) handles 2 A continuous, 50 A peak, with a typical drop of only 460 mV, 520 mV max.[/quote]
Schottky rectifiers would help decrease the voltage drop, although I would be worried about the reverse voltage rating of 30V, especially if we go with a wall wart that delivers just enough voltage at 100V and almost too much at 250V, although it should be enough in a full bridge topology (where it will only see half of Vpp as long as none of them fails open).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 15, 2010, 07:24:35 pm
It seems like everybody wants to go with the linear design. :) I got the circuits but couldn't get my hands on an o-scope yet to make voltage ripple tests, but Dave's video gives some ideas. If fenugrec's circuit will not be a routing nightmare then it is way to go as everybody wants to use that. Plus voltage ripple is not a problem with the linear one.

Two wall-warts is impractical and expensive, I think. But Delon circuit can probably be used, I don't see any reason why it cannot be used.

Do we really need to use a bridge rectifier? Maybe we should use four separate Shottky diodes if a Shottky rectifier does not exist. But I couldn't understand why we cannot use a regular rectifier.

But if this way cannot be realized, we can use an inverting SMPS to supply negative voltages?

I think PWM with an LC filter can be used to set V and I references if an RC filter will give too much noise.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arhi on September 15, 2010, 10:29:58 pm
I'm following this thread for a while now but I have to say I have no idea where the project is attm :(

Few hints (that might already be in the thread but that I missed - apologize if I bring back something already discussed but I went trough all 10 pages now again and I didn't find any of this)

- wrt "reverse input protection" - if the input to the "device" is DC the way I usually solve the "reverse protection" is not by using 4 diodes (and lose 2V + produce heat) but one diode across the input and fast fuse so if you attach source in reverse the diode will make "short" and fuse will blow. If there's no room for the fuse, then I use only one diode on one input lead so if you switch +/- on the input the device will just not get any power

- wrt "precission/calibration" - there are fairly cheap, very precise voltage references out there - 1V, 1.6V, 2V, 2.4V, 2.5V ... so imho using proper voltage reference would allow for simple calibration (as you have a "known" value to compare everything else to

- wrt ADC precision, 0-12V sampled at 8bit gives 0.05V precision, 10bit gives 0.012V ... I believe anything over 10bit will just bring in noise, nothing else, and "any" dsPic can handle 10bit adc at high sampling speed

- wrt DAC, a friend used LTC1590 (2x12bit dac) with great results (I attached his schematic but it is not finished, it works but he want to add much more stuff to it but might give someone some ideas)

- wrt reading the values from shunts / dividers, programmable gain op amps are imho the answer, they solve the "auto ranging" problem without losing precision and without adding noise, check out
  PGA: http://www.microchip.com/wwwproducts/De ... e=en010483 (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010483)
  R2R PGA: http://www.microchip.com/wwwproducts/De ... e=en021311 (http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en021311)

- wrt input - for 0-30V AC2DC non switching regulator I usually suggest AC transformer with 6/12/24/30V output and a relay that would switch to the proper input depending on the output so you decrease power dissipation on the power transistors (or whatever you use to drive the output)... since this project looks like 0-12V under 2A it is not that important (I even thing there's too much philosophy as initial idea with digital resistor was actually going to work, maybe using 12bit dac instead of digital resistor would be even nicer but with current below 2A and voltage below 12V it's basically very simple ... why make it so complex?)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 15, 2010, 10:40:57 pm
[quote author="alm"]Schottky rectifiers would help decrease the voltage drop, although I would be worried about the reverse voltage rating of 30V, especially if we go with a wall wart that delivers just enough voltage at 100V and almost too much at 250V, although it should be enough in a full bridge topology (where it will only see half of Vpp as long as none of them fails open).[/quote]Would that "voltage doubler" circuit work better with a full-wave rectifier?  i.e. smoother output from the capacitor and regulator?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 16, 2010, 12:07:42 am
[quote author="arhi"]
- wrt input - for 0-30V AC2DC non switching regulator I usually suggest AC transformer with 6/12/24/30V output and a relay that would switch to the proper input depending on the output so you decrease power dissipation on the power transistors (or whatever you use to drive the output)... since this project looks like 0-12V under 2A it is not that important (I even thing there's too much philosophy as initial idea with digital resistor was actually going to work, maybe using 12bit dac instead of digital resistor would be even nicer but with current below 2A and voltage below 12V it's basically very simple ... why make it so complex?)
[/quote]
An AC transformer with multiple taps would be nice, but since we want to avoid bringing the user into contact with mains, a wall wart with AC output currently seems the best option. If you can suggest an enclosed transformer (like a wall wart) with multiple taps, that would be great.

The issue with simpler solutions is usually that you can't regulate the voltage below a certain value (eg. 1.25V) and that you don't have variable current limiting unless you make it almost as complex as this. I did propose a dual LM317 scheme (something like this (http://http://www.uploadarchief.net/files/download/co%20labvoeding%20v2_b.pdf)), but the op-amp idea is more tried and true (at least the original version before Fen's modifications).

[quote author="tayken"]
Do we really need to use a bridge rectifier? Maybe we should use four separate Shottky diodes if a Shottky rectifier does not exist. But I couldn't understand why we cannot use a regular rectifier.
[/quote]
There are Schottky bridge rectifiers, the issue is finding one that has enough current capacity, reverse voltage range, and is cheap. The only issue with silicon rectifiers is the voltage drop, which could be an issue if we use a relatively low voltage wall wart. I think the Schottky rectifier came along when we were planning for both DC and AC input. 2V voltage drop for a 12V DC wall wart is pretty significant. I don't think it's as much of an issue with 24VAC, which is about 33Vpp. It might be an issue if we go with the almost too low at 100V, almost too high at 250V solution.

[quote author="tayken"]
But if this way cannot be realized, we can use an inverting SMPS to supply negative voltages?
[/quote]
In that case I would vote for both supplies to be switching, to keep the design simple. But I think switching supplies (at least the transformerless designs like buck and boost) have exactly the same issue: For a symmetrical output, you either need two supplies of opposite polarity (one inverting and one non-inverting, or one positive and one negative), or two floating inputs so you can connect the negative output terminal of the first regulator to the positive output terminal of the second. I don't think any of the common SMPS topologies can both sink and source current (which you would need if you stacked two positive supplies).

[quote author="rsdio"]
Would that "voltage doubler" circuit work better with a full-wave rectifier?  i.e. smoother output from the capacitor and regulator?
[/quote]
Yes, but the catch is that that one requires a center tap (at least the version I'm aware of), so we're back to square one ;). Might as well directly use that center tap, since we don't really care about doubling the voltage. A switchable voltage doubler would be a nice way to handle the 115V/230V issue, although we couldn't use it for creating a center tap at the same time. This one is actually using the full wave of the AC signal (except the part between +/- one diode drop), so it should be pretty efficient on the transformer if you load both power supplies. The positive part goes into the top capacitor, and the negative part into the lower one. But both sides are only driven from a half wave, so you need double the capacitance to keep the ripple from increasing.

I just did an LTspice simulation (circuit attached) of the Delon voltage doubler, and it behaved just as expected. Ripple is about 5Vpp each with a pulsating 1.5A load (about .75A avg) with 2200uF capacitance per side with an ESR of .05ohm (which seems a pretty typical value for non-low-ESR types). With 1.5A constant load on each side, the ripple is about 10Vpp, so we would need extra capacitance for 1.5A capacity. Increasing capacitance to 2x4700u decreases the ripple at 2x1.5A to 5Vpp again, which would give us 18V minimum at the input of the regulators with 24Vpp input. More capacitance wouldn't hurt, but would probably be expensive and bulky. I used 50Hz since this is the worst case scenario, ripple at 60Hz will be less. I used SS24 Schottkys because these were the first 2A diodes I found, I don't think Schottky is necessary here, any diode with enough current capacity (more than 2A would probably be better) should be fine.

With a symmetrical input (like the voltage doubler), we would have to design a negative version of whatever regulator we use (for example the final linear design from Fen), replacing all transistors by those of opposite polarity, reversing all diodes, move the connections to the op-amps around and turn the electrolytic caps around. Plus we would have to test it separately, since NPN transistors are not identical to PNP, and op-amps behavior different in inverting and non-inverting configurations. Having two similar but inverted layouts might also increase the risk of assembly errors (like the one LED on the Bus Pirate v3). Just doing the same regulator twice would be easier and less risky, but would require to separate secondaries. I'm not actually aware of any negative polarity lab supplies (you usually just stack two positive regulators, since they're floating anyway).

PS: Ian, any chance you can add .asc to the list of allowed file types?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 16, 2010, 01:22:10 pm
The dual LM317 with the digital pot was my starting point :) I take it you could do the same with a LM317 and op-amp.

I added .asc to the allowed file types.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 16, 2010, 05:31:16 pm
[quote author="ian"]
The dual LM317 with the digital pot was my starting point :) I take it you could do the same with a LM317 and op-amp.
[/quote]
I think you'd need two op-amps, and would basically be using the LM317 as a fancy power transistor, and be just as complex as the current idea. You do need some kind of OR circuit of the current and voltage regulation. Only two of the op-amps in Fen's circuit (IC1B and IC1C) are actually critical for regulation, I think. IC1D looks to be just for current measurement, and IC1A to amplify the signal from the DAC to the voltage regulator.

About the symmetrical power supply, I just remembered a commercial design of a lab supply with negative polarity: the Tektronix PS503A (and probably a few hundred others I'm not aware of). It uses both a positive and negative power supply, with opposite polarity transistors, but the two parts are not identical, some changes were probably necessary to compensate for different behaviors. It's not terribly stable, I've got it to oscillate by adding about a meter of wires (inductance) between the input filter cap and the circuit.

One issue with making Fen's design negative polarity is that the LM324 output voltage range is 0V to V+ - 1.5V. So in a negative polarity supply, it wouldn't be able to go below something like 1.5V - Vbe. But if we have symmetrical inputs, we could use the opposite polarity as 'negative' potential.

I think I found an error in Fen's schematic (he didn't present it as a finished product), Q1 was a Darlington in the Agilent design (not indicated in the schematic), and I don't see how a regular MJE3055 will have enough gain for the base current for R2 to be enough. I'm also not a fan of the 'constant current source' provided by (Vin-Vb(Q1))/R2, which will vary with output voltage. Can't imagine how Spice approved of this, unless the output voltage was low and it was optimistic about the Hfe of Q1. Either that, or I'm wrong, which is possible. Will try to study this in more detail and come up with an updated schematic.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 17, 2010, 03:13:52 pm
According to LTspice, the beta of the MJE3055T at ~350mA collector current is 160, I find this really optimistic, it's even higher than the typical curve from the Fairchild datasheet at its highest point (200mA), let alone worst case (which you should design for).

My suggestion is to move closer to the original Agilent schematic again. It appears to me that with the symmetrical input and AC, we should be able to copy the symmetrical supply around Vout for the op-amps.
- Change Q1 to a Darlington, probably from two discrete transistors since I believe these work better than monolithic Darlingtons.
- Bring back the symmetric power supply. I think we can do this with just linear regulators, without using the extra transformer windings. We create the positive voltage (for the positive regulator) from the input voltage with for example a 5V LDO, we connect the ground terminal to the output voltage (just like label A2 in the Agilent schematic). This would require Vin to be at least about 5V + dropout voltage + Vbe above Vout. Will have to check if this setup is stable enough. This might increase dissipation or limit current/voltage, we might be able to use a voltage multiplier trick for this, it's only low current, so small cap. The negative voltage comes from the opposite polarity (negative) input, with a linear regulator (preferably the same model as used for the negative voltage for the negative polarity regulator, but LDO not necessary). Voltage range might be an issue with this regulator, since it will see Vout+ - Vin- at the input. We might be able to avoid the negative voltage for the positive regulator (the LM324's output voltage range includes the negative rail), but for simplicity sake, I'd like to keep both designs as close as possible. I'll draw a diagram if this explanation doesn't make sense.

We need at least a positive supply for the negative regulator (LM324 can't come close to positive rail). We need something like the negative supply for the negative regulator (and positive supply for the positive regulator) for the current source, although we could also use a transistor-based current source in its place, which would require less voltage overhead. In my opinion, it's easier to feed op-amps with supply rails that are far from any input or output voltages, no worry about running into rails. It makes our work easier and less risky by allowing us to remain closer to the (tried and true) Agilent schematic. It might increase the number of passives, but this shouldn't increase costs by too much (all can be low power SMD).

I'll try to find time to create a schematic in LTspice this weekend, will have to spend some time really understanding the Agilent schematic first. If anyone notices anything stupid or violently disagrees, feel free to point that out before I waste any time ;).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 20, 2010, 07:57:03 pm
- I liked the idea of using precise voltage sources which was suggested by arhi. We might also use the PGA idea suggested by him.

- wrt negative voltage SMPS idea before: I first thought of suggesting a voltage inverter but there might be current issues related to them. But MC34063 can be used to generate negative voltages, so we can design the linear regulator stage with + and - supplies and outputs. We can also route these positive and negative supplies to Vref pins of the ADC and get signed measurements. Any objections to this idea?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 20, 2010, 08:56:01 pm
[quote author="tayken"]
- I liked the idea of using precise voltage sources which was suggested by arhi. We might also use the PGA idea suggested by him.
[/quote]
For the ADC? Sure, as long as it's significantly better than the built-in reference in the PIC and the rest of the circuitry makes the extra accuracy worthwhile. Not much point in using a voltage reference much more accurate than the voltage divider. PGA sounds like a good idea, as long as the voltages are within the PGA's input range (although we could put a fixed divider in front of the PGA), and it's not too expensive. Isn't this PGA programmed by connecting various pins to ground/Vcc? But I'm sure we can hook PIC GPIO pins to the programming pins. It would save us (relative) precision resistive dividers, if it's indeed accurate enough.

For the power supplies, it's probably not worth the effort, but you'd probably have to replace the regulators for the op-amp power supplies by more stable versions, and replace the op-amps by something with less offset and noise.

[quote author="tayken"]
- wrt negative voltage SMPS idea before: I first thought of suggesting a voltage inverter but there might be current issues related to them. But MC34063 can be used to generate negative voltages, so we can design the linear regulator stage with + and - supplies and outputs. We can also route these positive and negative supplies to Vref pins of the ADC and get signed measurements. Any objections to this idea?
[/quote]
I don't understand how this fits in with the current idea. Do you mean the symmetric power supply for the op-amps? Or the input for the negative regulator? The former idea would work fine, I guess, as long as PSRR of the op-amps is enough to reject the noise. But I'm not sure if it's necessary, since we already have a supply of opposite polarity for the other regulator. A boost converter for the positive supply above the output voltage (for positive regulator) might be a good idea, but I'd prefer a solution with lower parts count (something like diode, capacitor and linear regulator). These are low-current supplies (only op-amps and base currents, probably <<100mA or so), so simplicity and parts count are the most important, and efficiency is irrelevant.

I've made a rough schematic of what I meant in my previous post about symmetrical supplies for the op-amps. Q1/Q2 are the pass transistors (other transistors and op-amps omitted because I'm lazy^W^W^Wfor simplicity sake). D2/C2/D3/C3 are the voltage doubler that produce a symmetrical power supply (with a significant amount of ripple, since we want to keep our caps as small as possible for price, board real-estate and transformer loading). V+out and V-out are the outputs from the supply. V+cc/V+ee/V-cc/V-ee are symmetrical supplies around this potential for the op-amps. The input for the V+cc and V-ee regulators is about 1 diode drop below the peak input voltage, since there's very little loading, there's almost no ripple (as long as the capacitor is not too small). The 7x12 are arbitrary, they could probably be a much lower voltage (+/- 5V?), and could be LDO. As always, completely untested ;). But I think it should work since there's a significant voltage drop over the pass transistors (Darlington's can't saturate) and a significant ripple, so the max Ve is probably significantly below the peak output voltage from the doubler. But feel free to point out flaws and come up with alternative solutions.

The V+cc and V-ee might not be necessary, if we just use a current source for the base current, will have to spend more time with both the Agilent schematic and Fen's modifications to figure that out, didn't have time this weekend. Will also have to find a better Spice model for at least the power transistor. Don't feel obligated to wait for me, will probably take another week or so. Feel free to come up with other solutions.

If we use DC input, I see no way around a SMPS, but for AC, the voltage doubler seems like a nice solution. Can't imagine SMPS to be much cheaper than the extra capacitance, although it would be smaller. Price would be extra noise and complexity. Both are fair solutions depending on trade-offs.

Edit: just noticed that I missed the connection between C2/C3 and common. Can't edit it now, will fix it in next revision. But I wanted to mention it in case anyone gets confused.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 21, 2010, 10:39:53 am
[quote author="alm"]
[quote author="tayken"]
- I liked the idea of using precise voltage sources which was suggested by arhi. We might also use the PGA idea suggested by him.
[/quote]
For the ADC? Sure, as long as it's significantly better than the built-in reference in the PIC and the rest of the circuitry makes the extra accuracy worthwhile. Not much point in using a voltage reference much more accurate than the voltage divider. PGA sounds like a good idea, as long as the voltages are within the PGA's input range (although we could put a fixed divider in front of the PGA), and it's not too expensive. Isn't this PGA programmed by connecting various pins to ground/Vcc? But I'm sure we can hook PIC GPIO pins to the programming pins. It would save us (relative) precision resistive dividers, if it's indeed accurate enough.
[/quote]
This might be used for calibration purposes. A few jumpers can put the unit to calibration mode. Or we can build some test points for a calibration card which can be used to calibrate the unit from time to time. Just a thought.

[quote author="alm"]
[quote author="tayken"]
- wrt negative voltage SMPS idea before: I first thought of suggesting a voltage inverter but there might be current issues related to them. But MC34063 can be used to generate negative voltages, so we can design the linear regulator stage with + and - supplies and outputs. We can also route these positive and negative supplies to Vref pins of the ADC and get signed measurements. Any objections to this idea?
[/quote]
I don't understand how this fits in with the current idea. Do you mean the symmetric power supply for the op-amps? Or the input for the negative regulator? The former idea would work fine, I guess, as long as PSRR of the op-amps is enough to reject the noise. But I'm not sure if it's necessary, since we already have a supply of opposite polarity for the other regulator. A boost converter for the positive supply above the output voltage (for positive regulator) might be a good idea, but I'd prefer a solution with lower parts count (something like diode, capacitor and linear regulator). These are low-current supplies (only op-amps and base currents, probably <<100mA or so), so simplicity and parts count are the most important, and efficiency is irrelevant.
[/quote]
Yes, symmetric power supply for op-amps if we have use a DC input. I, too, prefer something with a lower parts count but only solution if we use DC input. It is probably not necessary for AC input the way I see from your post.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 21, 2010, 08:25:46 pm
[quote author="tayken"]
This might be used for calibration purposes. A few jumpers can put the unit to calibration mode. Or we can build some test points for a calibration card which can be used to calibrate the unit from time to time. Just a thought.
[/quote]
I think the money and effort is better spent on improving intrinsic accuracy (use more accurate reference for ADC, more accurate dividers/PGA, better filtering for signal / power supply, better ADC). If we have more accurate/stable parts, use these in the main circuit instead of using them once a year for calibration. People can probably use the lab power supply and a DMM for calibration: connect power supply to ADC input and DMM, adjust until DMM reads exactly 1.000V, click calibrate, repeat for 10.00V, 100.0mV and 10.00mV. DMM's are pretty accurate and ubiquitous. Use the same voltage for 100% of lower range and 10% of next range to save time. Calibration constants can be stored in EEPROM.

[quote author="tayken"]
Yes, symmetric power supply for op-amps if we have use a DC input. I, too, prefer something with a lower parts count but only solution if we use DC input. It is probably not necessary for AC input the way I see from your post.
[/quote]
Agreed, we can't do the peak voltage trick with DC. But we would need an inverting SMPS anyway for the negative input voltage, unless we use the dreaded two wall warts or one wall wart with symmetrical output (if such a beast is cheap and readily available). Can't do voltage doubler from DC, and I don't know any other way of splitting the voltage without dissipating lots of power or building an SMPS. If we use an SMPS for the negative voltage, we might evaluate if we skip the linear post-regulator all together (depending on parts count and noise). My current idea pretty much requires an AC output (transformer-only) wall wart with enough power (rough guess: 18Vrms/5A or so if we want 2x15V, 2x1.5A output?). Output voltage and current upper limit can be lowered as far as I'm concerned.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arhi on September 21, 2010, 11:38:37 pm
wrt refference - they are "very cheap" and they don't require any "additional circuitry" - just a 3 pin device Vdd, Vss and output. The output you connect to pic as vref and that's about how complex it is ?!?!? donno what you are talking about when you mention "complexity". You might want to add few capacitors to have more stable output but that's it, 1uF is more then enough. This way ADC gives you result in relationship to known value (voltage reference) and not in relationship with unknown value (Vdd)

wrt pga, the ones I used (from microchip) have SPI bus that you use to "program the gate" ... no jumpers needed here

The idea of using voltage reference and pga's is to have "known" values you compare your input from (so you know exactly what aplification op-amp will have and exactly what voltage is read by adc). There's no other way to have this values "known" (as your 7805 or 7803 or whatever regulator you use will always be +-0.3V or even worse, depending what regulator and who made it giving you 0.5V error converting ADC value to voltage - minimum if you use Vdd as Vref, but with voltage reference as Vref you get this to under 0.001V)

wrt calibration - you don't use this once a year to calibrate - you use it ALL THE TIME !!! ... the pic have Vref pin and you hook up the reference to this pin and configure adc to use it and that's about it - it is "auto calibrating all the time" .. you use the PGA-OPAMP instead of normal OPAMP + digital trimmer so instead of changing resistors defining the amplification factor, you bloody tell the opamp what amplification factor you want .. Idon't get the "use better parts" - THESE ARE THE BETTER PARTS ?!?!
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on September 22, 2010, 12:37:43 am
I agree with "arhi."  Any design based on ADC should have a voltage reference, not just a mere voltage regulator.  Some ADC chips have a built-in voltage reference, others require an external one.

The present design I am working on uses the Texas Instruments $2.72 REF5025AID (http://http://focus.ti.com/docs/prod/folders/print/ref5025.html), which is pin-compatible with the Maxim MAX6192AESA+ (http://http://www.maxim-ic.com/datasheet/index.mvp/id/1917)  They're available in various voltages like 2.048 V, 2.5 V, 3 V, 4.096 V, 4.5 V and 5 V.  To that common list, Texas Instruments adds 10 V, while Maxim adds 1.25 V.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 22, 2010, 01:06:46 am
[quote author="rsdio"]
I agree with "arhi."  Any design based on ADC should have a voltage reference, not just a mere voltage regulator.  Some ADC chips have a built-in voltage reference, others require an external one.
[/quote]
Can't remember anyone disagreeing with that, as long as the improvement over the internal reference (not much point in replacing a 0.5% internal reference by a 0.1% reference if you use 1% resistors as divider). I only disagreed with adding extra references for calibration purposes, I would rather use that money to buy a better reference for the ADC (or better ADC/PGA/whatever). Plenty of better references if you want to spend money, all the way up to the LTZ1000 which probably costs more than the total BOM of this project and wouldn't make sense at all.

I don't really understand the point arhi's latest post. Apart for correcting me on the SPI bus (thanks for that, I must have been confused with other PGA's), I don't see what he's responding to. I don't think anyone suggested using a 780x for ADC reference, and I see no need to shout about the PGA. I thought both I and tayken responded pretty positive.

By the way, don't the ADC channels need some sort of differential (ideally floating) inputs? Apologies if this was already decided, I haven't payed much attention to the ADC inputs yet. What's the current idea about that? I assume the power supply for the PIC/ADC is connected to the common output of the lab supply, since we don't want yet another wall wart. We want to measure the voltage between any two points (eg. over a high-side shunt), so connecting all negative sides together wouldn't work. Can the PGA's accept differential inputs? We have symmetrical supplies for the lab supply (if ADC ground is connected to lab supply ground), so that would give us a common mode range of -15V to +15V or so, which together with a fixed divider should do, if offset is low enough that it won't compromise accuracy at low ranges.

What about the isolation, how do we do that? A separate PIC/FT232 fed from USB power (will be turned off when USB is not plugged in) and isolated UART/SPI to the dsPIC? Or do we isolate the dsPIC from the lab power supply and ADC inputs somehow? Where would the dsPIC get its power from? USB? Requiring it to be connected to USB may be a fair trade-off, since you can't monitor or control it any other way.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 22, 2010, 09:55:34 am
For isolation - it's not great for speed, but it would be easy to use the PIC UART to a FT232 chip and isolate there. FT232 is powered by the USB, PIC is powered from a local regulator.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 26, 2010, 03:45:25 am
Hi guys, sorry I've been away from this thread for so long... I'm still interested though.

alm said:
Quote
I think I found an error in Fen's schematic (he didn't present it as a finished product), Q1 was a Darlington in the Agilent design (not indicated in the schematic), and I don't see how a regular MJE3055 will have enough gain for the base current for R2 to be enough. I'm also not a fan of the 'constant current source' provided by (Vin-Vb(Q1))/R2, which will vary with output voltage.

Thanks for looking at the design in detail. I was afraid nobody would go so far! Indeed, I didn't "select" the pass transistor, I just took one for which I had a SPICE model (I forgot HP used a darlington). You're right, it probably only has a hFE of 15-20 at Ic=1A. You're also right that the bias resistor is probably inadequate in a large number of conditions.

Just to clarify some of the features of the linear stage I posted some time ago ( http://dangerousprototypes.com/forum/in ... 87#msg9187 (http://dangerousprototypes.com/forum/index.php?topic=822.msg9187#msg9187) ) :
1- it will regulate down to 0 volts, without requiring a negative supply, if the op-amps are well chosen (LM358 should work, I can't say how well though)
2- op-amps U1, U2, and their compensation network (absent on the SPICE schem I drew), are critical. To repeat myself once more : it's farily easy to mess up the component choice, and have a supply that sorta-works but will be unstable. Unstable to the point that you can get substantial oscillation on the output. Or just terrible transient load change response. It's a great topology, and very flexible, but more delicate than a single LM317.

Misc thoughts:
- having two symmetrical regulators is nice but a bit restrictive for those times when you would really need a 12V supply and a 5V supply. Sure you can set one supply to 7V and the other to -5V, but it's still not great. The best is two floating regulator outputs.

- for an initial release, I think it should be most basic. Straight DC-input with polarity protection is most important, and the .3 or 0.4V drop caused by a series diode is insignificant. Or use a "crowbar" type circuit with an input fuse (useful in any case) with a diode to ground.

- I don't like AC-input with voltage-doublers: how do you accomodate the unknown range of voltages that a user might use ? Supplying 1A (or 1A + 1A) will put a lot of strain on capacitors (high ripple current). Also, if you don't want huge 60Hz ripple you want large capacitorvalues, which are expensive and physically large.

-whether to float the output needs to be decided. One thing is for sure : the very desirable flexibility automatically means it will be more complex & more expensive. Is it worth it ? In my experience, it's a nice feature, certainly worth a few extra $. I'll also vaguely quote someone on this thread (I think it was rsdio) concerning the basic utility of a lab supply :
Quote
If I need to use a lab supply, it's either because A) I don't have a supply built yet (unknown requirements) or B) I'm troubleshooting and suspecting the regulator

-I really see no need for a dsPIC. I think almost everyone now agrees that we're not going to kludge up a software feedback loop, therefore the requirements for the regulating uC would be:
 *a bunch of ADC channels for metering the output (10-bit is plenty enough, this is not a 5-digit calibrated multimeter);
 *either a couple DAC channels or PWM outputs that are capacitor-filtered to give variable DC.
I would tend to prefer a DAC solution here since filtered PWM inherently has ripple, and possibly a slow response time.
Now here's the catch. The most basic USB-enabled PIC is about 3$. Mchip lists the new 18F13K50 @ 1.30$ in large quantities. But at that price you don't get a DAC!
If you want USB + DAC, I actually haven't found any PIC that had more than 2 DAC channels. In any case it would be expensive, like 6-10$ , and wouldn't easily be opto-isolated.
That leads me to the next point :

-if a DAC chip is used in addition to the USB-speaking chip (PIC or FT232), it becomes easy(er) to add opto-isolation and have fully floatable outputs. But then you want to meter the output, so you also need ADCs on the isolated side ! At this point it would then sound justified to add a small, very basic PIC on the isolated side, which would serve only to monitor and steer the regulator. I like this idea, but one thing to consider is how much cost overhead it adds if we need to program 2 or 3 MCUs. Ian ?

To summarize : floating outputs are nice to have, but significantly more complex and expensive. I would opt for a single-channel, single-output version 01 with modest, but solid features. I'm attaching a symbolic diagram of what I have in mind.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 26, 2010, 10:37:38 am
In general the cost of each small component and programming is pretty insignificant (depending on part cost, obviously) compared to the setup fee.

My preference would probably be an FT232 chip on the PC side, and whatever PIC on the power supply side. If a DAC is used to set the supply, then an external DAC chip is probably best for cost and to stay in SPEC (the PIC DAC audio-only discussion from earlier).

Floating outputs are great, but if it adds a lot of trickery to isolate it could be a further drag on getting a real v1 out.

Quote
1- it will regulate down to 0 volts, without requiring a negative supply, if the op-amps are well chosen (LM358 should work, I can't say how well though)

I didn't realize this. I think we've all be discussing it from the perspective that negative voltage is required for 0v-0.6v output.

Quote
2- op-amps U1, U2, and their compensation network (absent on the SPICE schem I drew), are critical.


Could anyone following this thread please contribute a little more about this. A discussion or napkin sketch could be enough to help me work it into the schematic.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 26, 2010, 05:14:20 pm
Hi,

[quote author="ian"]
My preference would probably be an FT232 chip on the PC side, and whatever PIC on the power supply side.

Floating outputs are great, but if it adds a lot of trickery to isolate it could be a further drag on getting a real v1 out.

Quote
2- op-amps U1, U2, and their compensation network (absent on the SPICE schem I drew), are critical.


Could anyone following this thread please contribute a little more about this. A discussion or napkin sketch could be enough to help me work it into the schematic.
[/quote]

Re FT232 : do we have a usable PIC18-compatible USB stack ? I.e. can the BP4 stack be adapted to this project ? The same command-response structure could be used, or we could implement our own vendor requests/replies , with interrupt transfers. As I mentioned devices like the 18F13K* are quite nice, and a lot cheaper than an FT232. Plus they have an internal 1.024 / 2.048 / 4.096V reference for the ADC !

I think we should really keep floating outputs for a v2... Besides v1 will still be quite usable for a lot of people in a lot of typical situations.

As for the compensation networks, this is really at the limit of my knowledge, and will ultimately depend on the pass transistor, the drive trans, the output capacitor, and the op-amp type. If you recall the HP schematic, the op-amps all had small capacitors around them. In my SPICE schem I left them out except for a ~100p cap near the current-limiter. It slowed the response of the limiter, but consequently also added a bit of overshoot (the limiter set to 1A would still allow a short period of >1A output before cutting in).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 26, 2010, 09:26:07 pm
Quote
do we have a usable PIC18-compatible USB stack ? I.e. can the BP4 stack be adapted to this project ?

We can use the Microchip stack without distributing the source. There is also the zygote of an opensource USB stack, but it is still a work in progress. It's in the Bus Pirate dev-forum.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 26, 2010, 09:45:39 pm
Just some thoughts and questions:
- How about negative output? Or is the initial release will be positive output only? I don't require any negative output but I think some people were talking about it.
- DC input only is a good choice for simplicity. We might even put some pads in a square design so that people might change center positive to center negative with a quick de-solder & re-solder process.
- No dsPIC for sure, just a regular PIC for control purposes. No internal DAC as the only ones I could find were for audio applications, they were not recommended for control applications. I would suggest that we use FT232 for USB isolation purposes and for the initial design. Later we might choose to put another PIC for USB communication purposes.
- For the initial release we might go for PWM + caps instead of a seperate ADC IC. Lets see its performance, if it is really poor, then we can go for the ADC IC in the real design.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arhi on September 26, 2010, 10:16:19 pm
[quote author="alm"]
I don't really understand the point arhi's latest post. Apart for correcting me on the SPI bus (thanks for that, I must have been confused with other PGA's), I don't see what he's responding to. I don't think anyone suggested using a 780x for ADC reference, and I see no need to shout about the PGA. I thought both I and tayken responded pretty positive.
[/quote]

I most probably misunderstood your post...

anyhow, the whole adc/pga is only important for one segment, the segment that will be generating the voltage needed is much more important (and the part I know ziltch about)... I would like to see 3-5A more then 1-2A .. but .. maybe it would be cool to make the project out of 2 segments where one segment does the read/write and the other segment does the "power" stuff so one can easily change the power segment to get 5A or 10A if needed :) :) :)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 27, 2010, 09:07:13 am
[quote author="fenugrec"]
Thanks for looking at the design in detail. I was afraid nobody would go so far! Indeed, I didn't "select" the pass transistor, I just took one for which I had a SPICE model (I forgot HP used a darlington). You're right, it probably only has a hFE of 15-20 at Ic=1A. You're also right that the bias resistor is probably inadequate in a large number of conditions.
[/quote]
Nothing wrong with the pass transistor, but it would require a second transistor to make it a Darlington. I also wouldn't trust the spice model. If the hFE is so inaccurate, what else did they get wrong?

About the R2, I think a transistor/JFET constant current source would be better, since HP used a resistor to a constant voltage above Ve(Q1). No need for great accuracy, it just should be better than between 14V/R2 (almost zero output voltage) and 2V/R2 or so (max output voltage). Something like -50%/+100% should be fine.

[quote author="fenugrec"]
Just to clarify some of the features of the linear stage I posted some time ago ( http://dangerousprototypes.com/forum/in ... 87#msg9187 (http://dangerousprototypes.com/forum/index.php?topic=822.msg9187#msg9187) ) :
1- it will regulate down to 0 volts, without requiring a negative supply, if the op-amps are well chosen (LM358 should work, I can't say how well though)
2- op-amps U1, U2, and their compensation network (absent on the SPICE schem I drew), are critical. To repeat myself once more : it's farily easy to mess up the component choice, and have a supply that sorta-works but will be unstable. Unstable to the point that you can get substantial oscillation on the output. Or just terrible transient load change response. It's a great topology, and very flexible, but more delicate than a single LM317.
[/quote]

I have some doubts about your design, even though you appear to know more about this:
1. How's the stability of Q3 without emitter resistor? Isn't it very sensitive to tiny Vbe and temperature variations, making it hard to keep stable?
2. The HP design of Q1/Q6 appears be temperature compensated, since the Vb(Q6) is at about the same level as Ve(Q1). Your design isn't, which may make the job of the op-amps harder.
3. Why isn't this topology used in other lab supplies? All commercial designs I'm aware of use a negative and positive voltage relative to the output voltage. Even in a commercial design, this has to add some extra costs, why do they use it if they could easily omit it? There has to be some downside, it's not like an LM324 is a recent invention.
4. In general, the major changes compared to the original design makes me somewhat uncomfortable without doing extensive analysis and testing. Hence my preference for something closer to the HP design if we can (doesn't add much costs with the symmetrical design).

If you're convinced that it will work fine, I'm willing to believe that. But if I would have to build it, I would go for a more conservative design.

[quote author="fenugrec"]
- having two symmetrical regulators is nice but a bit restrictive for those times when you would really need a 12V supply and a 5V supply. Sure you can set one supply to 7V and the other to -5V, but it's still not great. The best is two floating regulator outputs.
[/quote]
Agreed, but not possible without two floating inputs (two wall warts).

[quote author="fenugrec"]
- for an initial release, I think it should be most basic. Straight DC-input with polarity protection is most important, and the .3 or 0.4V drop caused by a series diode is insignificant. Or use a "crowbar" type circuit with an input fuse (useful in any case) with a diode to ground.
- I don't like AC-input with voltage-doublers: how do you accomodate the unknown range of voltages that a user might use ? Supplying 1A (or 1A + 1A) will put a lot of strain on capacitors (high ripple current). Also, if you don't want huge 60Hz ripple you want large capacitorvalues, which are expensive and physically large.
[/quote]
I agree with the downsides of AC input. Input voltage could be compensated by two wall warts (110V and 230V version). About 4700uF/25V or so per side was required according to my spice simulations. Not enormous, but not small or very cheap either. It is the only way I see to offer symmetrical output with a linear supply and one wall wart, however, which is nice. Another issue is that I wouldn't trust all cheap DC wall warts to be stable and safe for delicate electronics (like the leakage issue (http://http://www.aplomb.nl/SMPS_leakage/Doc_ie.html) and wall wart suicide issue I referred to earlier). Designing/manufacturing an AC wall wart is much harder to screw up.

[quote author="fenugrec"]
-whether to float the output needs to be decided. One thing is for sure : the very desirable flexibility automatically means it will be more complex & more expensive. Is it worth it ? In my experience, it's a nice feature, certainly worth a few extra $. I'll also vaguely quote someone on this thread (I think it was rsdio) concerning the basic utility of a lab supply :
Quote
If I need to use a lab supply, it's either because A) I don't have a supply built yet (unknown requirements) or B) I'm troubleshooting and suspecting the regulator
[/quote]
I don't think extra parts will be too bad, some opto's and an extra PIC/FT232. Supply for the grounded part can be USB.

[quote author="fenugrec"]
-I really see no need for a dsPIC. I think almost everyone now agrees that we're not going to kludge up a software feedback loop, therefore the requirements for the regulating uC would be:
 *a bunch of ADC channels for metering the output (10-bit is plenty enough, this is not a 5-digit calibrated multimeter);
 *either a couple DAC channels or PWM outputs that are capacitor-filtered to give variable DC.
I would tend to prefer a DAC solution here since filtered PWM inherently has ripple, and possibly a slow response time.
[/quote]
Agreed.

[quote author="fenugrec"]
-if a DAC chip is used in addition to the USB-speaking chip (PIC or FT232), it becomes easy(er) to add opto-isolation and have fully floatable outputs. But then you want to meter the output, so you also need ADCs on the isolated side ! At this point it would then sound justified to add a small, very basic PIC on the isolated side, which would serve only to monitor and steer the regulator. I like this idea, but one thing to consider is how much cost overhead it adds if we need to program 2 or 3 MCUs. Ian ?
[/quote]
The reason for considering an FT232 was that we don't really need more than an USB interface on the grounded side. We could isolate the UART connection and connect the PIC to lab supply ground. I've used the small MCU per output on the isolated side in the past, because an SPI/I2C ADC is not much cheaper, and the MCU can also control the DAC's and switch some other stuff (I had relays for tap switching). With multiple channels, we would need more intelligence on the grounded side, since we would need to control two outputs with one UART. Using an FTDI device with dual UART is ugly in my opinion, and probably even more expensive.

[quote author="fenugrec"]
To summarize : floating outputs are nice to have, but significantly more complex and expensive. I would opt for a single-channel, single-output version 01 with modest, but solid features. I'm attaching a symbolic diagram of what I have in mind.
[/quote]
Not sure if the extra complexity for a single channel is that bad. What's wrong with a single FT232 (or USB PIC doing something similar) and two opto's? Another advantage of an isolated power supply is that you get protection of your USB port from connecting the output to something like mains for free. The choice of single vs. dual output depends on our choice of input. If we want two fully floating outputs, we would need two wall warts, so it would basically be a copy/paste job. Only the grounded side would be more complex (USB pic or FT232 + PIC with two UART/SPI outputs).

[quote author="tayken"]
- For the initial release we might go for PWM + caps instead of a seperate ADC IC. Lets see its performance, if it is really poor, then we can go for the ADC IC in the real design.
[/quote]
I would offer both options in that case, so we can compare (populate one board with DAC and one with PWM, or switch with a jumper).

[quote author="arhi"]
I would like to see 3-5A more then 1-2A .. but .. maybe it would be cool to make the project out of 2 segments where one segment does the read/write and the other segment does the "power" stuff so one can easily change the power segment to get 5A or 10A if needed :) :) :)
[/quote]
That's way outside the scope of this project. The design is scalable, but you would need to replace the current shunt, add extra pass transistors with emitter resistors, and probably add an extra transistor stage to provide enough pass transistor base current. You would also need much more cooling. Also much fatter traces for the high-current part. Not sure if it's worth it, it would probably be better to make your own PCB, possibly based on this schematic. I would also seriously consider SMPS for 10A, especially if low noise is not a requirement (eg. motors).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arhi on September 27, 2010, 07:41:26 pm
[quote author="alm"]
[quote author="arhi"]
I would like to see 3-5A more then 1-2A .. but .. maybe it would be cool to make the project out of 2 segments where one segment does the read/write and the other segment does the "power" stuff so one can easily change the power segment to get 5A or 10A if needed :) :) :)
[/quote]
That's way outside the scope of this project. The design is scalable, but you would need to replace the current shunt, add extra pass transistors with emitter resistors, and probably add an extra transistor stage to provide enough pass transistor base current. You would also need much more cooling. Also much fatter traces for the high-current part. Not sure if it's worth it, it would probably be better to make your own PCB, possibly based on this schematic. I would also seriously consider SMPS for 10A, especially if low noise is not a requirement (eg. motors).
[/quote]

Yes I know it's out of scope, just said "I'd like" :) ... anyhow I do feel that 2 stage pcb (motherboard and daughterboard) would not make design much more complex and then one can design different daughter board with different power consumption ..

Wrt smps - I never, ever made a single one work, I never even managed to modify existing smps... so that's out of my area of expertise / interest - and to be honest I'm looking at few interesting lab psu's for months now deciding to go or not to go for them (they will have to wait now for another few months as I just spent non planned 400E for a new lcd as the old one died on me few days ago) ... that is the only reason I like standard transistor design :D

but I'm going too far away off topic .. I already gave all my ideas (rv and pga's) and now all I can do is wait and see what smarter guy's then me can make :), you lost me somewhere around second page :D, but I must admit I like where the project is going :)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Pisami on September 27, 2010, 10:35:03 pm
[quote author="arhi"]
I just spent non planned 400E for a new lcd as the old one died on me few days ago
[/quote]
Did you check the power supply components, mostly the electrolytic capacitors or some of them have dried. If so, just change those to new, better models and you are good to go :) I did this once, the parts cost was about 4.5€.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 28, 2010, 02:22:11 am
[quote author="alm"]
About the R2, I think a transistor/JFET constant current source would be better, since HP used a resistor to a constant voltage above Ve(Q1). No need for great accuracy, it just should be better than between 14V/R2 (almost zero output voltage) and 2V/R2 or so (max output voltage). Something like -50%/+100% should be fine.
[/quote]
That part definitely needs improvement... I like the JFET idea. As it turns out, all transistor models I've seen specify ludicrous beta factors, and I'm not aware of any re-adjustment in function of Ic... What I drew was definitely more along the lines of a proof of concept - I wanted to make sure it could theoretically work.

Quote
I have some doubts about your design, even though you appear to know more about this:
1. How's the stability of Q3 without emitter resistor? Isn't it very sensitive to tiny Vbe and temperature variations, making it hard to keep stable?
2. The HP design of Q1/Q6 appears be temperature compensated, since the Vb(Q6) is at about the same level as Ve(Q1). Your design isn't, which may make the job of the op-amps harder.
3. Why isn't this topology used in other lab supplies? All commercial designs I'm aware of use a negative and positive voltage relative to the output voltage. Even in a commercial design, this has to add some extra costs, why do they use it if they could easily omit it? There has to be some downside, it's not like an LM324 is a recent invention.
4. In general, the major changes compared to the original design makes me somewhat uncomfortable without doing extensive analysis and testing. Hence my preference for something closer to the HP design if we can (doesn't add much costs with the symmetrical design).
All excellent points, sorry I can't answer most of them. One thing I might say is that the E3620 was designed for potentiometer panel controls. I saw no other simple way to convert it to DC control... Last time I checked HP service manuals, I didn't find a linear lab supply that could be digitally controlled with i.e. GPIB. The digitally-controlled units I found were SMPS designs.

Quote
If you're convinced that it will work fine, I'm willing to believe that. But if I would have to build it, I would go for a more conservative design.
Oh I'm far from convinced it'll work well, and I certainly don't want to sound over-confident. I do feel it's worth actually prototyping one of these, but I really can't say if it's going to turn out to be a waste of time.
On a side note: I had built a cheezy current regulator similar to this layout, with an LM358 driving a transistor in a single-supply circuit. It was far from perfect, and initially I had some oscillation problems, but after a bit of tweaking it became quite usable. I actually charge some battery packs with it...

I would ask what you would consider to be a more conservative design ? Some problems I see to using i.e. the E3620 (or any other) circuit is : component availability, unkown design decisions and different specifications.

Quote
[...] Designing/manufacturing an AC wall wart is much harder to screw up.
(Sorry, I trimmed the part mentioning using two wallwarts to get symmetrical / floating outputs)
They do make center-tapped AC wall warts. I'm not sure how internet-available they would be however (I bought a bunch at a local electronics dollarstore)

Quote
Quote
whether to float the output needs to be decided.

I don't think extra parts will be too bad, some opto's and an extra PIC/FT232. Supply for the grounded part can be USB.

Ok, as I said I'm all for it - but the guy making the boards gets to decide, in the end.


Quote
The reason for considering an FT232 was that we don't really need more than an USB interface on the grounded side. We could isolate the UART connection and connect the PIC to lab supply ground. I've used the small MCU per output on the isolated side in the past, because an SPI/I2C ADC is not much cheaper, and the MCU can also control the DAC's and switch some other stuff (I had relays for tap switching). With multiple channels, we would need more intelligence on the grounded side, since we would need to control two outputs with one UART. Using an FTDI device with dual UART is ugly in my opinion, and probably even more expensive.
Indeed. FT232 is ok, but I'm partial for a USB PIC speaking to the output channel(s) through an opto-isolated bus.

Quote
[quote author="tayken"]
- For the initial release we might go for PWM + caps instead of a seperate ADC IC. Lets see its performance, if it is really poor, then we can go for the ADC IC in the real design.
I would offer both options in that case, so we can compare (populate one board with DAC and one with PWM, or switch with a jumper).
[/quote]
Only trouble is that we would need 2 PWM channels,  very few PICs have two independant PWM modules. Of course we can generate the PWM in software, but if we need to manage ADC conversions & communications at the same time, it might not be worth the trouble.



[quote author="arhi"]
I would like to see 3-5A more then 1-2A .. but .. maybe it would be cool to make the project out of 2 segments where one segment does the read/write and the other segment does the "power" stuff so one can easily change the power segment to get 5A or 10A if needed :) :) :)
[/quote]
I'm against this for a v1 board. Modularity isn't useful to everyone. Plus, having 2 PCBs make things more complicated for fab'ing. Also: 12V @ 5A makes a big wall wart, and a hefty linear regulator + heatsink !
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arhi on September 28, 2010, 02:30:12 am
[quote author="asdf"]
Did you check the power supply components
[/quote]

I did the quick check and gave up (psu is ok, the problem is somewhere around high voltage ccfl transformer) ... not really relevant to this discussion but thanks anyway :)

[quote author="fenugrec"]
Only trouble is that we would need 2 PWM channels,  very few PICs have two independant PWM modules.
[/quote]

I'm not sure I understand this, sorry for slowing discussion down but you would need 2 PWM channels that have different duty cycle, they can have same frequency right? any pic with few pwm channels can do this, they can't have different frequency but they can have different dc ..
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 28, 2010, 02:43:49 am
[quote author="arhi"]
[quote author="fenugrec"]
Only trouble is that we would need 2 PWM channels,  very few PICs have two independant PWM modules.
[/quote]

I'm not sure I understand this, sorry for slowing discussion down but you would need 2 PWM channels that have different duty cycle, they can have same frequency right? any pic with few pwm channels can do this, they can't have different frequency but they can have different dc ..
[/quote]

I take that back, I see microchip has some new devices that have two CCP modules and more. I was thinking of older/smaller devices like 16F628, 16F88, 12F683, etc. We're fine, then p-)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arhi on September 28, 2010, 03:55:39 am
great ... there are few pic's with really independent channels where they can have different DC but those are fairly rare .. but commonly used ones with multiple pwm outputs like 16f877a, 16F887, 18f2550... they have "linked" pwm's that has to be on the same frequency but can have different DC (not sure about 887 it might even have truly separated pwm's) .. dsPIC is even more versatile in that regard
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 28, 2010, 07:52:00 am
[quote author="fenugrec"]
All excellent points, sorry I can't answer most of them. One thing I might say is that the E3620 was designed for potentiometer panel controls. I saw no other simple way to convert it to DC control... Last time I checked HP service manuals, I didn't find a linear lab supply that could be digitally controlled with i.e. GPIB. The digitally-controlled units I found were SMPS designs.
[/quote]
I think there are plenty, but finding one with full schematics might be a problem, since their latest designs don't tend to have schematics in the service manuals. I downloaded a few in the past for my own project, one example is the manual for the Agilent 6621A/6622A/6623A/6624A/6627A (http://http://www.home.agilent.com/agilent/editorial.jspx?cc=US&lc=eng&ckey=1000002469:epsg:man&nid=-11143.0.00&id=1000002469:epsg:man&pselect=SR.General), but it looks pretty complex and uses a custom hybrid for actual regulation. The HP 6632A/6633A/6634A service manual (http://http://www.home.agilent.com/agilent/redirector.jspx?action=ref&cname=AGILENT_EDITORIAL&ckey=739503&lc=eng&cc=US&nfr=-11143.0.00&pselect=SR.General) looks simpler, but still much more complex than the current design (probably because it can both sink and source). Other similar designs would be the ELV PPS-5330 (http://http://www.elv-downloads.de/Assets/Produkte/7/755/75572/Downloads/75572_PPS_5330_km_um.pdf) (German electronic hobbyist magazine know for high quality designs, just look at the pretty pictures) design, which uses PWM and a discrete ADC for some reason (educational value?). The ELV design without the DAC/ADC (plain old potmeter version) is pretty well known in local hobbyist circles, but I would trust Agilent over a magazine.

I don't think converting designs like this to DAC input is very risky, the pots are just voltage sources. I don't really have an issue with these modifications in your design (although I admit I haven't looked at them very much). We can dampen the heck out of the DAC outputs if we need to, it's not like we're going to convert this into an 1MS/s arbitrary waveform generator, we can consider them almost DC if that's necessary to get it stable. We can't do the same with the regulation loop, since it needs to be both stable and have good transient response, and will see a much more variable load (the load might modulate the output, the DAC just drives an op-amp).

My issue is mainly with the regulation to 0V without negative voltage, I can't quite put my finger on it, but my gut tells me there's a problem with it. Every linear lab supply I've seen uses negative potentials, and I can't imagine that all designers had shares in transformer manufacturers. I'm afraid it will misbehave close to ground (high output impedance, bad regulation, whatever). But I don't have any facts to back that up, so maybe I can be proven wrong. The only concrete example I have is the emitter resistor for the transistor sinking from the pass transistor base (Q3 from memory, but I don't have the schematic handy). Adding an emitter resistor that would drop say .5V to prevent tiny Vbe variations from making everything unstable would kill 0V operation. And the op-amps can't sink very well at <0.6V either (which is why you added Q3 in the first place).

Quote
I would ask what you would consider to be a more conservative design ? Some problems I see to using i.e. the E3620 (or any other) circuit is : component availability, unkown design decisions and different specifications.
Sure, there is risk in every design unless you use the exact same PCB and components. But the fewer changes, the lower the risk in my opinion.

What I would consider more conservative is the design I've seen many times: most of the circuit is fed from a symmetrical supply around the output voltage (like I sketched out last week, although don't mind skipping the voltage doubler if we have a better solution). A constant current source is connected to the base of the pass transistors, the op-amps sink to below Vout, even at 0V output (no issues with running into rails or saturation, and no need to invert their output). If we go with the DC input, we would need an SMPS for these voltages, not sure what this will do for noise. The main change compared to most designs would be the DAC, but if it's just scaling the 0-5V or whatever to some other range, it should be pretty safe.

Quote
They do make center-tapped AC wall warts. I'm not sure how internet-available they would be however (I bought a bunch at a local electronics dollarstore)
That would eliminate the voltage doubler that you dislike (unless we want to use it for voltage selection, double the voltage at 110V, the fact that most 110V places are 60Hz helps with ripple), but would keep the symmetrical (not two floating) outputs. I'm not a big fan of making two output circuits with inverted polarity either (mostly the extra effort and BOM), although I don't see any major issues. No idea about availability of these wall warts.

Quote
Ok, as I said I'm all for it - but the guy making the boards gets to decide, in the end.
My proposal is to keep it as a requirement for now, and drop it if it turns out to be a pain to design/source.

Quote
Indeed. FT232 is ok, but I'm partial for a USB PIC speaking to the output channel(s) through an opto-isolated bus.
Sure, as long as we have a working USB stack, that would be fine, too. Especially if we have multiple isolated outputs. But we might use a small PIC on the isolated side(s), too, since SPI requires tons of opto's (at least one multi-channel DAC and ADC per output) and I2C is a pain to isolate.

My preferences for DAC would be a real DAC, but if this turns out to make it too expensive and PWM performs good enough, we might use that. I don't see the point of using a more expensive PIC so we can skip a DAC, these things are <$1, even in single quantities at the likes of Digikey.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 28, 2010, 02:31:52 pm
For PWm generation, I was thinking of using a 24F series PIC and as far as I can remember they have multiple CCP modules (correct me if I'm wrong).
Quote
Quote from: tayken on September 26, 2010, 01:45:39 PM

    - For the initial release we might go for PWM + caps instead of a seperate ADC IC. Lets see its performance, if it is really poor, then we can go for the ADC IC in the real design.

I would offer both options in that case, so we can compare (populate one board with DAC and one with PWM, or switch with a jumper).
Actually as this is a prototype board, we put in both options and test their performances.

I think the only thing left is to finalize the linear regulator part. Both FTDI and separate PIC options have their pros and cons so I am undecided on that issue. But I kind of prefer FTDI as no programming is required (there might be bugs in firmware or other stuff) and it has been widely used in the previous designs so it is already available at Seeed.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 28, 2010, 03:27:34 pm
[quote author="tayken"]
For PWm generation, I was thinking of using a 24F series PIC and as far as I can remember they have multiple CCP modules (correct me if I'm wrong).
[/quote]
How much would this add in costs compared to a cheaper PIC with external DAC? Or do we need/want a PIC 24F either way? I'm not very familiar with the PIC models (more of an AVR person).

[quote author="tayken"]
Actually as this is a prototype board, we put in both options and test their performances.
[/quote]
This is what I meant. Would it be an issue if we build a prototype with a PIC with enough PWM channels, but switch to a cheaper PIC if we decide to go with the external DAC? Would the firmware require significant changes when moved from PIC 24F to for example a PIC 18 something?

[quote author="tayken"]
I think the only thing left is to finalize the linear regulator part.
[/quote]
And the ADC inputs, which have been mostly ignored. What's the current plan regarding grounding, differential inputs, ranging and negative voltages? The ideal DMM would have all inputs fully floating and protected, but that would require multiple isolated ADC's, which is probably way too expensive. There has been the idea to use the PGA, but it's not exactly clear to me how to use it. A quick glance at the datasheet suggests that the Microchip PGA's don't have differential inputs, so either one of the inputs is connected to the power supply output, or we have to isolate it (and the ADC). Some sort of protection on the inputs so it at least has a chance of surviving mains may not be a bad idea either (eg. series resistors and TVS diodes), or at least contain the damage.

I expect me and fenugrec to converge on a design soon, no major disagreements as far as I see. I would prefer to breadboard this supply (analog part, can use lab supply instead of DAC and DMM instead of ADC) in both Spice and real hardware and run some tests (eg. the National app note) before committing to PCB. I probably have most of the parts in stock, unless we decide on more exotic pass transistors or op-amps.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 28, 2010, 04:14:08 pm
[quote author="alm"]
How much would this add in costs compared to a cheaper PIC with external DAC? Or do we need/want a PIC 24F either way? I'm not very familiar with the PIC models (more of an AVR person).
[/quote]
I'll go for a PIC24F either way as peripheral pin select feature really helps with routing and may add "hackability" to the project in the future if we route some unused pins to a header (such as the control panel addition I have in mind). Also I'm more familiar with them and really liked them wrt 8-bit ones I used before. I don't know the price issue, but I'll say a few cents tops maybe even cheaper as PIC18F2550-I/SO used at IR Toy is $4.95 for one piece and PIC24FJ64GA002-I/SS used at BP is $4.09 for ıne piece (Mouser prices).

[quote author="alm"]
This is what I meant. Would it be an issue if we build a prototype with a PIC with enough PWM channels, but switch to a cheaper PIC if we decide to go with the external DAC? Would the firmware require significant changes when moved from PIC 24F to for example a PIC 18 something?
[/quote]
We will probably need to re-write the code for the registers in 18F. The changes can be minor or major, that depends on the code and the peripheral modules (SPI, I2C...) used.

[quote author="alm"]
And the ADC inputs, which have been mostly ignored. What's the current plan regarding grounding, differential inputs, ranging and negative voltages? The ideal DMM would have all inputs fully floating and protected, but that would require multiple isolated ADC's, which is probably way too expensive. There has been the idea to use the PGA, but it's not exactly clear to me how to use it. A quick glance at the datasheet suggests that the Microchip PGA's don't have differential inputs, so either one of the inputs is connected to the power supply output, or we have to isolate it (and the ADC). Some sort of protection on the inputs so it at least has a chance of surviving mains may not be a bad idea either (eg. series resistors and TVS diodes), or at least contain the damage.
[/quote]
Yes, ADC inputs are probably the next problem but if we dig too deep, it will be really expensive and hard to design. If we use the plan I suggested (using internal ADC of PIC, direct connection for regulator voltage and current readings, connection through an analog mux for measurement inputs) we can save the ADC module and the damage will be contained at the analog mux. We can add a protection for a certain voltage value (like 12 V DC max) so that people will not probe mains with this (Ian doesn't like people messing with mains :) seriously, there might be liability issues) if there is the need and demand, we can design an interface board which will expand the voltage range. Or this might be left as a hack. I can work on this part of the problem if no one wants otherwise.

If you can converge on a design, I think the project will make a leap forward as this was the main choke point of this design (all these arguments about linear or switch mode regulators, reference input method etc). This part really scares me as there might be oscillations or other problems.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 28, 2010, 05:12:28 pm
[quote author="tayken"]
Yes, ADC inputs are probably the next problem but if we dig too deep, it will be really expensive and hard to design. If we use the plan I suggested (using internal ADC of PIC, direct connection for regulator voltage and current readings, connection through an analog mux for measurement inputs) we can save the ADC module and the damage will be contained at the analog mux. We can add a protection for a certain voltage value (like 12 V DC max) so that people will not probe mains with this (Ian doesn't like people messing with mains :) seriously, there might be liability issues) if there is the need and demand, we can design an interface board which will expand the voltage range. Or this might be left as a hack. I can work on this part of the problem if no one wants otherwise.
[/quote]
I didn't imply designing it to measure mains or documenting it, but that doesn't mean it should go up in a puff of smoke and fry everything close to it if it's connected to mains. An upper limit of something like +/- 15V for measuring is fine in my opinion (allowing it to measure at least all power supply outputs in parallel would be nice, since you might want to measure something connect to it). Mistakes do happen, and it would be nice to at least limit the damage. But I agree that it should not add lots of costs and complexity. Can't imagine how designing it to be less likely to kill the user can be bad for liability, but I'm not a lawyer.

My idea would be something like differential input -15V to +15V or so -> precision fixed voltage divider (bring it within range of the amplifier, plus limit currents in case of overload) -> differential amplifier (eg. op-amp) to convert it to single-ended, also shift it to positive only between 0-5V or so for the PGA -> PGA (for ranging) -> mux/ADC. If you have a simpler idea, that would be great, because it sounds more complex than I'd like. The fixed divider might make it more sensitive to noise and offsets on low ranges, but would make the input more robust without much complexity compared to switchable resistors.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on September 29, 2010, 03:47:01 am
Hi,

Quote
I don't think converting designs like this to DAC input is very risky, the pots are just voltage sources.
Hmm, that's not how I understood the E3620 circuit... It seemed rather like a resistive divider used for feedback? (The voltage control pot is between +5V(reg) and -Output) Short of using a digi-pot I don't see other easy conversions. Anyway.


[quote author="tayken"]
For PWm generation, I was thinking of using a 24F series PIC and as far as I can remember they have multiple CCP modules (correct me if I'm wrong).
....
I'll go for a PIC24F either way as peripheral pin select feature really helps with routing and may add "hackability" to the project in the future if we route some unused pins to a header (such as the control panel addition I have in mind). Also I'm more familiar with them and really liked them wrt 8-bit ones I used before.
[/quote]

Check out arhi's previous posts, as he pointed out there are now a nice variety of 16F and 18F PICs with two or more CCP modules. I really don't think PPS is essential (PWM outputs will be PWM outputs, ADCs will stay ADCs), and the routing shouldn't be exceptionally hard.  But since I probably won't be doing much coding on this project it's not my call... Is the USB stack programmed in asm or C ? 24F asm would certainly need more work to port down to 18F, but C should be pretty manageable. How people can program <16-bit CPUs in C is beyond me, it feels sooo clunky p-))


[quote author="tayken"]
I think the only thing left is to finalize the linear regulator part.
[/quote]
Hehe I like the optimism


[quote author="alm"]
I expect me and fenugrec to converge on a design soon, no major disagreements as far as I see. I would prefer to breadboard this supply (analog part, can use lab supply instead of DAC and DMM instead of ADC) in both Spice and real hardware and run some tests (eg. the National app note) before committing to PCB. I probably have most of the parts in stock, unless we decide on more exotic pass transistors or op-amps.
[/quote]
We'll get there yet ! To be honest I don't have any religious attachment to this or that layout... If we need bipolar supplies, so be it. I just find that a totally single-ended circuit would be really elegant, and maybe easier to float. But in any case, it's definitely not time for a PCB yet.

ADCs : We want to monitor at least output V and I, but it would be vary nice to also take a reading of the input voltage, to compute a maximum power dissipation: if the user plugs in 25VDC, the output current should be capped in relation to the max transistor dissipation... Something like Imax = Pdis / (Vin - Vset) , not counting the sense resistor. Without this, the regulator can hardly be considered "short-circuit proof" - we can count on people not paying attention and asking too much of the reg. Or just assuming it's "smart enough" to not self-destruct.

Re ADC range selection : what about a resistive divider with MOSFET-selectable legs ? Top resistor = 10k, a few 10k bottom resistors which can be switched in through software control. Add diodes between the ADC pin and VDD, VSS to clip the range to safe levels... I figure the added Rds resistance should be negligible with 1% resistors , two or three magnitudes higher in value.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: alm on September 29, 2010, 07:13:54 am
[quote author="fenugrec"]
Quote
I don't think converting designs like this to DAC input is very risky, the pots are just voltage sources.
Hmm, that's not how I understood the E3620 circuit... It seemed rather like a resistive divider used for feedback? (The voltage control pot is between +5V(reg) and -Output) Short of using a digi-pot I don't see other easy conversions. Anyway.[/quote]
True, I oversimplified, but that's still basically level translation, and can be easily solved with a differential op-amp powered from said rails (which I believe is what you've done), or even with a passive resistor network (if output impedance isn't an issue). I don't see any unsolvable problems there, and I'm convinced we can get it to work. Not so sure about the other issues.

[quote author="fenugrec"]
We'll get there yet ! To be honest I don't have any religious attachment to this or that layout... If we need bipolar supplies, so be it. I just find that a totally single-ended circuit would be really elegant, and maybe easier to float. But in any case, it's definitely not time for a PCB yet.
[/quote]
I don't have anything against a single-ended supply, as long as we're convinced it will be stable. I agree it would be a really neat solution, because I've never seen it done before. But that makes me more careful at the same time, since it's possible that it's never been done because it's a bad idea. And bipolar would add some cost/complexity (two switchers?) with a single DC input.

A 'large scale' production should have more margins than a one-off, minor component variations shouldn't make the board unstable. It would suck to have complaints about oscillating supplies, and have to tell people to add a cap somewhere to make it stable.

[quote author="fenugrec"]
ADCs : We want to monitor at least output V and I, but it would be vary nice to also take a reading of the input voltage, to compute a maximum power dissipation: if the user plugs in 25VDC, the output current should be capped in relation to the max transistor dissipation... Something like Imax = Pdis / (Vin - Vset) , not counting the sense resistor. Without this, the regulator can hardly be considered "short-circuit proof" - we can count on people not paying attention and asking too much of the reg. Or just assuming it's "smart enough" to not self-destruct.
[/quote]
That might be a neat idea, as long as we have ADC channels to spare. Adding a temperature sensor to the heat sink would accomplish the same in a more robust manner (ambient temp, air flow), but assembly might be expensive (I tend to glue these on with heat conducting glue, we would need something in a TO-220-like package). I was mainly talking about the external measurement channels that were in the original proposal, the other ones are easier since it could be fixed range (as long as we have enough resolution) and we won't have any unexpected voltages either.

[quote author="fenugrec"]
Re ADC range selection : what about a resistive divider with MOSFET-selectable legs ? Top resistor = 10k, a few 10k bottom resistors which can be switched in through software control. Add diodes between the ADC pin and VDD, VSS to clip the range to safe levels... I figure the added Rds resistance should be negligible with 1% resistors , two or three magnitudes higher in value.
[/quote]
I would prefer a scheme where the input impedance remains constant, especially since our input impedance is unlikely to be so high that it doesn't matter at all (>=10Mohm). A switchable resistor divider would work too, and allow us to skip the PGA, either way would be fine for me. Whatever proves the easiest/cheapest/best (accuracy of at least 1% would probably be a requirement, even a crap DMM or panel meter does <=0.5%).
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 30, 2010, 09:05:51 am
[quote author="alm"]
I didn't imply designing it to measure mains or documenting it, but that doesn't mean it should go up in a puff of smoke and fry everything close to it if it's connected to mains. An upper limit of something like +/- 15V for measuring is fine in my opinion (allowing it to measure at least all power supply outputs in parallel would be nice, since you might want to measure something connect to it). Mistakes do happen, and it would be nice to at least limit the damage. But I agree that it should not add lots of costs and complexity. Can't imagine how designing it to be less likely to kill the user can be bad for liability, but I'm not a lawyer.
[/quote]
OK, I'll look up for something to limit the damage (something like blowing up a fuse or burning up the MUX only) and I'll try to design a way to simplify it as much as possible. But to measure negative voltages, we need a negative voltage supply on the board for the analog mux, otherwise we have to do the signal conditioning for all 8 channels.

[quote author="fenugrec"]
[quote author="tayken"]
For PWm generation, I was thinking of using a 24F series PIC and as far as I can remember they have multiple CCP modules (correct me if I'm wrong).
....
I'll go for a PIC24F either way as peripheral pin select feature really helps with routing and may add "hackability" to the project in the future if we route some unused pins to a header (such as the control panel addition I have in mind). Also I'm more familiar with them and really liked them wrt 8-bit ones I used before.
[/quote]

Check out arhi's previous posts, as he pointed out there are now a nice variety of 16F and 18F PICs with two or more CCP modules. I really don't think PPS is essential (PWM outputs will be PWM outputs, ADCs will stay ADCs), and the routing shouldn't be exceptionally hard.  But since I probably won't be doing much coding on this project it's not my call... Is the USB stack programmed in asm or C ? 24F asm would certainly need more work to port down to 18F, but C should be pretty manageable. How people can program <16-bit CPUs in C is beyond me, it feels sooo clunky p-))
[/quote]
The USB stack is in C as far as I know but aren't we going to use an FTDI IC or something else to isolate the signals? Also I think PPS is essential for connecting different devices with different protocols to an "expansion header" such as the one in Web Platform. My idea is to route at least one ADC channel, I2C pins if they are not used for some other thing on the board (or we can route them even if they are used), some other pins of the PIC and of course supply and ground voltages.

[quote author="fenugrec"]
[quote author="tayken"]
I think the only thing left is to finalize the linear regulator part.
[/quote]
Hehe I like the optimism
[/quote]
Yep, I'm an optimist. :) But seriously besides the linear regulator part the project can get most of it's hardware and other stuff from BP and other manufactured projects IMO. Plus I'm trying to kep everyons hopes up. ;)

[quote author="fenugrec"]
ADCs : We want to monitor at least output V and I, but it would be vary nice to also take a reading of the input voltage, to compute a maximum power dissipation: if the user plugs in 25VDC, the output current should be capped in relation to the max transistor dissipation... Something like Imax = Pdis / (Vin - Vset) , not counting the sense resistor. Without this, the regulator can hardly be considered "short-circuit proof" - we can count on people not paying attention and asking too much of the reg. Or just assuming it's "smart enough" to not self-destruct.

Re ADC range selection : what about a resistive divider with MOSFET-selectable legs ? Top resistor = 10k, a few 10k bottom resistors which can be switched in through software control. Add diodes between the ADC pin and VDD, VSS to clip the range to safe levels... I figure the added Rds resistance should be negligible with 1% resistors , two or three magnitudes higher in value.
[/quote]
I was also thinking about measuring the input voltage, I will add it to my list. Range selection is for measurement inputs, right?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: ian on September 30, 2010, 04:17:20 pm
The PIC stuff is very minor compared to the regulator part :) When the great minds converge on a design, it'll be easier to decide on a chip to use. The cost difference, and effort to port between chips is negligible. FTDI vs USB stack in terms of effort/difficulty is also negligible. Especially as large as this design is getting ;)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on September 30, 2010, 08:04:02 pm
[quote author="ian"]
The PIC stuff is very minor compared to the regulator part :) When the great minds converge on a design, it'll be easier to decide on a chip to use. The cost difference, and effort to port between chips is negligible. FTDI vs USB stack in terms of effort/difficulty is also negligible. Especially as large as this design is getting ;)
[/quote]

Hooray! Ian is thinking the same thing as me! :) Well, nearly :D

I have nearly no experience in the USB stack but it can be a good experience for me to work on it. After the linear regulator part is finished and requirements for the microcontroller section are finalized, we can select a chip and start working on the code. But of course for the code we need the hardware. :)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on October 01, 2010, 05:44:02 am
Hi,

Quote
I would prefer a scheme where the input impedance remains constant, especially since our input impedance is unlikely to be so high that it doesn't matter at all (>=10Mohm). A switchable resistor divider would work too, and allow us to skip the PGA, either way would be fine for me. Whatever proves the easiest/cheapest/best (accuracy of at least 1% would probably be a requirement, even a crap DMM or panel meter does <=0.5%).
Agreed. How much impedance would be enough ? I figure 1M would be quite adequate if we can manage - this is comparable to many passive oscilloscope probes.

[quote author="tayken"]
OK, I'll look up for something to limit the damage (something like blowing up a fuse or burning up the MUX only) and I'll try to design a way to simplify it as much as possible. But to measure negative voltages, we need a negative voltage supply on the board for the analog mux, otherwise we have to do the signal conditioning for all 8 channels.
[/quote]

A negative rail may not be essential - one possibility (yes, op-amps again...) is to wire an inverting stage symmetrical around ground like the first ASCII schem here:
http://electronics.stackexchange.com/qu ... with-a-adc (http://electronics.stackexchange.com/questions/3105/how-do-i-measure-a-negative-voltage-with-a-adc)
Not sure about the risk of latch-up in the op-amp, however... a rail-to-rail input IC is definitely necessary.

Quote
The USB stack is in C as far as I know but aren't we going to use an FTDI IC or something else to isolate the signals? Also I think PPS is essential for connecting different devices with different protocols to an "expansion header" such as the one in Web Platform. My idea is to route at least one ADC channel, I2C pins if they are not used for some other thing on the board (or we can route them even if they are used), some other pins of the PIC and of course supply and ground voltages.

As I see it, using an FTDI vs PIC wouldn't make an isolated PSU more simple or complex, just different. Here are some possibilities :
Code: [Select]
; FTDI, single isolated output
USB <=> FTDI <=OPTO=> PIC => regulator

;FTDI, dual independant outputs
USB <=> FTDI <=OPTO=>  PIC1 (regulator)
             <=OPTO=>  PIC2 (regulator)

;same, PIC-based
USB <=> PIC <=OPTO=>  PIC1 (regulator)
            <=OPTO=>  PIC2 (regulator)

I would personally go for the last of these; having a PIC to arbitrate the opto-isolated bus is better IMO. We can also program it to send a "keepalive" signal to the slave PICs : in case of a USB comm failure, disable the outputs or take other safe actions...
As for PPS, well it depends what the project is meant to be. I didn't see this as another "swiss-army" device like a BP, but rather as a configurable power source... In any case all reasonably-sized PICs have many extra ADC channels (internally multiplexable), so PPS would just allow you to use one pin instead of its neighbour... As for I2C or other data busses, I don't quite see where you would want this - perhaps on the isolated side ? but then the datastream adds traffic on the opto-bus, and calls for a more elaborated protocol. Is it worth stepping up to a 24F then? I think specifying a 44 / 64-pin QFP device for this kind of project is overkill, and would actually make the PCB more complicated, even with PPS !

That'll be 0.02$ please.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on October 01, 2010, 07:56:10 am
[quote author="fenugrec"]As I see it, using an FTDI vs PIC wouldn't make an isolated PSU more simple or complex, just different. Here are some possibilities :
Code: [Select]
; FTDI, single isolated output
USB <=> FTDI <=OPTO=> PIC => regulator

;FTDI, dual independant outputs
USB <=> FTDI <=OPTO=>  PIC1 (regulator)
             <=OPTO=>  PIC2 (regulator)

;same, PIC-based
USB <=> PIC <=OPTO=>  PIC1 (regulator)
            <=OPTO=>  PIC2 (regulator)

I would personally go for the last of these; having a PIC to arbitrate the opto-isolated bus is better IMO. We can also program it to send a "keepalive" signal to the slave PICs : in case of a USB comm failure, disable the outputs or take other safe actions...[/quote]

Agreed, but, to your list, I would add :
Code: [Select]
; PIC-based
USB <=> isolation <=> PIC regulator(s)

I do not recall the pricing, but there are USB PHY isolator chips which would sit between the physical USB device jack and the PIC, thus isolating everything on the board.  As we discussed, all power for the µC could come from the power supply input, allowing the USB to be used purely as a differential data transport and nothing else.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: blarson on October 01, 2010, 09:40:05 am
The LM317 is just a 1.25v version of the lm309/7805 style regulator.  It can be used fine without the resistors, you just supply 1.25v less than the desired output to the ADJ pin.  This needs to be able to sink up to 0.1mA.  Also, the minimum load is 10mA.  The resistors normally act as this minimum load and use cheap components to set the output voltage based on the internal regulator.

Also, some of the messages in this thread seem to forget that most voltage regulators have a minimum drop, in the case of the LM317 it's 3v.  So for 12v out, you need at least 15v in.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on October 08, 2010, 06:21:41 pm
Found this (http://http://www.microsyl.com/index.php/2010/03/31/bench-power-supply-0-25v-0-5amp/) via HackaDay. Might be a good example for regulator stage design.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on October 26, 2010, 06:42:04 am
Hi everybody!

In the newsletter from Maxim, I saw a good application note (http://http://www.maxim-ic.com/app-notes/index.mvp/id/1897) and wanted to share with you. It is for SMPS design mostly but some parts may relate to linear regulator design also.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Colfaxmingo on January 09, 2011, 09:07:15 pm
Is this project alive?  It sounds pretty awesome.  I haven't read anything new about it. I would be sad if it died.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: fenugrec on January 23, 2011, 02:52:22 am
[quote author="Colfaxmingo"]
Is this project alive?  It sounds pretty awesome.  I haven't read anything new about it. I would be sad if it died.
[/quote]

It's still just at the "idea" stage. Personnally I don't badly need one of these, and I'm a bit short on time.
However, there needs to be practical experimentation. There were many cases of "this should be built to verify it works" that still remain to be tested... and last time I checked there was still a lack of concrete engineering, i.e. knowledgable design. I drew up a lot of schematics (not all good), and rsdio + another member seemed to know what they were talking about but none of us logged much serious design.

If you're handy, I would say there's enough material in the old posts to let you build something that will most probably work. Not necesarily safe / reliable / stable / performant though.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: sqkybeaver on January 23, 2011, 03:17:41 am
it may be unnecessary to have it computer controlled a simple lcd and a micro should work, 2 or 3 channels output would be more than necessary.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on January 23, 2011, 04:46:03 pm
[quote author="sqkybeaver"]
it may be unnecessary to have it computer controlled a simple lcd and a micro should work, 2 or 3 channels output would be more than necessary.
[/quote]

The plan was that the computer would give some set voltages to a micro (18F series maybe), which in turn would use the components on board to give the requested voltage with current limitations. I already had a control module hack in mind (I ordered a bunch of rotary encoders and a keypad plus I have easy access to LCD screens). The project is kind of "in sleep" these days, my guess: because we couldn't converge on a design everyone got bored.

But after my finals I'm planning to "wake up" this project, even if it's only me working on it.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Pisami on January 23, 2011, 10:53:05 pm
Keep it coming! I'm going to at least buy one if it doesn't take years to come ;) If I can help (time, skills...?) I'd be happy.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: tempmj on March 17, 2011, 05:33:16 am
I saw this site and it made me think about this thread... so i'm pulling it out and adding this link that may give more ideas.  I'm not smart enough to judge if it's any better or worse than the suggestions already presented.

http://www.electrobob.com/digital-power ... -1-concept (http://www.electrobob.com/digital-power-supply-part-1-concept/?utm_source=rss&utm_medium=rss&utm_campaign=digital-power-supply-part-1-concept)
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: markus_b on March 18, 2011, 12:53:42 pm
I have the tuxgraphics one and it works well (was mentioned earlier in the thread).

I'd like to build something similar, but as a switching power supply. Essentially a microcontroller driven buck converter. Its main advantage would be that it can deliver more current at lower voltages without wasting most energy in a huge heatsink.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on April 03, 2011, 11:24:23 pm
This was discussed and we decided to use a linear PS circuit because of less noise. But I still feel like using a switching supply.

I got my hands on a power supply test kit from TI by Element 14 a little while ago. We can use some design parts and algorithms in this project IMO. I just have to go back to Japan and finish moving into my new house. :S
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: Gridstop on May 09, 2011, 12:26:02 am
I'm working on a small/simple version of something like this, now that seeed has dropped prices. My plan is to use a smps brick (or more likely old laptop adapter) and some linear regulators to provide 3.3v, 5v, and an adjustable from 0v->whatever. I do not see an easy way to add adjustable current limiting to standard regulators. My plan is to make it interface to a simple 16x2 or even 8x2 LCD and provide current measurements on the 3.3v, 5v, and adjustable line, as well as voltage on the adjustable output. The uC will control the voltage out instead of using a multiturn pot it will probably just use a rotary encoder.

I'm hoping to use all SMD but hopefully no very fine pitch parts. It will definitely fit in a 10cm by 10cm seeed board and possibly a 5cm by 5cm (maybe). Once school is out I'm going to start working on some PCB mockups/layouts.

Is there a simple/straightforward way to add adjustable current limit to a LM317/LM350 style reg? Or do you pretty much have to build the regulator from discreet parts?

Note: I haven't decided if it's really worth adding a USB interface or not. Since it will probably require isolation and the like. It might be worth just providing uart in/out, so it could be connected to an external isolation & interface circuit.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on May 25, 2011, 06:17:38 pm
what about using a spi 16bit DAC to control the reference  voltage for the error comparator in lm78s40. it would lower the noise from the PWM/filter design.

similar design could be used with a lm723 liner precision regulator, and the current limit could be controled via a RSense in parralel with a 1k digital pot. from witch the wipper could be conected to the Rsence lead of the 723 IC
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on May 25, 2011, 09:13:21 pm
[quote author="arakis"]what about using a spi 16bit DAC to control the reference  voltage for the error comparator in lm78s40. it would lower the noise from the PWM/filter design.[/quote]
Good point.  PWM is probably a cheaper solution, but noise issues could easily make it worth the extra expense of a real DAC.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on May 26, 2011, 12:15:52 am
Maxim MAX5137 are 2 chanel 12 bit high precision low power DAC with SPI interface and ready out for easy ddaisy chaning. the 12bit version is around 3$ and the 16 bit is around 6$  witch is not much, with the benefit that maxim is briliant at giving out samples world wide.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: Gridstop on May 26, 2011, 01:55:09 am
Microchip MCP4728 is a quad 12-bit I2C that has eeprom so you can set default power-up status. It's a 0.5mm pitch MSOP-10 though.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: sqkybeaver on May 26, 2011, 03:01:05 am
silabs have micros with 12bit d/a and 16 bit a/d not sure witch ones from memory

i'm currently using a c8051f121 has more than enough ram/program for this aplication, a 500ks 12 bit d/a, and ~1Ms 12bit a/d(internal mux)
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: bearmos on May 26, 2011, 04:30:57 am
just don't go with an analog device ADuC series micro.  the sigma delta converts wind up being extremely slow if you want decent resolution; even then there was errata that required the use of the lowest clock speed (otherwise even more noise was coupled into the readings).
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on May 26, 2011, 10:04:39 am
Accuracy is completely at odds with the convenience of on-board uC A/D.  If you need anything more precise than reading a basic potentiometer, I would recommend a stand-alone A/D with careful layout to avoid noise.  On-board D/A may not pose the same issues, since a PS will probably only require DC output and not any kind of signal - thus the DAC output could be massively filtered to remove any uC noise.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: honken on May 26, 2011, 11:57:13 am
Another reason to use external spi dac and adc is that electric isolation with cheep optocouplers becomes easier than isolating on the USB side.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on May 27, 2011, 01:51:41 am
I just found some excelent IC-s from maxim, those guys seriosly know what they are doing.

MAX9611, MAX9612
they are high side current sensing amplifiers with integraded 12bit ADC, I2C interface, and opAMP/comparator.

by adding  only a resistor and a Pmos to it you get current limiting, and 12bit A/D over the i2c for output voltage, current, temp, even set reference. by driving the reference via a DAC you get full digital control over current limiting. and you dont have to use any MC A/D chanels since the IC does it all for you. a

nd by using a lm78s40 or lm723 by driving its reference with a DAC you get full voltage regulation, and if you implement the i2c DAC you get full control over only 2pins over the whole power supply.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on May 29, 2011, 04:14:52 pm
some one noticed my post :D
http://dangerousprototypes.com/2011/05/ ... omparator/ (http://dangerousprototypes.com/2011/05/28/app-note-high-side-current-sense-amplifiers-with-12-bit-adc-and-op-ampcomparator/)
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on May 31, 2011, 01:17:59 pm
[quote author="arakis"]some one noticed my post :D
http://dangerousprototypes.com/2011/05/ ... omparator/ (http://dangerousprototypes.com/2011/05/28/app-note-high-side-current-sense-amplifiers-with-12-bit-adc-and-op-ampcomparator/)[/quote]
Well, no.  Actually I posted about these chips on the 18th.  Maybe you noticed my post?
Interesting parts (http://http://dangerousprototypes.com/forum/viewtopic.php?f=42&t=921&start=75#p22098)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on May 31, 2011, 03:42:16 pm
sorry, but i am unable to acess that part of the forum, i just asumed when i saw dp.com post right after my post on the forum that they were corelated.

anyway I developed an idea for a digitaly controled PS, that i am gonna build just as soon as my exams are over, in about a month.

the idea is relativly simple, it uses one 555, 3 comparators and 2 curent sense amplifiers.
its a clasic buck topology.
the 555 controles the switch.
the 555 is setup in such a whay that when a low pulse comes on its triger it gives out a low pulse witch is >= to fixed RC time. it goes low as soon as the trigger goes low, and stays low either for a fixed time or if the triger is still low it stays low untill the triger goes high.

the low output turns the switch on, high turns it off.

conected to the triger are 3 comparators. one that compares output Voltage to dac set referance. the second compares the inductor current trough high side curent aplifier, to a pre set maximum inductor current reference.
and the third inductor compares the ouput current to a second dac set refference.
(here the max9611-12 could be used)
when either of them goes low, the triger goes low and the switch is off.

I simulated it and it works rather well. the frequency is variable and depends on many things but two things can be controled:
the charge rate of the inductor,
and the 555 minimum off time, witch is used to stop any comparator oscilations contoling the switch.

Inductor charge rate is  calculated trough its maximum current and inductance. and the 555 minimum off time trough the rc network. for this cicuit to work on higher Frequancies and thus give more stability and fewer cost of the inductor, it needs comparators with low propagation delay and a 555 with a low propagation delay, because what is the point if you register that the current has crossed a pre set 4 amps when it takes the circuit a further time to respond and thus your current jumps to 5A, witch fries your inductor.

Plz coment and critique the design if you find any faults with it, thanks.
[attachment=2]
[attachment=1]
[attachment=0]

the output current comparator is mising but its a simply the max 9612 added to the triger.

the reason for doing this is that is easy to understand, simple to work with, and gives full control of the circuit to the designer. by seting up different reference voltages you could  control maximum Inductor current, maximum output current, output voltage. by lets say making the maximum inductor current reference a function of the output current you could have an addapting maximum current for incresed stability, and higher freq operation. and this is done by driving the maximum current comparator with the output of the output current amplifier.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: schazamp on May 31, 2011, 09:25:56 pm
[quote author="arakis"]I just found some excelent IC-s from maxim, those guys seriosly know what they are doing.

MAX9611, MAX9612
they are high side current sensing amplifiers with integraded 12bit ADC, I2C interface, and opAMP/comparator.
[/quote]

I was looking at the MAX9611/12 earlier, it seems pretty slick for an all-in-one solution. 

I am working on a version of the old plug-in ATX power supply thing, with built-in current and voltage measurement.  I thought about using the 9611, but was hoping to get enough resolution to measure very small (uA) currents.  Right now I'm looking at a combination of MAX9923 (current sense amp) + MAX9939 (programmable gain amp) paired with a PIC to produce an auto-ranging current meter. 

With a 0R1 current sense resistor and gains of 20-15700 (100 from the MAX9923H * 0.2-157 from the MAX9939), I ought to be able to get a range of from 1A to 1uA (using a 16-bit ADC).  I haven't quite figured out how much error will be a factor with these parts and with gains that large. 

I also haven't figured out an easy way to add a current limit circuit or a non-fuse-based overcurrent protector.  That seems to be the trade-off with the ATX-based things -- it's so easy to have the different voltages all at once (3V3, 5V, 12V, and even an adjustable), but adding other features is a pain.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: rsdio on June 02, 2011, 09:46:22 am
[quote author="arakis"]sorry, but i am unable to acess that part of the forum, i just asumed when i saw dp.com post right after my post on the forum that they were corelated.[/quote]
Sorry, I had a feeling that was a private area. Basically, I send lots of chip descriptions, press releases, and application notes to the core team at Dangerous Prototypes.  Then Ian selects the ones that he thinks might appeal to the larger community and posts them on the blog.  There is often a delay between my forum post and his blog post.  Plus, there are other people contributing to those chip and app note threads.  Personally, I like the fact that Ian filters the list, because I think that makes the blog more interesting.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: hak8or on June 12, 2011, 08:52:30 pm
I have been aiming to do something like this myself a long time ago, but due to me having a few other projects I am working on, I ended up leaving my psu project in the dust and neglected :(

So I will post my progress here, for all of you who want to use it for your own ideas. Keep in mind this is un finished, and I have yet to make a prototype to see how it works, so I cannot guarantee that it is all correct.

My main idea was to have something that would give me voltage sensing, a few voltage sources, and a single adjustable voltage source capable of giving me at least 12v (for things like programming certain chips).

I use a CPLD on it because I wanted to gain some experience with them and it gives me a tremendous amount of IO for a super cheap price. It has an external 8 channel ADC for sensing voltages and giving a very low speed scope.

For the adjustable SMPS, it uses a digital potentiometer to give a feedback voltage to the FB pin of the smps. The problem with this is I do not know what speed it needs to adjust the FB for a desired voltage, and if this is even the right way to control a SMPS. I got my information from asking this question on chiphacker: http://electronics.stackexchange.com/qu ... table-smps (http://electronics.stackexchange.com/questions/10487/different-ways-to-digitally-control-an-adjustable-smps)

It also has a small display, it is meant to be able to be used without a computer powering it (Li poly) so you can control and see the voltages and other things on the LCD. When running from a battery, you can turn off the LCD to save battery, and instead have the LEDS display the power state of any of the voltage sources, and for what ever else the user would want them to indicate. :P When it is connected to a computer, the user would be able to control the voltages and sense voltages on a PC program.

There are a few other intended features, and I originally wanted to make this into a product and sell it online, hence the price quotes as a PDF in the file, but I feel that it can be used to help the open source community make a better bench power supply at a quicker pace. My only request is that if any of the ideas are made from my uploading of this design, someone somewhere would put my name on it :P

Good luck with this project, and I hope that I was of some assistance to it.

*uploading the files now*
http://8486.a.hostable.me/Breadboard%20 ... supply.zip (http://8486.a.hostable.me/Breadboard%20Power%20supply.zip) <-- uploaded :D
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: ian on June 13, 2011, 08:47:26 am
I like that you included all the different files. It is cool to see the design evolve.

I think the feedback control will probably be ok. The ad7376 can take 30 volts. The wiper and R10 create a voltage divider that can be changed to control the feedback voltage.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: brian on July 09, 2011, 02:49:49 pm
I am not sure what the state of this project is as I did not read all 16 pages. But I skimmed through a few of the early design ideas and have some thoughts.

First of all I really want to produce things like PS and so on but I can't because of liability (at least not for sale). Even my 5W design for USB is a bit scary to sell without some sort of UL type approval.

Second, the early designs seemed to be switch mode and filtered digital signals for output. I would be very concerned about noise in such a design. There was a rule in my first lab for low noise reason: nothing digital. One way to perhaps design a high efficiency lower noise PS is to use switch mode DC-DC followed by linear regulation. IE have a switch mode PS supply a few volts more than the output, then use a regular linear stage. Many of the HP power supplies from the 80s have complete internal schematics online.

Third, integration. Sometimes integration is good and I get how you can with DAC/ADC do all three of these tasks but I am not sure they are the best way to do them. I would think about the problems separately and see if the designs really share components, if so you can integrate them at a savings. If not then it probably is not a wise choice to try to integrate the design.

The DSO board + function generator might be more appropriate combo for instance than having a function generator in a PS.

I think building a source meter for cheap would be nice though and that is almost what you guys are trying to construct. A Keithley 2400 runs about 2000 dollars.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Computerman on September 24, 2011, 02:32:54 pm
For the function generator, the XR2206 from Exar/Sipex is a good chip.
For the controller I would say the PIC24E series. 12-bit ADC, 9 16-bit timers, built-in USB OTG, 16-bit PWM. The Piccolo series from TI also has great analog!!!
An ATX power supply has +/-5V, +/-12V, and +3.3V. That would be fine for most applications.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: colin.i on December 08, 2011, 05:30:32 am
Have you guys seen eevBlog lately?
Dave made a pretty decent small psu thats quite accurate and pwm controlled.
Might be good for those of us who just want something small for the workbench...
Title: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on December 08, 2011, 07:13:19 am
[quote author="colin.i"]Have you guys seen eevBlog lately?
Dave made a pretty decent small psu thats quite accurate and pwm controlled.
Might be good for those of us who just want something small for the workbench...[/quote]
I saw that video but couldn't watch completely. I'll try to watch it and come up with sth usable.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: Tarloth on December 08, 2011, 04:24:13 pm
I use an AC to 28 volt 4 amp switching power source stolen from other equip and add one DC-DC module buyed at ebay for variable voltaje from 1.2 to 26 volt, add a discrete selector preselected values (3.3,5,9,12 and 24) and other multiturn potentiometer for fine adjustement. Add a virtual GND (only 100mA max) to obtain a splitted power source for some circuits that need it. Ferrite cores in cables, and final noise it´s really low, less than 10mV. I´m waiting from two modules from ebay to use as voltmeter and ammeter. All made from store pieces and $12 in components in ebay.

But, yo can buy good power sources used in ebay, but the cost of shipping to my country it´s greather than the cost of the power source :-(
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on April 17, 2012, 06:05:27 pm
Well after watching Dave's Dig.PSU series, I got to thinking, THAT'S awesome! in a super convoluted kinda way....
so I looked at his schematic, and said, ok, this is how he did it, lets not do it that way, as I respect him, and don't wanna copy his work, also his design has the down side of being on the expensive side...

I really liked tip about the lt3080, but I hated the fact that it just buffered the voltage, and couldn't have any gain, so you had to drive it with a separate op-amp... So I scourged the net looking for other cool chips..
and these are my results...

If you are looking for a integrated regulators, whose reference can be overridden.
they are either too small, go only up to 3.3 or 5v, or the LT308x series. Only example that I've found that can actually work is the good old 723, but I don't think his inv- input can be sunk to gnd..

next I was looking for some cool chips that only had an op-amp, and an integrated pass resistor...and the only one I've found was this LPR30, which is exactly what i want (one op amp for voltage, one for current, its friking perfect) the problem was that it's discontinued, and I couldn't find anything similar out there..

Ok so after 2 days of searching for this stuff, I gave up, and decided to build it out of discrete parts... op-amp and pass trough darling-ton....so I rummaged around the net for some cool discrete power-supply designs, and came to Jung Super regulator (http://http://tangentsoft.net/elec/opamp-linreg.html), supposedly much, much, better then any integrated regulator out there, and since all the audiophiles where in heat about it, it must be good, since they can hear the 0.000000000000000001% distortion difference. :D.
[attachment=1]

Whats cool about this design is that the series pass darlington is always pumped by the pnp/zener based constant current source..which is set for the maximum output current. the current feedback, and voltage feedback op-amps just sing this current away from the darlington base. this way even if everything fails, and there is a short the regulator will only give the maximum current..

The DACs are 12bit, I2C ones, and the Vref will be a 0.1% ~10-20ppm 2.048V
The current is monitored via the high-side current amplifier ina138. which has outputs V(Rshunt)*RS_OUT/5K. I plan on using 1oh Rshut, this will give out 2V @1A if RS_out=10k is used, or 2V@10mA if 1M is used, giving a better range for both reading current and controlling it.. these resistors can be switch via the MCU...

this is just the I2C DAC controlled PS part of the design. IT is designed to be powered with 19v dc lap top...I will add either a linear or switching tracking regulator which would float 3V above the output of this one...
*while the 358 is good enough for this regulator, really high performance regulation can be achieved by scaling the transistor and op-amps...for high frequency/low noise ones, the parts were chosen so they can easily be replaces with pin compatible, higher performance parts :D...

specs
0-12V control with ~3mV adjustment
0-1A current limit with 244uA adjustment at 0-1A range and  2.44uA at 0-10mA range maybe change this

part cost, 0.14e for the op-amps (this could be changed for some 2e much better ones)
2xDaC MCP4726 ~1.5e
ina138 ~ 1.6e
Darlington 1e, and vref..~1e total ~6e
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: tayken on April 17, 2012, 07:06:22 pm
I really liked this design! Maybe it is better to use a DAC with 2 voltage output? MCP4912 is 10bit SPI DAC, MCP4902 is 8bits SPI DAC. I managed to find some I2C DACs on Mouser but they were from Maxim and they were only 7 bits.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on April 17, 2012, 07:52:03 pm
yeah I checked, I really like the I2C design, and only affordable 12bit DACs in I2c are either single chanell or 4 chanell from microchip... if we build two separate output power supply's, the 4 channel one would work MCP4728...only it has to be powered from a reference, since the internal reference is total crap...*but they are dirt cheap :D
[attachment=1]
now I played around with it some more, and removed the ina138 and replaced it with the max9612 which does everything it does, plus it can control the current by itself, +and gives I2C 12ADC for current and (pre regulated voltage(which is useless)), It could be plcaed after the series-pass darlington, to but then it would only give us the voltage before the shunt, and add inductance to the feed back loop. only reason I see to move it would be to read the load current better, but even then there would be the error from the feedback loop resistors(current),
at its lowest setting X8 for current read.
which is 12bits @ (1A/8) 125mA which is a resolution of ~33uA ( if everything is set for 1A apsulute max current) id we lower it to 100mA it could do 3uApre ADC...
current control is via 12bit dac so at 1A it is 244uA per bit...

A pMOS LDO could easily be implemented, but I have concerns with stability with them
Title: Re: Computer controlled PS/function gen/multimeter
Post by: wvdv2002 on April 17, 2012, 11:20:36 pm
After designing a small benchtop supply powered by a laptop adapter I thought, maybe somebody on DP is already working on one. So it seems. But nonetheless, maybe some people can comment on my approach as well. The schematic is pretty rough for now, but I think you will get the idea. The PCB still has a lot of airwires, but this will be solved later on.

It will be a very small (10x8 cm) power supply with the following outputs:
3.3V - 300mA
5V    - 300mA
0-18V, 0-3A

There will also be a multimeter voltage and current measurement included.

a rotary encoder with switch is used to set the output voltage and current and there is a dedicated output disable switch. The whole thing can also be controlled via USB. There is a small Nokia LCD to output measured and set voltages and currents.

The PSU now uses the LM2596 as a buck converter with a second ripple filter and ferrite beads for filtering high frequency noise. I am contemplating to use the lm20323 (from TI) as a buck regulator instead, because it has a much higher switching frequency, so less output capacitors, a smaller coil, less heat dissipation and a smaller ripple. But it will be tougher to solder the TSSOP chip it is packaged in, especially the powerpad underneath.

For now I am trying to simulate the design in LTspice right now and the results are quite positive.
In the PCB design you can see all the output connectors (4mm banana plugs receptacles) which will be soldered to those holes.

Does anybody have comments on the design so far? I might need to add a precision reference somewhere. Any other suggestions?

There is quite a lot of PCB space left (except for under the switching regulator, as it needs a small heatsink), so any suggestions of things which might be handy in this design as well?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on April 18, 2012, 12:07:32 pm
seems cool, altgout the FB line seems to have too many contacts, are you sure the control will work.. it seems to me that the buffer from the DAC isnt doing much, but Don't fully understand how it works..
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: wvdv2002 on April 18, 2012, 12:36:55 pm
Regarding the feedback:

R5 is used for voltage feedback from the output.
C22 is used in the feedback loop to make sure the system won't start oscillating because of the extra filters in place.
R15 is the resistor that is normally connected between the feedback pin and ground, to make a voltage divider.
R21 and R3 are not populated (for testing other feedback methods).

The LM2596 makes sure the voltage on the FB pin will always be 1.25V.

Voltage feedback
So the voltage on the output will be regulated to be:
1.25*(R5+R15)/R5=Vout.
In my case 1.25*(470+10000)/470=27.8 volts.

But by adjusting the voltage on the other side of R15, the voltage reference used in regulating won't be 1.25V, but (1.25-Vdac).
So if the DAC outputs a voltage of let's say 1 volt, the regulated voltage will then be:
(1.25-Vdac)*(R5+R15)/R5=Vout.    (1.25-1)*(470+10000)/470=5.7 volts.

The opamp after the DAC divides the voltage the DAC outputs. The normal range is 0-2.048 volts in 4096 steps, but I change it to 0-1.3, so the full range of the DAC can be used (4096/1.3*1.25=3940 steps) instead of only (4096/2.048*1.25)=2500 steps. It adds more flexibility to the design.

Current feedback
The current flowing towards the output is measured using R4 and the high side current amplifier MAX4372. A current in the range from 0-3A will be converted into a voltage of 0-1.5V, because:
I = 3 amps
R4 = 0.01 ohm
Voltage amplification MAX4372 = 50 times.

3*0.01*50=1.5V

This measured current is then compared to the set current using opamp IC7B. When the current measured is higher than the set current, the output of the opamp will go high, current starts flowing through D3 into the feedback pin, increasing the voltage on that point, to which the LM2596 will respond by lowering the output voltage and decreasing the current.

I hope this makes things more clear. Thanks for letting me think the circuit through again, now I know I might have to move the current measurement resistor to right  before  the output, now the currents coming from the capacitors are not taken into account.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: arakis on April 19, 2012, 09:54:45 am
cool, nice trick with the Vref-Vdac :), I see only one possible problem, the op amp is rated for only 6V, maybe it would be better to use a 30V one just to be safe, or add a 6v zener on its output.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: isaac on May 23, 2012, 08:56:49 pm
I like this design so far. How do well do you think it will work across voltage ranges? Also what about minimum load? The Jung 2000 has a minimum load of 300 mA which is kind of high, in my opinion. I'm not much of an analog expert, so I haven't analyzed this circuit at all.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: wvdv2002 on May 24, 2012, 12:09:43 am
It does work over all voltage ranges, including short circuit without breaking, with a not so 'hard' to regulate load. The circuit kinda freaked out when I attached a DC motor, which is quite a nasty load. But under a resistive load there is almost no ripple apparent on the output. I tested the circuit a bit on a breadboard, but switching power supplies are not known for working well on breadboards. The output can come within 2.5 volts of the input voltage, under load. I am quite sure the irregular load condition problem can be compensated on a PCB.

I finished the design of the PCB and in a few weeks time post my findings on the build circuit here.
There are some problems with Vref of the LM2596 dropping under when the output comes closer to the input voltage. I hope this can be compensated in software. But I am making a version with another step down converter as well (The LM20323). It will be a guess if this chip works or not, as there is some over voltage protection in that chip which basically short circuits (in a safe way) the switching power supply if the feedback pin rises too high above the reference voltage.... But for the rest the LM20323 is quite a sturdy chip, it being used in automotive applications and all. But SEEDstudio lets me make a 10x10 cm PCB for the same price as a 10x5 cm. So I will just test both circuits at once.

For version 2.0 (or even higher ;), I might even use a Microchip DSPic, which can be used in a digital feedback loop SMPS. This adds interesting possibilities, like a digital PID feedback system with tunable parameters, direct current feedback (which responds much faster to changing loads) and some other nice tricks. But for now, I will stick to Version 0.5.
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: mikestefoy on May 25, 2012, 01:26:26 pm
love the design so far.
may I suggest using a PIC with a USB port, say PIC18F2550, so it can be connected to a PC via USB, and then remotely controlled/measured.

just rechecked the schematic dooohhhhh !!
it has a USB port
Title: Re: Re: Computer controlled PS/function gen/multimeter
Post by: wvdv2002 on May 25, 2012, 01:40:15 pm
I just send the PCB design to SEEED for manufacturing. There is a USB connector included and the PIC used in the project is the 18f46j50, which is the 44 pin version of the PIC in the bus pirate V4. So the thing can be controlled using a computer.

I plan to make the whole thing computer controllable. The current and voltage can be set on the PC and the actual current and voltages measured can be send to the computer. I hope to reuse part of the bus pirate code for this project, so it has about the same user interface and command structure.

Would be nice to use the thing to plot charging curves of batteries and the like for example.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: wvdv2002 on January 15, 2013, 09:58:18 pm
It has been a while, but some progress has been made on my small mobile power supply. I have received the PCB and build both versions of the apparatus, one with the LM20323 and the other with the lm2596. Both versions function as expected actually.

The version with the LM20323 did not work, as it goes berserk when the current feedback kicks in, because it tries to compensate for what the chip thinks is an overvoltage problem. When it comes to voltage limiting capabilities it works very good, because it is much more efficient than the version with the LM2596, which above 2-2.5 amps gets quite hot.

The version with the LM2596 works quite well, although in current limiting mode there is some oscillation for the moment (I did not try to compensate for this yet). Furthermore it tends too make a high pitched noise in some load conditions. The voltage ripple is about  50mV and the current ripple 50mA. Which I think is still quite a lot, hopefully I will find some way to improve it.
So you can charge batteries with it, but it is not a laboratory supply (yet).

There were some minor errors, like the opamp apparently having two different versions, one with VDD and VSS reversed, of course I chose the most exotic of the two parts... Furthermore the Vusb detection pin was connected to a non 5V tolerant pin and started to supply 5V to the 3.3v rail via the PICs internal diodes, my bad.

So, now I need to start thinking about getting rid of the oscillations and order one of these babies (http://https://www.sparkfun.com/products/10596), which will make it look way more badass. Let me know what you guys think of the design up till now.

On the computer control side of things. I first need to switch back to the C18 compiler instead of the XC8, too bad the USB stack does not work on the new compiler yet.

EDIT: Ok, I also found the solution to the oscillations and noise. The second coil added too much phase delay, thereby making the thing unstable. I removed the coil and now I only get 30mV of ripple while regulating a voltage and 50mV of ripple while current regulating :D
Title: Re: Computer controlled PS/function gen/multimeter
Post by: hybernaut on January 16, 2013, 02:36:33 pm
This looks sweet--nice work! 

[My first DP post]
Title: Re: Computer controlled PS/function gen/multimeter
Post by: garak on January 17, 2013, 12:48:58 am
Wow its great to see someone took this idea and ran with it. I had long forgotten about this project idea. Looks great, keep up the good work.

Thanks
--
Chris "Garak" McDonald
Title: Re: Computer controlled PS/function gen/multimeter
Post by: popol on March 13, 2013, 06:33:36 pm
Nice work! I'll keep looking for updates. Thanks for sharing.

Popol
Title: Re: Computer controlled PS/function gen/multimeter
Post by: diogoc on December 17, 2013, 12:43:54 am
Are you thinking to share the schematics?
Title: Re: Computer controlled PS/function gen/multimeter
Post by: diogoc on July 17, 2014, 03:01:45 pm
If anyone want, here is almost the schematic for the chinese ZXY6005S power supply
https://drive.google.com/file/d/0BzkDuD ... sp=sharing (https://drive.google.com/file/d/0BzkDuDi_KxbsVGRiZ0lfYjkxaHM/edit?usp=sharing)
Title: Re: Computer controlled PS/function gen/multimeter
Post by: Circuiteromalaguito on February 08, 2015, 06:01:44 am
Are there any news? I'm quite interested on this.

I found Sigrok, it's an interesting program that needs more attention. It could be used for this pice of hardware if finally gets developed.

There's DSLogic , but it isn't Open Hardware and lacks DMM features.
Title: Re: Computer controlled PS/function gen/multimeter
Post by: markbroady on June 09, 2016, 11:25:12 am
One thing to keep in mind as a possibility is an AC adaptor instead of DC.  They're rare, but I have seen some products which come with a wall-wart adaptor that outputs AC instead of the typical DC.  Something around 20 V AC or less.