Tuesday, July 22, 2014

Minima - Programming

UPDATED: Aug 14, 2014 15:58


Due to my Minima CPU Module damage (see: Link) I will have some time to consider some addition modifications to my Minima Program.

Please provide comments and feedback.

Current Status

As currently implemented the following functions exist and published on my GitHup Repository. This implementation is know as an "Minima Alternate Tuning Method". Note: these functions are not found in the Farhan's original sketch.
  • High resolution, plus/minus 1Hz Tuning (thanks to Jeff - KO7M).
  • Near Normal Dial Tuning Method as found on most Dial Radio system.
  • Tuning Cursor positioning via Left/Right push buttons.
  • Automatic (original) or Manual Selection of Sideband via push button.
  • Ham Band Switching via Up and Down push buttons
  • Nine Ham Band Memories, with Frequency and Sideband Saved
  • RF386 Power Amplifier Filter Selection via generated clock pulses (Note: Not a lot of testing has been done on this yet)

Recent Additions

These are some recently implemented, but NOT published, functions that are being tested. These will be made available soon.
  •  Re-centering the Tuning POT can be done while any button is pushed (held) without changing the current frequency - DONE
  • Tuning 2500 Hz Steps, similar to FT-817 left knob. Note: most SSB stations are spaced 2500 Hz apart as seen on most waterfalls. - DONE

Some Plans

Additional functions that are currently being planned, are:
  • Two Memories for each band, implemented and saved as "A" and "B" VFO - DONE
  • Plus or minus 990 Hz RIT with 10 Hz resolution - DONE
  • Cross-Band or In-Band operations; Transmit on "A" VFO and Receive on "B" VFO (Note: I need to check the Regulations to see if Cross-Band operations is legal?) - DONE
  • Transmit enabled only within the nine Ham Bands (Note: due to complexity, 60m band is not currently planned) - DONE

Long Term Plans

Some longer term implementation ideas include:
  • Frequency Dial Calibration - DONE
  • IF Configuration and Adjustments - DONE
  • On demand, save user specified Band Memories into non-volatile memory,  and retrieved on power up. - DONE
  • Implement a simple Menu System for user specified function and modes.
  • Implement simple automatic CW ID and CW CQ Calling Memories. - DONE
  • Implement QRSS, WSPR, and PropNET Transmit Beacon modes. QRSS - DONE
  • Limits imposed on modes, based on Band Plans, i.e., SSB Transmit only in phone section. A "digital" mode could allow computer controlled transmit via a sound card on Upper Sideband.
  • "Factory" Reset (memories and configuration) on demand. - DONE
  • etc, etc

The GitHUB

With the normal GitHUB functionality different "Named" levels of complexities can be made available for users;
  • Farhan's Original Sketch
  • My Alternate Tuning Method without buttons (this works with the original Minima Hardware as documented by Farhan)
  • My Alternate Tuning Method used with Six additional buttons (used by functions as proposed here)
  • Beta code with new untested functions

Hardware Requirements

All of the above proposed functionality requires only the addition of a few parts (see: Link);
  • One 47K Resistor between two pins on the microprocessor.
  • Six simple push button switches with six 4.7K Resistors, all installed on the front panel. 
  • For RF protection, a few bypass Caps are suggested (see: Link).

Implementation

To implement all of the above functionality in the programming space available, a Sketch rewrite for size optomization may be necessary. Therefore, the original Sketch and programming details may become less obvious to a novice programmer.


Your Help Needed

Other implementation ideas are Requested, Encouraged and Welcome.

OR, this could be a starting point for your own GitHUB Fork, a place to save your Sketch Modifications and share in the programming fun.

OR, someone that likes to write user documentations is always welcome to help. But note, all of this is in flux, and therefore flexibility is a necessity.

Please provide comments and feedback.

--

Sunday, July 20, 2014

Minima - Damage Report

After returning home from Salmoncon 2014, where I had my Minima Transceiver Modules on display and for demonstration, I decided to again add some more functionality to my Minima Alternate Tuning Method software.

My Minima Transceiver Modules
This photo was taken at Salmoncon 2014,
Thanks to Linda -
AB7YL
But at home, when I turned the Minima ON, it ran for a short time and then went blank. A second attempt at Turn ON, was equally as bad, the LCD presented large black-blocks for the top row of characters.

My Minima CPU Board has Died!

The Problem

