Thursday, August 27, 2015

Arduino Controlled Spectrum Analyzer for Ham Radio

As a Ham, of course I want to be able to examine frequencies, and the strength of the signal on that frequency. So imagine my excitement when I found the following Arduino solution!

The Specan is actually a very simple but robustly built receiver. it is, in essence, a double conversion superhet receiver with 112 Mhz and 12 Mhz Intermediate frequencies. The first mixer uses an Si570 as the local oscillator. The second oscillator is a crystal controlled at 100 MHz; built with a common microprocessor crystal of 20 MHz. Unlike most radio receivers, the second IF has two filters : a narrow band crystal filter with 1 Khz bandwidth and a wide band LC filter with 300 Khz bandwidth. The detector converts the tuned signals into a log scale. The detector output is a decibel measure of the incoming signal.
The Specan is controlled with an Arduino board. The Arduino controls the Si570, handles the front panel, talks to the computer over the USB port, reads the detector and switches the filters. In a very simple usage, the Specan can be tuned around like a regular radio. Instead of listening to the signals, you read their strength on the LCD display.
You can switch between wide and narrow filters : using the wide filters to hunt for signals and then use the narrow filter to locate and measure them with greater precision. This in itself is quite a useful function. It is possible to measure intercepts, gains and harmonics without using a computer.
Under a PC's control, the Specan can be made to step through any sequence of frequencies and plot them on the computer screen. The Specan understands a handful of text commands sent over the USB port of the Arduino.
The Specan also accomplishes a long standing personal goal - to make the homelab at VU2ESE entirely homebrew. The Specan can easily replace our aging TEK 465 scope and do even more.
This Specan can be built for far less than hundred dollars. Though it needs quite a few evenings of work. Construction is straightforward.You won't need any special tools. Modules of the Specan are used to align the rest of it! The Specan serves as its own set of test and alignment gear!

Monday, August 24, 2015

What good are Shift Registers?

Everyone eventually runs into the problem of running out of I/O pins on the Arduino, and the Raspberry Pi. A shift register is a chip that can give you 8 or more additional I/O ports, while only using 3 ports on the microcontroller. There are input and output shift registers, and today I'm showing an example of an output shift register,the 74HC595.

I've taken an Adafruit protoboard, and soldered in a 74HC595, 8 LED's, and 8 220 ohm resistors.

The tutorial I followed is found at https://www.arduino.cc/en/Tutorial/ShiftOut and documents the construction,and gives three example sketches.

Have fun!

Sunday, August 23, 2015

Using a 3x4 Keypad

Ever want to use a 3x4 Keypad? These keypads from Adafruit can be used for numeric data entry or for access control for a security system. Our example allows you to input a multiple digit entry with a "enter key" (#) and a "cancel key" (*). In our example, we will assemble a file name for submission to a sd card, but you can drop that off if you don't need that.

I plugged the keypad cable into a male extended length header, and plugged in directly into pins 2-8 on the arduino.



Download the library file at http://playground.arduino.cc/Code/Keypad and install into your library folder.

The following sketch will allow a key sequence of  at least 6 digits. You can enlarge the string if you need more digits. It displays each digit as entered in the serial monitor,and allows you to press * to cancel and start over if you make a mistake.

Thanks to Mike McRoberts and Mark Stanley for their help!

Also see our RFId and Fingerprint scanner tutorials!

#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {4, 3, 2}; //connect to the column pinouts of the kpd

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

char entryStr[8]; 
int i=0;

void setup(){
  Serial.begin(9600);
}
  
void loop(){
  char key = keypad.getKey();
 
 if (key){ 
   if (key == '*'){
   memset(entryStr, 0, sizeof(entryStr));  
   i=0;
   key=0;
   Serial.println(""); 
   Serial.println("Canceled"); 
   
   } else if (key != '#'){
     entryStr[i]= key;
     i++;
     Serial.print(key);
     }
   else {
   Serial.println(""); 
   i=0;
   key=0;
   
   String fileName = entryStr;
   memset(entryStr, 0, sizeof(entryStr));
   fileName = fileName + ".mp3";
   Serial.println(fileName);
   }  


 }
}