Overunity.com Archives is Temporarily on Read Mode Only!



Free Energy will change the World - Free Energy will stop Climate Change - Free Energy will give us hope
and we will not surrender until free energy will be enabled all over the world, to power planes, cars, ships and trains.
Free energy will help the poor to become independent of needing expensive fuels.
So all in all Free energy will bring far more peace to the world than any other invention has already brought to the world.
Those beautiful words were written by Stefan Hartmann/Owner/Admin at overunity.com
Unfortunately now, Stefan Hartmann is very ill and He needs our help
Stefan wanted that I have all these massive data to get it back online
even being as ill as Stefan is, he transferred all databases and folders
that without his help, this Forum Archives would have never been published here
so, please, as the Webmaster and Creator of these Archives, I am asking that you help him
by making a donation on the Paypal Button above.
You can visit us or register at my main site at:
Overunity Machines Forum



Arduino signal generator

Started by ayeaye, October 27, 2016, 02:33:55 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

TinselKoala

You still have quite a few compiler warning messages. To see them in your IDE, select File>Preferences then check the "Show verbose output during compilation" box. They don't prevent a successful compile but they may be causing problems in how the sketch actually works.

I'll be testing this new version later on this evening. Thanks for your good work!

Magluvin

This is a tiny oscope with arbitrary wave form gen up to 44khz analog and 1mbps max. Bought one a few years ago. This can interface with pc with gabos software download on that page. the make larger ones also as the screen on this is too small to strain your eyes on but the pc interface software works pretty good.
http://www.gabotronics.com/development-boards/xmega-xprotolab.htm
$49

Mags

TinselKoala

OK, I've done some testing of the new code. It does work better, at least at low frequencies.

But there is still some problem. At higher frequencies it does not do the duty cycle correctly. For example I input "8000000" for frequency and "33" for duty cycle and it gives me a 50 percent duty cycle. Or, if I don't reset the Arduino and put in 8000000 and 33 as a second setting, it gives me 125000 and 50. If I reset and put in 2520000 and 33, it gives me Frequency 2666666.75, Duty Cycle 16.67 .

The signal sent to the scope agrees with the Serial Monitor, but the program often gives me something other than what I put in as freq and duty cycle. Also it behaves differently if I reset the arduino before a new setting, than it does if I do not reset the arduino before a new setting.

But at least it oscillates at low frequencies now.

ayeaye

Quote from: TinselKoala on October 31, 2016, 10:58:34 PMFor example I input "8000000" for frequency and "33" for duty cycle and it gives me a 50 percent duty cycle. Or, if I don't reset the Arduino and put in 8000000 and 33 as a second setting, it gives me 125000 and 50.

I'm afraid that i cannot reproduce again. I tested it without oscilloscope. I copied the exact code from here, compiled it, uploaded to the Arduino. Started the serial monitor, entered frequency 8000000 and duty cycle 33. It showed frequency 8000000 and duty cycle 50. Then i again entered the frequency 8000000 and duty cycle 33, without restarting the serial monitor, and it again showed frequency 8000000 and duty cycle 50, not frequency 125000 and duty cycle 50 as you said. So i could not reproduce it behaving differently when resetting and when not resetting.

What concerns the program giving something other than put in, then one reason why it certainly happens is because it is limited by discreteness. Like with the frequency 8000000, the duty cycle can only be 50, because with the Arduino clock frequency 16 MHz. the timer can only go two steps. With the frequency 2520000 and duty cycle 33, the pulse width has to be integer. The period as integer is 6, and 33 percent of it when truncated is 1, which is 16.7% of 6. It is not good that it is truncated and not rounded, but this is a simple program.

Thank you for testing.

verpies

Quote from: TinselKoala on October 31, 2016, 10:58:34 PM
At higher frequencies it does not do the duty cycle correctly. For example I input "8000000" for frequency and "33" for duty cycle and it gives me a 50 percent duty cycle.
Of course because the 16MHz Arduino clock is not capable of providing more than 50/50 precision at 8MHz output.