The voltage on the 5.0V Rail was measured at 7.8 Volts. The regulator was fried, which I am sure that voltage cooked the ATMEGA328P-MU Microprocessor as well. I knew the regulator was under rated for the increased load that I had put on it, but it had worked so far, even though it would get very warm.

The Attempted Repair

For repairs, I first replaced the 5 Volt Regulator.

Now the 5 volts Rail is correct, but the microprocessor is still toast!

My attempt to replace the microprocessor was NOT so successful, some traces were damaged while removing the micro. The micro had been solder through the back side of the PCB as a heat sink. De-soldering the heat sink heated the board and small traces TOO much, damage was almost inevitable. In hindsight, it would have been better to Hot Air reflow the part off. But I do not have Hot Air tools.

Dead Microprocessor

This of course is one of the pitfalls of using very small quad-flat-pack version of the microprocessor, if it were the large DIP, replacement would be a quick chip replacement. But, I like to use the smallest chips that I can find.

My software modification testing will have to wait until I replace the board, but I am NOT looking forward to re-building this Homebrew board with its 85 via's.

The Solution

I decided to pay the bucks, and have OSHPark.com manufacture a set of boards for me. The boards will be in hand in about a week. I will continue working on the Minima Software additions, but software testing will have to wait.

Maybe, this may provide time for me to finish my Homebrew Audio boards for the Minima.

--

Wednesday, July 9, 2014

Minima - User Interface Module

Updated with 3D Model Link, see below.

Thus far, I have been working on the Minima Alternate Tuning Method with push button switches that were hay-wired on a Protoboard.  Reliability of the switches and connecting wires were always suspect.

To solve this problem I have created a Modular User Interface (UI) that will be used with the rest of my Minima Modules. The UI will plug directly onto the Processor Board.

Here it is as designed in DipTrace,  and presented in 3D:

The UI in DipTrace 3D
And, as plugged onto the Processor Board:

As Installed
 (sorry for the poor photo quality, it was taken late last night)

The UI board was produced via the Toner Transfer Method, it is double sided and contains 23 40mil via's.

Wardy at http://wardyprojects.blogspot.com/ has rekindled my interest in building 3D component models for DipTrace.

DipTrace provides over 3500 component in their 3D Library, but rarely are the components that I use found (like simple headers, POTS, and buttons).

DipTrace uses the newer VRML2 format (and a few others) for their 3D components.

In the past I have used AC3D from http://www.inivis.com/ for my 3D needs , but I had let my License laps on an old forgotten dead workstation.

Wardy inspired me to re-purchase the AC3D software and start playing in 3D again (I hope that was a good idea!). The POT and push button switches seen in the design image above were recently created. The following is the most recent 3D part that I have created, it is a SMA PCB Edge Connector. It will be seen on future projects.

A 3D SMA PCB Edge Connector
To use AC3D, I save the component in the native format (*.ac) and then export the same part in VRML2 format, and which is saved in the same directory. Because AC3D does not read (import) VRML2 format, I have to re-export the parts if changes are made to the original.

Although AC3D does read (import ) the older VRML1 format, it does NOT read the VRML2 format (only export), the 3500 3D parts supplied by DipTrace can not be used as a template or starting point for my parts (what a waste).

I need to find a VRML2 to VRML1 converter, so far, googling has not helped.

My 3D Model Library

To promote the use of 3D Models in Published Documents I will share all of my 3D Models, the following Dropbox link is my "working and storage" space for my Electronic Parts.


Feel free to use my 3D Models as you like, but if they are used in your Published Documentation, please give me credit.

--

Sunday, July 6, 2014

Minima - Alternate Tuning Method - Cont'd

I have been working on Software for the Minima Transceiver. As posted before, my plan was to provide an Alternate Tuning Method for the Minima.

 In the Beginning

The original tuning method was provided via a standard POT that had a center position that did not change the frequency of the radio. When turned off center to the left the frequency would go down in different steps depending on how far from center the POT was turned. Once near the desired frequency, turning the POT back toward the center would decrease the steps size so that tuning could be stopped on the desired frequency. The same is necessary to increase the frequency, but in the opposite direction. The original Driver for the Si570 did not have 1Hz resolution and therefore the preprogrammed tuning steps was a reasonable, or an acceptable solution.

New Direction

I desired higher resolution and a more natural way of tuning the Minima Transceiver, within the limits of using the existing Minima hardware as much as possible. And I wanted to add some additional features to the software, see below. A method of adding additional push buttons switches was found, thanks to Minima e-mail contributors.The button circuit can be found here. Note: most of the wiring can be done on the front panel, next to the switches.

