I would like to make a square wave generator which will output a signal with amplitude X voltages and frequency between 1KHz to 1MHz, with the precision of 1KHz (for example: 785kHz, 926kHz, 999kHz, etc ...). I have tried to do that with Arduino Uno, but I realized that I would need a precision of 1ns to be able to do that. 1ns equals to 1GHz. So, what hardware do I need to be able to do that?
1 Answer
Direct Digital Synthesis may be over the top for what you want but it can certainly deliver the goods: -
Click on the picture to take you to the data sheet. It produces a sinewave but this can easily give you a square wave (on board comparator). With a 28 bit control register on frequency a 16MHz clock can be divided down to 0.0596 Hz if I read the data correctly and this is also the resolution.
The big disadvantage to the 555 brigade (yes, I have used one recently) is that you need to control it with SPI so a small micro interface to a keypad might be a good idea. Hey you can even use the micro for telling you what frequency it's generating (via an LCD).
Maybe the arduino can do SPI?
-
\$\begingroup\$ This will give you what is called 'discrete jitter' of +/- 1/2 the sample clock period. This may or may not be acceptable. If this jitter is acceptable, then this is definitely the best solution as it has extremely high resolution and the frequency accuracy is tied to the crystal and not an RC circuit (as is the case for a 555). \$\endgroup\$ Commented Jul 15, 2015 at 18:00
1/F
) period times. \$\endgroup\$