Generating & Detecting Various Frequencies

Hi everyone! I just got my Arduino board yesterday but unfortunately have to wait for a USB type 'B' wire. But that's okay, because I discovered Arduino lately and their open-source info and links to more open-source info got me a good head start on this whole concept. Awesome! Thank you! I have lots of ideas to start experimenting with. It's just a matter of where to begin. I'm wondering the limits of using the ATmega328P to both generate and detect frequencies (not necessarily the same project). I found the 'Tone()' command and that was a good start, and then found PWM which I will start looking more into.

My main question is: - What method should I go about for generating various frequencies at least into the radio range, but the higher the better! Can I somehow simply upgrade the crystal oscillator circuit to a higher frequency crystal and circuit? I'm guessing the higher frequencies would need an external circuit altogether? I'm looking for the widest possible range of frequency that I can generate while keeping things fairly simple.

  • Using inputs from various EM coils and sensors hooked up live with USB/Bluetooth to a laptop/tablet with custom Android/Windows software serving as a detailed readout, analyzer, oscilloscope, stat log files, etc. For this technique I found a method for converting line-driven code to event-driven code. The loop constantly checks for trigger and calls a command through USB. The ideal situation is upload a sketch to make it possible to both trigger events from Android app through USB and see the immediate feedback/results.

The goals are many, but for this topic I would like to detect various electromagnetic fields including natural emf fields(long term research & development) and artificial radiation(devices to turn harmful radiation into useful electricity). If anyone knows if something similar has been done to learn from, please let me know! So far most of what I try to look up on this I get stuff on motor control.

Infinite thanks!

The Arduino runs on a 16MHz crystal, and it won't run much faster. You would need to read the spec on the ATMgea328 to get the full details.

In practical terms this means that the Arduino is not the best platform for generating RF unless all you want is square waves of powers of 2 division of 16MHz.

The Arduino does not have Digital to Analogue converter, so the Tone output is via square waves. The "analogue" outputs are just low frequency Pulse Width Modulation, and are only suitable for controlling things like LEDs

In terms of signal analysis, again, the Arduino is too slow for all but basic analysis of audio frequencies. And, The faster you try to read the ADC, the less accuracy you get.

The Arduino also only has a small amount of internal RAM, generally 2k, and not all of it would be available for sample storage, so this also seriously limits signal analysis.

Yea it looks like the clock can only run up to 20Mhz, so for higher I will need to make an external circuit and then control it digitally with a control pin. And I did start realizing the digital/analog issue. I don’t think I would want to use DAC for sine waves, so I will use the chip for generating only as a starting point maybe.

As far as signal analysis, I think I can get away with some useful features by doing most of the processing on laptop/computer software and just use the Arduino mostly as a ‘bridge’ between external circuits and a full computer, rather than a stand-alone unit And hmmm, never thought about the ADC! So it seems I would have to convert it back to digital… If I can get a reasonable accuracy, I think it still has potential because of how simple it can be at the same time.
I might start by trying to detect AC electricity (60hz), then 2.4Ghz cordless phones, etc

But you are right, for any real detailed diagnostic/generating/analyzing I will need to research into some more complex chips like the ARM core or something.

It's hard to beat those cheap Asian DDS modules for generating sine wave from a 0-40Mhz range. They require 4 digital output pins to control.

The AD9851 goes to 0-70MHz but costs a little more.


Those sig gen's are super cool ;-) Thanks for posting. I may get one, as I currently don't have a sig gen and this seems like a really cheap way to make one !

In regards to the original posting

As far as signal analysis, I think I can get away with some useful features by doing most of the processing on laptop/computer software and just use the Arduino mostly as a 'bridge' between external circuits and a full computer

I'm not sure how you intend to get the data to the PC fast enough, unless you just want to capture a small buffer of data e.g 1kB and then send it via serial.

You may want to take a look at the Arduino Due, as its much faster, but its not really fast enough for what you want to do.

I think in reality you need a DSP based microcontroller and not a general purpose one as used in the Arduino.

The Arduino (ATMega328) is good for controlling stuff, not not that good at handling a lot of processing or data storage, and by modern standards its very slow and contains a tiny amount of RAM.

Working with the Arduino takes me back around 20+ years to the capabilities of the early 8 and 16 but processors like the Z80 and 8080, and even then I had way more memory to play with (64KB)

I think over the next couple of years there will be a slow shift to ARM cortex processors with far higher clock speeds for a lot of micro controller projects.

For example, there is already the Teensy board ( ) which I think is Arduino compatible in terms of programming (They claim it is) Which is clocked at 72Mhz and can be clocked higher and has 64k ram

Or there are ARM board like this one

Which have similar specs.

Or look at the Raspberry PI (albeit it is lacking a lot of IO)

Or the BeagleBone Black (Albeit some what more expensive and harder to get hold of unfortunately )