Clique aqui para Documentação em Português
- Folders structure
- Source Code
- Schematic
- The Bluetooth shield used with Arduino
- Arduino prototype
- Android Remote Controll Application
- More about the Android Application and Arduino source code
- Messages received by Arduino via Bluetooth
- Videos
- 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..
- Box_3D_Printer folder is about a box project to use with this project of antenna tuner on Alexloop Magnetic loop antenna or similar. It can be used to build a tuner box by using a 3D printer. Click here to see a video that shows the box example project with the Android and Arduino Antenna Tuner.;
- images folder has some pictures about this project
- schematic folder has the schematic document build by fritzing software, an open-source hardware initiative that allows us to design electronics circuits;
- sources folder has the Android Magnetic Antenna Tunner Application to control the servo attached to a capacitor via bluetooth connection, and the Arduino sketch that implements the contrrol the capacitor (Servo).
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.
This setup can be used with Alexloop antenna tuner or similar. The tune and fine tune commands are applied to only one capacitor.
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.
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.
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.
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.
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.
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).
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.
Selecting the paired bluetotth.
Bluetooth paired and ready to send commands to Arduino circuit.
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.
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.
// 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);
}
// 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)
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.
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. |
The files ArduinoOneCapacitor.ino, ArduinoTwoCapacitors.ino and BluetoothTuner.java will help you understand the Antenna Tuner comunication protocol.