EEVblog Electronics Community Forum

EEVblog => EEVblog Specific => Topic started by: IanB on December 03, 2011, 07:17:28 am

Title: Power supply part 4
Post by: IanB on December 03, 2011, 07:17:28 am
All this PWM filter stuff is a bit meh. It would look far more impressive to attach a stepper motor to the ten turn pot and control the stepper motor from the micro  ;)
Title: Re: Power supply part 4
Post by: IanB on December 03, 2011, 07:21:03 am
One of the more enjoyable uploads though. The visual and practical stuff with simulators and graphs and oscilloscope traces teaches concepts a lot better than textbooks.
Title: Re: Power supply part 4
Post by: benemorius on December 03, 2011, 08:20:35 am
One of the more enjoyable uploads though. The visual and practical stuff with simulators and graphs and oscilloscope traces teaches concepts a lot better than textbooks.

I agree. For some reason, I really enjoyed getting to watch things go from theory to simulation to circuit probing. I guess maybe seeing that sexy new InfiniiVision scope  may have had something to do with it. :P
Title: Re: Power supply part 4
Post by: McMonster on December 03, 2011, 09:06:48 am
I think there's a small problem in the video, it's all black around 30:50 to 31:28.
Title: Re: Power supply part 4
Post by: benemorius on December 03, 2011, 09:35:44 am
I think there's a small problem in the video, it's all black around 30:50 to 31:28.

Yes, there's a superfluous clip from 30:53 to 31:28 which repeats the audio from 30:18 to 30:53 with blank video.
Title: Re: Power supply part 4
Post by: EEVblog on December 03, 2011, 09:40:45 am
All this PWM filter stuff is a bit meh. It would look far more impressive to attach a stepper motor to the ten turn pot and control the stepper motor from the micro  ;)

Just like on those expensive Hi-Fi's where people want to see the knob spin at their command from the chair huh?  ;D

Dave.
Title: Re: Power supply part 4
Post by: tnt on December 03, 2011, 09:41:39 am
About those "probing glitches". How do you get rid of them ?
A video about probing techniques and pitfalls would be useful.
Title: Re: Power supply part 4
Post by: EEVblog on December 03, 2011, 09:42:13 am
I think there's a small problem in the video, it's all black around 30:50 to 31:28.

Yes, there's a superfluous clip from 30:53 to 31:28 which repeats the audio from 30:18 to 30:53 with blank video.

Combination of Sony Vegas screwing up, and a bit of PEBKAC.

Dave.
Title: Re: Power supply part 4
Post by: ejeffrey on December 03, 2011, 10:11:21 am
All this PWM filter stuff is a bit meh. It would look far more impressive to attach a stepper motor to the ten turn pot and control the stepper motor from the micro  ;)

Just like on those expensive Hi-Fi's where people want to see the knob spin at their command from the chair huh?  ;D

Dave.

My parent's used to have a cheap all-in-one unit with a motorized volume knob.  This was from before it was standard to convert everything to digital and I guess for some reason digital potentiometers were ruled out. Sadly it broke down and they threw it out before I could recover the volume pot.
Title: Re: Power supply part 4
Post by: zargnut on December 03, 2011, 01:59:25 pm
Really interesting and well explained for a newbie. When you finalize your design, would you consider posting your schematic and parts list? I would love to build it. But could use the extra hand-holding a printable reference would provide.

thanks
dan
Title: Re: Power supply part 4
Post by: firewalker on December 03, 2011, 04:11:14 pm
Dave, a small request...

Can you use the rotary encoders method for the project? Rotary encoders always gives me a hard time. Will you, fantastic Dave?  :-* :-* :-*  :P :P :P

Alexander.
Title: Re: Power supply part 4
Post by: tnt on December 03, 2011, 04:46:26 pm
For those who like math, the dual stage RC filter has this transfer function :

