Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Arduino freq counter/prescaler?

Status
Not open for further replies.

MikeMl

Well-Known Member
Most Helpful Member
I'm building a remote 1kW motorized automatic L-network antenna-tuner for 14MHz, 18MHz, 21MHz, 24MHz, 28MHz and 50MHz. I need to measure the RF input frequency (crudely) in order to recall and preset the motor-driven tuning capacitor and inductor to previously memorized settings based on the actual frequency being sent to the tuner.

The controller is an Arduino mini. I would like to do most of the work inside the mini. Is a 16:1 divider (4bit counter) sufficient to do 54MHz (the max input freq)?
 
A PIC can directly read frequency up to 50MHz (and a bit more, but 50 guaranteed), possibly an AVR could do similar?

PIC's do it by feeding the external frequency directly in to a hardware counter input, which is essentially TTL type spec, giving 50+MHz.
 
There is a design for an inductance meter (Which is basically a frequency meter.) in the June 2007 that uses an ATmega48 which is probably similar in specification to the ATmega328 used in the Arduino mini. It measures frequency up to 8Mhz which would be good enough with the divide by 16 prescaler. The code is written in assembler so I don't know if you could read the same frequency with code written in "C" (I am useless at writing code in "C") (I assume the code will be written in "C" as you are using an Arduino.) This morning before I remembered this article I looked at the data sheet for the ATmega328 but could not find the maximum input frequency for the counter but from Googling It seems the external input is clocked to synchronize the edges to the internal clock. This is probably why it is not as fast as the PIC 's counter that Nigel mentioned. I assume this is to go with the ATU that you are building. Did the helipot idea work for giving the position of the tap on the coil ?

Les
 
Thanks for the interest.
There is a design for an inductance meter (Which is basically a frequency meter.) in the June 2007 that uses an ATmega48 which is probably similar in specification to the ATmega328 used in the Arduino mini. ...
Which publication?
I assume this is to go with the ATU that you are building. Did the helipot idea work for giving the position of the tap on the coil ?
I put a 2:1 mechanical reduction between the roller-inductor shaft and the ten-turn pot shaft. The useful range of the roller inductor is about 17 turns, so this works fine. The ten bit Arduino AD provides more than enough resolution... I will post a picture...

This Google got a lot of hits; haven't had time to read them yet...
 
I know this is of no use to you, but when I worked at a communication company, we had a 100W HF auto antenna tuner. The CPU used the fwd/Rvs power to run the tuning algorithm. It did not need to know the frequency. Just thought I would mention it.
 
I know this is of no use to you, but when I worked at a communication company, we had a 100W HF auto antenna tuner. The CPU used the fwd/Rvs power to run the tuning algorithm. It did not need to know the frequency. Just thought I would mention it.

A directional coupler (to allow the Arduino to measure SWR) will be used for the final positioning of the L and C. I am going to use memorized (band-dependent) positions to preset the tuning to the same positions where the best match was found the last time I tuned that band as this tuner will always be connected to the same antenna. Will store the settings in EEProm during power down.

One trick I learned is that making the vertical antenna element 18ft long allows it to be tuned with a series-C input , shunt-L from whip to ground tuning network without having to reconfigure the network on any band from 20m to 6m. The 18ft whip doesn't resonate on any ham band, but can be tuned without switching the configuration of the tuner. Even at a 1kW power level, the maximum voltages are manageable at < 3kV and the currents are < 3A on all bands of interest.

Goal is a hands-off remote tuner, and to get to learn more about what I can do with a $3 Arduino Mini.

Here are two pictures of my breadboard (literally) as it exists so far:

TunerTop.jpg

TunerFrt.jpg

So far, the control box just has two center-off switches (joysticks) for testing. The left one controls the capacitor; the right one controls the inductor; up to increase capacitance or inductance; down to decrease, respectively. Tapping the joystick makes one little step up or down. Holding the joystick for ten seconds steps once a second. Holding the joystick for more than ten seconds causes the gearmotor to slew at full speed.

The blue readout is just a voltmeter that shows the pot wiper voltage of whichever joystick was last pressed. The voltage is ratiometric to the Arduino's 5V supply, so is also read by the Arduino's AD converter and used to stop rotation of the respective shaft as the capacitor reaches min and max capacitance, and the inductor reaches the limit of its travel.

The two motors and the meter readout are multiplexed based on which joystick was last pressed. This makes possible the six wire interface.

So far, I have written Arduino code for positioning the capacitor and the inductor, checking the limits, slewing slow and fast, stopping at the limits, going to a specific position, etc. Now the real fun begins...
 
You did a splendid job on construction, really nice job :) What configuration are your tuning elements. If my memory serves me right, the one I worked on had series C (tunable), shunt L (multiple inductors switched in/out binary), and series C (tunable). It often took awhile to get a good tune ~ 30 sec, 10 MHz was always a trouble spot for some reason. I was a factory tech at the time so I never really knew how the code worked.
 
Given the cost of a 4-bit counter, why not put 2 or 3 in series? 54 MHz/4096=13.2 kHz, low enough that you can measure it directly in software if the arduino's internal counters are not a good fit.

ak
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top