Frequency generator and analyzer

Hi, I am new to this forum and also to Arduino world.

I need some basic guidelines for my project.

I need to make some sort of frequency generator and analyzer. On one end this device should have some web GUI for management, which shouldn't be a problem. On the other end device should communicate with tone signals, which opens more questions than answers for me.
Device will receive a sequence of tones (beeps) separated with specific pause in milliseconds. Those tones are single frequencies from the set of telecommunication tones (1071 Hz, 1207 Hz, 1241 Hz, ... 1683 Hz, 2227 Hz, 2295 Hz). Specific frequency should be detected and according to some rules, device should be able to generate back specific tone (from the same set as mentioned above).

My question is, what would be the best approach to build such a device. I don't have necessary knowledge about electronics. To implement logic which tone should be generated/detected and when, and to implement web GUI, I guess RaspberryPi is a good choice. So for the "frequency part" I see the following problems:

  • raspberry has only digital ports,
  • some dedicated chips, DSPs, DTMF chips, ...either have to have different power supply, which represents new problem for me, or are limited by the number of ports to detect/generate frequency tones. By the way, my device should be able to detect tones on at least 8 different ports.
  • some chips don't support required frequencies or are only capable of DTMF,
  • some chips are only capable of receiving or only sending, not both. My device should be able to send and receive frequencies on the same port,
  • maybe I need ADC+some DSP,
  • ...

We have a specific connector which we will wire to analog ports that will receive and send those frequencies.

Please help me out with some basics about what hardware I need, do I need additional chip to detect and send frequencies or is this possible to do only with Arduino.

Thank you in advance,
BR

I guess these tones are square waves. What is the precision you are looking for on the frequency to produce these tones ?

I don't know the characteristics of signals yet, but the precision should be +-16Hz.

What you could do with an Arduino DUE if the input signal is a PWM:

Detect frequency with an input capture and output the same frequency with x% duty cycle.

The only tricky part is that the board should be able to receive and send frequencies on the same pin...

What is the delay between the frequency detection and the output of its "dual" frequency ?

Thank you for your help.
So if I understand correctly, it is possible to detect and generate single tone frequencies on Arduino pins? Without additional chip (processor/controller)?

About delays: incoming tones are going to be in form freq1, pause, freq2, pause, freq3, ... those impulses and pauses are going to be 20-30ms (so 20/30ms impulse and 20/30ms pause, ...) And then delay between detection and generation, I am not sure, but probably also 20/30ms. Why is that a problem?

When a timer capture is programmed on a DUE board, a pin is declared as an input to receive a PWM signal. Upon frequency detection by a Timer programmed in input capture mode, you will have to declare that same pin as an output, Reset the Timer, program the Timer in waveforme mode and output a "dual" frequency. This can take a few clock cycles, but fortunatly 20-30 ms are much more than necessary.

To set the output frequencies, you will have to divide a Master frequency (let say 42 MHz) by a 32-bit prescaler register: For example, 42 MHz/18300 = 2295.08 Hz.

Ok, I recorded the exact signals, that my device is going to receive/analyze, with oscilloscope. The signal is sin wave, so analog signal. Not square wave as you asked earlier. So I guess I will not be able to do this with PWM pins. ??
Is it possible to do all that we talked about, with analog ports on Arduino?

There is a window feature on the ADC controller: You can set an high and/or a low threshold to trigger an interrupt. In the interrupt handler, do the math to discover the input sin wave frequency. I suppose the frequency to be constant during this stage of the process.

The question is: what is the output signal ? A square wave at the same frequency or another sin wave ?

Thanks I will try that. The output signals are the same as input signals, so output from Arduino also have to be analog sin wave.

If the output signal is a sin wave, it can be a PWM with an RC filter or a DAC. But since the input pin has to be an ADC input pin, and this same pin should be the output pin too, it can't be a DAC pin.

Are you expecting to handle 8 channels simultaneously?

Given you have only a few dozen cycles per tone pulse, it would be easiest if the
tone pulses are nice and clean, then a comparator can be used to both detect the presence
of a pulse and measure its frequency through zero-crossing (well, slightly off-zero, since you
want to distinquish pulse from no-pulse).

The output of 8 comparators can to go to 8 interrupt sensitive pins (pin change interrupts
perhaps). The ISRs record the crossing times into a small circular buffer for each pin.

The main code has to check each of these every 30ms or so looking for consistent periods
representing a particular tone. With micros() granularity of 4us, you can get about 4Hz
resolution for a 1kHz tone.

The devil is in the details, though.

And outputing requires a lot of ISR processing too.

I would use an LM567 tone detector chip for each tone you want to detect. And then a NE555 oscillator and band pass filter for each tone you want to generate.

However this sounds like a X-Y Problem so what exactly is your application?

Thank you all for help.

MarkT:
Are you expecting to handle 8 channels simultaneously?

Yes, all channels need to be handled simultaneously. Depends on when the tone is received.

Grumpy_Mike:
However this sounds like a X-Y Problem so what exactly is your application?

My application is basically frequency detector and generator, for testing some Telecommunication equipment.

I got Arduino Uno, ethernet shield and bread board, so I will try to detect or generate some signals with only Arduino for now.

Thanks, BR

for testing some Telecommunication equipment.

Dosn't really enlighten. What sort of Telecommunication equipment?

A piccolo system?

Why is that important? I gave all the relevant information needed for answering my question.
But if you're that interested; its some proprietary equipment for analog trunk lines which is communicating with some other equipment, that I don't even know and will never see. Those two systems communicate with mentioned frequencies. So I need to make some device, that will behave in the same way this other equipment behaves, so that we can develop and test those functionalities on our proprietary trunk equipment.

Anyway, thanks to all for helping.

Why is that important?

Because knowing what the system needs to do is important for correct guidance.

The Arduino has limited real time signal handling capability so you have to be careful in your design to see what will work.

You have still not provided what I would call relevant information like of these eight tones are they all needed to be generated similtainiously or at any one time is only one being sent. What is the data rate that these tones are expected to operat at? What is the frequency of these tones?

On receiving is only one tone being recieved at any instant or are there multiple tones being sent at the same time like the telephone system? Again what is the data rate, that is how long do you have to recognise a tone both in terms of cycles of tone and milliseconds?

This is fundamental information that you know but we don’t. This will define if your project is possible on an Arduino or not.