Hi, I am trying to interface a homemade function generator to an LCD screen to display the amplitude and frequency that is being generated, can anyone help me with writing a code to do so? The frequency is adjustable from 1MHz to 1Hz in 6 increments and also can be fine tuned with potentiometers, not sure if that helps or not.
Frequency is the easiest, tap off some signal, make it square with a high gain amplifier. The there are two ways to work out the frequency:-
- use the pulse in function to measure the period of the signal.
- count the number of cycles in a certain time interval.
Amplitude is a bit more tricky, I assume you want peak to peak but you can also have peak, average and RMS.
Look at a peak detector circuit. You also need to make sure you never feed negative voltages into the arduino's analogue input.
prob just peak to peak, but thanks for the info, i will try the frequency and see what happens first