dh1tw / remoteRotator

remoteRotator lets you expose a local antenna rotator (azimuth / elevation) to the network
MIT License
44 stars 5 forks source link

Hamlib support #20

Open Void-Seeker opened 2 years ago

Void-Seeker commented 2 years ago

Hamlib is an Open Source project that implements common API for controlling different HAM radio setups that, well, can be controlled by software. Including rotators. It would be quite simple to add hamlib support to remoteRotator. If only I had some skills in Go, I would've implemented it myself. Unfortunately, I know nothing about it.

dh1tw commented 2 years ago

Hi, yes - you are right. It shouldn't be too complicated to include Hamlib support in remoteRotator. In principle, a new Rotator has to implement the rotator.Rotator interface. Check out the Dummy rotator and Yaesu rotator for real-world implementations.

I see basically two possibilities to add Hamlib support - either by supporting the native C library or by connecting via TCP to the hamlib rotctld daemon. Both have advantages and disadvantages. I already started some time ago on a goHamlib - a go wrapper for Hamlib. It covers most of the radio (rig) interface, but not the rotators (yet). Another downside is that has to use cgo to interface with the hamlib C library. This makes cross-compiling for multiple OS and platforms a bit more complicated. On the other hand, connecting to rotctld via TCP is easy. The only disadvantage I see is that it requires a running instance of rigctld which then wouldn't be under the direct control of remoteRotator.

Go has a very shallow learning curve! If you are comfortable in any kind of C flavor, you can learn it in a breeze! :-)

KevinOleniczak commented 1 year ago

I used the yaesu stuff as a sample and added supported for the Idiom Press Rotor-EZ (yaesu DXA models in my case, but I believe their protocol works for many others). It only took a few hours and its working well so far. I'll do a PR soon to share. https://www.hamsupply.com/rotorcard-yaesu-dxa-rotors/

dh1tw commented 1 year ago

I would expect that the Rotator-AZ also speaks the Yaesu Gs232 protocol. In that case, remoteRotaor should actually work out of the box.

KevinOleniczak commented 1 year ago

I have the Yaesu G800DXA and it does not come with a serial interface. Yaesu suggests the GS-232B interface ($650) unit to provide serial control that would talk GS232 protocol. I opted for the Idiom Press interface noted above ($160), but it uses a different serial protocol. FWIW I went down this path because it didn't work using the "yeasu" option and after looking into the docs I see why. https://www.hamsupply.com/wp-content/uploads/2015/11/Rotor-EZ-Protocol.pdf

dh1tw commented 1 year ago

I see. Indeed the serial protocol is entirely different, but it looks pretty straightforward. AP1 and AI1 are the only commands you really need. I would recommend creating a copy of the yaesu implementation and adjusting It to the Idiom Press Interface protocol.