Skip to content

pu2clr/Magnetic_Loop_Antenna_Tuner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magnetic Loop Antenna controlled by Android and Arduino

Clique aqui para Documentação em Português

Table of contents

  1. Folders structure
  2. Source Code
  3. Schematic
    1. One capacitor version
    2. Two capacitor version
  4. The Bluetooth shield used with Arduino
  5. Arduino prototype
    1. One Capacitor version
    2. Two Capacitor version
    3. Arduino with a HM10 (HMSoft) BLE
  6. Android Remote Controll Application
  7. More about the Android Application and Arduino source code
  8. Messages received by Arduino via Bluetooth
  9. Videos
  10. Photos

This project is about a minimalist version of a Remote Control for Magnetic Loop Antenna controlled by Arduino and Android via Bluetooth. I think it can be improved and adjusted for your needs.

April 3th, 2019. By PU2CLR, Ricardo Lima Caratti..

Folders structure

Source code

All Arduino and Android Application codes are avaiable on Sources folder. The bluetooth shield have to be desconected during the sketch upload process. See ArduinoOneCapacitor.ino, ArduinoTwoCapacitors.ino and BluetoothTuner.java code documentation. You might need change parameters or adapt it for your needs. There is also a version that use a BLE (Bluetooth Low Energy). Click here to see the BLE version.

Schematic

One capacitor version

This setup can be used with Alexloop antenna tuner or similar. The tune and fine tune commands are applied to only one capacitor.

One capacitor schematic

Two capacitors version

This setup uses two servos. The main servo should be attached to a "high" capacitance capacitor. The fine tune servo should be attached to a low capacitance capacitor. This video shows this idea.

One capacitor schematic

The same Android Application used to control the One capacitor version can be used to control the two capacitors version. There is a checkbox on the Android Application that you can select one or two capacitors setup.

IMPORTANT: It is recommended that you check your servo parameters (specifications). You might need change some defined constants on Android Application and Arduino sketch. You will find documentation on ArduinoOneCapacitor.ino, ArduinoTwoCapacitors.ino and BluetoothTuner.java to do that if necessary.

The Bluetooth shield used with Arduino

You can use the HC-05 or HC-07 bluetooth shield. I did not get success with BLE standard and the Android Application developed for this project.

Bluetooth HC-05 - Photo 1

Android Remote Control

Bluetooth HC-05 - Photo 2

Android Remote Control

Arduino circuit built on protoboard

One Capacitor version

The photo below shows the Android, Bluetooth and Servo setup for one capacitor version. Please, check your Servo specification. You might need to change some definition on the Arduino sketch. See ArduinoOneCapacitor.ino sketch source code documentation.

Android Remote Control

Two Capacitors version

The photo below shows the Android, Bluetooth and two Servos setup for two capacitors. The fine tune capacitor should have low capacitance. Please, check your Servo specification. You might need to change some definitions on the Arduino sketch. See ArduinoTwoCapacitor.ino sketch source code documentation.

Android Remote Control

Android Application

The version of Android Application used here was built in 2014. The last Android Studio used to build it was 3.3.2 (2019). Probable, you will need to do some adjust on your IDE environment to build this application.

You also might need to check your servo specification and change the BluetoothTuner.java (see comments in the java program).

Android Remote Controll - Photo 1

Connecting to Bluetooth you should press the Bluetooth button and select the paired Bluetooth, in this case it is HC07. You have to pair the bluetooth before by using system interface.

Android Remote Control

Android Remote Controll - Photo 2

Selecting the paired bluetotth.

Android Remote Control

Android Remote Controll - Photo 3

Bluetooth paired and ready to send commands to Arduino circuit.

Android Remote Control

More about the Android Application and Arduino source code

All source code can be found here. You might need to change some configurations depending on servo specification and kind of capacitor you are using. The Arduino and Android Application source code are docummented as shown below.

Important parts of the Arduino and Android code

The pieces of code below illustrate the configuration on Android Application (Java) and Arduino (C / C ++) that can be adjusted by you according your servo and capacitor specification.

Aplicativo Android (BluetoothTuner.java)

    // You might change this setup depending on your servo specification
    public int OFFSET = 800;   // Min. Pisition  (0 degree)
    public int MAXPOS = 2200;  // Max. position  (Max. degrre)
    public int CENTER = (MAXPOS - OFFSET)/2 + OFFSET /2;   // Center is CENTER + OFFSET
    // Change parameters for one or two capacitors
    // You might change the values depending on your capacitance of your capacitor and servo specification
    public void onTwoCapacitorsClicked(View v) {

        boolean chk =((CheckBox) v).isChecked();
        if (chk ) { //
            MIDDLE_MAX_OFFSET = MAXPOS;
            MIDDLE_CENTER = CENTER;
            FINE_MAX_OFFSET = MAXPOS / 4;
            FINE_CENTER = CENTER / 4;
        } else {    // One Capacitor estimated values. You might need change it
            MIDDLE_MAX_OFFSET = MAXPOS / 4;
            MIDDLE_CENTER = CENTER / 4;
            FINE_MAX_OFFSET = MAXPOS / 8;
            FINE_CENTER = CENTER / 8;
        }

        seekbarMiddleTune.setMax(MIDDLE_MAX_OFFSET);
        seekbarMiddleTune.setProgress(MIDDLE_CENTER);

        seekbarFineTune.setMax(FINE_MAX_OFFSET);
        seekbarFineTune.setProgress(FINE_CENTER);

    }

Arduino Sketch

// Define pulse width modulation for fine, regular and large tune 
#define FINE_TUNE            5            // short pulse on servo
#define NORMAL_TUNE          15           // regular pulse on servo
#define LARGE_TUNE           50           // large pulse on servo

#define SERVO_PIN            9            // Pin where is connected the servo
#define CAP_LED_PIN         13            // Define the status LED pin of the capacitor

#define MIN_PULSE          800          // Min. pulse of the servo (you need to know abour you servo specification)
#define MAX_PULSE         2200          // Max. pulse of the servo (you need to know abour you servo specification)

Messages received by Arduino via Bluetooth

The Arduino receives a message sent by the Android Application or any terminal bluetooth application connect to the Arduino, and proceess this message by sending pulse to the servo attached to the capacitor.

See on the Arduino sketch (ArduinoOneCapacitor.ino and ArduinoTwoCapacitors.ino), the defined constants FINE_TUNE, NORMAL_TUNE, LARGE_TUNE, MIN_PULSE and MAX_PULSE. These constants define the pulse width modulation for the servo. You might need to change the values of these constants depending on the servo specification.

Commands received by Arduino via Bluetooth and actions

After the Bluetooth connection is established between Arduino and Android Application, the Arduino start waiting for a message from the remote control. The table below shows the messeges processed by Arduino.

Character Description
+ Fine tune clockwise (short pulse width modulation).
- Fine tune counter-clockwise (short pulse width modulation).
r Regular tune clockwise (midle pulse width modulation).
l Regular tune counter-clockwise (midle pulse width modulation).
R Large tune clockwise (large pulse width modulation).
L Large tune counter-clockwise (large pulse width modulation).
M The servo goes to the maximum position.
m The servo goes to the minimum position.
C or c The servo goes to central position.
F This means that the servo should go to a certain position. This message is followed by a numeric value (servo position) and the '#' character indicating the end of the message. Example: The mensagem F1000# makes the servo go to position 1000.
T Like 'F' this means that the servo should go to a certain position. Example: The mensagem T1500# makes the servo go to position 1500.
IMPORTANT

The files ArduinoOneCapacitor.ino, ArduinoTwoCapacitors.ino and BluetoothTuner.java will help you understand the Antenna Tuner comunication protocol.

Photos

Photo 1

Android Remote Control

Foto 2

Android Remote Control

Foto 3

Android Remote Control

References

Videos about this project

About

Bluetooth Remote Control for Magnetic Loop Antenna

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published