The U.RAT Kill Switch and LCD Display

Spinning a capacitor is no problem – you can spin it as much as you’d like in either direction. But the roller inductor would not last if a high torque stepper motor keeps banging on its stops. My first idea (following the KISS rule) would be to just add some leds – green for L – and turn it on when the rocker switch is to the left, yellow when its to the right, and turn a blue led on when a micro switch detects that you are near the end. The code to detect a micro switch is trivial and would fit snugly in the u.RAT C code:

if (digitalRead(buttonPin) == HIGH) {         
      digitalWrite(stepPin, LOW);
} else {
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(100);         
  digitalWrite(stepPin, LOW);
  delayMicroseconds(100);
} 

The problem is that you are now “tuning in the dark” and don’t have a repeatable process – like you would if you had dial markings. Instead, you could have a simple LCD display instead of the LEDS:

Adafruit Pi OLED. Notice how it uses I2C pins and no GPIO pins. This is very important!

In fact, since I am more inclined to dedicating my Raspberry Pi Zero W to this project, this small “Pi-O-LCD” display is perfect for the task. The WiringPi library that I am already using has an LCD Library, and it is as easy as setting up the device (mapping it) and then just writing to it. I would just have a counter that adds the number of ticks going up (CW) and subtracts them if going down (CCW). In fact, that library even has what looks like a normal printf function – but for the LCD!

 

VOACAP Online – Jari Has Added a Superb SP – LP Feature!

You now see SP and LP buttons on Jari’s new grey line mapping feature:

I’m actually analyzing something I need – CE on 160M, but this map would be even more fun for Heard Island, Amsterdam or South Africa:

I wanted to see when ZS and W6 would be right at the grey line for both of us – and it turns out in a month from now – the SP during the W6 sunset and ZS sunrise would be a good time to check. 

What this tells me is on 160M it just might be possible to work ZS when the time lines up just right. Before this tool, I sort of could figure this out, but it only just occurred to me that you need much finer “resolution” because you need to know when the right 10 minutes will be. VOACAP Online is the first tool to deliver such resolution. In fact, I believe this might even be better than a prediction. It helps you to develop DX-ing strategies.

I will do a more extensive analysis using 40M when I listen to a group who gets on every morning (year round) on the West Coast – and where they look for the ZS stations during our morning LP each day. My theory is that that LP path is the worst right around Summer Solstice, but is quite good for the rest of the year. I can now use this tool and see why my theory might turn out to be correct. I can’t blame it entirely on the day length – because we are in opposite hemispheres. My theory might turn out to show that both solstices are not as good – I will have to pay closer attention. But – this form of thinking and theorizing is now aided by VOACAP Online – its a great learning tool.

I used to use VOACAP Online, Sunrise-Sunset and then DX Atlas, but with these new features – those three steps in my analysis can be done all in VOACAP ONline – Bravo Jari – great work, tools for low banders are needed – and VOACAP Online is forging the way.

U.RAT – Next Steps

I’ve cleaned up the uRAT code and removed probably 2/3rds of what was in the Utility KUSB that Paul, N6HZ wrote, and so now its close to as lean and mean as possible. I am sure if I download a code editor that has C dependency checking I can get rid of more lines – but for now its clean enough – all unused routines are gone. Since the code is really only useful for people with a KPOD, it seems to make sense that Elecraft would distribute it – maybe just as bundled in with the KPOD as hackable C code – or perhaps in a Github Repo. We will know after Freidrichshafen – where the Elecraft Team are headed.

In the meantime, I have signed up to present the uRAT at Pacificon and will offer my good friends at EBARC – with several Diablo DX-ers who are members, the first presentation. I’m hoping to package it up as a demo unit.

          

I happen to have these two Palstar Components, so will mount them on an old Ameritron ATR-30 chassis that I have – where I can use my NEMA-23 stepper motor brackets and create a cool “show and tell” demonstration set up.

I also will try to make the uRAT work on a Raspberry Pi Zero W – since that will fit in my control box with room to spare. I will have fun with one unit for “show” and the other for “go” out at the antenna.

One thing I will order is a set of shaft couplers, but I will first have to measure the size of the Palstar component shafts, and to do that, I will be getting a digital caliper:

Hard to believe this is only $16.00 – they wanted $27 for a very cheap version at an Ace Hardware store. As much as I like shopping local when I can . . . Amazon is hard to beat any more.

Once I get my “show and tell” rig together, I can write up a nice article for QST and also put together my slide deck for my presentations. The part that is most fun for me is that I get to “play” product designer, something (as my wife Kat mentioned yesterday) that I wanted to do in electronics since I was a kid back in Newton, NJ.

And its true, in 4th Grade, Ms, Goodin taught us a series on “Inventors”, and I did a report on Guglielmo Marconi, and we took field trips to Edison’s Lab in Menlo Park, NJ:

I sure wish Tesla had gotten his fare share of fame – but in any case, it was just too cool as a kid to think that people had invented all the great things that they had. I wanted in on that – and here I am!

 

 

The uRAT Has Landed!

YEAH BABY, YEAH!

The uRAT now works very nicely – exactly as I had envisioned it working:

The “secret sauce” included:

  • Elecraft sharing a KPOD utility that is part of their development and QA suite (thanks Paul, N6HZ and Eric, WA6HHQ!)
  • WiringPi – Gordon Henderson of Devon, UK, who created a C library that makes it as easy to work with RaspberryPi GPIO as it is to wire up gadgets and code on Arduino. The GPIO utility was critical too – since Gordon uses Arduino pin mapping – which could confuse easily. His utility (which I wrote about a few blog posts ago) saves you from becoming really confused
  • Haydn Huntley – in Hawaii, who had the BEST TB6600 and Stepper wiring diagram and test code – so that I knew that I had the electrical wiring and dip switches correct
  • I know both C and Python, and at the right level for this project. Its 100% C – but I used Python to ensure my wiring was right and since I was learning WiringPi – it was most expedient to use Python to hack through part of the project. My C skills are a bit better than I thought – must have been those 6 months at Travana – where I did code a pretty intense C# program. But I have never gotten into the hardware stuff before, so this is just too cool

So, why is this a big deal?

  1. My Mod Bob antenna project will now be complete
  2. Its worthy of a QST Article
  3. I learned RaspberryPi and Arduino – and people at work are extremely interested – and even in ham radio now
  4. Elecraft can potentially market the KPOD to the “Maker” market. I have suggested that they maybe discuss with “Lady Ada” at Adafruit – AC2SN. This is just too perfect for the ham and maker markets and crowd
  5. Anyone can take “venerable” old analog antenna tuners and breathe new life into them. Or even build your own and get it right out at the antenna feed, and out of the shack (freeing up space and being more efficient in the process)
  6. I didn’t sit around bored whining about how conditions are crummy
  7. I put it on my LinkedIn and resume because it jives with my career, and “Internet of Things” and “Robotics” are becoming all the rage. Think about it – robots work because of Stepper motors – and this is about as simple a robot you can build
  8. I am having more fun than I think ever in ham radio and electronics. My wife said I look like I transported back to when I was 11 and build my first Heathkit – and yeah, even younger – when my parents had bought me this:

Of course, I have some code cleanup, and I am trying to decide how to share this with the world. I’d personally much rather have Elecraft distribute the code from their site since this is a KPOD-centric project, and maybe see if someone else would want to maintain a Git Repository and Open Source it. I am too busy to do that kind of administration stuff – plus I did that kind of work as an Oracle DBA for 22 years, so that was enough. At Credit Karma I created the companies first Data Dictionary in the first quarter I was there – and as a Staff Software Engineer, handed all my code over to younger people in our team and am teaching 8 people how to code in Python. This quarter I am teaching and also managing the “socialization” of the Data Dictionary and bringing in other departments as an internal sort of “Open Source” project. So – one of these kinds of projects is enough. At home – I just want to play! But the parallels behind designing and creating the uRAT and the CK Data Dictionary is a very cool and fun thing. Life is good!

Adafruit has this groovy little LCD Shield, and yes, I’m already thinking how cool would it be to enumerate the “ticks” from the KPOD and display on an LCD built into my control box. Maybe Version 1.1 – I think just getting the RaspberryPi wired up in my control box, getting the steppers out at the tuner, cleaning up the code, seeing where this project goes as far as getting it out in the world, writing a QST Article possibly, etc.

The potential for this project to become a spring board for so many fun things is what this is all about, and dreaming up product ideas is just way too much fun.

This is even more fun than last years Low Band Receiving Antenna work – and that was a blast!

 

 

u.RAT – A Very Exciting Journey!

uRat Logo Copyright (c) 2017 – Rich Holoch 

Killer logo designed by Jeff, K1NSS. The logo will be copy righted, the project will be Open Source.

A very big breakthrough today – I have the KPOD and the Stepper code working. The KPOD is the “Head” written in C:

. . . . and the Stepper code is written in Python (the Tail).

This site has really great interactive pinouts:

https://pinout.xyz/pinout/ground

And I owe the Python and TB6600 driver wiring bits to Haydn from Hawaii who has the only really useful posting on the web that clearly explains how to get the Raspberry Pi working with the TB6600:

http://www.nlogn.com/blog/

It turns out that this might be the most important part about Haydn’s Blog Post:

HY-DIV268N-5A Connects to:
DIR- RPi GPIO GND
DIR+ RPi GPIO #18
PUL- RPi GPIO GND
PUL+ RPi GPIO #23
EN- RPi GPIO GND
EN+ RPi GPIO #4 or GND
A+ stepper green wire
A- stepper gray wire
B+ stepper red wire
B- stepper yellow wire
DC- GND (black on PC power supply)
DC+ +12v (yellow on PC power supply)

 

As it turns out, his HY-DIV268N-5A driver uses the same chip as my driver, the Toshiba T6600. The other “biggie” in this puzzle was accidentally getting the dip switches right on the driver. What helped me is my new bench power supply – which lets you set and limit voltage and current. The dip switches also limit current – so its easy to have the motors just sit there – not moving, even though you are sure everything is wired up right and that your code looks right.

Quite a few “variables” even for what really is a very straight forward project. If I had to brag – it wouldn’t be the code or the electronics, but the simple idea to glue two awesome products together using a Raspberry Pi – for me, the “Conceptual Design” is the coolest because I do feel its quite “elegant”. In fact, if you want to just use a rotary encoder, a couple of switches and a home brewed antenna tuner – the whole shebang could be built using parts worth maybe $100 – $150 tops. If you have a junk box – its less. Using the KPOD and the BT1500A cost me $1000 instead of just buying a remote-able Palstar AT-AUTO, which is a darn nice rig, but I don’t think is the right circuit for the open wire / balanced fed Mod Bob. The BT1500A is still my favorite antenna tuner ever, and the KPOD – my favorite tuning knob ever.

Most of the parts that you can get in the Maker world are made in China, and they either come with zero documentation or if there are more than a simple diagram, “Chinglish” that you have to reverse engineer to (hopefully) understand. Some of the products have horrible QC – the two drivers I used when I had the stepper motors turning on the Arduino worked fine – but the way they soldered the screw clamp connectors – they wouldn’t open or close and I had to solder my wires right to the board.

Luckily, these SMAKN TB6600 driver boards are top quality and I don’t have to do anything special. They run nice and cool too – and have a massive heat sink:

I purposely over engineered the drivers and motors so they would last outdoors in the heat and cold, and also so I wouldn’t have reliability issues voltage or current wise.

The “official” Arduino and Raspberry Pi boards are very high quality. Two Chinese brands that seem good (so far) are SMAKN and Elegoo. This is where Adafruit rocks – they don’t sell junk, and their prices are fine. The Pi Hut looks good too. The driver boards with the crappy connectors were from SainSmart – and while I only purchase products with high marks (reviews), perhaps I got a couple lemons?

Wow – this couldn’t come at a better time in my “hobby life”. DXCC Chasing has been stale ever since VK0EK was on the air – except for Top Band – but the wait between entities on Top Band can be long once you get above about 50 entities. I surely am very pleased that I worked what I did when I did since July 2001 – 16 years ago, but with 2 left for Top of Honor Roll and 13 left for DXCC on Top Band, I was “pining for the fjords”. Or maybe “watching the grass grow”.

Enter in this new “Maker World” and I feel like my next chapter is very clear, very exciting and opens my mind in a way that sitting around hoping some DX will activate just can’t do.

My next trick will be to add in the C GPIO control code to Paul’s Elecraft code. It might be as easy as some setup of the three pins 4, 18 and 23, I guess set enable on and then in the loop that is printing the KPOD information add a single command that pulses the direction using the sign of the integer and the step with the integer value. Something like this, which is a very small subset of this example: http://raspberrypihobbyist.blogspot.com/2014/02/stepper-motors.html

#include <wiringPi.h>

const int NUM_STEPS = 6; // number of steps including half steps
int currentStep = 1; // just assume this starting point

 pinMode (4, OUTPUT) ;
 digitalWrite(4, 0);
 pinMode (18, OUTPUT) ;
 digitalWrite(18, 0);
 pinMode (23, OUTPUT) ;
 digitalWrite(23, 0);

// step the motor. 1 for clockwise, -1 for counter-clockwise
void step(int dir) 
{ 
    currentStep += dir; 
    if (currentStep>NUM_STEPS) 
        currentStep = 1; 
    else if (currentStep<=1) 
        currentStep = NUM_STEPS; 
    MoveStepper(currentStep);}

int main()
{ 
    int i, x, c; 
    // initialize WiringPi library 
    x = wiringPiSetup (); 
    if (x == -1) 
    { 
        printf("Error on wiringPiSetup.  Program quitting.\n"); 
        return 0; }
 

Introducing The u.Rat

u.RAT = Universal Remote Antenna Tuner

The devil is in the details – but if I had to have a very simple product brochure that explained what the u.RAT is, this would be it. I would say you can use any analog antenna tuner that you like – in the shack or remote out at the antenna. I’d say that the Palstar BT1500A is my tuner of choice for non coax (open wire fed) antennas. And while my tuner only has two knobs, three knob tuners and even tuners with switched inductors can be used. Its a perfect way to breath life into that old antenna tuner that’s just laying around – or, the antenna tuner you wanted to home brew yourself.

 

The Final Design of the “Universal Remote Antenna Tuner” (U.RAT)

I have the hacked N6HZ (Paul from Elecraft) C program ready to have the GPIO call added (as soon as I get that breakout board), and I also have to get the steppers working with the drivers, and will need a program that watches for an input pin to go high to trigger the steppers. I did find an Arduino sketch and complete wiring and dip switch settings:

There are code and wiring references for the Raspberry Pi, but looking at this Arduino sketch, all I have to do (to complete the prototype) is add a function that gets called with two parameters – which stepper to turn and which direction. Since the rotary encoder sends plus and minus numbers the direction is in the sign of the number – minus for CCW and plus for CW. I hope I don’t run into any rude surprises, and I don’t think I will – but I still have to get the KPOD to turn one and then the other stepper. The devil is always in the details, and I am very excited that I might have this working by tomorrow night (since the last parts that I need won’t be here until tomorrow). As I said before, the design and prototyping aspect of this project is one of the most fun learning “journeys” I have had – and my mind has been expanded so far beyond just chasing after DXCC entities (for 16 years) that it is the most welcome change in my hobby. To be fair – we are now at a place where the first “waves” of hackers have done so much work that I get to just jump in and skate. They did the hard work. Secondly – I didn’t just sit on my butt in the shack all those years – I had been a “Maker” – but an antenna maker, and now that I really have hit “Peak Antenna”, I very much needed this change. OK – back to the topic at hand . . .

I posted this before, but its so good, here is what I need to do once I get the breakout board and jumpers that have male to female connectors:

This fellow gives several very important tips that other tutorial videos don’t. Here is another one that has a really nice description of how Stepper Motors work:

The final “product” is a Universal Remote Antenna Tuner (U.RAT). It is meant to be used by anyone who wants to take a two knob antenna tuner and remote it at the antenna. Hackers can add a third control if they like – and the KPOD rocker switch easily supports three – but the BT1500A only has two, so that’s as far as I will take the project. Here are the benefits:

  • Take any old commodity analog tuner and remote it. Used antenna tuners can be had on the cheap
    • The tuner at the antenna might be more efficient than in the shack. I think for open wire balanced tuners this is a must
    • The KPOD used to tune the antenna tuner takes up far less space in the shack and is just too cool
  • The KPOD can be used to also control other things like a wireless remote antenna switch. Future versions might use the F buttons for memories. Some antenna tuners have switches, so the F buttons could be mapped to switch positions
  • The project will be Open Sourced
  • Elecraft gets to market the KPOD to the Maker Community as well as the Ham Community (if they wish). My all time favorite ham radio company is Elecraft – I’m a huge loyal fan for sure – and they have sponsored more DX-peditions than anyone. I hope I can help them sell KPOD’s!

The feature set of the first version will be very simple. The idea is that other contributors can extend and fork the code into other projects and ideas. I have no vision for fully automatic or WiFi – at least for now. This project firmly plants me as a Maker-Ham or a Ham-Maker?

I will add this finished project to my resume. My motivation was to learn and get a cool remoted antenna tuner and a great low band antenna out of this project, but the process I just went through aligns perfectly with my Data Architect role – and extends my capabilities into a Product Designer.