River City ARCS
General Membership Meeting

March 4, 2014

  • Introduction to Arduino – Part 2
    A Software Morse/RTTY Sender

Learning Computer of the 80’s

$99 Sinclair ZX81 Kit

Typical ZX81 Set Up

Today’s $29 Learning Computer

What is a Microcontroller?

http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC05TB.pdf

ANALOG
INPUTS

What is the difference between a ‘Digital Input’ and an ‘Analog Input’?

A microcontroller is a complete computer system, including a CPU,

memory, a clock oscillator, and I/O on a single integrated circuit chip.

http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC05TB.pdf

p. 25

NOTE: Inputs, Outputs (and more specifically, ANALOG and Digital inputs/outputs). What is the difference between Analog and digital? Also, the CRYSTAL and the CLOCK. The crystal creates the ‘beat’, and the clock is the internal signal at the crystal oscillation frequency that synchronizes all operations of the microcontroller.

Terminology

    • I/O Board - main microcontroller
    • Shield - add-on boards
    • Sketch - the program
    • Sensor - components (thermistors, etc.)
    • Modules - serial data (GPS module, etc.)

The primary terms you need to know are what the I/O Board is, what a shield is, and what a sketch is.

The I/O Board is the "brains" of the operation.  You program these from your computer.

A Shield is a device that plugs into an I/O Board.  These extend the capabilities of the I/O Board.

A Sketch is a program written for the board and shields.

Shields

APRS Shield

Ethernet Shield

Touchscreen Shield

Sensors

Photo/thermistor, infared, force sensitive resistor, Hall effect, Piezo, tilt sensor..

Sketches

Includes

Globals

void setup()

void loop()

Sketches are built in the Arduino Development Kit. The dev kit is free and open source. It is basically a simplified C++ processor.

The sketch is then uploaded to the Arduino I/O board and will run.  

Applications - APRS

Argent Data

Trackduino

Arduino Controlled Tuner

Morse Encoder

http://www.multiwingspan.co.uk/

Morse Encoder Flow Chart

Morse Encoder - Sketch

/* 
 Piezo Element Morse Code Sketch
 
 */

const int buzzerPin = 9;
const int ledPin = 7; CHANGE to pin 13 (on board LED)
// tone frequency C
const int tonefreq = 523; CHANGE to 2500 (louder piezo output)

// constants for tone and rest durations
const int dotlength = 100;
const int dashlength = dotlength * 3;
// inter-element gap - between each dot or dash of a letter
const int inter = dotlength; 
// letter gap is 3 dots - the inter gap is always added - so this is one fewer
const int lgap = dotlength * 2; // inter-letter gap
// word gap is 7 dots - with letter and inter gap already counted, this is -1
const int wgap = dotlength * 4; //inter-word gap

Sketch – Character Routines

void dot()
{
  // play a dot
  tone(buzzerPin, tonefreq);
  // LED
  digitalWrite(ledPin, HIGH);
  delay(dotlength);
  noTone(buzzerPin);
  // LED
  digitalWrite(ledPin, LOW);
  delay(inter);
}

void dash()
{
  // play a dash
  tone(buzzerPin, tonefreq);
  // LED
  digitalWrite(ledPin, HIGH);
  delay(dashlength);
  noTone(buzzerPin);
  // LED
  digitalWrite(ledPin, LOW);
  delay(inter);
}

Morse Character Table

void soundLetter(char letter)
{
  // letters are in order of frequency
  switch(letter)
  {
  case 'E':
    dot();
    return; 
  case 'T':
    dash();
    return; 
  case 'A':
    dot();
    dash();
    return;
  case 'O':
    dash();
    dash();
    dash();
    return; 
  case 'I':
    dot();
    dot();
    return;

RTTY Encoder

http://www.timzaman.com/?p=138

RTTY Encoder Flow Chart

RTTY Sketch - Changes

// Transmit a bit as a mark or space

void rtty_txbit (int bit) {

if (bit) {

// High - mark

digitalWrite(2, HIGH); CHANGE TO tone(buzzerPin, markfreq); (2295)

digitalWrite(3, LOW); CHANGE TO digitalWrite(ledPin, HIGH);

}

else {

// Low - space

digitalWrite(3, HIGH); CHANGE TO tone(buzzerPin, spacefreq); (2125)

digitalWrite(2, LOW); CHANGE TO digitalWrite(ledPin, LOW);

}

// Delay appropriately - tuned to 50 baud.

delay(20); CHANGE TO delay(22.222); (45 baud)

//delayMicroseconds(250);

}

Questions?

Arduino_CW_RTTY_Sender - Google Slides