References: ( http://ernest.utreg.net/?page=arduino-tuner )
Ernest says: " I was so surprised by the simplicity, that I decided to extend the tuner. The next step is to vary the inductor. Therefore I made a new one with an extra connection in the middle. I added a relay to switch between the half or the full inductance. Now the software is modified, it does two sweeps with the capacitor, one with half induction, and another one with full induction. Again, it searches for the best combination. I tested it, and now it finds a nice SWR for almost any load! The movie shows a slow version, to allow you to see it working. The code below is the fast version, it tunes within 2 seconds!
The circuit diagram is given here. The green part is the RF section, which is electrically isolated from the control section. The control section is connected to the Arduino board, pins are given. The SWR meter is not in the circuit, but should be placed between the tuner and the transmitter (TX). The DC output of the SWR-meter is connected to analog input 0 of the Arduino. Parts are not critical. The transistor can be any regular NPN type, e.g. BC547. The resistor is 2200 ohm in the circuit, but could also be 4k7 of 1k or anything between. The diode handles the backfire current of the relay, and could be of almost any type, e.g. 1N4148. The servo is a generic 180 degrees 5 volt servo and mechanically attached to the capacitor. The inductor is switched by a 5 volt relay, which must be capable to handle the desired RF power. Before using this code, remember it is still for demo purposes, so there is no code in there for a "tune" button or so. It simply tunes, wait 10 seconds, tunes again, waits 10 seconds, tunes again, etc... For building a real tuner, you will also have to compare the reflected power to the forward power. So you will have to read both meters, compare them, and depending on the results you probably want to alarm the user when no low SWR could be found".
// AutoTuner v2
// by PA3HCM
#include // We will use a servo
Servo cap; // for rotating the capacitor
int capPin = 9; // attached to pin 9
int indPin = 13; // Inductor relay on pin 13
int reflPin = 0; // Reflection input on analog pin 0
int pos = 0;
boolean bestIndPos = HIGH;
int capPos = 0;
int bestCapPos = 0;
int refl = 0;
int bestRefl = 1023;
void setup() {
cap.attach(capPin);
}
void loop() {
// reset
bestCapPos = 0;
bestIndPos = HIGH;
bestRefl = 1023;
cap.write(0); // turn capacitor to start position
delay(500); // this will take a bit of time, so wait
// find best reflection with full inductance
digitalWrite(indPin, HIGH);
delay(200);
for(pos = 0; pos < 180; pos += 3)
{
cap.write(pos);
delay(15);
refl = analogRead(reflPin);
if (refl < bestRefl) {
bestRefl = refl;
bestCapPos = pos;
bestIndPos = HIGH;
}
}
// find best reflection with reduced inductance
digitalWrite(indPin, LOW);
delay(200);
for(pos = 180; pos > 0; pos -= 3)
{
cap.write(pos);
delay(15);
refl = analogRead(reflPin);
if (refl < bestRefl) {
bestRefl = refl;
bestCapPos = pos;
bestIndPos = LOW;
}
}
// select best capacitance and inductance
digitalWrite(indPin, bestIndPos);
cap.write(bestCapPos);
// wait before re-entering the loop...
delay(10000);
}
No comments:
Post a Comment