With a lot of work Jeff - KO7M, rewrote the Si570 Driver to provide better than 1Hz resolution. He did so by, rewriting the original floating point algorithms using fast 64bit interger math. His Driver is a plug-and-play replacement for the original. Jeff's Si570 Driver can be found here.

Writing replacement software to implement my Alternate Tuning Method started as a simple modification and grew into a major rewrite of the Minima program sketch. Many people around the world provided inspiration, testing, and ideas that were eventually included in what it has become today.  

Jeff - KO7M, Wayne - NB6M, and John - MI0DFG are major contributors.

The functionality of this program will continue to grow; to include menus, beacon modes and several other interesting ideas. Programming space is limited, but some things can be carefully added.

But, Program Modifications and Additions have Costs

One major cost, hassle, or headache was how to minimize the use of Variable Space to stay within the 1K bytes (RAM) available on the ATMEGA328P microprocessor.

So far, the Program Space has not been an issue, currently the program uses only about 20K bytes of the available 32K bytes (FLASH).

Free Memory from the Variable Space (RAM) is necessary for proper program execuiton as the "stack" used by each programmed function consumes and releases it as they are called. There are NO reported run-time errors if ALL of the Free space is used, the program just become erratic or fails (crashes). Using ALL of Free Memory is NOT a good thing. At one point, there were only 322 bytes of available Free Space at program reboot (way too little), program crash was inevitable.

An analyses of Variable Space of the modified Sketch indicate that most of it was used by String Constants within the program. A method was needed to move the String Constants to FLASH Memory, and out of RAM. With lots of research and putting disconnected ideas together, a method was concocted that provided the solution. The problem is discussed, but no-where on the web could I find a suggested cut-n-paste integrated solution.

Arduino String Constant Moved to FLASH Memory

The solution that I came up with is implemented via a set of Macros. The macros uses the PSTR construct in conjunction with a "strcpy_P" function. My simple solution is implemented as a buffer and two simple macro. This solution is not as fast as it could be, because it copies the String Constants back to RAM before it's used. But in doing so, the String Constants can be used anywhere within the program as normal, by wrapping it in a simple "FLASH( ... )" programming construct.



char buf[60];
// ERB - Force format stings into FLASH Memory
#define FLASH(x) strcpy_P(buf, PSTR(x))
// FLASH2 can be used where Two small (1/2 size) Buffers are needed.
#define FLASH2(x) strcpy_P(buf + sizeof(buf)/2, PSTR(x))


A few examples from the Minima Sketch as used:



debug(FLASH("Register[%i] = %02x"), i, dco_reg[i]);

sprintf(c, FLASH("%-16.16s"), FLASH2("VFO swap!"));
printLine2(c);



These examples are saved here for my future reference, and hopefully saved where other programmers may find it, and find it as useful.

After moving the String Constants to FLASH Memory, it has grown from 20K to about 21.5K bytes, but still with lots of room for careful additions.

This solution has changed Free Memory from 322 bytes to 1070 bytes for this Minima Program Sketch. With 1070 bytes of Free Space the program will not (should not) fail for lack of stack resources.

The Alternate Tuning Method

The Alternate Tuning Method implements the following, which are not found in the original sketch.

  • High resolution, plus/minus 1Hz Tuning (thanks to Jeff).
  • Near Normal Dial Tuning as found on most Dial Radio system.
  • Tuning Cursor positioning via Left/Right push buttons
  • Automatic (original) or Manual Selection of Sideband via push button
  • Nine Ham Band Memories, with Frequency and Sideband Save via Up and Down push buttons
  • RF386 Power Amplifier Filter Selection via generated clock pulses (Note: Not a lot of testing has been done on this yet)

Thanks to the people on the web and Minima e-mail list, the current Alternate Minima Tuning software is working very smooth and provides some very desirable functions.

The GitHub Repository where this software is available, is:


As the software continues to be developed, the GitHub Repository will be updated, check back often.

A complete dynamic list of my Minima Project posts are available via this search link (which will include this post):




UPDATE: July 14, 2014 12:16
After much more research, I found the use of "PSTR" used in a similar context as I have suggested documented, at:

http://electronics4dogs.blogspot.com/2010/12/simple-way-how-to-use-progmem.html

I wished I have found this link long ago.


--