Friday, January 18, 2019

2019 ~ Piddling in the Shack

What to do when all is does is rain?

January 20th, 2019. How to sample the S Meter readings.

Below I discussed The use of the LCD display and how by sampling every time through the loop that the serial processing caused the tuning knob to be essentially put on hold. I then theorized that sampling the signal say every thirty cycles through the loop would let you have the S Meter reading while not hanging up the tuning.

Mind you I am not a programmer so my solutions often seem bizarre but they do work,

  • The first thing I did was to identify "p" as an integer in the forward of the sketch. I also identified oldp as a memory of the p count. like int p = 0; and int oldp = 0;
  • In the void loop I added two lines of code The first says p = p + 1; and the second is that oldp = p; The first line simply adds the numeric 1 to the old value of p every time through the loop.
  • Next I have a sub-routine called S Meter (CheckSM();) Thus not only is a 1 added each time but the loop checks the CheckSM(); 
  • In the void CheckSM() is a simple statement that says if p = 30 (or whatever you select) then analogRead(A0) and perform some math functions. But there is more as I added additional screening software to look at the values of the math function and to display info based on the ranges of values produced -- typically it can say S3, S5 or S9+.

Undoubtedly more elegant ways to do it --- but Clunky N6QW has found a way to do it.

Pete N6QW

So OK Enough is Enough .. but more rain is on the way.

I love the Motor Trend Velocity Channel as there is such an abundance of creativity and some super cool ideas by  very clever car builders in  America's heartland. 

With all of the rain I was faced with keeping my head warm but at the same time wearing my wool beret (chick magnet) would surely spell disaster to that really FB hat. Then I thought what would the car guys do … A quick trip to the pantry where I keep the various sizes of trash bags and the smallest one cut to size made a waterproof cover for my beloved beret.

One rather attractive older woman in the supermarket check out line, upon seeing my creation, said it all: I really like men who can think of great solutions. Chick magnet works all of the time!

Trash Bag Beret Cover

The rain also caused me to spend a bit more time noodling some solutions to common problems. One problem I had as a result of the 2018 SSB Transceiver building spree was that I depleted my stock of Color TFT displays. I have some coming on a slow boat from China but what do I do today for a display? 

In looking at my bins I soon discovered I have a batch of 16X2, 16X4 and even a whopping 20X4 LCD's. I sort of gave up hope of using these as I discovered that with IDE 1.8.5 many of my older sketches hiccupped and burped as the LCD Libraries I had didn't like the new IDE. In 2018 I tried looking for some new libraries but nothing seemed to work. The rain gave me some time to once again look for new IDE 1.8.5 compatible LCD_I2C libraries. I was successful.

The next problem was that the older sketches were "clunky" and did not lend themselves to adding new functionalities like two VFO's. My newer Color TFT display sketches on the other hand did provide that capability. So the task was to meld the LCD displays with the newer Color TFT sketches. Yes Virginia not only is there a Santa Claus but I now have this..

The first thing to catch is that it is in keeping with the Juliano Blue and sports a 20X4 face. So Nice and Big! 

  • The default start up is VFO A and that is on the very first line. At the end of the line you see the word "ON" as this lets you know it is the active VFO … it is ON.
  • The second line tells the Mode and in this case a panel switch has selected Upper Sideband. That is followed by my call sign. At my advanced age it is always nice to know what is your call sign. Following N6QW, is the step tuning rate and that is changed from the push in encoder button or another SPST momentary panel switch that is in parallel with the encoder switch. Step rates of 100 (default), 1KHz, 10Khz,  and 100K are the choices
  • The third line shows VFO B and in this case the default (with USB) is on the WSPR frequency. For you FT8 guys you can make that 7.074 Megahertz. The VFO A or VFO B select is a simple grounding of one of the Arduino Pins. Now when VFO B is selected the "ON" disappears from Line #1 and now "ON" appears at the end of Line #3.It is really nice to just flip a switch and you can do FT8 without cranking the VFO tuning knob.
  • The fourth line shows an S Meter -- and this is a placeholder and merely shown as a possibility. Here is an interesting coding problem --remember I am not a coder. I wrote some math functions that sample random noise on Pin A6 and that gets translated to a numeric value. I then set up  "screening" software code that had ranges. If the answer was between such and such value then two bars appeared and if it was in a higher range then four bars appeared, At some point the display simply reads "Over S9" without any bars. That worked pretty slick! BUT! BUT! I noticed that as I tuned quickly there was no change in the frequency reading and then all of a sudden the frequency would jump by several kHz. The light bulb went on .. the Arduino was so busy making bars that it impacted the tuning changes. I nulled out the S Meter math and tuning went as normal -- remove the nulls and you have the problem back. So that is a bit more noodling on how to have your cake and eat it too. Time to think about sampling and not constant updating.
  • One other function not covered but was a clue about the S Meter updating. I also included my TUNE Tone function. Firstly I am using a UNO R3 as a development board; but then loading the code onto a Pro-Mini. Interesting first problem the Tone Library I used works FB with the Uno and Nano but not the Pro-mini. I saw this same problem with a Leonardo Board I have. But how it works with the UNO and Nano is a simple push of a Momentary Push Button which the code recognizes and for about 10 seconds a 988 Hz tone is generated and after suitable filtering (RC Filter to round out the corners of the square wave output) it is fed to the Microphone amplifier. It is a pulsed tone and makes for less strain on the IRF510 like a "Key Down" situation. In one variant I even send in Morse code my call sign. Now the clue --while the Arduino is creating and transmitting a pulsed 988 Hz Tone -- if you turn the VFO dial nothing changes on the display. Thus the clue that the Arduino is a sequential processor, which it is. In the lower right hand corner when you invoke the TUNE button the word TUNE appears on the screen so you know you are in the TUNE mode.

I have a plan for collecting some more parts /assemblies lying around and following in the footsteps of the Velocity Channel guys "fabricate" yet another rig (the 2nd for 2019).

Keep on building.

Pete N6QW


  1. Juliano Blue is the New Black. Glad you have come back.

  2. Pete rain man but not like Cruise and Hoffman 😁😁☺☺☺👌

  3. Pete

    You can speed up the AD measurement process dramatically.The A-D has a mode where it will sample continuously in the background at a rate you specify (say, 5khz). Read up on "Arduino AD Continuous Sampling". This uses no processing throughput and the last sample is always available to read.

    If you want to get a little fancier, you can set up a timer interrupt to catch these samples at a predictable rate.

    It's really quite simple, even for an old RF dog like me.


    1. Hi Ralph,

      Thanks for your suggestion. As I said I was taken by the Velocity Channel and how the car guys come up with solutions that may initially not be evident. I guess I just a wanna be like the car guys … thus the trash bag solution.


    2. Hi Joe,

      Thanks for the tip -- I will chase that down.


  4. I ran into a Similar problem with the encoder being sluggish while the mpu was busy doing other things, so I stole Tom Hall's idea for using interrupts to service it. Works like a charm as long as you keep the interrupt service routine short. In my current project, I'm using interrupts to handle the encoder and read the input from CW paddles for an integral keyer. It almost works as intended, hi.

  5. This comment has been removed by the author.

  6. Pete trash bags are good in an emergency. I remember several Boy Scout hikes where at least one boy came home with a trash bag poncho. Amazon sells a unisex rain bonnet if you want something more permanent.


SDR ~ The Wave of the Future

Where can I get a Cheap SDR RADIG? 5/26/2019 ~ Memorial Day Weekend I observed Memorial Day weekend in 1965, at our base at Chu Lai...