Preface of this series
In this three post series I'll go over how I made my Stockcorner JC3-s tuner remotely tunable and turned the Yaesu FT-991a into a remote rig, which hasn't been achieved by many solutions on the market. The big plus point of my tinker solution: It's completely open source, until the very last bit when transmitting voice on macOS.
Chapters of this series can apply to other radios, other tuners.
I tried to design and combine elements with universal potential. If you don't own a JC-3s or an FT-991a, chances are that procedures presented here might still be of value to your shack - and home.
The Yaesu FT-991a is a great shack-in-a-box at a good price. It beats the ICOM offerings in value by combining all modes and all bands with up to 100W RF power.
But it has downsides: Yaesu's UI and UX is lacking compared to ICOM's offerings. While the integrated USB ports delivers both CAT control and sound card access in one cable, the menu structure of the FT-991a is clunky. Adjusting certain settings require deep dives into the menu. Remote controlling an FT-991a is way more involving than what ICOM offers at a comparable price point, with few out-of-the box options and none directly from the manufacturer. This is one motivation to control the FT-991a via USB.
Unless you buy a specifically designed Autotuner for this Yaesu radio, or some pricey bespoke cable for certain auto tuners, you cannot control a tuner. Even among Yaesu radios, the pinouts in the back differ - so owning different Yaesu radios can mean that you need to buy different cables or tuners. This creates another motivation for this series: Control a tuner, ideally any tuner, remotely and independently of the radio attached to it.
In this series of posts, I tackle the following challenges:
- Control the great Stockcorner JC3-s tuner without its control box
- Automate the tuning process: Mode switching, RF power adjustment, SWR control
- Fully and headlessly remote operate the FT-991a and JC-3s, including Digi modes and voice
A github repository containing all material discussed will be created in the near future. A tl;dr might come if enough people cry for it.
Chapter 1 - Remote operate the JC-3s
The Stockcorner JC-3s is a tuner rated for up to 200W SSB. It's sturdy, pricey and doesn't take a lot of space.
It was recommended to me in German HAM forum in a private message, after I was publicly berated for my plan to go for 80m from an inner city flat. This recommendation turned out to be a great one, because that little tuner really can tune a 11m wire on 80m (I am aware of how lossy my signal is).
To replicate elements presented in this post you need:
- A soldering iron (but since you are reading such a nerdy post, you will ask yourself: which tip?)
- At least one ESP* development board (ESP32 or ESP8266 of your choice) and a method to safely power it
- A transistor - see below which one
- A JC-3s tuner - or any other tuner with a KEY and START logic accessible to your soldering iron tip
- Wire, solder, patience and fresh air
- A chisel tip
The out-of-the-box experience
JC3-s and the FT-991a do work together, but don't talk to each other. Instead, I need to tell the FT-991a to never use it's internal tuner and the tuner when it has to do its job.
While the tuner can be connected to Kenwood and ICOM transceivers directly, Yaesu transceivers require a small control box delivered in the package.
The push button (START) triggers the tune mode, the LED signals whether the tuner is in tune mode or not (KEY).
Pressing the push button closes a circuit for as long as it is pressed. I'm not sure about what happens inside the JC-3s, but I do know it doesn't matter how long I depress the pushbutton, even a very short press is enough to put the tuner into tune mode.
The switch toggles the integrated EEPROM frequency memory for quicker tuning of known frequencies.
The control box delivers power to the tuner, which in my case comes from the same 13.8V source I use for the FT-991a. In addition, four wires carry KEY and START signals.
In order to tune the JC-3s with the FT-991a, one has to adjust the RF power to be in the range of 10-20W and either send out an AM carrier or constant CW tone. I tend to use the latter.
The process the following:
- FT-991a: Change operational mode
- FT-991a: Adjust RF power
- JC3-s: Press the START push button
- JC3-s: See the KEY LED light up
- FT-991a: Press PTT
- FT-991a: Watch the S-Meter coming down to hopefully something below 2
- FT-991a & JC3-s: Release the PTT when KEY LED goes off OR no sufficiently low S-value has been reached
- FT-991a: Re-set RF power and mode to the desired setting for operation
The Tuner has an internal timer. After its time limit, it leaves the tune mode no matter if tuning was successful or not.
My intention is to keep this manual process untouched and seamlessly add a secondary, remote tuning process.
Making it smaaaat
We can never have the FT-991a and JC3-s talk with each other, but we can add an intermediary.
Since the process of tuning is the same on any band and follows a linear process, it begs to be automated.
The challenge: Tune and become QRV without touching any device.
ESP to the rescue
A little background: My home is becoming increasingly "smart" thanks to the great community around home assistant and forbiddingly cheap chinese systems-on-a-chip (SoC), namely the ESP32 and ESP8266 platforms by espressif.
These ESPs come with programmable memory, a processor and WiFI/Bluetooth on a chip. For
a few Euros less than two Euro one can buy an ESP8266 development board, which fully exposes the multiple GPIOs of the ESP. Being Arduino compatible and with an immense support by the tinkerer community, these little things are great for almost all home automation projects. You could use an ESP8266 with a cheap sensor to measure the power consumption of your washing machine and get a push notification when the washer is done. This way you can retrofit your washer for less than 10 EUR to become an IoT device without giving away your data or buying into a closed source ecosystem. There are countless other applications. It's a deep rabbit hole.
Chances are that you already have ESP based devices in your house.
If you bought cheap smart plugs, smart light bulbs, smart fans etc. and had to download an app for control, then most likely you have bought a white labelled system powered by tuya. In this case, you may want to think about moving away from tuya without throwing away your devices. There are very serious security concerns for doing so.
If you are no coder, you can still join the fun thanks to the power of esphome. It offers the ability to create a custom firmware for your ESPs and integrates very tightly into the home assistant ecosystem. Many code snippets are available in the community and can be copypasta. A different alternative firmware called tasmota doesn't need you to code at all, since there are ready to use templates for many popular devices.
For example: It's a very good idea and entry into the world of home automation to get some cheap gosund SP111 smart plugs, flash an esphome firwmare with tuya convert and enjoy a locally controlled smart plug and energy meter - which is integrated into home assistant, siri, google assistant etc. Alternatively, you could try tasmota, as mentioned above.
Breaking on of these little things is very hard and over-the-air (OTA) updates almost always work. They are really just great to experiment with.
Prepare an ESP8266 for the control box
The dirt cheap ESP8266 development board I chose for this project can be powered by either USB or a LiPo battery - thus it'll be happy with anything between 3-6V DC.
Since my original plan was to place the ESP in the control box, I wanted to power it with the same 13.8V power source. To convert 13.8V to a usable voltage range, I need a step-down / buck converter.
These can be had for cheap. I bought six pack of LM2596 based buck converters for 9 EUR. They should not be used for devices with a narrow window of acceptable voltage nor should they endure more than 400mAh for a longer period. They are fine for powering an ESP8266.
After a soldering a pair of leads to the entry point of the 13.8V power source in the control box, I attached the buck converter via a pair of AWG18 wires, measured and adjusted the current on the OUT ports of the converter until I reached 4V.
To my understanding ESPs are like insects: Without a central nervous system. Like pulling the leg off an ant doesn't cause it pain, pulling power from an ESP won't make it require a re-install. Thus, my ESP powers up when the control box receives juice and the other way around. There's no control startup or shutdown. Just light and dark. 6 legs or no legs. (I hope the story about the ants is correct, otherwise child me was a monster)
esphome code for the ESP8266
This is my completed esphome code used to create the firmware for my ESP8266, dubbed "jc3s_remote". Note that it includes a web server of its own. We need this as a fallback and to control it without home assistant.
web_server enables communicating directly with the ESP via methods I'll discuss and make us of in the the next post.
esphome makes it very easy to create lean firmwares and does a lof of its magic in the background. All one has to focus on is the question: Which features do I want - esphome does the boring backend end part.
esphome: name: jc3s_remote platform: ESP32 board: esp-wrover-kit web_server: port: 80 id: jc_3s_remote wifi: ssid: "<YOURSSID>" password: "<YOURSSIDPASSWORD>" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Jc-3S Remote Fallback Hotspot" password: "<YOURFALLBACKPASSWORD>" captive_portal: # Enable logging logger: # Enable Home Assistant API api: ota: binary_sensor: - platform: gpio pin: number: 33 mode: INPUT_PULLDOWN inverted: true name: "KEY LED" device_class: light id: key_led switch: - platform: gpio pin: number: 25 inverted: false id: start_switch - platform: template name: "START Switch" icon: "mdi:radio-tower" turn_on_action: - switch.turn_on: start_switch - delay: 800ms - switch.turn_off: start_switch
Connecting the KEY LED
binary_sensor: - platform: gpio pin: number: 33 mode: INPUT_PULLDOWN inverted: true name: "KEY LED" device_class: light id: key_led
You can see from this part of the code that we attach the LED lead to GPIO 33 on the development board. When the tuner is powered on, the circuit of the LED has roughly 1.1V open circuit. The GPIO is indirectly pulled to the same ground as the LED via the buck converter - so when KEY is triggered and the LED turns on, the ESP can measure that drop in voltage.
GPIO 33 is attached to the positive lead going of the START LED, just after the capacitor and before the LED. The negative lead is unused. On this picture you also see that I gave up on putting the ESP in the control box and opted for running wires to a separate little control box for the ESP. A control box for the control box. It's an ugly box.
I am aware that this is not a clean way to do this and I should add a resistor and diode in between the + lead and the GPIO - but for now it works.
Since we know that the START pushbutton closes a circuit momentarily, we should be able to close this circuit remotely.
Challenge: The open circuit of the pushbutton has around 5V. Too much to feed into the ESP directly via a GPIO.
Instead, we can use the power of transistors. I opted for a NPN BP139, since it can "trigger" the gate on very low voltage, ideal for usage with an ESP. Initially, I tried an often recommended MOSFET, the IRLB8721PBF, but I couldn't get it to work. I admit, I am very new to transistors and understand very little about them, I am just happy that the BP139 works.
With very low power and current delivered via a "triggered" GPIO 25, the gate closes the circuit between source and drain. Since we do not want to amplify at all, just abuse the transistor as a sort of relay, I placed a 200ohm resistor between GPIO and gate. Again, I'm not quite sure what I'm doing here, but it works. I hope whatever amplification still happens, it won't have a negative effect on the tuner.
For safety, I also added a diode which is open in the direction of GPIO -> Transistor. Just in case something breaks and 5V want to come over to the ESP. Of the three leads you see in the picture one connects gate and GPIO 25, the others are soldered in parallel to the START circuit inside the JC-3s control box.
I am aware that using a relay could be considered a cleaner method. Attaching the positive and negative lead to the NO ports of a relay shield connected to an ESP8266 would be an alternative method, requiring just a bit more space and costing just a bit more - but it would cleanly separate the circuits of the ESP and tuner.
switch: - platform: gpio pin: number: 25 inverted: false id: start_switch - platform: template name: "START Switch" icon: "mdi:radio-tower" turn_on_action: - switch.turn_on: start_switch - delay: 800ms - switch.turn_off: start_switch
You can see from the code for the GPIO controlling the transistor what we "close" the circuit for 800ms. In tests this was plenty time to trigger the tune mode.
This concludes the hardware side. Ideally you place the ESP and the buck converter into a nice plastic box (avoid metal).
Trigger the tuner in the browser
The aforementioned home assistant is where we create pleasing interfaces to interact with out smart home elements. It allows the creation of powerful automations, communication with closed-source tools like Apple Siri, integrates an ever growing list of platforms and pushes for WYSIWYG editing of components and automations, to open up the world of "Hey Siri, start kodi" to non-techies. In short, it is truly awesome. I think that was enough unpaid advertisement for home assistant.
With the new jc3s_remote ESP8266 online, esphome takes care to offer its services in home assistant. Home assistant actually asks to add the newly found switches and sensors to its web interface. The esphome code defines icons and nature of the elements esphome will offer to home assistant, so there's very little left to configure. The result can look look this:
On this screenshot you see two additional tiles: 'Shack power consumption' and 'Power shack' - These two tiles are powered by an gosund sp11 smart plug running esphome. With this, I can trigger the relay inside the sp11 to control mains connection of the power supply of the transceiver, tuner and ESP8266. Like mentioned earlier, it's a good idea to get some of those tuya based smart plugs and re-flash them for local control and benefit. In fact, for a fully remote station, it's a necessity to be able to power cycle remotely.
You noticed how I haven't touched the FT-991a yet. This has a reason: The FT-991a needs more elaborate and software based intermediaries to join the IoT crowd. More on that in the next post.
This is only the first step: Since we can trigger START via a web command, we can use it as a building block to automate the entire tuning process. More on that in the next post.