Starting the VFO for the Pixie. LCD Screen and Rotary Encoder.

For the Pixie VFO we will be using an Arduino UNO. First we will connect the LCD Screen and Rotary Encoder. To cut down on connections an I2C LCD Screen will be used. The same library is used from past projects. The link to the website with the library and tutorial are https://www.ardumotive.com/i2clcden.html .

Advertisements
Rotary Encoder
16×2 LCD Screen

The Rotary Encoder used was purchased off of amazon. These were relatively cheap and came in a 10 pack. It came with a small knob that will work for testing. In the final VFO, a different knob will be used.

Advertisements

The test sketch displays a number on the screen. When the Rotary Encoder is Turned, the number will change. If you open a serial monitor window and turn the encoder, the direction will be indicated in the window. Depending on your rotary encoder, the direction may be backwards. An easy fix for this is to swap the DT and CLK line on the Arduino.

Advertisements

Rotary Encoder and LCD Screen Test Sketch

/*
Rotary Encoder and LCD Screen Test Sketch 8/20/19
Rotary Encoder - libraryhttps://github.com/mathertel/RotaryEncoder
I2C LCD - download library http://www.ardumotive.com/i2clcden.html
https://KM4NMP.com
*/
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Rotary.h>


const int W_CLK_PIN = 8;
const int FQ_UD_PIN = 9;
const int DATA_PIN = 10;
const int RESET_PIN = 11;

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
Rotary r = Rotary(2, 3);
int TurnNum = 100;
long Freq = 14000000;

void setup() {
  Serial.begin(9600);
  lcd.begin(16,2);
  r.begin();
Advertisements
  PCICR |= (1 << PCIE2);
  PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);
  sei();

  lcd.setCursor( 3, 0 );                   
  lcd.print("KM4NMP.com");  
  delay(2000);
   
}

void loop() {

  lcd.setCursor( 4, 1 );                   
  lcd.print( Freq ); 
  delay(200);
}

ISR(PCINT2_vect) {
  unsigned char result = r.process();
  if (result == DIR_NONE) {
    // do nothing
  }
  else if (result == DIR_CW) {
    Serial.println("ClockWise");
    Freq = Freq - TurnNum;
  }
  else if (result == DIR_CCW) {
    Serial.println("CounterClockWise");
    Freq = Freq + TurnNum;
  }
}

Links

http://www.mathertel.de/Arduino/RotaryEncoderLibrary.aspx

https://www.ardumotive.com/i2clcden.html

https://km4nmp.com/2019/08/11/preparing-to-modify-the-40m-pixie/

https://km4nmp.com/2019/08/03/assembling-the-40m-pixie/

Welcome to the Lab

Advertisements

Latest Posts

Advertisements

2 thoughts on “Starting the VFO for the Pixie. LCD Screen and Rotary Encoder.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close