Arduino VFO

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

BASIC

Arduino
Part I
Objectives
• Introduction to Arduino

• Build a 1-60MHz DDS VFO prototype, breadboard and write


Sketches, with Buffer amps to be designed, and PCB Using
your own laptop

• Go on to build other useful stuff - RF Meter, Digital mode


transmitters, QRP Transceiver, SWR Meter….

• Revise your knowledge

• Or start at the beginning

• Hands-on Amateur Radio


Components
• Arduino UNO single
board micro-computer

• Breadboard, wires

• LED, 220R

• LCD, Rotary Encoder

• Si5351 module

• Connecting wires

(male to male)
Arduino UNO
Setup your PC
• Club Wifi: BARS_AP

• Password: 1234567890

• Download and install Arduino IDE from



arduino.cc > Downloads

• If you have already installed, update to 1.8.1


Copy the USB Stick
Pass it round
• Quit/Exit Arduino IDE

• Make a folder and


copy the contents of
the stick to


Documents/Arduino

• Contains libraries and


a various sketches
Set-up IDE
• Create a folder/
directory:
Documents/
Arduino

• Start Arduino IDE

• Go to
Preferences,
select Arduino
Sketchbook
location
Re-start
Arduino IDE
Plug in your UNO
• Connect your UNO to your
PC by the USB Cable



• Start Arduino IDE > Tools

• Chose Board, Port


(COMx)
Coding
C++
• A problem can always be divided into bits, called
functions. Some already exists in libraries

• C++ language is based on libraries and functions

• We have lots already written for us

• Arduino IDE has a set of functions in its own libraries

• User libraries of functions have examples of how to


use them
Library example
• Use library:


#include “LiquidCrystal_I2C.h”

• Create an LCD object for your display, which has an I2C address of 0x3F,
16 columns and 2 rows


LiquidCrystal_I2C lcd(0x3F, 16, 2);

• Use the object




lcd.init();

lcd.print(“Hello World”);
Look at some real code
// include libraries for LCD
#include "LiquidCrystal_I2C.h"
Use library
// LCD I2C address, cols, rows
#define LCDADDR 0x27
//#define LCDADDR 0x3F
#define LCDCOLS 16
#define LCDROWS 2

// create an LCD object "lcd" Create lcd object


LiquidCrystal_I2C lcd(LCDADDR, LCDCOLS, LCDROWS);

// setup runs once on upload


void setup() {
// initialise the LCD & switch the backlight on
lcd.begin();
Use lcd functions
// move the cursor to col, row and output text
lcd.setCursor(3, 0);
lcd.print(" BASIC “);

pinMode(10, OUTPUT);
digitalWrite(10, HIGH); Use Arduino functions
Take a look at the
Arduino Library
arduino.cc > Learning > Reference
Part II
Let’s continue our activities

LiquidCrystal_I2C corruption
problem has been solved
New USB Stick
1st: Delete all stuff in
Documents/Arduino/

2nd: Copy new USB stick to


Documents/Arduino/

Result?
Documents/Arduino/
Test sketch
• Plug in your Arduino UNO using the USB cable

• Open

File > Sketchbook > My_Blink
// My_Blink
// flashes a LED on pin 13

// pin number
#define LED 13

// the setup routine runs once


void setup() {
// initialise the digital pin 13 as an output
pinMode(LED, OUTPUT);
}

// the loop runs over and over again, forever


void loop() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH voltage level)
delay(1000); // wait for 1 second (1000ms)
digitalWrite(LED, LOW); // turn the LED off (LOW voltage level)
delay(1000); // wait for 1 second
}

Upload
Your hardware
and it’s interface
LCD, Rotary Encoder
Synthesiser
Two kinds of Synthesiser
We
• There are two kinds will start
with
this one
• Digital output, Si5351

Good for mixers, SDR

• Analog output, AD9850



Needed for pure output

• Analog output generates


a sine wave using 

a D/A convertor
Si5351 Synthesiser
• Si5351 has 3 outputs each
programmable

• The outputs are 3.3V, can


drive 8mA = 4dBm into 50R

• It has an I2C bus input SDA


& SCL (address 0x60)

• Frequency 10kHz to 

> 200MHz

• 0.01Hz min tuning steps

• Arduino library
AD9850 Synthesiser
• AD9850 has sine wave and
digital outputs

• 5V operation

• Dedicated serial bus (not


I2C)

• > 30MHz output, LPF

• 0.0291Hz min thing steps

• Arduino library
LCD
• The display is 16
characters by 2 lines

• It has an address on the I2C Bus


I2C bus (0x3F or
0x27)

• It has a data line (SDA)


and a clock line (SCL) GND - ground
VCC - +5V
• Data is sent serially SDA - Data
SCL - Clock
Rotary Encoder
• The Rotary Encoder has a
two outputs
A (CLK)
• From the phase of the B (DT)
outputs you know the SW
direction +5V
GND
• Outputs A & B go to
digital input pins 2 & 3

• The shaft is a push button


switch, connected to pin 4
Serial I2C bus
Arduino talks to some hardware on a serial bus

A4
A5

Arduino is a “Master”
Devices are “Slaves”
Every slave has an address (0x60, 0x3F…)
The I2C bus
Arduino Pinout
• A plan for pin usage
• Interfaces for
• SIG/FWD, REV
• RETURN LOSS
• RFMETER
• I2C
• RX/TX SEQ
• AD9850 BUS
• BAND SELN
• PTT
• ENCODER
Using your
LCD
Build a display
• Connect up

SCL = A5

SDA = A4

VCC = 5V

GND = GND

• Open

My_LCD_Test-Basic

Upload
Press Reset to run again
Using your
Si5351
Build a VFO
• Connect up

SCL = A5

SDA = A4

VCC = 5V

GND = GND

• Open

Use a four
My_VFO_KB-Basic wire cable

• We will set the VFO


frequency from your
PC keyboard
Upload
1 Open Monitor My_VFO_KB-Basic

3 Enter Frequency in Hz

2 Set Newline Set 9600


Check output on a Radio
Build a 1-60MHz
VFO
Can extend to 10kHz to 200MHz (maybe higher)
VFO 1-60MHz
Wire encoder: Wire LCD:
CLK = D3 GND - GND
DT = D2 VCC - +5V
SW = D4 SDA - A4
GND - GND Use a five SCL - A5
+ - 3.3V wire cable
(+ can go to 5V or 3.3V)

Open
Use a four
My_VFO_Basic wire cable

Upload I2C Bus


Have fun.
Try transmitting
My_HELL_S/MT_5x7
and
My_WSPR

Remember
Si5351 - Mixers, SDRs, digital apps
AD9850 - Antenna analysers, low harmonic apps

You might also like