Wednesday, October 29, 2014

Minima - User Options


On Mon, Oct 27, 2014 at 11:36 AM, John <****@*******> wrote:
Hello Eldon
I know that you said that you want to stop coding and get on with construction,  I was just about to upload BS02 again but with various options turned off to suit my way of operating , which is a bind, as I have to make the changes, upload again every time I make a small change,     So I was wondering if it would be possible to have some of the more popular options available on the menu like you have the 60m (yes /No), possibly     Tune 2500 khz,    CW beacon,    Scanning, they could all be Yes/No options
Would save a lot of trouble,   Just a suggestion !!!! get the minims going first
73
John


John,

I decide to respond to your questions via a blog post, and CC to the Minima email reflector, so my answers can be leverage by others.

Yes, I need to finish my Minima build.

And YES, most options could (or should) be added to the menu option.

Although, I wrote the menus as it is, in hast, as a trial to see if it was valuable. In hast, means that the menu system is very inefficient and requires much code space than it should. It needs to be rewritten with space, performance, and optimisation in mind.

In previous revisions of the Arduino IDE, my Minima Alternate Tuning Method (MATM) Sketch was running out of space and therefore user compile-time USER_OPTIONS was the only method available for allowing users to pick and choose their desired functions. As you know, with the NEWER Arduino IDE 1.5.8, the MATM uses much less of the available space and therefore most (if not all) current USER_OPTIONS will fit, at the same time.

John, I think you have said that you take your ATMEGA328P processor out of the Minima circuit and place it in an Arduino UNO to reprogram it. If so, yes, I can see how compile and modifications would be a pain - and therefore menus would be much better. First, I suggest that you upgrade and use a USB to Serial Converter connected to a four pin header on the edge of your controller board. There are NO components necessary to use this header. Although personally, I always put a 1nF cap on all processor pins that leave the processor board, especially when used in an RF environment. Downloading a Sketch and Restating the processor with this set up is automatic.

PropPlug and Four Pin Header
There are several USB-to-Serial Converters available from different manufactures, most are created using the same FTDI FT232R chip.  I use the "PropPlug" from Parallax. The required four header pins from the processor are; GND, TX, RX, and Reset. The PropPlug works very nicely with the Arduino IDE.

As most readers of my blog know, I like to build electronic project with the smallest parts that I can find (small is my thing). For example, for the Minima I did not use the ATMEGA328P-PU, I used the ATMEGA328P-MU which is a small MLF-32 package. The downside is, it can not be taken out of the circuit to be programmed, nor can it be easily replaced.

Top: ATMEGA328P-PU
Bottom: ATMEGA328P-MU

For me, using the original suggested large DB9 Serial connector for programming on the back of my project was a non-starter, but a simple four pin header is acceptable. Also, the original suggested level translation parts are not necessary with a FTDI interface.


So Yes, new revisions of my MATM software will include more menu items to make option selection easier. Note: "menus" will always be a compile time USER Option.



-- Home Page: https://WA0UWH.blogspot.com

Sunday, October 26, 2014

Julian - G4ILO

This weekend I learned of the loss of my friend and fellow blogger, Julian Moss - G4ILO.
Julian Moss - G4ILO
Julian has succumb to an incurable brain tumour, which he gallantly fought, and has blogged about at: http://onefootingrave.blogspot.com/ . Like most, I will miss him and his Ham Radio Blog entries at: http://blog.g4ilo.com/

My blog is a direct result of Julian's encouragement, he convinced me to start my own blog. He encouraged and guided my initial efforts. Over the years, we exchanged posts, comments, email, programs, and even some small QRP hardware projects.
 
So, I think, A blog entry is the best possible tribute to my friend - Julian.

RIP - Julian - G4ILO, you will be missed.


-- Home Page: https://WA0UWH.blogspot.com

Monday, October 20, 2014

Minima - Jeff's ENCODER04

This is a proposed configuration to support Jeff's ENCODER04 routines within my Minima's Alternate Tuning Method. This is a fantastic addition for the Minima.



The following circuit should be added to the Minima to implement the ENCODER04 Rotary

Encoder and Multiple Push-Button Switches parallel to the original FN Switch. 

--------+
Arduino |
        |
   AVCC |
   pin20|--------+---1K---- +5V
        |        |
        |        = 100nF
        |        |
        |        G
        |
    PD5 |---------------- To Original Minima LowPass Filter
  pin11 |
        |
    PC0 |---------------- To Proposed Rf386 Power Amp Filter Selector
  pin23 |
        |
        |
    PD7 |                                    +--------+
  pin13 |------------------------+-----------|B      C|------------------------+
        |                        |     G-----|G  ENC  |                        |
    PD6 |--------------+---------)-----------|A      G|---+                    |
  pin12 |              |         |           +--------+   |                    |
        |              = 1nF*    = 1nF*                   G                    |
        |              |         |                                             |
        |              G         G                                             |
   AREF |                                                                      |
   pin21|----+-------+                       * = Optional but Suggested        |
        |    |       |                           for CPU's in RF Environments  |
        |    |       = 100nF                                                   |
        |    |       |                                                         |
        |    |       G                                                         |
        |   47K                                                                |
        |    |                                                                 |
        |    |                                                                 |
        |    |                                                                 |
    PC3 |    |                                                                 |
   pin26|----+-----+---4K7---+---4K7---+---4K7---+---4K7---+---4K7---+---4K7---+
        |    |     |         |         |         |         |         |         |
        |   FNS    = 1nF*    S         S         S         S         S         S
   AGND |    |     |         |         |         |         |         |         |
   pin22|----+-----+---------+---------+---------+---------+---------+---------+
        |    |
--------+    G

            "FN"           "Left"   "Right"   "SBand"     "Up"     "Down"     btn7
           (btn1)          (btn2)    (btn3)   (btn4)     (btn5)    (btn6)    (btn7)


Where:
  4K7 is a 4.7K ohm resistor
  47K is a 47K ohm resistor
  FNS is the original FN switch
    S is a new switch
    = is a capacitor
    G is a ground and AGND
  ENC is the Rotary Encoder (A/G/B) with Push Button (C/G).

NOte: The Encoder Push Button switch (pins C/G) is parallel with btn7, if desired,
      one or the other switches can be deleted of left in parallel.

Note: The Encoder pins A and B, can be exchanged to reverse the Encoders electrical rotation.


ENCODER04 is available as a User Option within the current Rev (ERB_IL) of Minima Alternate Tuning Method at:


--

Thursday, October 16, 2014

Minima - Encoder, Two Implementions

After several days of work, I think I now have a working set of Encoder Routines that are usable for the Minima. Testing has been done by several builders.

The first routine: Encoder01, uses a polling analog read (non interrupt) to detect the Encoder switch changes and is not listed below.

The second routine; Encoder02, is usable for the builders that have moved to an I2C LCD and therefore have two dedicated microprocessor pins to connect to the Encoder pins A and B.

The third routine; Encoder03, is usable for builders that continue to use the parallel LCD and therefore do NOT have dedicated pins to connect to the Encoder. The previous Analog Tuning Pin and the FN Pin are used as shown in the suggested multi-switch schematic.

Selecting which Encoder routines are used, is done via a Optional Configuration selection in the "A1Config.h" file, by un-commenting the selected Encoder.



//#define USE_POT_KNOB  1 // 2304b - Option to include POT support
//#define USE_ENCODER01 1 // 2220b - Option to include Simple Encoder01 support
//#define USE_ENCODER02 1 // 2610b - Option to include FULL Two Digital Pin ISR Encoder02 support
  #define USE_ENCODER03 1 // 2604b - Option to include ISR Encoder03 support On Tuning Pin


Now that the details are work out, the Encoder supporting routines are short and simple. Each containing the "tigger" debounce timers as suggested by the author of the PinChange Library. Yes, it is called "tigger", because everyone knows tiggers bounce, as in Winnie-the-Pooh.

Some unnecessary detail are left out of these listing, check the GitHub for the actual code.

For Encoder02, these routines are used:



#include "PinChangeInt.h"

volatile int knob;

// ###############################################################################
void encoderISR() {
    int pin = ENC_B_PIN;
    static unsigned long startTime = 0;
    unsigned long tigermillis;
    uint8_t oldSREG = SREG;

    cli();
    tigermillis = millis();
    SREG = oldSREG; 
    if (tigermillis-startTime <= ISR_DEBOUNCE_TIMEOUT) return;
    startTime=tigermillis;
    
    knob += digitalRead(ENC_B_PIN) ? -1 : +1;
}

// ###############################################################################
void initEncoder() {
    int pin = ENC_A_PIN;
     
    pinMode(ENC_A_PIN, INPUT_PULLUP);
    pinMode(ENC_B_PIN, INPUT_PULLUP);
    
    PCintPort::attachInterrupt(pin, &encoderISR, FALLING);
}

// ###############################################################################
int getEncoderDir() {
    char tmp = knob;
      
    if (tmp>0) {uint8_t oldSREG = SREG; cli(); knob--; SREG = oldSREG; return +1;}      
    if (tmp<0) {uint8_t oldSREG = SREG; cli(); knob++; SREG = oldSREG; return -1;}
    return 0;
}


For Encoder03, these routines are used:



#include "PinChangeInt.h"

volatile char knob;

// ###############################################################################
void encoderISR() {
    int pin = ENC_B_PIN;

    static unsigned long startTime = 0;
    unsigned long tigermillis;  
    uint8_t oldSREG = SREG;

    cli();
    tigermillis = millis();
    SREG = oldSREG;   
    if (tigermillis-startTime <= ISR_DEBOUNCE_TIMEOUT) return;
    startTime=tigermillis;
        
    knob += analogRead(pin) < 440 ? -1 : +1;
}

// ###############################################################################
void initEncoder() {
    int pin = ENC_A_PIN;
      
    pinMode(ENC_A_PIN, INPUT_PULLUP);

    PCintPort::attachInterrupt(pin, &encoderISR, FALLING);
}

// ###############################################################################
int getEncoderDir() {
    char tmp = knob;

    if (tmp>0) {uint8_t oldSREG = SREG; cli(); knob--; SREG = oldSREG; return +1;}
    if (tmp<0) {uint8_t oldSREG = SREG; cli(); knob++; SREG = oldSREG; return -1;}
    return 0;
}


Notice: Only a few lines are different between the two implementations.


-- Home Page: https://WA0UWH.blogspot.com