(http://latex.codecogs.com/png.latex?H(j%20\omega)%20=%20\frac{1}{1%20+%20j%20\omega%20\left[R_2%20C_2%20+%20R_1%20\left(C_1%20+%20C_2%20\right)%20\right]%20-%20\omega%20^%202%20R_1%20C_1%20R_2%20C_2})

And present this impedance to the input:

(http://latex.codecogs.com/png.latex?Z(j%20\omega)%20=%20\frac{1%20+%20j%20\omega%20\left[%20R_2%20C_2%20+%20R_1%20\left(%20C_1%20+%20C_2%20\right)%20\right]%20-%20\omega%20^%202%20R_1%20C_1%20R_2%20C_2}{j%20\omega%20(C_1%20+%20C_2)%20-%20\omega%20^2%20R_2%20C_2%20C_1})

(it's all from a 'back of the envelope' attempt, so I might have made a mistake but it "looks" right)
Title: Re: Power supply part 4
Post by: leniwiec on December 03, 2011, 05:56:42 pm
Hello everybody! ;-)

Dave, really good episode imo.

I am wondering about few thing, regarding to this episode. Is there any method to make integral from pwm signal really quick, for example let's get the situation where whole power supply is build around micro and hysteresis for current limiter is in software, then we need really quick reaction.

Second thing that I think may be interest, specially for nob is measurements instruments for power supply, and also method of connecting it. For example in symmetrical  power supply this is not so obvious.
Also I wondering about how they measure current in all of those cheap-china powersupplys where they have 3 terminals and only one 3-4 digits amp meter and the current may flow in 3 "path" (plus2ground, minus2ground and plus2minus).

Cheers!

Ps. sorry for my language - it may be not so good (en is not my native) ;)
Title: Re: Power supply part 4
Post by: EEVblog on December 04, 2011, 04:26:58 am
Dave, a small request...

Can you use the rotary encoders method for the project? Rotary encoders always gives me a hard time.

Yep, I'll be using them.

Dave.
Title: Re: Power supply part 4
Post by: EEVblog on December 04, 2011, 04:28:16 am
I am wondering about few thing, regarding to this episode. Is there any method to make integral from pwm signal really quick, for example let's get the situation where whole power supply is build around micro and hysteresis for current limiter is in software, then we need really quick reaction.

You'd use a fast DAC instead.

Dave.
Title: Re: Power supply part 4
Post by: dcel on December 04, 2011, 06:27:37 am
Dave

Having been "out" of electronics for years, I have decided to get back into it and teach myself pic microcontrollers. I have been watching the eevblog for a while and felt compelled to actually sign up for the eevblog forum (first forum I have ever subscribed to) just so I could tell you thanks for the work you are doing here and keep up the great work. I have learned more watching your eevblog than in 3 years vocational electronics and a year of college electronics ( too much theory and math). I have recommended your eevblog to a friend returning to college for electronics as well.

I especially look forward to building a pic controlled power supply for the lab I am setting up now. I can't wait for the next video...

Thank you,
Chris
Title: Re: Power supply part 4
Post by: EEVblog on December 04, 2011, 08:48:21 am
Thanks Chris, and welcome.

Dave.
Title: Re: Power supply part 4
Post by: ejeffrey on December 04, 2011, 09:55:14 am
I am wondering about few thing, regarding to this episode. Is there any method to make integral from pwm signal really quick, for example let's get the situation where whole power supply is build around micro and hysteresis for current limiter is in software, then we need really quick reaction.

As dave said, use a real DAC.  Filtering PWM is cheap and easy, but very low performance.  It is fine for generating low resolution DC signals, but if you need anything fancy a DAC is what you want.  Even a cheap DAC will outperform the PWM signal by a lot.  That said, designing a control loop with a microprocessor in the feedback loop is significantly more complicated to get right.  It takes some effort to have anywhere near as fast of a response time as a cheap op-amp and guaranteeing stability is considerably harder due to the latencies involved.

Quote

Also I wondering about how they measure current in all of those cheap-china powersupplys where they have 3 terminals and only one 3-4 digits amp meter and the current may flow in 3 "path" (plus2ground, minus2ground and plus2minus).

These power supplies are floating and only connected to the + and - terminals.  The ground terminal is simply connected to the chassis ground and to the mains earth connection.  They are generally provided with clips that let you short either the + or the - output to ground in order to make a positive or negative voltage supply.  All current is returned to the - output, only leakage current from the powered device flows through the ground pin.
Title: Re: Power supply part 4
Post by: slateraptor on December 04, 2011, 10:50:44 am
For those who like math, the dual stage RC filter has this transfer function :

(http://latex.codecogs.com/png.latex?H(j%20\omega)%20=%20\frac{1}{1%20+%20j%20\omega%20\left[R_2%20C_2%20+%20R_1%20\left(C_1%20+%20C_2%20\right)%20\right]%20-%20\omega%20^%202%20R_1%20C_1%20R_2%20C_2})

And present this impedance to the input:

(http://latex.codecogs.com/png.latex?Z(j%20\omega)%20=%20\frac{1%20+%20j%20\omega%20\left[%20R_2%20C_2%20+%20R_1%20\left(%20C_1%20+%20C_2%20\right)%20\right]%20-%20\omega%20^%202%20R_1%20C_1%20R_2%20C_2}{j%20\omega%20(C_1%20+%20C_2)%20-%20\omega%20^2%20R_2%20C_2%20C_1})

(it's all from a 'back of the envelope' attempt, so I might have made a mistake but it "looks" right)

I'm pretty sure the filter was a cascaded 2nd-order RC low pass with a transfer function:

(http://latex.codecogs.com/gif.latex?H(j\omega)=\frac{1}{(1+j\omega{R_1C_1})(1+j\omega{R_2C_2})}=\frac{1}{1+j\omega(R_1C_1+R_2C_2)-\omega^2{R_1C_1R_2C_2}})

...and the output impedance of the filter (assuming the output impedance of the input source is negligible) from Laplace-domain to jw-domain:

(http://latex.codecogs.com/gif.latex?Z_{out}(s)=((R_1\|\frac{1}{sC_1})+R_2)\|\frac{1}{sC_2}=&space;{\frac{\frac{R_1}{1+sR_1C_1}+R_2}{\frac{R_1}{1+sR_1C_1}+R_2+1}}|_{s=j\omega}=Z_{out}(j\omega)=\frac{\frac{R_1}{1+j\omega{R_1C_1}}+R_2}{\frac{R_1}{1+j\omega{R_1C_1}}+R_2+1})

Input impedance of the filter in Laplace domain (assuming buffer input impedance is ideally infinite):

(http://latex.codecogs.com/gif.latex?Z_{in}(s)=R_1+\frac{1}{sC_1}\|(R_2+\frac{1}{sC_2}))

I won't bother simplifying this one. Then again, I might not be remembering the filter from the video correct..."back of the envelope" calculations from "back of the mind" thoughts fo sho.
Title: Re: Power supply part 4
Post by: slateraptor on December 04, 2011, 11:06:56 am
For those who like math...

P.S. and for the record, I don't like math in the same way I don't like condoms: it's an indispensable tool when the task at hand calls for it, but when the task is complete, most people won't dare touch it and it gets flushed down the toilet either way. =\
Title: Re: Power supply part 4
Post by: george graves on December 04, 2011, 11:33:31 am
Any reason why using a digital pot wasn't an option?

I'm thinking of modding an off the shelf, coarse/fine typical bench top supply with some digital pots - mostly to give me programmable features.  Any thoughts?
Title: Re: Power supply part 4
Post by: firewalker on December 04, 2011, 11:54:53 am
Nice!!!

I guess you are going to use a PIC mcu. It would be also nice to select C a compiler in order to make the code (The part for decoding the decoders is "essential" for me) portable for AVR e.t.c.

Alexander.

Dave, a small request...

Can you use the rotary encoders method for the project? Rotary encoders always gives me a hard time.

Yep, I'll be using them.

Dave.

Nice!!!

I guess you are going to use a PIC mcu. It would be also nice to select C a compiler in order to make the code (The part for decoding the decoders is "essential" for me) portable for AVR e.t.c.
Title: Re: Power supply part 4
Post by: tnt on December 04, 2011, 12:10:23 pm
I'm pretty sure the filter was a cascaded 2nd-order RC low pass with a transfer function:

(http://latex.codecogs.com/gif.latex?H(j\omega)=\frac{1}{(1+j\omega{R_1C_1})(1+j\omega{R_2C_2})}=\frac{1}{1+j\omega(R_1C_1+R_2C_2)-\omega^2{R_1C_1R_2C_2}})

This doesn't look right. It looks just like you multiplied the two transfer function of each stage.
The RC filter has this transfer function :
(http://latex.codecogs.com/gif.latex?H(j\omega)=\frac{1}{1+j\omega{RC}})

But only if the loading impedance at the output if negligible. Which is the case for the second stage (because feeding an opamp), but not for the first stage which is loaded by the second stage and introduces another term.

PS: Nice analogy :) I also don't do math just for the sake of it, but I found myself having to compute a RC filter having a specific impedance while in a train with nothing else than a paper and pencil and I just tought I'd share this because I find it useful to sometime being able to go back to this. (Even tough when I learned that at uni I wasn't convinced of the usefulness :)
Title: Re: Power supply part 4
Post by: slateraptor on December 04, 2011, 01:33:04 pm
This doesn't look right. It looks just like you multiplied the two transfer function of each stage.
The RC filter has this transfer function :
(http://latex.codecogs.com/gif.latex?H(j\omega)=\frac{1}{1+j\omega{RC}})

But only if the loading impedance at the output if negligible. Which is the case for the second stage (because feeding an opamp), but not for the first stage which is loaded by the second stage and introduces another term.

PS: Nice analogy :) I also don't do math just for the sake of it, but I found myself having to compute a RC filter having a specific impedance while in a train with nothing else than a paper and pencil and I just tought I'd share this because I find it useful to sometime being able to go back to this. (Even tough when I learned that at uni I wasn't convinced of the usefulness :)

See attached pic for circuit, just to be sure we're on the correct page. For simplicity of analysis, we'll denote R1/C1 as 1st-stage components and R2/C2 as 2nd-stage.

Output impedance of the 1st stage:

(http://latex.codecogs.com/gif.latex?Z_{out1}(j\omega)=R_1\|\frac{1}{j\omega{C_1}}=\frac{R_1}{1+j\omega{R_1C_1}})

Input impedance of the 2nd stage:

(http://latex.codecogs.com/gif.latex?Z_{in2}(j\omega)=R_2+\frac{1}{j\omega{C_2}})

Since both expressions are functions of omega, evaluate at the limits.

At DC, viz. w = 0:

(http://latex.codecogs.com/gif.latex?\lim_{\omega\rightarrow0}{Z_{out1}(j\omega)}=R_1)
(http://latex.codecogs.com/gif.latex?\lim_{\omega\rightarrow0}{Z_{in2}(j\omega)}=\infty)

And at the other end of the spectrum:

(http://latex.codecogs.com/gif.latex?\lim_{\omega\rightarrow\infty}{Z_{out1}(j\omega)}=0)
(http://latex.codecogs.com/gif.latex?\lim_{\omega\rightarrow\infty}{Z_{in2}(j\omega)}=R_2)

So it's clear that the stages are impedance matched. Of course, this assumes that the output impedance of the uC pin providing the PWM signal and input impedance of the non-inverting input of the buffer are very small and very large, respectively (which is a reasonable assumption). QED.

I think you're train of thought drifted towards transistor small-signal analysis. Attention to detail, my friend...only because you forced my hand in writing a proof. ;) And btw, I LOVE this codecogs instant online latex business! Thanks for the indirect link!! :D
Title: Re: Power supply part 4
Post by: tnt on December 04, 2011, 01:59:30 pm
See attached pic for circuit, just to be sure we're on the correct page. For simplicity of analysis, we'll denote R1/C1 as 1st-stage components and R2/C2 as 2nd-stage.

Yes, this is what I was thinking about.

So it's clear that the stages are impedance matched. Of course, this assumes that the output impedance of the uC pin providing the PWM signal and input impedance of the non-inverting input of the buffer are very small and very large, respectively (which is a reasonable assumption). QED.

Mm... sorry I don't see it.

I do agree that the additional term ( j w R_1 C_2 ) in m y transfer function is irrelevant at both extremes:
* If w = 0 (DC) then the term is just nulled.
* If w -> inf then the term is irrelevant compared to the quadratic term w^2

But in the transition region, the term has "some" influence. (it doesn't change drastically the response, but it's there nonetheless). So yes, if you're just drawing the bodeplot by hand for a quick check you can ignore it. But in the analytical solution, it must be present. If you're ok with an approximate solution, you might as well drop all the linear terms and just keep the constant one and the quadratic one.

The first stage if you consider it connected to a non-negligible load :
(http://latex.codecogs.com/png.latex?H_1(j%20\omega)%20=%20\frac{Z_{in2}(j\omega)||\frac{1}{j\omega%20C_1}}{R_1%20+%20\left(%20Z_{in2}(j\omega)||\frac{1}{j\omega%20C_1}%20\right)}%20=%20\frac{1}{1%20+%20j\omega%20R_1%20C_1%20+%20\frac{R_1}{Z_{in2}(j\omega)}%20})

Which clearly shows the "extra" term and later on simplifies itself to (j w R_1 C_2).

And btw, I LOVE this codecogs instant online latex business! Thanks for the indirect link!! :D

Yes, the stuff is just awesome :p
Not sure if they really like hotlinking to it but meh ...
Title: Re: Power supply part 4
Post by: jahonen on December 04, 2011, 02:01:51 pm
I don't think one can just ignore the input impedance of the second stage. Here is a simulation and comparison to a transfer functions represented here. They match perfectly for each case and shows that if one puts ideal buffer (SPICE E-component, or VCVS) between stages, then the direct cascade assumption holds.

I think that math is a good thing in general but I like application oriented way, so that when I get a mathematical description of the problem done (this can't be easily done by a computer), I'd prefer to use brute force of CAS to solve it, just to avoid page(s) full of just dummy algebraic manipulations which are quite error prone and I hate discovering stupid error three pages later...

Edit: It seems that I mistyped the frequency in Maple, but not a great amount. :)

Regards,
Janne
Title: Re: Power supply part 4
Post by: slateraptor on December 04, 2011, 02:32:39 pm
The first stage if you consider it connected to a non-negligible load :
(http://latex.codecogs.com/png.latex?H_1(j%20\omega)%20=%20\frac{Z_{in2}(j\omega)||\frac{1}{j\omega%20C_1}}{R_1%20+%20\left(%20Z_{in2}(j\omega)||\frac{1}{j\omega%20C_1}%20\right)}%20=%20\frac{1}{1%20+%20j\omega%20R_1%20C_1%20+%20\frac{R_1}{Z_{in2}(j\omega)}%20})

Ahh, yes. I see where you're coming from and rescind my argument. Indeed, I was approximating way too much. Good show on putting me in my place.

@jahonen: Simulated and got the same results. But I see exactly where tnt is coming from now and he's without a doubt correct.
Title: Re: Power supply part 4
Post by: leniwiec on December 04, 2011, 02:43:29 pm
As dave said, use a real DAC.  Filtering PWM is cheap and easy, but very low performance.  It is fine for generating low resolution DC signals, but if you need anything fancy a DAC is what you want.  Even a cheap DAC will outperform the PWM signal by a lot.  That said, designing a control loop with a microprocessor in the feedback loop is significantly more complicated to get right.  It takes some effort to have anywhere near as fast of a response time as a cheap op-amp and guaranteeing stability is considerably harder due to the latencies involved.

Yes, I am currently using DAC (r2r), but I just wondering, because theoretically we can calculate it from 1 signal period... only hardware implementation of this may be very hard. 

These power supplies are floating and only connected to the + and - terminals.  The ground terminal is simply connected to the chassis ground and to the mains earth connection.  They are generally provided with clips that let you short either the + or the - output to ground in order to make a positive or negative voltage supply.  All current is returned to the - output, only leakage current from the powered device flows through the ground pin.

Uh, so they really not so much symmetrical ;)
Title: Re: Power supply part 4
Post by: ivan747 on December 04, 2011, 02:58:58 pm
All this PWM filter stuff is a bit meh. It would look far more impressive to attach a stepper motor to the ten turn pot and control the stepper motor from the micro  ;)

Just like on those expensive Hi-Fi's where people want to see the knob spin at their command from the chair huh?  ;D

Dave.

Yup. I took an old stereo apart just to get that part. It's not a stepper motor, though; just a common DC one. There is no electronic feedback because you choose when to stop, so you are part of the feedback system, actually. There must be some current limiter for the DC motor on that circuit, though.
Title: Re: Power supply part 4
Post by: jahonen on December 04, 2011, 03:19:31 pm
I have wondered why there are no delta-sigma modulators in a MCU for DA conversion, it would be easier to filter than a PWM (as the noise would be at higher frequency), and further, the noise would be random noise, instead of discrete tone + harmonics that of PWM. All 1-bit audio DACs work with this principle (I'm listening one as I write this via my headphones and it works great!).

But anyway, if the noise performance is a great concern, I'd go to a DAC solution (I think that it is not _that_ expensive) without any hesitation as it makes much easier to get rid of the supply induced noise in the MCU (output logic voltages are not clean even if fed from voltage reference) due to ground bounce/VCC droop in ground/VCC bond wires etc.

Regards,
Janne
Title: Re: Power supply part 4
Post by: RJSC on December 04, 2011, 11:26:22 pm
Any reason why using a digital pot wasn't an option?

I'm thinking of modding an off the shelf, coarse/fine typical bench top supply with some digital pots - mostly to give me programmable features.  Any thoughts?

I was thinking about it to.
Any reason we shouldn't?

A supply only with one pot would be more suitable to mod.
One problem on modding an off the shelf supply could be that I don't know of any digital pot that can be floatting (MCU ground and one terminal of the POT must be tied, because of the internal CMOS switch).
Title: Re: Power supply part 4
Post by: george graves on December 05, 2011, 04:43:56 am
I was thinking about it to.
Any reason we shouldn't?

A supply only with one pot would be more suitable to mod.

Dave mentioned in the Constant current dummy load video, that it's often done with two pots in series.  So, you might be able to replace both with a single digital pot?

One problem on modding an off the shelf supply could be that I don't know of any digital pot that can be floatting (MCU ground and one terminal of the POT must be tied, because of the internal CMOS switch).

Hmmmm - I'm a noob - and have only played with digital pots - but something like this can't be used?

http://www.maxim-ic.com/datasheet/index.mvp/id/2676 (http://www.maxim-ic.com/datasheet/index.mvp/id/2676)

That chip is only 256 values....but I'd assume there would be a 10-bit type digital pot?

I could see adding a few rotary encoders, an character LCD and a keypad to make a poor-man's, single channel version of something like this:

(http://i00.i.aliimg.com/photo/v0/108749280/RIGOL_DP1308A_PROGRAMMABLE_DC_POWER_SUPPLY.jpg)

Based around an arduino, and something like this:

(http://www.mpja.com/images/9601.jpg)

The goal  (for me) would be to have a power supply that I could store a few values in and press a button to recall them.  Also the ability to "type" in a value quickly.  "3.3v" or "10.111v" - I think it would be very hand to have to simulate sensor outputs and quickly calibrate a device based on two different voltages- quickly switching between a few voltages - rather then having to manually dial in a voltage over and over again.

Title: Re: Power supply part 4
Post by: IanJ on December 07, 2011, 06:55:38 pm
All this PWM filter stuff is a bit meh. It would look far more impressive to attach a stepper motor to the ten turn pot and control the stepper motor from the micro  ;)

Just like on those expensive Hi-Fi's where people want to see the knob spin at their command from the chair huh?  ;D

Dave.

Yup. I took an old stereo apart just to get that part. It's not a stepper motor, though; just a common DC one. There is no electronic feedback because you choose when to stop, so you are part of the feedback system, actually. There must be some current limiter for the DC motor on that circuit, though.

I converted an old analogue Denon amplifier by using DC motor and a small H-bridge circuit driven via an Arduino. Input via a small IR detector that picks up the VOL UP/DN on my remote.
Current limiting is done at the supply to the H-bridge taking into consideration FET RDS(on).......everything set up safe so that in the event say both FETs on left side of the H-bridge turn on at same (say the Arduino crashes!) then then nothing is overdriven.......no smoke!

I use it every day.

Ian.
Title: Re: Power supply part 4
Post by: JimmyM on December 08, 2011, 05:41:06 pm
I really enjoyed the 4 part series. I like the design a lot. I may start going through the design process to see if I could build something similar with a slightly larger range.
One thing did bother me though. Using pots is fine to adjust because you move the pot until the output reads what you want. However, the uC doesn't know if the output is really what you want it to be. But you could have a calibration procedure. The uC can read the output via ADC and adjust an internal calibration matrix so that when it says to output 3.3V worth of PWM, the output is actually 3.3V.

One thing though. 12-bit PWM using the internal 8MHz oscillator in an AVR will only do 8MHz/4096 ~= 1.9kHz. So even with an external 16MHz crystal, you can only get 3.8 kHz PWM at 12-bits. So an external DAC would be needed to get a clean DC signal without a lot of extra filtering. DACs aren't all that expensive. Some even have an internal reference. the price difference between 12-bit and 16-bit DACs is small, so why not go for a 16-bit SPI or I2C driven DAC and be able to get fine control and calibration of the output.

Just thinking out loud.
Title: Re: Power supply part 4
Post by: Frant on December 12, 2011, 01:09:21 am
Ahh, yes. I see where you're coming from and rescind my argument. Indeed, I was approximating way too much. Good show on putting me in my place.

The two stages of the filter obviously interact with each other, which is inherent to this topology. What can be done is to choose the component values differently in order to minimize the loading of the first stage. For instance, in the second stage the values can be R=100k and C=10n. If you run your simulation with these values, you'll see the improvement.
Title: Re: Power supply part 4
Post by: ejeffrey on December 12, 2011, 09:53:01 am
I have wondered why there are no delta-sigma modulators in a MCU for DA conversion, it would be easier to filter than a PWM (as the noise would be at higher frequency), and further, the noise would be random noise, instead of discrete tone + harmonics that of PWM. All 1-bit audio DACs work with this principle (I'm listening one as I write this via my headphones and it works great!).

A few MCUs do have true DACs.  Some of the PIC line have general purpose D/A converters, and analog devices has a few as well.  In the SOC class of embedded processors onboard audio DACs are pretty standard.  They are not always suitable for control applications, but as long as they can be DC coupled they should be OK for providing an operating set point.

Anyway, if you are desperate to save a few cents, but PWM isn't good enough, you can actually make a 1st order sigma-delta modulator in software.  You just set the PWM resolution for (say) 8 bits at a higher frequency, but keep a 12 bit control word.  Then keep a software error accumulator that keeps track of the quantization error and updates the PWM width every cycle.  You will still see low frequency ripple because this is a 1st order modulator, but most of the noise power will be pushed up into the higher frequencies and be easier to filter, and the response time will be much faster.  IMHO, not really worth it compared to just putting in a cheap DAC.
Title: Re: Power supply part 4
Post by: EEVblog on December 12, 2011, 12:15:51 pm
Hmmmm - I'm a noob - and have only played with digital pots - but something like this can't be used?

http://www.maxim-ic.com/datasheet/index.mvp/id/2676 (http://www.maxim-ic.com/datasheet/index.mvp/id/2676)

That chip is only 256 values....but I'd assume there would be a 10-bit type digital pot?

The most common type is 256 step, but you can get 1024 step ones. IIRC I have never sen higher.
Digital pots also have a low max supply voltage, mostly TTL type range, only a few have say 12V or greater.
No problem in my circuit configuration because one of the advantages of it is the ground referenced control voltage design. But harder to use digital pots in higher voltage designs where sometime the pot isn't ground referenced.

Quote
The goal  (for me) would be to have a power supply that I could store a few values in and press a button to recall them.  Also the ability to "type" in a value quickly.  "3.3v" or "10.111v" - I think it would be very hand to have to simulate sensor outputs and quickly calibrate a device based on two different voltages- quickly switching between a few voltages - rather then having to manually dial in a voltage over and over again.

Sounds exactly like my design  ;)
Part 5 coming soon...

Dave.
Title: Re: Power supply part 4
Post by: JimmyM on December 12, 2011, 12:34:08 pm

Sounds exactly like my design  ;)
Part 5 coming soon...

Dave.

Anxiously awaiting.
Title: Re: Power supply part 4
Post by: ivan747 on December 12, 2011, 03:45:28 pm

Sounds exactly like my design  ;)
Part 5 coming soon...

Dave.

Anxiously awaiting.

Looking forward to watching it. Is is going to be about the user interface and the MCU?
Title: Re: Power supply part 4
Post by: JimmyM on December 12, 2011, 05:18:17 pm
I am SO building one of these. A couple of ADC connections from the Current amplifier and the Vout can calculate Wattage on an LCD.
Title: Re: Power supply part 4
Post by: EEVblog on December 12, 2011, 09:53:41 pm
Looking forward to watching it. Is is going to be about the user interface and the MCU?

Next video will probably be a few additions to the schematic, like the micro, ADC/DAC (yes, no PWM), and various current measurement stuff, and likely more datasheet and component selection stuff.
I just laid out the board and have a time lapse video of that, so I'll add some commentary and make a video.
Then there will likely be another on the system design and layout etc
Plus still another trick up my sleeve.
Plenty of videos to do yet I think...

Dave.
Title: Re: Power supply part 4
Post by: baljemmett on December 12, 2011, 10:34:57 pm
Plenty of videos to do yet I think...

Excellent news -- I get the impression you're really enjoying this project!
Title: Re: Power supply part 4
Post by: firewalker on December 12, 2011, 10:36:57 pm
(http://i.imgur.com/tTpwis.jpg) (http://i.imgur.com/tTpwi.jpg)

(http://i.imgur.com/LNV56s.png) (http://i.imgur.com/LNV56.png)

(http://i.imgur.com/xaxbSs.gif) (http://i.imgur.com/xaxbS.gif)

 ;D ;D ;D

I am hoping for DIP packages...

Alexander.
Title: Re: Power supply part 4
Post by: IanB on December 12, 2011, 11:52:55 pm
I am hoping for DIP packages...Alexander.

But some of us need an excuse to practice SMD soldering  ;)
Title: Re: Power supply part 4
Post by: EEVblog on December 13, 2011, 01:36:21 am
I am hoping for DIP packages...Alexander.

But some of us need an excuse to practice SMD soldering  ;)

Then you will both get your wish!
As mentioned on today's AmpHour, the PSU project is mostly through-hole, but a few SMD parts were unavoidable.

Dave.
Title: Re: Power supply part 4
Post by: caroper on December 22, 2011, 01:03:53 pm
If I may add to the wish list.

Will the final design allow them to be connected in Series / paralleled / cascade configurations to provide more current, more voltage or a tracking +/- Supply?

It is often stated that it is cheaper to buy a good bench supply than to make one, but the joy of building it and understanding exactly how it works, thanks to your tutorials, is priceless. I would love to build this just for the practical experience and my power requirements, for the foreseeable future, are low. 12V at 500mA is more than I envisage needing, but if the PSU's are isolated then 2 could possibly give +/-12V at 500mA or 12V at ~1Amps or 24V at 500mA.

This will be a step up from my Velleman LAB1 PSU and a great addition to any hobby lab.
Any chance of releasing it in Kit form?

Good on you Mate.
I look forward to Part 5.

Cheers
Chris
Title: Re: Power supply part 4
Post by: JimmyM on December 22, 2011, 01:19:03 pm
I'm hoping for an AVR based design instead of PIC. Just a personal preference. I have more experience with AVRs. But if it is with a PIC, I can certainly substitute an AVR in my version. I'm envisioning a few buttons, a rotary encoder, and a small LCD. What say you, Dave? Will you be doing an LCD?
Title: Re: Power supply part 4
Post by: firewalker on December 22, 2011, 01:27:14 pm
I am also hoping for a AVR design. Not because I don't like PICs. Because PIC programming under GNU/Linux...

Either way it would be trivial to "cross platform it".

Alexander.
Title: Re: Power supply part 4
Post by: RJSC on December 22, 2011, 01:55:34 pm
If I may add to the wish list.

Will the final design allow them to be connected in Series / paralleled / cascade configurations to provide more current, more voltage or a tracking +/- Supply?

It is often stated that it is cheaper to buy a good bench supply than to make one, but the joy of building it and understanding exactly how it works, thanks to your tutorials, is priceless. I would love to build this just for the practical experience and my power requirements, for the foreseeable future, are low. 12V at 500mA is more than I envisage needing, but if the PSU's are isolated then 2 could possibly give +/-12V at 500mA or 12V at ~1Amps or 24V at 500mA.

This will be a step up from my Velleman LAB1 PSU and a great addition to any hobby lab.
Any chance of releasing it in Kit form?

Good on you Mate.
I look forward to Part 5.

Cheers
Chris

If you write your own MCU firmware, tracking will be easy:
Build 2 identical floating PSUs and add an optoisolator to the microcontroller (use standard serial ASCII characters over the UART or custom protocol if you want) and send the current voltage from the master supply, and the slave should receive the data and track the master accordingly.

If you leave an optoisolated serial interface for computer control (useful for automated tests or extremely low frequency function generator) you can just connect the 2 supplies directly to one another and the master supply will issue commands as if it were the computer.
Or if you leave them connected to the computer, the computer can read the voltage from the master supply and send it to the slave, or you can have both a dedicated computer interface and tracking interface.

The key is the optical isolation on the communication so that you can connect the ground of one supply to the positive of another.

Now the difficult is to choose between all of this communication methods.

(I'm not a native english speaker, so, if it sounds confuse, feel free to ask for clarification)
Title: Re: Power supply part 4
Post by: RJSC on December 22, 2011, 01:59:50 pm
I am also hoping for a AVR design. Not because I don't like PICs. Because PIC programming under GNU/Linux...

Either way it would be trivial to "cross platform it".

Alexander.

Well, there's good news for you!  :)

Quote
    After a long beta testing period Microchip finally released MPLAB X V1.0.

    MPLAB X is the new  integrated development system for Microchip microcontrollers. It is built on the Java platform so Mac, Linux, and Windows users are supported. Here are some major features of MPLAB X:

        Based on Java / Netbeans.
        Supported under Windows, Linux and Mac OS X 10.5 and Mac OS X 10.6.
        Newer, more functional GUI.
        MPLAB C32 (for PIC32MX), C30 (for PIC24 and dsPIC), C18 compilers are available.
        HI-TECH C Lite Compiler for PIC18s, and HI-TECH C Lite Compiler for PIC10/12/16 are also available.

Title: Re: Power supply part 4
Post by: firewalker on December 22, 2011, 02:01:27 pm
NICE!!!

Alexander.

I am also hoping for a AVR design. Not because I don't like PICs. Because PIC programming under GNU/Linux...

Either way it would be trivial to "cross platform it".

Alexander.

Well, there's good news for you!  :)

Quote
    After a long beta testing period Microchip finally released MPLAB X V1.0.

    MPLAB X is the new  integrated development system for Microchip microcontrollers. It is built on the Java platform so Mac, Linux, and Windows users are supported. Here are some major features of MPLAB X:

        Based on Java / Netbeans.
        Supported under Windows, Linux and Mac OS X 10.5 and Mac OS X 10.6.
        Newer, more functional GUI.
        MPLAB C32 (for PIC32MX), C30 (for PIC24 and dsPIC), C18 compilers are available.
        HI-TECH C Lite Compiler for PIC18s, and HI-TECH C Lite Compiler for PIC10/12/16 are also available.

Title: Re: Power supply part 4
Post by: shebu18 on December 22, 2011, 03:03:04 pm
I still hope for a AVR version too. I also think that if it will be PIC someone with experience will write a code for AVR.
Title: Re: Power supply part 4
Post by: McMonster on December 22, 2011, 05:03:26 pm
Or maybe Dave will surprise us and choose less or next to not known MCU or even small ARM, they're dirt cheap nowdays (and a bit overkill for this application). I'd actually be happy if this was the less known micro, AVRs and PICs are used in all kind of hobby projects and it's a bit boring.

As for the code, a block diagram or pseudocode would be nice.
Title: Re: Power supply part 4
Post by: firewalker on December 22, 2011, 05:17:16 pm
Dave said it will be PID-28 packet. This narrows it down...  :P :P :P :P

Alexander.
Title: Re: Power supply part 4
Post by: JimmyM on December 22, 2011, 07:26:19 pm
Dave said it will be PID-28 packet. This narrows it down...  :P :P :P :P

Alexander.
Ummm. What's a PID-28 Packet?
Title: Re: Power supply part 4
Post by: caroper on December 22, 2011, 07:37:26 pm
Well the new low pin count, dip packaged, PIC32MX, MIPS core chips from Microchip were released into production this month. Lots of peripherals, including 16 bit PWM and 10 bit ADC's that can run at 1Meg samples per second, all clocked at 80Mhz, it has a lot of processing power. It could be ideal for this sort of operation.

Title: Re: Power supply part 4
Post by: JimmyM on December 22, 2011, 07:59:21 pm
Well the new low pin count, dip packaged, PIC32MX, MIPS core chips from Microchip were released into production this month. Lots of peripherals, including 16 bit PWM and 10 bit ADC's that can run at 1Meg samples per second, all clocked at 80Mhz, it has a lot of processing power. It could be ideal for this sort of operation.
Wow. That sounds cool. I may just have to look that thing up. I have no idea what I'm going to do with 80MHz of processor, but I should be able to come up with SOMETHING!
Title: Re: Power supply part 4
Post by: firewalker on December 22, 2011, 09:12:41 pm
Dave said it will be PID-28 packet. This narrows it down...  :P :P :P :P

Alexander.
Ummm. What's a PID-28 Packet?

Yea, I meant DIP.

Alexander.
Title: Re: Power supply part 4
Post by: McMonster on December 22, 2011, 11:03:22 pm
Well the new low pin count, dip packaged, PIC32MX, MIPS core chips from Microchip were released into production this month. Lots of peripherals, including 16 bit PWM and 10 bit ADC's that can run at 1Meg samples per second, all clocked at 80Mhz, it has a lot of processing power. It could be ideal for this sort of operation.

Sounds interesting. I think I'll give them a try before DIP/SO/TSSOP ARMs become available.
Title: Re: Power supply part 4
Post by: EEVblog on December 23, 2011, 02:00:29 am
Nothing exotic, it's a bog standard AVR Atmega48, with separate 12bit Microchip ADC and DAC.
I considered a 12bit ADC PIC in DIP (basically the only brand micro with DIP 12bit ADC).
I decided to Guild the Lilly over the integrated 10bit solution.

Dave.
Title: Re: Power supply part 4
Post by: firewalker on December 23, 2011, 10:42:34 am
When you mentioned DIP-28 I said to my self "If he chooses AVR, I bet it would be ATmega8".

Alexander.

Nothing exotic, it's a bog standard AVR Atmega48, with separate 12bit Microchip ADC and DAC.
I considered a 12bit ADC PIC in DIP (basically the only brand micro with DIP 12bit ADC).
I decided to Guild the Lilly over the integrated 10bit solution.

Dave.
Title: Re: Power supply part 4
Post by: jstkatz on December 25, 2011, 07:39:49 am
Any plans on making this availible as a kit? I'm guessing there would be demand for it and it seems to have much better performance than other electronics power supplies.
Title: Re: Power supply part 4
Post by: EEVblog on December 25, 2011, 11:04:08 am
Any plans on making this availible as a kit? I'm guessing there would be demand for it and it seems to have much better performance than other electronics power supplies.

Yes, that is the plan, hence the through-hole parts.

Dave.
Title: Re: Power supply part 4
Post by: McMonster on December 25, 2011, 11:56:24 am
Any plans on making this availible as a kit? I'm guessing there would be demand for it and it seems to have much better performance than other electronics power supplies.

Yes, that is the plan, hence the through-hole parts.

Dave.

Will there be an option for soldering multiple regulators on the PCB for more current?
Title: Re: Power supply part 4
Post by: JimmyM on December 25, 2011, 12:04:51 pm

Yes, that is the plan, hence the through-hole parts.

Dave.
Dave, a kit would we awesome. But I do have a request. Would it be possible to make the uC on a plug in board? To allow us to use a different controller. Your board could just use a DIP-40 foot print for the controller. Then nearly any controller could be used. I'm not saying that you should provide the different daughter boards. Just the one for the chip you choose. But we could build a customer one if we choose. That would ROCK.
Title: Re: Power supply part 4
Post by: shebu18 on December 25, 2011, 12:06:21 pm
If we will have the schematics we can implement any uC. There is no need for a plug in board.
Title: Re: Power supply part 4
Post by: McMonster on December 25, 2011, 12:14:26 pm

Yes, that is the plan, hence the through-hole parts.

Dave.
Dave, a kit would we awesome. But I do have a request. Would it be possible to make the uC on a plug in board? To allow us to use a different controller. Your board could just use a DIP-40 foot print for the controller. Then nearly any controller could be used. I'm not saying that you should provide the different daughter boards. Just the one for the chip you choose. But we could build a customer one if we choose. That would ROCK.

Different micros have different pinouts, you can't just stick DIP-40 footprint and hope AVR's supply, ADC etc. pins will match those on different controllers. It won't even work on all AVRs with the same pin count. It would require having some kind of connections like goldpins on development boards to be connected using jumper wires and this would be very ugly for such a device. A pluggable daughter board would make more sense, but is it worth it?
Title: Re: Power supply part 4
Post by: shebu18 on December 25, 2011, 02:07:13 pm
What he wanted to say is that wanted to change the dip40, on which not all pins are used with another micro that has the same pinout made by the plug in board. It' kind of like the arduino and its shields.
Title: Re: Power supply part 4
Post by: JimmyM on December 25, 2011, 10:29:02 pm
What I was suggesting was that just about any controller could be mounted to a daughter board that has a 40DIP footprint. Like a mega168 TQFP smd chip on a small pcb with 2 row of 20 pins. See what I'm getting at.
Title: Re: Power supply part 4
Post by: EEVblog on December 25, 2011, 10:43:39 pm
Dave, a kit would we awesome. But I do have a request. Would it be possible to make the uC on a plug in board? To allow us to use a different controller. Your board could just use a DIP-40 foot print for the controller. Then nearly any controller could be used. I'm not saying that you should provide the different daughter boards. Just the one for the chip you choose. But we could build a customer one if we choose. That would ROCK.

Sorry, the board is already done, DIP28 AVR.
This is an open source kit, so the idea is that people can build upon the existing code and share etc. If you have everyone using a different processor then it kinda makes a mess of the whole concept. If you really want to use your own processor, then you can lay out your own board, or hack on an adapter board.
IMO it's better to pick a processor and lock it in, than try and provide such a flexibility that few people will actually take advantage of.

Dave.
Title: Re: Power supply part 4
Post by: alm on December 25, 2011, 10:54:34 pm
Designing a daughter board with a DIP-28 connector shouldn't be much harder than DIP-40. The majority of the customers will probably use the MCU firmware as-is, and many of the people that will hack it will probably use the standard AVR, so the daughter board would unnecessarily increase the price for many people.
Title: Re: Power supply part 4
Post by: JimmyM on December 26, 2011, 12:07:18 am
Ok then. Just a thought. Still very much looking forward to the rest of this project.
Title: Re: Power supply part 4
Post by: Greg J on December 29, 2011, 01:59:57 am
Software is software :) The only options with uC there is things like resolution of D/A , unless you still want to carry on with PWM.
It would be nice to have usb or serial port on it tho, and uC that has as many as possible pin driven interrupts. Otherwise you have to write
the pathetic sort of code with while loops and sleeps. The worse kind ever, but it is pretty much a norm in open source/open hardware world. (see arduino modules).

Title: Re: Power supply part 4
Post by: Nick Gammon on December 31, 2011, 04:20:21 am
I've been experimenting with doing PWM from an Arduino to the power supply breadboard.

I connected pin D3 (a PWM pin) of the Arduino Uno to the pin 3 of the voltage-sensing op-amp (+) via a 10K resistor, and with a 10 uF capacitor for filtering (between pin 3 of the op-amp and Gnd).

By experimentation, it turned out that multiplying the required voltage by 23 gave the correct output from the power supply.

Code: [Select]
const byte voltagePin = 3;
const float adjust = 23.0;

void setup () { }

void loop ()
  {
  for (float voltage = 0; voltage <= 5.5; voltage += 0.5)
    {
    analogWrite (voltagePin, voltage * adjust);
    delay (3000);
    }   
  }  // end of loop

Judging by my meter, the output is accurate to about 1 percent. Measured readings (volts):

Code: [Select]
0.031
0.492
1.014
1.494
2.017
2.496
3.019
3.499
4.022
4.500
5.021
5.498
Title: Re: Power supply part 4
Post by: JimmyM on December 31, 2011, 04:28:17 am
An Arduino might be good for experimentation. But you wouldn't use one in a finished unit. Would you? I mean why use a $30 Arduino in place of a $2 uC.
Title: Re: Power supply part 4
Post by: amspire on December 31, 2011, 04:42:10 am
An Arduino might be good for experimentation. But you wouldn't use one in a finished unit. Would you? I mean why use a $30 Arduino in place of a $2 uC.
Atmega168 ICs starts off at a one-off price of about $2.50 on Digikey and under $2 for 1000, and the Atmega328 starts off at under $4 for one off quantities or $2.20 for 2000 off quantities. You only use the $30 Arduino for development, but for a final application, you can usually replace the Arduino board with the processor chip and a few cheap components.

So it is a $2 IC, and an Arduino project can be used in a finished product.

Richard.
Title: Re: Power supply part 4
Post by: Nick Gammon on December 31, 2011, 04:44:30 am
An Arduino might be good for experimentation. But you wouldn't use one in a finished unit. Would you?

No I wouldn't. But it is good for getting the theory right. And I like to understand what I am doing.

Besides, it sounds like Dave is going to use an Atmega. The basic chip will be the same (similar, anyway). The Atmega48 is basically the same as in the Arduino, but with less program memory, RAM and EEPROM.
Title: Re: Power supply part 4
Post by: JimmyM on December 31, 2011, 05:06:04 am
Gotcha. So you could use the arduino bootloader and program in the finished project. Not the entire Arduino board. I think I see what you mean.
I still need to look at the schematic when it's released. I might use a different chip on a daughter board to allow me to connect things like LCDs or whatever else I might want to add. It shouldn't be that hard to build a daughter board for a mega324/644 that plugs into a DIP-28 socket. That is, of course, if Dave hasn't already thought of that sort of thing.
Title: Re: Power supply part 4
Post by: Nick Gammon on December 31, 2011, 05:15:02 am
Absolutely. In fact the Arduino IDE can be used to program "bare bones" boards. I did an example here:

http://www.gammon.com.au/forum/?id=11109 (http://www.gammon.com.au/forum/?id=11109)

Just the chip, a couple of decoupling caps, and a resonator. And if you don't care too much for accuracy you could just use the internal clock.

You don't have to use the bootloader, although it simplifies downloading new programs a bit. You can use an FTDI cable through the ICSP interface (basically the SPI pins).

(edit) I got that wrong. You use the FTDI cable to program through the serial pins (effectively it is a USB to serial converter). To use the ISCP interface (the SPI pins) you need a programmer like the USBtinyISP.

The FTDI cable, example for around $20:

http://www.adafruit.com/products/70 (http://www.adafruit.com/products/70)

The USBtinyISP ($22):

http://www.adafruit.com/products/46 (http://www.adafruit.com/products/46)

With the USBtinyISP (or similar) programmer you don't have to waste program memory on a bootloader, although the Optiboot one is only 512 bytes.

Title: Re: Power supply part 4
Post by: amspire on December 31, 2011, 05:22:48 am
Gotcha. So you could use the arduino bootloader and program in the finished project. Not the entire Arduino board. I think I see what you mean.

Yes. I don't like to loose the easy Arduino programming, so you take the pins that normally do the RS232/USB chip and take them to a header instead. Then use a $3 Nokia clone CA-42 cable (with a slight rewiring) to do the USB to the RS232 header. Works fine. If you need to change the crystal frequency of an Arduino-based project, it is just a matter of editing boards.txt in hardware/Aduino folder in the Aduino folder in Program Files.
Title: Re: Power supply part 4
Post by: JimmyM on December 31, 2011, 05:26:46 am
I'll have to look into the Nokia cable trick. I haven't used PC to AVR via USB yet.
Title: Re: Power supply part 4
Post by: amspire on December 31, 2011, 05:35:15 am
And if you don't care too much for accuracy you could just use the internal clock.
If there is no need for accurate time measurement, why not use the internal oscillators?

There is the calibrated 8MHz internal clock, but even the uncalibrated 128KHz internal clock may be all that a power supply needs.

Richard.
Title: Re: Power supply part 4
Post by: alm on December 31, 2011, 05:39:51 am
A UART bootloader would require a stable clock source.
Title: Re: Power supply part 4
Post by: amspire on December 31, 2011, 05:42:45 am
The internal 8MHz clock is accurate enough for the UART comms, as long at you don't erase the calibration bits.

Edit: Maybe not. I just looked it up and the factory calibrated 8MHz is only accurate to 10%.  Not really good enough, so scrap the internal clock idea. User calibrated, it is accurate to 1% over the full temperature range but if you are going to add a calibration step, why not buy a crystal or resonator instead ?
Title: Re: Power supply part 4
Post by: alm on December 31, 2011, 06:05:15 am
The typical graphs in the ATmega328PA datasheet show about +/- 2-3% change over temperature or voltage, +/- 5% over both. AVR140 claims than the max. deviation over temp/voltage is 10%, and calibration accuracy is +/- 2%. It might work with RS-232 after calibration if you don't need the whole temp/voltage range, but it's more hassle than it's worth in my opinion. The only reason might be power usage, but then a 32 kHz crystal for calibration might be a better solution.
Title: Re: Power supply part 4
Post by: EEVblog on December 31, 2011, 06:05:28 am
I maxed out the pins on my 28pin ATmega so had to use the internal oscillator.
Arduino compatibility seemed a bit overkill, but recently I'm starting to think it wouldn't be such a bad idea, just to ease people having a go at modding it.
But the proto PCB is in the post...  :(
Yes, there is a serial interface capability on the final design.

Dave.
Title: Re: Power supply part 4
Post by: firewalker on December 31, 2011, 11:31:38 am
There are cheaper boards for usb<->serial communication. PL2303 ones cost about 4 USD. I am using those for some time now and had no complaints. The only trap is that some boards doesn't use original Prolific chips. Not a problem though if you order from a reliable source.

Alexander.

(http://i.imgur.com/gdWzn.jpg)
Title: Re: Power supply part 4
Post by: JimmyM on December 31, 2011, 12:08:36 pm
I maxed out the pins on my 28pin ATmega so had to use the internal oscillator.
Arduino compatibility seemed a bit overkill, but recently I'm starting to think it wouldn't be such a bad idea, just to ease people having a go at modding it.
But the proto PCB is in the post...  :(
Yes, there is a serial interface capability on the final design.

Dave.
Looking forward to getting a look at it.
Title: Re: Power supply part 4
Post by: shebu18 on December 31, 2011, 12:22:21 pm
There are cheaper boards for usb<->serial communication. PL2303 ones cost about 4 USD. I am using those for some time now and had no complaints. The only trap is that some boards doesn't use original Prolific chips. Not a problem though if you order from a reliable source.

Alexander.


I have a nokia dongle which a wanted to use for usb<->uart but i had problems with the drivers from prolific. Tried on XP and 7, still the same problem. So i recommend only FTDI as an convertor, or maybe the avr chip arduino is using now.
Title: Re: Power supply part 4
Post by: EEVblog on December 31, 2011, 12:41:08 pm
Anyone actually had any practical experience with Arduino serial comms using the internal oscillator?
Looks like I could make my current project Arduino compatible as-is, the only issue is the use of the internal oscillator.
Otherwise it's a re-spin or daughterboard using a larger SMD based Arduino MEGA compatible device and the external crystal.
Or a design re-spin trying to gain an extra 2 pins somewhere (input switches most likely)

Dave.
Title: Re: Power supply part 4
Post by: firewalker on December 31, 2011, 01:08:10 pm
Anyone actually had any practical experience with Arduino serial comms using the internal oscillator?
Looks like I could make my current project Arduino compatible as-is, the only issue is the use of the internal oscillator.
Otherwise it's a re-spin or daughterboard using a larger SMD based Arduino MEGA compatible device and the external crystal.
Or a design re-spin trying to gain an extra 2 pins somewhere (input switches most likely)

Dave.

I think that everything in Arduino is tweaked for 16 MHz Xtal though. I will try in an ATmega8 the UART comm with the internal osc.

Alexander.
Title: Re: Power supply part 4
Post by: Blue on December 31, 2011, 01:45:11 pm
Hi Dave,

I'd like to congratulate you on your awsome video blogs. I like it a lot.

About your usart0:

Using the internal clock: 8 MHz.
Looking at table 20.5 from the datasheet: you can use: 9600, 19.2k or 38.4k baud by setting the UBRRn register according to the table.

Well there you have it...

Have fun,

Nick
Title: Re: Power supply part 4
Post by: Bored@Work on December 31, 2011, 02:01:09 pm
Anyone actually had any practical experience with Arduino serial comms using the internal oscillator?

Not with the Arduino, but with the atmega MCUs, which should be the same. The short answer is, it is a gamble.

The internal oscillator comes out of the factory calibrated for +/- 10% at a certain temperature. While one atmega coming from the factory might be good enough for the USART, the next might not be.

You can then individually calibrate each atmega. The first problem is of course doing the calibration (Atmels Studio 4 comes with support for it, and there is an appl. note about it). The second problem is that the oscillator is still temperature dependent. If you calibrate at the wrong temperature you still end up with the wrong frequency.

For a kit, or anything supposed to go out to Arduino users I don't think individual calibration is an option, but without it it is a gamble.

Quote
Looks like I could make my current project Arduino compatible as-is, the only issue is the use of the internal oscillator.
Otherwise it's a re-spin or daughterboard using a larger SMD based Arduino MEGA compatible device and the external crystal.
Or a design re-spin trying to gain an extra 2 pins somewhere (input switches most likely)

We need to see the schematic to figure out if there is an easy way. Or you could think about expanding the ports with a cheap 74HC595 on the SPI interface.

Dave.
[/quote]
Title: Re: Power supply part 4
Post by: firewalker on December 31, 2011, 02:09:25 pm
I believe that if the frequency shifting causes a baud error less than 1% at a given baud rate it will work with no major issues.

Alexander.
Title: Re: Power supply part 4
Post by: amspire on December 31, 2011, 02:13:13 pm
Anyone actually had any practical experience with Arduino serial comms using the internal oscillator?
I haven't actually tried using the internal oscillator, but the Arduino does provide support for the internal clock for atmega168 and 328 chips.

If you have a chip with a working bootloader, you will need to replace the bootloader, change the fuse settings for internal clock use, and let Arduino know the new clock speed.

Here how it is done.  You need to add a new boards.txt entry. This can be done in two places - adding it to the boards.txt file in hardware/arduino in the Arduino program folder, or adding it to a "hardware\arduino" folder in your sketchbook folder (not your sketch folder - that is a different thing). You find out where the sketchbook folder is by running Arduino and going to Files->preferences. If there is a boards.txt file in hardware/arduino in the sketchbook folder, it will use that and totally ignore the one in Arduino program folder. If you add it to Arduino program folder, the added board may get lost in a future update. Don't like either option.  Ideally, they should allow a hardware/arduino folder in the sketch folder, but they don't.

I would probably add the single entry boards.txt file to my sketchbook, with another copy plus a readme.txt file with instructions in the sketch folder. When you finish this job, delete the entry from the sketchbook folder, so it does not mess up the next arduino project. If all the above sounds confusing, just do it, and you will see what the problem is.

Anyway if you are using a atmega328 chip, you need a boards.txt file containing this in one of the two locations:

Code: [Select]
##############################################################

atmega328ic.name=ATmega328 8 MHz internal clock

atmega328ic.upload.protocol=stk500
atmega328ic.upload.maximum_size=30720
atmega328ic.upload.speed=57600

atmega328ic.bootloader.low_fuses=0xE2
atmega328ic.bootloader.high_fuses=0xDA
atmega328ic.bootloader.extended_fuses=0x05
atmega328ic.bootloader.path=arduino:atmega
atmega328ic.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328ic.bootloader.unlock_bits=0x3F
atmega328ic.bootloader.lock_bits=0x0F

atmega328ic.build.mcu=atmega328p
atmega328ic.build.f_cpu=8000000L
atmega328ic.build.core=arduino:arduino

The "low_fuses" setting enables the internal clock, and the f_cpu setting sets 8MHz. The bootloader has been changed to "ATmegaBOOT_168_atmega328_pro_8MHz.hex" which is already in the hardware folder in the Arduino program folder. Everything else is the same as a standard 16MHz external clock Arduino.

Then you run Arduino with the target connected.

Go to tools->board and select "ATmega328 8 MHz internal clock"
Go to tools->programmer and select "Arduino as ISP"
Go to tools->burn_bootloader

You now should be ready to go. The chip now has the new bootloader, and the Arduino has the new settings for the internal 8MHz clock atmega328.

BoredAtWork is correct - the chip comes from the factory calibrated to 10% according to the data sheet. I do not know why it is so bad - it sounds like a very conservative figure to me as if they go to the trouble of calibrating it at the factory, I am sure they would calibrate it to 1% at the time. If it is within 5%, then the serial comms will probably work. I do not have experience, but the Arduino does go to the effort of providing the bootloader, so it might work OK.

Richard.

Edit: I left out one important fact. The "Arduino as ISP" option uses an Arduino board to program the bootloader onto a second board or device.  Here is a tutorial describing it:

http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)
Title: Re: Power supply part 4
Post by: firewalker on December 31, 2011, 02:15:47 pm
What if you don't use a xtal witch require two pins. You could use a stable external clock source (VCXO) witch need only one pin.

Alexander.
Title: Re: Power supply part 4
Post by: JimmyM on December 31, 2011, 02:17:44 pm
Dave, is this going to be an arduino programming based project or are you going to write the C yourself?
Title: Re: Power supply part 4
Post by: Bored@Work on December 31, 2011, 02:28:44 pm
I believe that if the frequency shifting causes a baud error less than 1% at a given baud rate it will work with no major issues.

But the atmega RC oscillator is not stable over temperature. From memory, an atmega oscillator calibrated at a temperature of 25° to 8.00 MHz oscillates with approx. 8.50 MHz at 85°. That is > 4%.

What if you don't use a xtal witch require two pins. You could use a stable external clock source (VCXO) witch need only one pin.

Do you think it is a god idea to require from the Arduino crowd to unsolder an (SMD) crystal and two (SMD) caps from an Arduino board? I mean, these people picked the Arduino for a reason.
Title: Re: Power supply part 4
Post by: amspire on December 31, 2011, 02:31:15 pm
What if you don't use a xtal witch require two pins. You could use a stable external clock source (VCXO) witch need only one pin.

Alexander.
This is a good idea, and if you do, you still need a new boards.txt but only the frequency will be changed to the external crystal frequency. As an example, for a 10MHz external oscillator, you would need this boards.txt file:

Code: [Select]
##############################################################

atmega328ex.name=ATmega328 10 MHz external clock

atmega328ex.upload.protocol=arduino
atmega328ex.upload.maximum_size=30720
atmega328ex.upload.speed=57600

atmega328ex.bootloader.low_fuses=0xFF
atmega328ex.bootloader.high_fuses=0xDA
atmega328ex.bootloader.extended_fuses=0x05
atmega328ex.bootloader.path=atmega
atmega328ex.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328ex.bootloader.unlock_bits=0x3F
atmega328ex.bootloader.lock_bits=0x0F

atmega328ex.build.mcu=atmega328p
atmega328ex.build.f_cpu=10000000L
atmega328ex.build.core=arduino
atmega328ex.build.variant=standard

Title: Re: Power supply part 4
Post by: IvoS on December 31, 2011, 02:53:52 pm
Hi, is there a schematic somewhere out there for very low noise adjustable power supply? Something like Walt Jung super regulator (but adjustable) with only a few microV output noise?
Title: Re: Power supply part 4
Post by: Bored@Work on December 31, 2011, 04:49:52 pm
Hi, is there a schematic somewhere out there for very low noise adjustable power supply? Something like Walt Jung super regulator (but adjustable) with only a few microV output noise?

You get good results with two LM317, one configured as a tracking preregulator, forcing a constant voltage (something like 4 V) over the second regulator. The principle is in the LM317 datasheet, but you need to add the parts for the "improved ripple rejection" (also in the datasheet) to both of the regulators. You could even think about adding LC filtering to both regulators.

Another way is to follow a normal regulator with a clean-up shunt regulator. See e.g. http://eetimes.com/design/automotive-design/4009607/Feedforward-noise-cancellation-rejects-supply-noise (http://eetimes.com/design/automotive-design/4009607/Feedforward-noise-cancellation-rejects-supply-noise) They blow the concept a little bit out of proportion, calling it a "feed-forward noise cancellation technique", yeah sure. It is an active shunt regulator, if you ask me.
Title: Re: Power supply part 4
Post by: Nick Gammon on December 31, 2011, 07:59:52 pm
Anyone actually had any practical experience with Arduino serial comms using the internal oscillator?
Looks like I could make my current project Arduino compatible as-is, the only issue is the use of the internal oscillator.

Why do you need to do this (the serial comms)? You can use the Arduino IDE and program using the USBtinyISP via the 6 SPI pins, which you can break out or get at one way or another (even if you have to program the chip before inserting it onto the board).

It's still "Arduino compatible" - you just need to be aware if you are running at 8 MHz rather than 16 (which is done by a #define in the library) in places that matter, like timing code.

Dave, is this going to be an arduino programming based project or are you going to write the C yourself?

If you program in the Arduino IDE you are "writing C yourself". It just saves you mucking around with a lot of configuration options, Make files etc.

Dave, you should easily be able to fit your project onto the Atmega328 family of chips. Personally I would go for the top of the range: Atmega328 (sold by Element14 for $4.33 in lots of 25+) compared to the Atmega48 ($3.62). For 71 cents difference you get a lot more flash memory, RAM and EEPROM.

If you are running out of interface ports, you can hook up 119 lots of I2C devices to the two I2C pins. Devices like LCD drivers, ADC, IO expanders for keypresses, etc. Even a single 16-port I2C IO expander gives you 16 extra ports which can be individually configured for input or output.
Title: Re: Power supply part 4
Post by: EEVblog on December 31, 2011, 11:25:50 pm
What if you don't use a xtal witch require two pins. You could use a stable external clock source (VCXO) witch need only one pin.

Makes no difference, all my pins are used, so freeing up one extra pin or two extra pins requires a board re-spin.

Dave.
Title: Re: Power supply part 4
Post by: EEVblog on December 31, 2011, 11:26:45 pm
Dave, is this going to be an arduino programming based project or are you going to write the C yourself?

I was going to write it myself, but now I'm thinking that Arduino compatibility might be better for people.

Dave.
Title: Re: Power supply part 4
Post by: EEVblog on December 31, 2011, 11:35:35 pm
Why do you need to do this (the serial comms)?

Because that's the "normal" way to program an Arduino board, is it not?

Quote
You can use the Arduino IDE and program using the USBtinyISP via the 6 SPI pins, which you can break out or get at one way or another (even if you have to program the chip before inserting it onto the board).

I didn't know you could do that.
That would work on the current board because I have the ISP header on the board.

Quote
It's still "Arduino compatible" - you just need to be aware if you are running at 8 MHz rather than 16 (which is done by a #define in the library) in places that matter, like timing code.

Yes, easy fix.

Quote
If you are running out of interface ports, you can hook up 119 lots of I2C devices to the two I2C pins. Devices like LCD drivers, ADC, IO expanders for keypresses, etc. Even a single 16-port I2C IO expander gives you 16 extra ports which can be individually configured for input or output.

Of course.
The only issue is that the board is done.
If it happens to need a re-spin, then I can change things however I want, but if I want to run as-is, then I'm stuck with the internal oscillator.
Might still be an issue actually because I still have that optional serial interface using the internal oscillator. I've used that no problem with PIC's factory calibrated internal osc before, but not with AVR.

Dave.
Title: Re: Power supply part 4
Post by: firewalker on December 31, 2011, 11:54:36 pm
Actually yes, you can use Arduino IDE to compile your program and load the hex file to the target mcu using ISP and whatever programmer you wish. With this way you can save the space the bootloader needs.

The downside is that someone will need a programmer to load it.

My opinion though is that if the frequency shifting doesn't produce baud error bigger than 1% it will be ok. So, now need for changes.

Alexander.
Title: Re: Power supply part 4
Post by: shebu18 on December 31, 2011, 11:56:51 pm
On the 328 the bootloader takes around 2kb of memory, you still have 30k for programing. on the 48 you do not have enough memory. You could use 168 or 238 for the board. The chips are also pincompatible.
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 12:04:21 am
Actually yes, you can use Arduino IDE to compile your program and load the hex file to the target mcu using ISP and whatever programmer you wish. With this way you can save the space the bootloader needs.

Of course. I did know that, somewhere up there  ::)
Shows how much I use Arduino  ;D

Quote
The downside is that someone will need a programmer to load it.

Not a huge deal I suspect. Given that the serial interface is an optional board anyway.

Quote
My opinion though is that if the frequency shifting doesn't produce baud error bigger than 1% it will be ok. So, now need for changes.

Yes, 1% is usually enough for reliable serial comms.

I suspect the best solution is to simply re-spin the board and add the 16MHz crystal.
With any luck I've goofed something anyway and it'll need a re-spin  ;D

Dave.
Title: Re: Power supply part 4
Post by: Greg J on January 01, 2012, 12:51:30 am
Will the design be physically divided into the analogue and uC part ? i.e., separate boards ?

Something tells me, I could use the analogue part as learning experience - but when it comes to uC - I have few things I want to do to make it work for me, something tells me it will differ from whatever someone else will do. Even such a brilliant guy like yourself.

One thing I want, is to have few buttons (3-4) with predefined voltage that I could just bring in with one touch. Likewise for current settings.

Plus, having separate analogue board would mean that you could have few of them not just one :)


Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 01:07:55 am
Will the design be physically divided into the analogue and uC part ? i.e., separate boards ?

Something tells me, I could use the analogue part as learning experience - but when it comes to uC - I have few things I want to do to make it work for me, something tells me it will differ from whatever someone else will do. Even such a brilliant guy like yourself.

One thing I want, is to have few buttons (3-4) with predefined voltage that I could just bring in with one touch. Likewise for current settings.

Plus, having separate analogue board would mean that you could have few of them not just one :)

No, one board, sorry. The serial is separate though. Yes, there are 4 buttons, two of which I was going to use for pre-defined voltages/currents.
Everyone will have different needs of course, it's an open design so you can change it any way you like.

Dave.
Title: Re: Power supply part 4
Post by: Blue on January 01, 2012, 02:07:38 am
Hi Guys & Dolls,

I never experienced any problems with the internal clock and serial io.  :)
For those who think it is a problem just test it in your oven and deep freezer. 8)
Again, no problem on the other side of the planet...

Cheers and happy new year,

Nick
Title: Re: Power supply part 4
Post by: Greg J on January 01, 2012, 02:46:24 am
Dave, will the analogue part differ much from what you already designed ?
And can you tell us where exactly the serial io and clocks really matter ?
I thought this is strictly either PWM, or DAC (some PICs have internal DAC). I do agree that arduino makes things easier.
The way I would do it, I would use arduino nano, or arduino pro - and just have pins that will accommodate it.

Can't wait to see what you'll come up with - I'm sure it will be better then our best imagination :)
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 02:56:09 am
Dave, will the analogue part differ much from what you already designed ?
And can you tell us where exactly the serial io and clocks really matter ?

The analog core is basically the same, but I have added real 12bit DACs and better current sensing.
The serial I/O and clock only matters if I make it Arduino compatible.

Quote
I thought this is strictly either PWM, or DAC (some PICs have internal DAC). I do agree that arduino makes things easier.
The way I would do it, I would use arduino nano, or arduino pro - and just have pins that will accommodate it.

That would just increase the cost over just having the micro on it's own.

Dave.
Title: Re: Power supply part 4
Post by: Greg J on January 01, 2012, 03:24:22 am
That would just increase the cost over just having the micro on it's own.

Indeed, but will make programming it and so on so much easier. These things come with usb port, and loader on it already.
You can buy arduino nano off ebay for £8. Personally I don't own any uC programmers anymore, arduino and TI MSP LP board do things for me.
Design pins for arduino pro, or nano on your board - stick it on - et voile, job done. Nice and simple.
Title: Re: Power supply part 4
Post by: JimmyM on January 01, 2012, 03:54:18 am
Sure, writing code for the arduino is C, but you have to write code for the arduino. If I can just write C and have to think about all the config options (I don't have to mess with make files with AVR Studio), I can write code for the Tiny10 up to the mega2560. Sure, if you want to hack together an experiment, an Arduino is probably a good idea. But for a finished project, an installed uC running straight code (I mean no bootloader) is, in my humble opinion, a proper solution.
However, given that this going to be an open source project, I suppose considering an Arduino software environment might be better for the masses.
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 04:08:56 am
Indeed, but will make programming it and so on so much easier. These things come with usb port, and loader on it already.
You can buy arduino nano off ebay for £8. Personally I don't own any uC programmers anymore, arduino and TI MSP LP board do things for me.
Design pins for arduino pro, or nano on your board - stick it on - et voile, job done. Nice and simple.

AU$17 vs <$4 one-off price difference.
That translates to a very significant base cost increase on the kit, unless I supply the kit without the Nano or at-cost.

The only difference is that anyone who wants to reprogram must have an ISP programmer of some kind instead of just straight USB. That's not a big deal I suspect. The majority won't want to play with the firmware.

Dave.
Title: Re: Power supply part 4
Post by: Nick Gammon on January 01, 2012, 05:57:59 am
Just as a general response to some of the above ...

I presume your design doesn't currently have a USB interface, so to program it you either need to use a bootloader with a custom FTDI cable ($20) or via the ISCP header using a custom programmer ($22). Clearly the difference, for people that want to reprogram it, is minimal.

The Optiboot loader, currently used on the Uno (Atmega328) is 512 bytes, not 2Kb. The overhead, out of 32 Kb of program memory is minimal. Particularly since you were talking about using a chip with less memory to start with. Add 70 cents to the chip price and you can afford lots more "bells and whistles" in terms of the onboard code.

You don't need to muck around with hex files, I have personally programmed my "bare bones board" project just using the IDE. You edit the preferences file (once off) to tell it to use the USBtinyISP programmer rather than the bootloader, and then just hit Ctrl+U to compile and upload. Couldn't be simpler.

I would be tentatively planning to go through a calibration phase (to compensate for slight differences in resistor values) and store compensation data in the EEPROM. That way each unit should be pretty accurate. You might also have default "turn on" settings.

Quote
The serial I/O and clock only matters if I make it Arduino compatible.

As I said before, it's Arduino compatible even without that. In fact, if you are using the Atmega48 chip, and have an ICSP header, you would be hard-pressed to not have it Arduino-compatible. The only difference might be the way you write the software. And honestly, why not use the Arduino IDE? The compiler is g++, an industry standard. It generates tight, efficient code. The linker optimizes away stuff you don't need. You don't have to use any of their libraries if you don't want to. But things like the ports are already defined in header files. Interrupts are easy to do.
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 06:09:26 am
I presume your design doesn't currently have a USB interface, so to program it you either need to use a bootloader with a custom FTDI cable ($20) or via the ISCP header using a custom programmer ($22). Clearly the difference, for people that want to reprogram it, is minimal.

Yes, but if you use an external programmer then you can use that for other stuff, instead of adding $10+ to the cost of every project you do.
If everyone designed kits based around Arduino modules instead of bare chip, then every kit and every project will be at least $10 more expensive. Do people really want that?
To me it seems like a waste of cost, in this case a large chunk of the project cost that I'll have to either pass on to buyers, or eat it.

Quote
The Optiboot loader, currently used on the Uno (Atmega328) is 512 bytes, not 2Kb. The overhead, out of 32 Kb of program memory is minimal. Particularly since you were talking about using a chip with less memory to start with. Add 70 cents to the chip price and you can afford lots more "bells and whistles" in terms of the onboard code.

You don't need to muck around with hex files, I have personally programmed my "bare bones board" project just using the IDE. You edit the preferences file (once off) to tell it to use the USBtinyISP programmer rather than the bootloader, and then just hit Ctrl+U to compile and upload. Couldn't be simpler.

I would be tentatively planning to go through a calibration phase (to compensate for slight differences in resistor values) and store compensation data in the EEPROM. That way each unit should be pretty accurate. You might also have default "turn on" settings.

As I said before, it's Arduino compatible even without that. In fact, if you are using the Atmega48 chip, and have an ICSP header, you would be hard-pressed to not have it Arduino-compatible. The only difference might be the way you write the software. And honestly, why not use the Arduino IDE? The compiler is g++, an industry standard. It generates tight, efficient code. The linker optimizes away stuff you don't need. You don't have to use any of their libraries if you don't want to. But things like the ports are already defined in header files. Interrupts are easy to do.

Yes, relax, I'm sold on making it "Arduino compatible", because I don't have to do anything extra to do that.

But no one has yet convinced me that using an existing Arduino module is worth the extra cost.

Dave.
Title: Re: Power supply part 4
Post by: Nick Gammon on January 01, 2012, 06:29:52 am
Why do you need to do this (the serial comms)?

Because that's the "normal" way to program an Arduino board, is it not?

I supposed it depends what you mean by "normal". There are quite a few Arduinos ...

http://arduino.cc/en/Main/Hardware (http://arduino.cc/en/Main/Hardware)

The "development board" version has a USB port, so yes, it is designed to be as easy as possible for beginners. The bootloader is a program residing in upper memory which is allowed to change the flash memory (various fuse bits configure this). So one way of updating the flash is for the bootloader to kick in at reset time, check for data on the serial port, and if it passes various tests, update the main program memory.

However the hardware also is designed to respond to ICSP programming (using SPI via the ICSP port), and boards like the USBtinyISP convert data from the USB port into the appropriate SPI sequences. The nice thing is that you can still use all the Arduino libraries and (so-called) sketches whether or not you use the bootloader.

So really, the prototyping board is useful for quickly testing a concept, and then you can move to just the chip and whatever support components you need, but still use the development environment.

Yes, but if you use an external programmer then you can use that for other stuff, instead of adding $10+ to the cost of every project you do.
If everyone designed kits based around Arduino modules instead of bare chip, then every kit and every project will be at least $10 more expensive. Do people really want that?
To me it seems like a waste of cost, in this case a large chunk of the project cost that I'll have to either pass on to buyers, or eat it.

I think we are at cross-purposes here. I am not suggesting using the Arduino board as such. That's $30 compared to $5 for the chip. But you can test out your ideas (as I did with the power supply) by using the board. Quick and easy. But then you take the bare chip, add a resonator maybe, and a few resistors and capacitors, and you are down to a cheap and simple solution.

And you are quite right, using the external programmer, you get to keep the programmer and use it for dozens of projects. That's where buying lots of Arduino "development boards" falls down. You are paying multiple times for the USB interface, which you need once.
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 06:54:24 am
I supposed it depends what you mean by "normal". There are quite a few Arduinos ...
http://arduino.cc/en/Main/Hardware (http://arduino.cc/en/Main/Hardware)
The "development board" version has a USB port, so yes, it is designed to be as easy as possible for beginners. The bootloader is a program residing in upper memory which is allowed to change the flash memory (various fuse bits configure this). So one way of updating the flash is for the bootloader to kick in at reset time, check for data on the serial port, and if it passes various tests, update the main program memory.

Yes, "normal" means the development board version, so the user can program with a USB cable in stead of requiring an external board.

Quote
However the hardware also is designed to respond to ICSP programming (using SPI via the ICSP port), and boards like the USBtinyISP convert data from the USB port into the appropriate SPI sequences. The nice thing is that you can still use all the Arduino libraries and (so-called) sketches whether or not you use the bootloader.

So really, the prototyping board is useful for quickly testing a concept, and then you can move to just the chip and whatever support components you need, but still use the development environment.

I think we are at cross-purposes here. I am not suggesting using the Arduino board as such. That's $30 compared to $5 for the chip. But you can test out your ideas (as I did with the power supply) by using the board. Quick and easy. But then you take the bare chip, add a resonator maybe, and a few resistors and capacitors, and you are down to a cheap and simple solution.

That is exactly what I have already done.
In my case I have jumped straight to the final design PCB, I'm not just "testing" things, so I have designed with the bare chip with the standard ISP port. So as it stands with the boards I will get in few days, it is "arduino compatible", but you need an external programmer board to program it if you want to modify it.

Quote
And you are quite right, using the external programmer, you get to keep the programmer and use it for dozens of projects. That's where buying lots of Arduino "development boards" falls down. You are paying multiple times for the USB interface, which you need once.

Bingo.
Greg suggested I stick on a footprint for an existing Arduino module, and that's what I can't see any sense in doing, it's an expensive solution for a little bit of extra convenience for those who want to play with the firmware.

Dave.
Title: Re: Power supply part 4
Post by: Greg J on January 01, 2012, 03:03:45 pm
Sure, writing code for the arduino is C, but you have to write code for the arduino.

Only except that its c++. Yes, there's a difference.
(C++ is far superior, and safer of course).
Title: Re: Power supply part 4
Post by: JimmyM on January 01, 2012, 03:33:00 pm
Sure, writing code for the arduino is C, but you have to write code for the arduino.

Only except that its c++. Yes, there's a difference.
(C++ is far superior, and safer of course).
Oooo. You got me. The whole world should only use Arduino now for its safety and superiority.
Title: Re: Power supply part 4
Post by: Greg J on January 01, 2012, 03:38:49 pm
As sarcastic as your answer might, you are very right :)
Things such as const correctness, are not very high on C standardisation committee's agenda I'm afraid.

But that's going bit off topic, so I'll stop here.
Title: Re: Power supply part 4
Post by: firewalker on January 01, 2012, 04:07:54 pm
As a general rule in my programs for that involve serial communication I do something like

Code: [Select]
#define BAUD 38400UL                          // Baud rate.

/* Baud rate calculations. */
 #define UBRR_VAL ((F_CPU+BAUD*8)/(BAUD*16)-1) // Smart roundup.
 #define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1)))   // Real Baud.
 #define BAUD_ERROR ((BAUD_REAL*1000)/BAUD)    // Fault per 1000 parts.

 #if ((BAUD_ERROR<990) || (BAUD_ERROR>1010))
    #error Baud rate error bigger than 1%, aborting!
 #endif

Alexander.
Title: Re: Power supply part 4
Post by: alm on January 01, 2012, 04:32:25 pm
What's the point of keeping the baud error of the nominal frequency below 1% if the RC oscillator may be 10% off nominal?
Title: Re: Power supply part 4
Post by: Mechatrommer on January 01, 2012, 04:44:57 pm
i hate to see this thread which shines as ee analog design to become a rather "code proned" or digital frantic thread. why dont we just wait for dave to finalize it and start modding from there? i trust digital side is not so dificcult for everybody (every idiot can count to 1 :P ) my 2cnts.
Title: Re: Power supply part 4
Post by: JimmyM on January 01, 2012, 07:12:31 pm
i hate to see this thread which shines as ee analog design to become a rather "code proned" or digital frantic thread. why dont we just wait for dave to finalize it and start modding from there? i trust digital side is not so dificcult for everybody (every idiot can count to 1 :P ) my 2cnts.
Agreed.
I know this project is based on the LT3080, but LT also has the LT3083 (3A rated instead of the 1.1A of the LT3080). There shouldn't be any harm in substituting the higher current rated LT3083, right?
I was looking into using a slightly different pass element (discrete TO-3 and Op-Amp for greater power handling), then I came across the LT3083.
Title: Re: Power supply part 4
Post by: slateraptor on January 01, 2012, 07:38:14 pm
Sure, writing code for the arduino is C, but you have to write code for the arduino.

Only except that its c++. Yes, there's a difference.
(C++ is far superior, and safer of course).

??? *cough* Processing *cough*
Title: Re: Power supply part 4
Post by: Nick Gammon on January 01, 2012, 08:25:16 pm
The only difference is that anyone who wants to reprogram must have an ISP programmer of some kind instead of just straight USB. That's not a big deal I suspect.

Back onto the topic of Dave's gadget, there is a cheaper solution if you already have an Arduino. The Arduino development board itself (various flavours) can itself be used as an ISP programmer.  There is a whole page devoted to this subject:

http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)

One presumes that "the Arduino crowd" (as someone called them) would have an Arduino. So basically you just upload the "ISP sketch" to your Arduino, connect up 6 wires to the ICSP header of your target device (reset, power, Gnd, MISO, MOSI, SCK) and then upload your sketch in the usual way, telling the IDE that your "programmer" is the "Arduino as ISP".

So, a "free" programmer, if you need one.

The whole power supply project is a cool and educational idea. My next test is going to be to try to read back the voltage on the power supply using the analog input (ADC converter) on the Atmega, so that I could test if, when requesting 5V output, I actually get 5V. Presumably, once calibrated, this could be used to see if current limiting had kicked in. I'm guessing that Dave's design does just that, since there are lots of ports available on the processor chip for this sort of thing.
Title: Re: Power supply part 4
Post by: alm on January 01, 2012, 09:54:19 pm
Quote
NOTE: Currently, you cannot use an Arduino Uno as an ISP programmer because the optiboot bootloader does not support this sketch. A revision for this is in progress.
I believe there's a workaround that can be found on the Arduino forum, but it's not (yet) mentioned in this tutorial.
Title: Re: Power supply part 4
Post by: Nick Gammon on January 01, 2012, 10:05:49 pm
That comment was dated October 03, 2010.

I tried recently (like a month or so ago) with my Uno without any problems.

More information here:

http://arduino.cc/forum/index.php?topic=82451.0 (http://arduino.cc/forum/index.php?topic=82451.0)
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 10:27:48 pm
I know this project is based on the LT3080, but LT also has the LT3083 (3A rated instead of the 1.1A of the LT3080). There shouldn't be any harm in substituting the higher current rated LT3083, right?

Correct.
The basic kit will likely ship with the LT3080, and those who want to upgrade the current can drop in the 3083.
But in my design the max current sense is 2.048A
And for those who complain about the price and availability, you can use an LM317 and live with the 1.25V minimum (just tweak the code to subtract it out).

Dave.
Title: Re: Power supply part 4
Post by: EEVblog on January 01, 2012, 10:29:55 pm
The whole power supply project is a cool and educational idea. My next test is going to be to try to read back the voltage on the power supply using the analog input (ADC converter) on the Atmega, so that I could test if, when requesting 5V output, I actually get 5V. Presumably, once calibrated, this could be used to see if current limiting had kicked in. I'm guessing that Dave's design does just that, since there are lots of ports available on the processor chip for this sort of thing.

Yes, it can even have two displays - set voltage/current, and actual voltage/current.
But I'm using external 12bit DAC and ADC.

Dave.
Title: Re: Power supply part 4
Post by: JimmyM on January 01, 2012, 11:49:29 pm
But in my design the max current sense is 2.048A
That's not too shabby either, but if the current sense resistance is halved, the current limit will be 4.096 A (resolved in 2 mA steps). Correct?
Then I would have to make a few tweaks to the code so that what's displayed on the LCD is what's happening in real life.
Title: Re: Power supply part 4
Post by: RJSC on January 02, 2012, 12:05:30 am
No, with a 12 bit DAC you should have 4096 steps (2^12), so you can have 4.096A with 1mA steps.
Maybe Dave's version has 0.5 mA steps.
Title: Re: Power supply part 4
Post by: EEVblog on January 02, 2012, 12:11:53 am
Sure, you could scale it any way you like, 2.048A is just what I've chosen for my standard max range.

Dave.
Title: Re: Power supply part 4
Post by: slateraptor on January 02, 2012, 12:17:32 am
But in my design the max current sense is 2.048A
That's not too shabby either, but if the current sense resistance is halved, the current limit will be 4.096 A (resolved in 2 mA steps). Correct?
Then I would have to make a few tweaks to the code so that what's displayed on the LCD is what's happening in real life.

With relatively high current draw, I suspect you're liable to encounter issues with thermal noise. 1 bit uncertainty on a 12-bit ADC is pretty ballsy as it is without paying extremely close attention to board layout.
Title: Re: Power supply part 4
Post by: Blue on January 02, 2012, 02:44:03 am
Hi Dave,

In your previous thread part you mentioned that you used Altium for the pcb board design. Can you do a video about designing with Altium?

Thanks,

Cheers,

Nick
Title: Re: Power supply part 4
Post by: joelby on January 02, 2012, 03:10:44 am
In your previous thread part you mentioned that you used Altium for the pcb board design. Can you do a video about designing with Altium?

Altium themselves have a large range of good videos covering most aspects of the software - is there anything in particular you were after that these don't go through?
Title: Re: Power supply part 4
Post by: EEVblog on January 02, 2012, 04:38:18 am
In your previous thread part you mentioned that you used Altium for the pcb board design. Can you do a video about designing with Altium?

They already have plenty of videos available, I'm not going to help them out  ;)

Any PCB videos I do will be as package-agnostic as possible. Otherwise you aren't lerning PCB design, you are learning a drive a specific tool.

Dave.
Title: Re: Power supply part 4
Post by: firewalker on January 02, 2012, 10:30:24 am
They already have plenty of videos available, I'm not going to help them out  ;)

I am guessing they are going to sue you because "You did it wrong".  :P :P :P

Or they could  appreciate it and renew you license. Trololololol.  ;D

Alexander.
Title: Re: Power supply part 4
Post by: Blue on January 02, 2012, 11:22:41 am
Dave,

I really enjoyed one of your videoblog where you showed how to create a pcb (I forgot what numer is was).
What I accentually wanted is a videoblog showing you how to do the pcb layout for this project. Where to place components as you did with respect to noise etc.
Give some general idea's on how to layout a pcb - just as you did in your now famous document. I don't care if you do it with tool x, y or z.

Cheers,

Nick
Title: Re: Power supply part 4
Post by: EEVblog on January 02, 2012, 11:31:36 am
I am guessing they are going to sue you because "You did it wrong".  :P :P :P

They already gave me a cease-and-desist on the use of altiumforum.com  ::)

Quote
Or they could  appreciate it and renew you license. Trololololol.  ;D

Hang on while I start up my flying pig  ;D

Dave.
Title: Re: Power supply part 4
Post by: EEVblog on January 02, 2012, 11:34:32 am
I really enjoyed one of your videoblog where you showed how to create a pcb (I forgot what numer is was).
What I accentually wanted is a videoblog showing you how to do the pcb layout for this project. Where to place components as you did with respect to noise etc.
Give some general idea's on how to layout a pcb - just as you did in your now famous document. I don't care if you do it with tool x, y or z.

An entire multi-part PCB design tutorial video series is something I really want to, just needs some planing and time.
I was thinking I'd base it around my existing document as a starter.

For the PSU project I have a time-lapse video capture of me laying out the board, and I was going to do put some commentary on top of that (sped up of course).
Not ideal, but fairly easy to do.

Dave.
Title: Re: Power supply part 4
Post by: JimmyM on January 02, 2012, 04:07:49 pm
No, with a 12 bit DAC you should have 4096 steps (2^12), so you can have 4.096A with 1mA steps.
Maybe Dave's version has 0.5 mA steps.

Ah right. 4096. I can certainly live with 1mA steps.
Title: Re: Power supply part 4
Post by: Greg J on January 02, 2012, 05:41:50 pm
Maybe as another part, or improvement you could show us how to design it into switching power supply ?
I mean, properly, not using one transistor ;) ;)
Title: Re: Power supply part 4
Post by: Nick Gammon on January 03, 2012, 12:34:02 am
Sorry, the board is already done, DIP28 AVR.
This is an open source kit, so the idea is that people can build upon the existing code and share etc.

Dave, is the schematic available in any reasonably accessible form? (even just a screenshot in PNG format)

I still haven't resolved the issue of the current suddenly cutting out as you turn the pot down, and think maybe I didn't quite assemble my version to be the same as yours.
Title: Re: Power supply part 4
Post by: benemorius on January 03, 2012, 12:43:55 am
Sorry, the board is already done, DIP28 AVR.
This is an open source kit, so the idea is that people can build upon the existing code and share etc.

Dave, is the schematic available in any reasonably accessible form? (even just a screenshot in PNG format)

I still haven't resolved the issue of the current suddenly cutting out as you turn the pot down, and think maybe I didn't quite assemble my version to be the same as yours.

I haven't  watched it yet but the 5th video just finished uploading and looks promising if you're after a completed schematic. ;)
Title: Re: Power supply part 4
Post by: Blue on January 03, 2012, 12:58:37 am
An entire multi-part PCB design tutorial video series is something I really want to, just needs some planing and time.
I was thinking I'd base it around my existing document as a starter.

For the PSU project I have a time-lapse video capture of me laying out the board, and I was going to do put some commentary on top of that (sped up of course).
Not ideal, but fairly easy to do.

Dave.


That would be wonderful  :)
Title: Re: Power supply part 4
Post by: JimmyM on January 03, 2012, 12:29:28 pm
I haven't  watched it yet but the 5th video just finished uploading and looks promising if you're after a completed schematic. ;)
Where?
Title: Re: Power supply part 4
Post by: firewalker on January 03, 2012, 12:45:48 pm
Where?

http://www.eevblog.com/episodes/ (http://www.eevblog.com/episodes/)

Alexander.
Title: Re: Power supply part 4
Post by: shebu18 on January 03, 2012, 01:00:34 pm
you also could try and subscribe to the youtube channel.
Title: Re: Power supply part 4
Post by: Nick Gammon on January 03, 2012, 08:43:51 pm
"Try" is the operative word here. I subscribe, and still haven't been notified of that episode. I get notifications ... a couple of days later.
Title: Re: Power supply part 4
Post by: firewalker on January 03, 2012, 08:59:09 pm
I had the same issue with another channel. Try to un-subscribe and subscribe again.

Alexander.

"Try" is the operative word here. I subscribe, and still haven't been notified of that episode. I get notifications ... a couple of days later.