uta Control
Uccle test antenna is an antenna used by the radio department in order to carry out tests as part of various projects involving antennas. Uta control enable the test antenna to be moved sideways.
Material needed
- Raspberry Pi3 or 4
- Raspberry Pi Sense HAT
Yoctopuce VirtualHub
In order to connect and use the yocotpuce devices, the yoctopuce VirtualHub needs to be installed on the Raspberry. Run the following command to install it :
wget -q -O - https://www.yoctopuce.com/apt/KEY.gpg | gpg --dearmor | sudo tee -a /usr/share/keyrings/yoctopuce.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/yoctopuce.gpg] https://www.yoctopuce.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/yoctopuce.list
sudo apt update
sudo apt install virtualhub
sudo VirtualHub --install_udev_rule
To install the hub as a service, run this last command :
sudo VirtualHub -i
utaCtl.py
Python module for controlling the lateral motorization of the antenna (using a Yocotpuce device) with a joystick or keyboard arrows.
About the Yoctopuce and Keyboard libraries
The script uses Yoctopuce and Keyboard Python libraries. In order to run the script appropriately, a copy of the Sources developing directory included on the libraries has been added to this repository (under the name yocto-lib and key-lib). A statement on the script (before importing the modules) sets up the PYTHONPATH to allow running the script appropriately. Note that in Linux you can use the command pip install yoctopuce
and pip install keyboard
to install them, but it has an impact on the operation or the script, specifically the syntax of the "import" statements.
A configuration file (utaCtlConf.ini) must be present in the same directory of the main python script (utaCtl.py). It contains the parameters (logical names, voltage delivered, direction, selected control, etc.) of the electronic devices for the system. Please, see the example file below.
About the sense HAT library
The sense-hat library needs to be used in order to use the Pi sense HAT. This library is already installed on the raspberry Pi3 and 4 devices. If the library is not found, update the Raspberry Pi or install the sense HAT software by running the following commands :
sudo apt-get update
sudo apt-get install sense-hat
sudo reboot
Usage
Being a python script, the program needs to be invoked from terminal using the following syntax :
$ python utaCtl.py
Then a small text will appear indicating the state of the antenna :
Error state (if any)
- "Device not connected to the virtual hub" : device not connected to the computer
- "Motor not found" : motor not powered up
- "Motor is offline" : motor not detected
Functional state
- "Direction : [direct/reverse]"
- "Selected control : [joystick/keyboard]"
- "The antenna is connected and ready to be used"
Control and Sense HAT usage
Don't forget to specify which motor control will be used (joystick or keyboard) in the configuration file (utaCtlConf.ini) before running the main script.
Joystick and Keyboard arrows
- left or right x1 : move forward or backward at slow speed
- left or right x2 : move forward or backward at fast speed
- right then left (resp. left then right) : slow down or stop the movement
- up or down (or middle for the joystick) : brake and stop the motor
LED screen
- direction arrows : green arrow in forward direction ; blue arrow in backward direction
- speed indicator : single arrow - slow speed ; double arrow - fast speed
- red square : stop indicator
- red cross : over current indicator (motor will stop automatically)
- red "V" letter : under voltage indicator (motor will stop automatically)
Config File (utaCtlConf.ini)
The utaCtlConf.ini file must present in the same directory as the main script (utaCtl. py). The information required is :
- logical_name : logical name of the yoctopuce device used
- direction : selected direction -if 'direct' the antenna move forward when the joystick is pressed in the right direction -if 'reverse' the antenna move backward when the joystick is pressed in the right direction (note that a colour arrow indicate the direction of movement of the antenna).
- slow_driving_force : voltage percentage delivered to the motor for the slow speed (from 0% to 100% - 100% corresponding to fast speed)
- braking_force : braking force of the motor from 0% to 100%
- over_current_limit : current limit (in mA) beyond which the motor will stop. If 0mA is chosen, the motor will use its default value (32A).
- under_voltage : voltage limit (in V) under which the motor will stop. If 0V is chosen, the motor will use its default value (3V).
- control : selected control beteween 'joystick' and 'keyboard' control
Please note that many set of parameters ([OPTION_NAME]
) can be present on this file, but only the [DEFAULT]
will be selected by the script as valid/current configuration parameters set. Any other set can be present as a reminder/backup.
[DEFAULT]
logical_name = utaMotor
IPaddress = 127.0.0.1
direction = direct
slow_driving_force = +85
braking_force = +50
over_current_limit = +500
under_voltage = +10
control = keyboard