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

0 Members and 1 Guest are viewing this topic.

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3632
  • Country: au
Re: Power supply part 4
« Reply #75 on: December 31, 2011, 03:42:10 pm »
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.
« Last Edit: December 31, 2011, 03:49:42 pm by amspire »
 

Offline Nick Gammon

  • Contributor
  • Posts: 41
  • Country: au
    • Gammon Software Solutions
Re: Power supply part 4
« Reply #76 on: December 31, 2011, 03:44:30 pm »
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.
 

Offline JimmyM

  • Regular Contributor
  • *
  • Posts: 93
Re: Power supply part 4
« Reply #77 on: December 31, 2011, 04:06:04 pm »
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.
 

Offline Nick Gammon

  • Contributor
  • Posts: 41
  • Country: au
    • Gammon Software Solutions
Re: Power supply part 4
« Reply #78 on: December 31, 2011, 04:15:02 pm »
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

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

The USBtinyISP ($22):

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.

« Last Edit: December 31, 2011, 04:31:57 pm by Nick Gammon »
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3632
  • Country: au
Re: Power supply part 4
« Reply #79 on: December 31, 2011, 04:22:48 pm »
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.
« Last Edit: December 31, 2011, 04:24:53 pm by amspire »
 

Offline JimmyM

  • Regular Contributor
  • *
  • Posts: 93
Re: Power supply part 4
« Reply #80 on: December 31, 2011, 04:26:46 pm »
I'll have to look into the Nokia cable trick. I haven't used PC to AVR via USB yet.
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3632
  • Country: au
Re: Power supply part 4
« Reply #81 on: December 31, 2011, 04:35:15 pm »
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.
 

alm

  • Guest
Re: Power supply part 4
« Reply #82 on: December 31, 2011, 04:39:51 pm »
A UART bootloader would require a stable clock source.
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3632
  • Country: au
Re: Power supply part 4
« Reply #83 on: December 31, 2011, 04:42:45 pm »
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 ?
« Last Edit: December 31, 2011, 04:55:20 pm by amspire »
 

alm

  • Guest
Re: Power supply part 4
« Reply #84 on: December 31, 2011, 05:05:15 pm »
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.
 

Online EEVblog

  • Administrator
  • *****
  • Posts: 28738
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #85 on: December 31, 2011, 05:05:28 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.
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2314
  • Country: gr
Re: Power supply part 4
« Reply #86 on: December 31, 2011, 10:31:38 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.

« Last Edit: December 31, 2011, 10:43:29 pm by firewalker »
Become a realist, stay a dreamer.

 

Offline JimmyM

  • Regular Contributor
  • *
  • Posts: 93
Re: Power supply part 4
« Reply #87 on: December 31, 2011, 11: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.
 

Offline shebu18

  • Frequent Contributor
  • **
  • Posts: 307
  • Country: ro
Re: Power supply part 4
« Reply #88 on: December 31, 2011, 11: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.
 

Online EEVblog

  • Administrator
  • *****
  • Posts: 28738
  • Country: au
    • EEVblog
Re: Power supply part 4
« Reply #89 on: December 31, 2011, 11: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.
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2314
  • Country: gr
Re: Power supply part 4
« Reply #90 on: January 01, 2012, 12:08:10 am »
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.
Become a realist, stay a dreamer.

 

Offline Blue

  • Regular Contributor
  • *
  • Posts: 55
  • Country: nl
  • Fighting for peace is like fucking for virginity
Re: Power supply part 4
« Reply #91 on: January 01, 2012, 12:45:11 am »
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
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Power supply part 4
« Reply #92 on: January 01, 2012, 01:01:09 am »
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]
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 firewalker

  • Super Contributor
  • ***
  • Posts: 2314
  • Country: gr
Re: Power supply part 4
« Reply #93 on: January 01, 2012, 01:09:25 am »
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.
Become a realist, stay a dreamer.

 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3632
  • Country: au
Re: Power supply part 4
« Reply #94 on: January 01, 2012, 01:13:13 am »
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
« Last Edit: January 01, 2012, 05:23:04 pm by amspire »
 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2314
  • Country: gr
Re: Power supply part 4
« Reply #95 on: January 01, 2012, 01:15:47 am »
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.
Become a realist, stay a dreamer.

 

Offline JimmyM

  • Regular Contributor
  • *
  • Posts: 93
Re: Power supply part 4
« Reply #96 on: January 01, 2012, 01:17:44 am »
Dave, is this going to be an arduino programming based project or are you going to write the C yourself?
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Power supply part 4
« Reply #97 on: January 01, 2012, 01:28:44 am »
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.
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 amspire

  • Super Contributor
  • ***
  • Posts: 3632
  • Country: au
Re: Power supply part 4
« Reply #98 on: January 01, 2012, 01:31:15 am »
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

 

Offline IvoS

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: us
Re: Power supply part 4
« Reply #99 on: January 01, 2012, 01:53:52 am »
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?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf