It’s been a busy few days, but I did manage to get the serial loop control running.
As shown in the photo above right, my magnetic loop motor drive and gears are hooked up to the computer though a serial communications line. Most recent computers do not have an RS-232 (COM Port) connector. So, you use a USB-to-Serial adapter, like the CP2102 breakout board. This creates an emulated serial port, in my case COM7, which can be used to remote control a stepper motor.
The tiny chip at the left of the breadboard is the Arduino Pro Mini, a tiny version of the Arduino. It connects to the motor controller (top) and an end-stop switch on the controller. I 3D printed the orange lever to press against the end stop switch at the minimum counter-clockwise direction. One side of the switch is connected to an “interrupt pin” on the Arduino. When the switch changes (opens or closes) it automatically signals the Arduino.
Based on the gear ratios in the stepper motor and on the plastic (yellow) worm gear, it takes 50,900 motor steps to turn the capacitor through its full range. So, this provides very fine tuning.
Serial Loop Control Basic Commands
My first version of the control software has some basic commands. A “+” turns the loop control on. A “-” turns loop control off. The letter “G” commands the motor to move to an absolute position. In the example above left, I sent “G=5000” which tells the Arduino to move the motor to position 5000, about 10% of its travel distance.
Sending the letters “U” or “D” tells the motor to move a relative number of steps. In the example above, the “D=300” command told the system to move down 300 steps from 5000 to 4700.
While the motor is moving, the system sends back position information once per second until its target is reached, then says “Ready” for the next command.
At first connect, the serial loop control automatically homes itself, i.e. finds position “0”. This is done by turning the motor counter-clockwise until the end stop switch closes, and then moving clockwise a short distance until the switch opens again. This happens very quickly and assures that the system always starts in the same position.
The next step is to replace the wired serial connection with a wireless connection to provide real remote control of the magnetic loop. I have written the control software so that it does not care if it is being controlled through the serial port or over WIFI – it’s all serial data however it moves around.