A Microcontroller Operated SWR Meter: Unterschied zwischen den Versionen

Aus DL8RDS Wiki
Wechseln zu: Navigation, Suche
(Progress)
(First Steps on Arduino)
Zeile 94: Zeile 94:
 
  }
 
  }
  
And after making a connection to /dev/ttyUSB0 with 9600 bit/s and handshake off, I was able to read the Hello by every second. So also the serial connection is damn simple. The next bit was even a bit harder: I want to read out the setting of a poti and send the value to the serial console. That's my first attempt to make a bridge from the real world into the digital world. Here's the setup:  
+
And after making a connection to /dev/ttyUSB0 with 9600 bit/s and
 +
handshake off, I was able to read the Hello by every second. So also the
 +
serial connection is damn simple. The next bit was even a bit harder: I
 +
want to read out the setting of a poti and send the value to the serial
 +
console. That's my first attempt to make a bridge from the real world
 +
into the digital world. Here's the setup:
  
[[Image:
+
[[Image:Arduino_mit_poti.jpg|400px]]
  
 +
The poti is a 1 kOhm.
 +
 +
And here's the code:
 +
int potiPin = 0;
 +
int potiVal = 0;
 +
 +
void setup() {
 +
  Serial.begin(9600);
 +
  int potiPin = 0;
 +
}
 +
 +
void loop() {
 +
  int zahl = 10;
 +
  int potiVal = analogRead(potiPin);
 +
  Serial.println("Poti-Wert:");
 +
  Serial.println(potiVal);
 +
  Serial.println("-------------");
 +
  delay(1000);
 +
}
 +
 +
And now when I take a screwdriver and twist around the poti, I am
 +
getting different values in my minicom!!!
 +
Poti-Wert:
 +
541
 +
-------------
 +
Poti-Wert:
 +
561
 +
-------------
 +
Poti-Wert:
 +
653
 +
-------------
 +
Poti-Wert:
 +
804
 +
-------------
 +
Poti-Wert:
 +
857
 +
-------------
 +
Poti-Wert:
 +
1018
 +
-------------
 +
Poti-Wert:
 +
1023
 +
-------------
 +
Poti-Wert:
 +
1019
 +
Most remarkable is that the values range from 0 to 1023. So that's just
 +
a perfect basis to do further calculations.
  
 
=== Next? ===
 
=== Next? ===
  
 
* Come back and see in a few weeks / months...
 
* Come back and see in a few weeks / months...

Version vom 17. September 2009, 01:42 Uhr

1 Project description

This project is part of the SVXLink project. Since I intend to use T7F transceivers for this project, it is highly interesting to detect troublesome antenna and SWR conditions and to be able to shut off the transmitter. The only way to do that is to read out the SWR digitally. And this can be done using the I2C BUS.

BTW, I want to measure some more values:

  • PA temperature
  • Transmitter power consumption / input current
  • Total system input current

And I want to switch some things, too:

  • Be able to switch the transceiver OFF

But very basically this project can also be seen in an isolated perspective: I want to learn how to use a microcontroller and set up a project that's useful for other OMs as well. Notably interesting will be to use the Sparkfun Low Current readout boards and feed this voltage into the ADC that's contained on the Arduino board. so that I possibly don't even need the I2C BUS for this isolated scenario.

The LCD display is a ANAG Vision AV2020YFBF-SJ

2 Other People's work

3 Shops where to buy the components

4 Project Plan

  • Purchase stuff
  • First build a directional coupler. Role model: http://www.dj4uf.de/projekt/swr/swr.htm
  • Then make sure the readouts of the forward voltages are within a reasonable range. identify peak voltages.
  • Then take the BeagleBoard and be successful measuring voltages through a Analog Digital Converter (ADC).
  • Then connect the coupler to the ADC and see if it's possible to measure the voltages.
  • Then connect an LCD display to an Arduino board.
  • Then successfully control the LCD display and devise a reasonable display readout
  • Then read the I2C bus from the Arduino board
  • Then calculate the SWR based on the readings from the I2C bus and send them to the LCD display
  • Finally build a nice case
  • Write an article and post it in some fancy electronics magazine :-)

5 Progress

5.1 Purchase Stuff

  • 2009-09-04 The BeagleBoard has an I2C header in the expansion port. So it is just a wonderful idea to use it and read out some things. The only problem: It's operated with 1,8V. So I need a bidirectional voltage translator.
  • 2009-09-05 I decided to get the one from Gravitech.
  • 2009-09-10 My ADC arrived. I'm still waiting to receive the voltage translator. And I have bought some books on Arduino programming. Still need to buy the Arduino board and an LCD display.
  • ToDo: Go shopping

There are some guides on how to connect LCD dislays and Arduinos:

5.2 First Steps on Arduino

My first steps on the Arduino platform are successful! Since I have been working on a Ubuntu Hardy platform, I noticed that I would not be able to compile my programs properly because there are some bugs here and there. Anyway, so I decided to upgrade to the most modern Ubuntu Jaunty distribution and now it works fine: I can start the Arduino development environment without problems. Trying out the first little program, the famous "Blink" program which blinks a LED, compiled perfectly. So I started over and plugged the LED into digital output pin 13 and GND and uploaded the code and there it went. The Arduino went blinking!!!

int ledPin =  13;    // LED connected to digital pin 13

void setup() 
{                
  // initialize the digital pin as an output:
  pinMode(ledPin, OUTPUT);     
}

void loop()                   
{
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(1000);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(1000);                  // wait for a second
}

My next experiment was to send stuff to the serial console back to the computer. Here I tried out some code from the book "Manuel Odendahl, Julian Finn & Alex Wenger. Arduino. Pysical Computing für Bastler, Designer & geeks. O'Reilly, 2009.", page 132 ff.

void setup() 
{
  Serial.begin(9600);
}
void loop()
{
  Serial.println("Hallo");
  Serial.println("--------");
  delay(1000);
}

And after making a connection to /dev/ttyUSB0 with 9600 bit/s and handshake off, I was able to read the Hello by every second. So also the serial connection is damn simple. The next bit was even a bit harder: I want to read out the setting of a poti and send the value to the serial console. That's my first attempt to make a bridge from the real world into the digital world. Here's the setup:

Arduino mit poti.jpg

The poti is a 1 kOhm.

And here's the code:

int potiPin = 0;
int potiVal = 0;
void setup() {
  Serial.begin(9600);
  int potiPin = 0;
}

void loop() {
  int zahl = 10;
  int potiVal = analogRead(potiPin);
  Serial.println("Poti-Wert:");
  Serial.println(potiVal);
  Serial.println("-------------");
  delay(1000);
}

And now when I take a screwdriver and twist around the poti, I am getting different values in my minicom!!!

Poti-Wert:
541
-------------
Poti-Wert:
561
-------------
Poti-Wert:
653
-------------
Poti-Wert:
804
-------------
Poti-Wert:
857
-------------
Poti-Wert:
1018
-------------
Poti-Wert:
1023
-------------
Poti-Wert:
1019

Most remarkable is that the values range from 0 to 1023. So that's just a perfect basis to do further calculations.

5.3 Next?

  • Come back and see in a few weeks / months...