Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Frequency-programmable PWM IC?

PWM IC

  • Please log in to reply
9 replies to this topic

#1 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 18 April 2013 - 11:55 PM

I need to generate a 50% duty-cycle square wave at an arbitrary frequency that depends on various operational parameters. This could be done with an STM32F, but this particular application isn't going to use a microcontroller, just a custom PCB interfacing with a PC. Does anyone have any suggestions for a low-cost yet accurate part? I need accuracy to within 0.01 Hz.

 

EDIT: I need a frequency range of at least 100-5000 Hz.



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 19 April 2013 - 08:42 PM

You haven't mentioned what frquency range you need but this I2C programmable oscillator can go from 16.2kHz all the way up to 133Mhz:

https://www.sparkfun.com/products/9116

Don't know about the accuracy or frequency resolution of this device (see the d/s) but there should be lots of similar devices. Depending on what your application is, you might need a driver circuit to go with it if you plan to drive a load with the output.

#3 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 25 April 2013 - 11:44 PM

You haven't mentioned what frquency range you need but this I2C programmable oscillator can go from 16.2kHz all the way up to 133Mhz:

https://www.sparkfun.com/products/9116

Don't know about the accuracy or frequency resolution of this device (see the d/s) but there should be lots of similar devices. Depending on what your application is, you might need a driver circuit to go with it if you plan to drive a load with the output.

A programmable oscillator would work, provided I can find one that works between 100-5000 Hz and has a resolution of 1 Hz, accurate to within 0.01 Hz.



#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 26 April 2013 - 04:35 AM

Verdris, if your specs are confirmed, the solution is not easy.

First off, 0.01Hz on 5kHz means 20ppm and this implies a very good quality crystal, preferably thermo-controlled.

Secondly, I suppose that you need a good frequency stability, so the only feasible way to create a similar circuit is starting from a crystal source, then cascading a certain divider. However, given "fin" as the crystal frequency, is not easy to find an arbitrary integer N which yields the desired "fout". In other words:

N = Fin / Fout, where Fout = 100..5000 and N must be integer.

Moreover, N should be multiple of 2, because you want always a duty of 50%.

 

For instance, suppose choosing a crystal of 10MHz. To generate a 100Hz sq-wave, you should divide the source by 100,000 and that's fine(*).

Afterward, let's suppose you want an output of 101Hz: this time the division has to be 99,010 (closest integer).

Now suppose to generate 4,987Hz: the closest integer multiple of 2 is 2,006, but the actual frequency is 4,985Hz.

As you may see, it's not an easy solution problem.

 

The "easiest" way to solve your problem that comes in my mind is using a PLL, but it's *FAR* from being as easy as the hobby-average-knowledge. It would be useful if you clarify, for instance, the purpose and/or whether the specs are correct, or can be relaxed a bit.

Cheers

 

UPDATE: There's another option, although it's not much easier.

The approach is building the waveform using the super-sampling technique, which consists to "serialize" the waveform on a shift register in order to obtain the desired pattern.

The crystal precision keeps the same, but perhaps the pattern creation would be pretty easier than other ways. Since your goal is having a 1Hz out of 5000, it means that you should have a resolution of *at least* 1/5000 = 200us...which stands for 200us per sample.

That's theoretical, though, because a good super-sampling should be many times faster than the maximum frequency desired.

Cheers


Edited by Mario Vernari, 26 April 2013 - 05:36 AM.

Biggest fault of Netduino? It runs by electricity.

#5 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 26 April 2013 - 06:00 AM

Since the frequency is very low, another option could be to use a small slave micro to generate the square wave. As for the resolution, it should be possible to find the correct combination of divider and s/w "PLL" for "odd" frequencies but stability could be poor and the same as system clock at best.

I might be able to do some tests with a small micro this weekend and if it works out, I could supply schematic and firmware.

 

EDIT: I got one of these AD9850 based DDS synthesizers that ranges 0...40Mhz with a supposed resolution of ~0.03Hz and a jitter of 80 picoseconds. I haven't had time to play with it yet and don't know if it can actually output any arbitrary frequency between 100 and 5000 Hz.

http://www.ebay.com/...=item4ac08454fa

 

Maybe Mario could have a look at the datasheet of the AD9850:

http://www.analog.co...eets/AD9850.pdf



#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 26 April 2013 - 11:46 AM

I don't know how easy is developing a firmware for a small mcu being able to yielding such a features of accuracy. Of sure you can do something interesting, but...how many time should you count for it?

I read that Verdris want a cheap solution.

 

I think that the AD9850-way could be a solution, although it's just a demo board and not ready for using in a real case. I can't say anything about it, because I don't know. The crystal problem is still alive, though.

I believe should be the Verdris turn to explain better what's the goal of his project.

 

Cheers


Biggest fault of Netduino? It runs by electricity.

#7 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 26 April 2013 - 12:57 PM

A through hole msp430 @ 16MHz with i2c slave caps is 2 USD and I might try for kicks, could come in handy. But I agree, let Verdris explain more first.

#8 Verdris

Verdris

    Advanced Member

  • Members
  • PipPipPip
  • 128 posts
  • LocationReno, NV

Posted 26 April 2013 - 07:15 PM

Hi all,

 

Thanks for the responses. To clarify my purpose: the experiment involves determining the resonant acoustic frequency of a chamber (easy) and then using that frequency to TTL drive a laser. As the acoustic resonant frequency is a strong function of temperature and density, I need to be able to accurately determine the frequency at any given moment.



#9 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 27 April 2013 - 01:54 AM

That sounds very Jarre but in the opposite direction

:D

Maybe there's an analogue way to achieve what you need to do?

Hmm...speaking of opposites gave me an idea:

Why not try connecting a regular loudspeaker to an oscilloscope? Vibrating air would hopefully induce vibrations to the cone and move the coil enough for a small voltage to be measured on the oscilloscope. I guess the amplitude would increase significantly as you hit the resonance frequency.

You could then design a circuit to amplify the signal as needed and then, for example, use an op amp comparator to generate the square wave and drive the laser based on that. The purpose of the comparator would be to detect when the amplitude is high enough to indicate that resonance frequency has been found.

Would it be possible you think?

#10 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 27 April 2013 - 06:55 AM

Hmmm...I agree with Hanzibal.

Perhaps I didn't understand how exactly the project is working, but a square wave isn't the proper way to measure a resonance. That's because a square wave is composed by a lot (infinite) harmonics, so...what's the actual resonating frequency?

I believe you should use a very well done sine wave generator, which should have a perfect spectrum response.

Cheers


Biggest fault of Netduino? It runs by electricity.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.