Author Topic: EEVblog #240 - Power Supply Design Part 8  (Read 49598 times)

0 Members and 2 Guests are viewing this topic.

Offline Zad

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: gb
    • Digital Wizardry, Analogue Alchemy, Software Sorcery
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #25 on: January 29, 2012, 10:36:03 pm »
I utterly HATE software religion wars. One simple SPI routine has turned into a war of optimisation, readability, what optimisation "really" means, what compiler is "best" and cock waving comparisons. This is why I prefer to stick with hardware.

Move on guys. If it works, it works. If you want to rewrite it to please your particular software God, then feel free but don't drag everyone else into it. Linux only got anywhere because one person was in charge.


Offline EEVblog

  • Administrator
  • *****
  • Posts: 37626
  • Country: au
    • EEVblog
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #26 on: January 29, 2012, 10:37:25 pm »
Dave, when you started the video the light was quite bright (I like it). At some time it dimmed. Do you use a spotlight and turned it off for the laptop's screen capturing?

The light in the new lab is crap and highly variable depending upon the angle. Usually I let the auto exposure setting on the camera pick and then change to manual mode to fix that setting, but sometime I tweak it by hand if it looks too dull on the playback screen.
An yes, I have some small spotlight on arms too that I move around.

Dave.
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #27 on: January 29, 2012, 10:45:16 pm »
I utterly HATE software religion wars. One simple SPI routine has turned into a war of optimisation, readability, what optimisation "really" means, what compiler is "best" and cock waving comparisons.

You haven't read the postings you are commenting on, have you?
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline ndictuTopic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: sk
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #28 on: January 29, 2012, 11:14:12 pm »
No. This is a dictatorship, I'll code the way I like, no one else gets any say in it until it's released  :P

Yeah as I said in the last paragraph, it'll get much worse than the HW talks. You can of course ignore the suggestions, but as TerminalJack505 said, there probably isn't much to talk about for now.

I utterly HATE software religion wars. One simple SPI routine has turned into a war of optimisation, readability, what optimisation "really" means, what compiler is "best" and cock waving comparisons.

You haven't read the postings you are commenting on, have you?
Probably not. I think we generally agreed about the best (well, at least better) way to do it. Not that it matters for a prototype, as long as it works.
 

Offline naimis

  • Contributor
  • Posts: 41
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #29 on: January 29, 2012, 11:38:19 pm »
I wonder if anyone if foolish enough to do a software coding video blog?

Dave.
As a "software guy", I'd have to really put some thought into finding a subject I'd consider less interesting for a video blog  ::)
 

alm

  • Guest
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #30 on: January 30, 2012, 12:06:44 am »
Yup, order of magnitude worse than hardware...
I wonder if anyone if foolish enough to do a software coding video blog?
Probably, though I haven't bothered to look. Screencasts about software development seemed fairly popular a few years ago. Software doesn't lend itself as much to the video blog format, though. Seeing someone typing gets boring really fast, and the added value of seeing someone type it compared to just the code plus a description is quite limited. There are plenty of regular blogs though.

I utterly HATE software religion wars. One simple SPI routine has turned into a war of optimisation, readability, what optimisation "really" means, what compiler is "best" and cock waving comparisons. This is why I prefer to stick with hardware.
I'd have to agree with BaW and wonder whether you've actually read this thread.

Move on guys. If it works, it works. If you want to rewrite it to please your particular software God, then feel free but don't drag everyone else into it. Linux only got anywhere because one person was in charge.
Yes, lets get back to the regular scheduled arguments about which micro is the best, which one Dave should use for his own projects and which brand of test equipment is the best. Not to forget comparing DMM sizes. ;)
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11771
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #31 on: January 30, 2012, 01:05:03 am »
I'd have to agree with BaW and wonder whether you've actually read this thread.

What else is the, "Ooh, you did it wrong, you should have used a loop!" argument all about?  ::)

Dave's a big boy now, he's been around the block a few times, it's not like he's never heard of for loops. If he wants to do it that way it's his business.

One reason software blogs in the net are so unproductive is because people perpetually get bogged down over the same questions that have been done to death a thousand times before. Such pointless time wasting is a sign of bad engineering. If it is readable, easy to edit, does the right thing in all cases, runs fast enough and fits in the available memory then it's good code. Look how easy it was for Dave to shift the two null bits from the end to the beginning. In hardware, shaving the component count might save you some costs in production; removing a couple of lines in software, not so much.
 

alm

  • Guest
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #32 on: January 30, 2012, 01:30:00 am »
What else is the, "Ooh, you did it wrong, you should have used a loop!" argument all about?  ::)
You consider this a religious war?

One reason software blogs in the net are so unproductive is because people perpetually get bogged down over the same questions that have been done to death a thousand times before.
Citation needed. I come across plenty of software blogs when searching for stuff, and they rarely seem unproductive to me. Joel Spolsky's blog is the most recent one that comes to mind. Sure, there's plenty of repetition, but it's not like there aren't a thousand blogs discussing how to connect a LED to an Arduino.
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11771
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #33 on: January 30, 2012, 02:01:29 am »
Citation needed.

I really meant the comments/discussion part. There are certainly people out there with interesting things to blog about on software development (even if Joel Spolsky ran out of fresh material a long time ago).
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37626
  • Country: au
    • EEVblog
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #34 on: January 30, 2012, 02:23:15 am »
Look how easy it was for Dave to shift the two null bits from the end to the beginning.

Bingo.
When writing something like this bit-bang routine, the last thing I give a damn about is wanting to optimise things for code space in a for loop.
With in-line rolled-out code like I did, when it doesn't work, I can simply hack individual bits very easily for troubleshooting purposes without dicking around with stupid loops.
There is method to my madness.

Dave.
 

Offline PeteInTexas

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #35 on: January 30, 2012, 04:04:17 am »
How did I know the SMOP monster was going to rear its ugly head when those chips starting populating the board   ::)
 

Offline PeteInTexas

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #36 on: January 30, 2012, 04:08:57 am »
Citation needed.

I really meant the comments/discussion part. There are certainly people out there with interesting things to blog about on software development (even if Joel Spolsky ran out of fresh material a long time ago).

Except for the straight forward "how-tos" and tutorial, software blogs tend to be a rant of one level or another.  It gets old fast.
 

Offline Lightages

  • Supporter
  • ****
  • Posts: 4309
  • Country: ca
  • Canadian po
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #37 on: January 30, 2012, 06:57:59 am »
Dave:

In the last coupe of videos, not only did the brightness change, but so did the colour balance. To my eye it is very jolting but you already know I am a video producer and camera man. Perhaps you might want to set the colour balance to a fixed value instead of auto, if you haven't already.

Secondly, the power supply looks to be a nice small package with many benefits. I just might buy one!
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #38 on: January 30, 2012, 07:23:14 am »
to try and break away from the software discussion,

i assume you havent had time to start with the adc yet, as you said it was the companion one, i now fear that even 10 bit accuracy may have been thrown out of the window :/

also, is there any tricks to trimming in a voltage reference?

and to finish on a good note, good video as always dave, shows the use of a DSO with a one shot trigger
 

Offline darrenb

  • Contributor
  • Posts: 36
  • Country: au
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #39 on: January 30, 2012, 10:33:32 am »
I can't understand why Dave moved the zero bits from the end of the bit banging sequence to the front?

From the look of the data sheet it appeared the bits at the end (least significant bits, the right hand end) were the ones that didn't matter?  So they appeared to be correctly being sent at the end initially.

 

Offline hans

  • Super Contributor
  • ***
  • Posts: 1621
  • Country: nl
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #40 on: January 30, 2012, 11:06:32 am »
Let's talk over more pressing matters, software is like.. it works as is, and quick enough? Good, moving on.

I wonder if the analog parts of MicroChip aren't inherently 'bad'.  As you mentoined, ADC's and DAC's in micro's are not as good as an external one. I don't know on what design they are making the external converters, but if it's the same as the micro's, you're still back to where we were.

They also make like 22-bit ADC's with a claim of 18+ ENOB. I have no idea whether they will meet this specification. I have some of these lying around (MCP3551), but I really wonder whether these are spot on as well. Maybe they have a terrible offset of +100 counts if both inputs tied to GND hard.. not sure.

I'd resort to another manufacturer, probably, for analog parts from seeing this. Well, they meet their specifications, but +/- 12 LSB is quite horrible (0.3% right there). Am I right in saying that the worst case situation, the output voltages could be off by 2-3% (voltage reference +/- 0.25%, FSR output +/-1%, linearity +/-0.3%, unwanted offsets)? Kinda a pity of all the precision resistors and current sense amplifiers, etc. I would probably pick a more precise DAC from AD or TI.

Ah well, the given resolution was way better than required anyway :) Furthermore, if you really want a 'DC accurate' measurement, I think calibration is inevitable. A better resolution is ofcourse nicer because you can more precisely vary steps (only for that reason I'd smack in a overkill ADC or DAC for my hobby power supply which is probably a one or twice off).
« Last Edit: January 30, 2012, 11:25:07 am by hans »
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37626
  • Country: au
    • EEVblog
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #41 on: January 30, 2012, 11:21:41 am »
I can't understand why Dave moved the zero bits from the end of the bit banging sequence to the front?

From the formula in the datasheet, the output voltage would have been too high. I wanted 1mV/mA output.

Dave.
 

Offline darrenb

  • Contributor
  • Posts: 36
  • Country: au
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #42 on: January 30, 2012, 11:49:15 am »
I can't understand why Dave moved the zero bits from the end of the bit banging sequence to the front?

From the formula in the datasheet, the output voltage would have been too high. I wanted 1mV/mA output.

Dave.

Hi Dave,

But you're throwing away bits aren't you.  Lets say for 10 bits of data being sent to the ADC the data sheet says to send it 16 bits, the first four bits being the configuration bits, the next 10 being the data bits and the last two being thrown away.

Using 'C' for config bits, 'D' for data you want to send and 'X' for stuff it will throw away I think it said to send as;
CCCCDDDD DDDDDDXX.

But after the programming change it's now being sent as;
CCCCXXDD DDDDDDXX where you're throwing away the two bits at the front and the ADC is throwing away the two bits at the end.

I haven't done the math to figure out what the consequences of this would be but it doesn't seem right.  Maybe this will fix the error you were seeing?  Or maybe I'm missing something (happens all the time).

 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37626
  • Country: au
    • EEVblog
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #43 on: January 30, 2012, 12:19:38 pm »
The error I am seeing has nothing to do with this.
I want and need 1mV/bit output, because that is what matches my current sense amp output. And to get that with the 2.048V reference and 12 bits I need to use the lower 10 bits with the x2 amp.

Dave.
 

Offline darrenb

  • Contributor
  • Posts: 36
  • Country: au
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #44 on: January 30, 2012, 12:55:40 pm »
The error I am seeing has nothing to do with this.
I want and need 1mV/bit output, because that is what matches my current sense amp output. And to get that with the 2.048V reference and 12 bits I need to use the lower 10 bits with the x2 amp.

Dave.

Gudday again Dave,

Yes you're right - forget the error it's probably not related and it's most likely not even an error in the first place.

But..  Are you sure you're not just sending 8 bits to the ADC.  The ADC wants two bytes or 16 bits.  The first four bits are config bits so you're left with twelve.  You're sending two zeros (discard bits) at the front and then 10 bits of data but the last two are being dropped by the ADC.  12 - 2 (at the front) - 2 (at the end) = 8 bits of significant data being sent.

Based on the blog at 20:03 maybe the discard bits should be back at the end after the data bits instead of in front?

 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11771
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #45 on: January 30, 2012, 03:37:53 pm »
I think I would do the experiment implied by darrenb's question: successively increment the lsb of the data word you are sending and see what the delta of the output voltage is each time you increase it by 1. Are you getting the output precision you expect to be getting?

With a 2048 mV reference voltage and 10 bit resolution (= 1 part in 1024) I think you would expect the DAC output to increase by 2 mV with each step of the input word. If something is wrong the output would change in larger steps with every 2 or 4 increments rather than one small step per increment.
 

Offline jaapiyo

  • Newbie
  • Posts: 1
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #46 on: January 30, 2012, 03:54:15 pm »
I don't know if anyone pointed this already, but I think it would be nice if Dave made diffident kits for different mains power specifications. (Like EU, US etc.)
 

Offline slateraptor

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #47 on: January 30, 2012, 04:12:44 pm »
But..  Are you sure you're not just sending 8 bits to the ADC.  The ADC wants two bytes or 16 bits.  The first four bits are config bits so you're left with twelve.  You're sending two zeros (discard bits) at the front and then 10 bits of data but the last two are being dropped by the ADC.  12 - 2 (at the front) - 2 (at the end) = 8 bits of significant data being sent.

Based on the blog at 20:03 maybe the discard bits should be back at the end after the data bits instead of in front?

Dave is using a 12-bit DAC shifted out MSB first for the test; of the 12 bits, only the lower 10 bits are used. I don't know where you're getting the "- 2 (at the end)" part from.

If you pay close attention to the bit-bang code after the corrections were made, you'll see:

SPI_DATA <= 4 config bits
SPI_DATA <= 0
SPI_DATA <= 0
SPI_DATA <= (temp >> 9) & 1
SPI_DATA <= (temp >> 8) & 1
...
SPI_DATA <= (temp >> 1) & 1
SPI_DATA <= temp & 1


If something is wrong the output would change in larger steps with every 2 or 4 increments rather than one small step per increment.

The issue is simply that the significance of datasheet specs, in particular non-linear error, was overlooked; the chip is within spec.
 

Offline baljemmett

  • Supporter
  • ****
  • Posts: 665
  • Country: gb
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #48 on: January 30, 2012, 04:13:31 pm »
I don't know if anyone pointed this already, but I think it would be nice if Dave made diffident kits for different mains power specifications. (Like EU, US etc.)
I think it's designed to run off a plugpack or similar, rather than including the mains side of things -- so there shouldn't be anything that needs to change between mains systems.
 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11771
  • Country: us
Re: EEVblog #240 - Power Supply Design Part 8
« Reply #49 on: January 30, 2012, 05:28:39 pm »
Dave is using a 12-bit DAC shifted out MSB first for the test; of the 12 bits, only the lower 10 bits are used.

That doesn't make sense from a design perspective. In an output word the least significant bits affect the resolution while the most significant bits affect the magnitude. If you masked the most significant two bits to zero in a 12 bit word you would completely change the output value, whereas if you masked the least two bits to zero you would keep the same value but lose a bit (two bits) of precision. If you wanted the different chips in the family to be plug-compatible you would want to be masking off the lower two bits of the 12 bit word to leave a lower precision 10 bit word.

Although I have not had a chance to read the datasheet, I would be surprised if the chip designers dropped such a clanger.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf