1.8 MHz signal generation?

Can an Arduino generate a 1.8 MHz signal? My googlage has led me to conflicting results. I can use an Uno or an ATTiny85 depending on what would work better.

Sub-question: would the tone() function be the best way to do this, or can I do it somehow else?

Thanks!

b_ankenb:
Sub-question: would the tone() function be the best way to do this, or can I do it somehow else?

Well, maybe!

While it says

The library uses the hardware timers on the microcontroller to generate square-wave tones in the audible range.

the first problem is that 1.8 MHz is not an even division of the 16 MHz clock. If you actually want 1.8 MHz, you would need to replace the resonator with an 18 MHz one.

But you have of course posed the XY Problem. :roll_eyes: Why do you want 1.8 MHz and why ever do you think your requirement is in any way related to Arduinox?

Thank you. I appreciate that link to the XY problem as it's a very concise description of the problems I face when I've tried to help other people with things online.

I was trying to be concise in my original question, probably at the expense of actual usefulness. What I'm trying to do is run a piezo to vaporize water (or, really, ethyl alcohol, but I've been told 1.8 MHz is the optimal frequency for both). I have the piezo, but don't have a board to drive it.

You can find some more information here: piezoelectricity - Piezo electric water vaporizer - Electrical Engineering Stack Exchange

...although that link questions my 1.8 MHz stat. Maybe I can find some MHz that is an even division of the 16 MHz clock and falls within a usable range?

Actually, after further googling, I'd need an AC signal to run the piezo anyway. Maybe I could alternate one pin high, another low, and connect each one to a MOSFET hooked up to the positive and negative ends of the circuit? Feels sketch. Further advice would be appreciated.

I think if you have the transducer, we need the specification sheet. The article you cite is way too general but points out that using the transducer itself in a self-resonant mode oscillator is probably optimum and simple. :stuck_out_tongue_closed_eyes:

As long as a slight deviation is acceptable, 16/9 yields 1.77MHz provided by a timer. If that's not acceptable, use a different frequency resonator.

I also think that a specific driver board is required for such piezo frequencies and power.

With Uno you can generate 1.6MHz or 2.0MHz I think, using the atmega328's timer2. You can get it to count 4 or 5 clock pulses and reset to zero, and toggle a pin each time. Nothing closer to 1.8MHz than that because of its 16MHz crystal. You could then turn that into an AC signal with an inverter gate.

DrDiettrich:
16/9 yields 1.77MHz provided by a timer.

Wouldn't that give a 0.9MHz output? Each time the timer hits 9 it would toggle an output pin?

PaulRB:
Wouldn't that give a 0.9MHz output? Each time the timer hits 9 it would toggle an output pin?

Not necessarily. With the PWM frequency of 1.77MHz a duty cycle of 4/9 or 5/9 comes close to a regular square wave.

Ah, right! Those clever timers!

The OP asked about the tiny85's timers. With a suitable crystal, e.g. 18MHz... ?

Now that we have ascertained that the intent is to drive a piezo transducer, precision is not so important but knowing the actual specification of the transducer - such as whether the usable frequency is even anything close to 1.8 MHz - is appropriate.

And a microcontroller is not the appropriate way to drive it anyway. The normal and most appropriate, simplest way is a self-resonant oscillator. :roll_eyes:

IMO power piezo transducers are operated in resonance, i.e. the exact frequency is determined by the physical construction, or whatever frequency results from excitation and feedback.

Precisely the point I repeat. :sunglasses: