Author Topic: Power supply part 4  (Read 58233 times)

0 Members and 1 Guest are viewing this topic.

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Power supply part 4
« Reply #100 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 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.
« Last Edit: December 31, 2011, 04:51:40 pm by BoredAtWork »
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 Nick Gammon

  • Contributor
  • Posts: 41
  • Country: au
    • Gammon Software Solutions
Re: Power supply part 4
« Reply #101 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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #102 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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #103 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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #104 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.
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2450
  • Country: gr
Re: Power supply part 4
« Reply #105 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.
Become a realist, stay a dreamer.

 

Offline shebu18

  • Frequent Contributor
  • **
  • Posts: 309
  • Country: ro
Re: Power supply part 4
« Reply #106 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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #107 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.
 

Offline Greg J

  • Regular Contributor
  • *
  • Posts: 83
  • Country: gb
  • Hi there
Re: Power supply part 4
« Reply #108 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 :)


--
Take It EV
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #109 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.
 

Offline Blue

  • Regular Contributor
  • *
  • Posts: 120
  • Country: nl
  • Fighting for peace is like fucking for virginity
Re: Power supply part 4
« Reply #110 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
 

Offline Greg J

  • Regular Contributor
  • *
  • Posts: 83
  • Country: gb
  • Hi there
Re: Power supply part 4
« Reply #111 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 :)
--
Take It EV
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #112 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.
 

Offline Greg J

  • Regular Contributor
  • *
  • Posts: 83
  • Country: gb
  • Hi there
Re: Power supply part 4
« Reply #113 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.
--
Take It EV
 

Offline JimmyM

  • Regular Contributor
  • *
  • Posts: 93
Re: Power supply part 4
« Reply #114 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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #115 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.
 

Offline Nick Gammon

  • Contributor
  • Posts: 41
  • Country: au
    • Gammon Software Solutions
Re: Power supply part 4
« Reply #116 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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #117 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.
 

Offline Nick Gammon

  • Contributor
  • Posts: 41
  • Country: au
    • Gammon Software Solutions
Re: Power supply part 4
« Reply #118 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

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.
 

Offline EEVblog

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #119 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
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.
 

Offline Greg J

  • Regular Contributor
  • *
  • Posts: 83
  • Country: gb
  • Hi there
Re: Power supply part 4
« Reply #120 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).
--
Take It EV
 

Offline JimmyM

  • Regular Contributor
  • *
  • Posts: 93
Re: Power supply part 4
« Reply #121 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.
 

Offline Greg J

  • Regular Contributor
  • *
  • Posts: 83
  • Country: gb
  • Hi there
Re: Power supply part 4
« Reply #122 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.
--
Take It EV
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2450
  • Country: gr
Re: Power supply part 4
« Reply #123 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.
Become a realist, stay a dreamer.

 

alm

  • Guest
Re: Power supply part 4
« Reply #124 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?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf