`

~Arduino Construction Project~

Updated 2/11/2015

Let's Build Something Arduino/DDS Sketch

 

Hams, especially, have this insatiable urge to “plug her in and let her rip” which could result in many smoked parts. So with the Arduino CW Sender project resist that urge and take the time to install the Arduino on a working platform and to allow for the additional components such as switches and connectors so that the terrible flash of light and smell of burnt parts is avoided. We recommend the use of a 4” X 6” piece of single sided copper PC board as the working platform. With this size the final assembly will fit in a standard 7X5 metal chassis or enclosure.

The Uno R3 is a credit card sized PC board that conveniently has four mounting holes in the board as seen below. Even with these holes through which a 4-40 type screw will pass there is an interference with the hole nearest the ICSP (In Circuit Serial Programming) connector. A solution to this problem is to use a 2-56 screw at this location or to take the 4-40 screw head and to “file off” a portion of the head, thereby making it smaller. Spacers to lift the Uno off of the base platform can be either standard metal type spacers or even the nylon typethat can be found at your local hardware store. Jameco Eectronics as well as Radio Shack stock these spacers. In a pinch two stacked 6-32 nuts can be used as spacers. The Uno does not have to sit far above the chassis but just enough so there are no shorts from the PC board to ground. For the assembly below 2-56 screws and stand-offs were used on the Arduino and 4-40 screws and standoff for the perf board.

Arduino Uno R3 with the breakout board and small prototype board. Connections from the Arduino Uno R3 are made using Right Angle header pins that have wires soldered to them and then are subsequently soldered to the terminal blocks on the underside of the breakout board. The numbers on the breakout board correcpond to the Arduino Uno R3 pin numbers. The right angle headers are available from sources such as Jameco, Mouser, Digi-Key and All Electronics. The perforated board and prototype board are available from Radio Shack

This methodology saves wear and tear on the Arduino. The 5 VDC block in the upper right hand corner of thebreakout board is powered from the 5 VDC on board regulator on the Uno R3.

In the article which appeared in the Spring 2014 Issue of QRP Quarterly it was stated a parts list for the breakout board would be on this page. Here it is:

1

4" X 6" Single Sided Copper PC Board 0.059 thick.

eBay Vendor "abcfab"
2 Perfboard (317 holes) Radio Shack P/N 276-149
3 Metal Standoff Spacers 8 each (These are sold in pack of four so two packages are needed.) Jameco Electronics P/N 106551
4 Prototype Bread Board Radio Shack P/N 276-003
5 Right Angle Pin Headers Jameco Electronics P/N 1946041
6 Terminal Blocks 11 each two terminal Jameco Electronics P/N 189676

 

NEW Part III ----------What to Expect ? NEW

Part II specifically addresses the mode where CW is being generated by the operation of a Bug (mechanical keyer) and as OT's know it, a "Sideswiper". This mode includes a built in sidetone and realy keying of your favorite transmitter. The 2014 Summer issue of QRP Quarterly details Part II.

Part III is the generation of CW using the Computer Keyboard where the text is diaplayed on the Computer Screen and a relay output is available to key a transmitter. The text is also shown in scrolling format on a local LCD. Cool Right? One canned message, the CQ string, is sent simply by depressing the "=" on the keyboard.

A future mode is Arduino generated code practice where call signs and messages are randomly sent with the bonus that the sent text speed can be varied as well as displayed on the computer screen using the serial connection as a check of what was copied. Stay tuned - de KK6FUT & N6QW!

 

 

This is Part III Keyboard CW Sender in action. From KK6FUT & N6QW

 

Liquid Crystal Displays for the Arduino

 

Ben Kuo, KK6FUT

Pete Juliano, N6QW

 

We have been gently urged by the QQ Editors to include LCD displays in our Arduino projects , as there is a certain allure, charm and magic to a “visually changing scene”. Seemingly it is a It would seem like a reasonable request , and one would think which would be easy to implement which of course . However, in reality may be reasonable but , it is not easy to implement an LCD display, like the one included in CW Sender Part II. The CW Sender Part III has an LCD Display in addition to the Computer display.

We'll detail some of those issues here in this article.

 

N6QW owned a small computer manufacturing business and was amazed at how much behind the scenes coordination took place when building a computer from parts and pieces. Video cards , while differing in capabilities , all used a standard interface. The same applies to motherboards, hard disk drives and on and on. There were some exceptions but for most situations any board, any card , any power supply was the rule. Thus was the basis of the terms “plug and play”.

 

Unfortunately such universal plug and play does not exist with the Arduino and the various available LCD’s, LCD interfaces and LCD Libraries. Thus t This short piece is an attempt to clarify what may be involved in implementing an LCD into an Arduino project.

 

The basic element needed for LCD implementation is to understand the three legs of the stool: 1) the hardware, 2) the software environment and 3) programming the software

 

The Hardware:

 

  • There are many different kinds of LCDs, offering up different sizes and options. LCD selection offers many opportunities, to varying degrees, for displaying various data in small areas of the front panel. Common LCD types range from a 16 X 1 which means there are sixteen characters on a single line which of course i --which is somewhat s self- limiting . At the other end of the spectrum is the --to 20 X 4 , which means there are 20 characters per line with a total of four lines. In between are the 8X2 and the 12X2 displays. These are further subdivided into non-backlit and backlit devices. The non-backlit LCDs are marginal in that the screen can only be seen when the light hitting the front face is “just right” and certainly not good under low light conditions. With the backlit LCDs, there are optional background colors and as well as character colors. A blue background with white lettering , for example, sure looks cool. The green background with black lettering is a step up from a red background with black lettering , which can be fatiguing after long viewing periods! There of course is a price spread, with the 16X1 non-backlit (NBL) being less expensive as compared to than the 20X4 backlit (BL) units , which are the higher end devices. Typically the 16X1 NBL are less than $5 and the 20X4 BL ones are in the $15 range. Our personal bent is We prefer the 16X4 or 20X4 BL type, the reason being is that because it is better to have more than adequate display area versus having not enough. That said more lines you have, the more complex!

 

  • Check which o n board controller in used in the LCD . There is however a magic decoder ring when evaluating what type of LCD to purchase and that is , which is the type of on board controller that is built into the LCD electronics. The LCD’s with the HD44780 controller are the most common and any other type may not work with the libraries that are available. Thus l Look carefully at what is the display controller before flashing the plastic! I n summary we view t The best option is either the 16X4 or the 20X4 Back Lit with the HD44780 controller chip. [There is another reason we are suggesting this type of LCD is that in the future a joint KK6FUT/N6QW SSB transceiver project will have an Arduino driven DDS and the 4 line display is required for that radio.] Units manufactured by Seiko, Samsung, Hitachi, Hantronix have the HD44780 controller and will work with the libraries.
  • Parallel or Serial I2C connections? LCD interconnections to the Arduino are either of the Parallel type or the Serial I2C. Most of the inexpensive LCD’s, regardless if they are 16X1 or 20X4, out of the box, are the parallel interface type and that would which require s at least 6 of the Arduino digital pins to implement. This of course really gobbles up a substantial part of the digital I/O capability. Not to worry However, you don't have to worry, as many of the Arduinos, such as the UNO R3, have what is called an I2C Serial interface . that can be ported out The I2C interfaces uses of A analog p Pins A4 and A5 or as in the case of the (or, if you are using the Arduino Leonardo , are brought out as separate pins ). These two pins are Clock (SCL) and Data (SDA). A Using a separate small interface board generically called a “back pack” which is either is connected to the back of the LCD display or permanently soldered to the LCD , converts converting the two wire I2C Serial Data to the 6 pin Parallel Data needed to drive the display. Figure 1 shows one of the typical backpacks that enable the two wire interface (actually 4 wires if you also count the +5 VDC and GND.) Thus This preserves the precious digital pins on the Arduino are preserved for other uses. This seems like a no-brainer BUT for the fact that the backpacks are not all standard and require different I2C addresses and different libraries.
  • I2C Library and Hardware Complexity. This being the case it undoubtedly Due to the different I2C addresses and libraries, it will require some experimentation to get your LCD to play. Remember not easy? Later in this piece in the article, we've provided a matrix , Figure 2, is provided to to help decode some of the I2C addresses and libraries . which are two the biggest players. Virtually most any parallel LCD (with the HD 44780) can be plugged into the back pack and will function, once the library and I2C address are resolved. Backpacks sold by Jameco, ADA Fruit, Marlin P. Jones, Sparkfun as well as many listed on the major auction sites will work FB. Caveat Emptor: Make sure they are + 5 Volts DC, have 16 pins for the LCD and 4 pins that connect to the Arduino, and that the I2C address is documented. N6QW purchased a bargain backpack on an auction site and the documentation stated any of eight I2C addresses would work. He had to test all eight before he found that the last one actually worked. Remember the not easy comment at the beginning! It's not as easy as one might think! Note so Some backpacks have programming solder pads where whatever is specified as the I2C address such as A0, A1 or A2 must have th ose at same corresponding pads solder bridged to work in the circuit. Definitely not plug and play!

 

The Software Environment:

 

  • Libraries are not standard! Stating the exact library that will be used for the project is critical; but since there are many libraries, it will drive you nuts trying to figure which is which. In order for the display to work the hex include file in the library must be initially stated as: #include<LiquidCrystal.h> or #include<LiquidCrystal_I2C.h>. These are the two most common we have seen and used. Another statement needed for the Arduino to “wire in” the I2C and LCD is: In order to support the I2C interface, another library also needs to be included, using the #include <Wire.h> statement.
  • Important: the libraries are hardware specific , and will conflict . These libraries Just a note these three library items must be downloaded from various manufacturers and loaded into your Arduino library directory. websites with Arduino Site yielding the Wire and LiquidCrystal.h libraries and LiquidCrystal_I2C.h library can be found at the Ada Fruit site. All three must be present in the Arduino library on your computer. Simply inserting these statements in the sketch will cause the compiling to fail. The library must be present on your computer for everything to work! Even more important, the libraries in many cases conflict -- you can only include one library for one particular piece of hardware at any one time, and may have to move the proper set of files into the Arduino library directory when needed.
  • Check the I2C address. Designating the LCD I2C address in the setup and initiation is a critical step. Some backpacks only require that you provide the address which may range from 0x20 to 0x27 depending on who manufactured the backpack. Others may have an address such as A0, A1 or A2. You need to check which address your particular hardware is "hard coded" to accept. While other still at the same time you give When you set up the I2C address that , you must also specify the LCD type (character width and lines) where an entry might be (0x27, 16,4);. . For example, a A formal subsequent s Sketch statement to set up an LCD with an address of 0x27, with 16 characters wide display and four lines, might read like LiquidCrystal_I2C lcd(0x27,16,4);

 

 

Programming the Software

 

In order to display characters on the LCD, you need to write code to properly position the characters for display. To display "Hello World", we first need to write at position 0 on line 0. Some "tribal knowledge" from the software world: the first line or position is not 1, but is 0. So, for example, positioning at line 4 you would need to write to line 3, position 0. Understanding how data is actually displayed requires more than plug and play. It is not enough to simply connect an Arduino and hope that “Hello World” is displayed. Code has to be written that says start writing at position 0 on line 0. Yes the first line is line 0 and line four would be 3. The first character is printed at position 0 and the last at position 15.

 

To actually center the “Hello World” you must count the number of characters and spaces which would be 11 and then one has to add “filler” so that the wording is more or less centered. Translated that That means , in addition to the two words and a space , that leaves 5 spaces for filler which are blanks so we would be required to tell the computer to . This results in the command lcd.print(“ Hello World “); assuming the first position of the first line was designated as the starting point. Thus there are two blank spaces, the word Hello, a space, the word World and three blank spaces.

 

In the case where you might have a changing display with a fixed display like Code Speed = XX. The “Code Speed =” would be addressed in the set up and essentially always be done at power on and remain the same. By the way that would only leave four spaces to enter the actual code speed which means a blank, the XX and a blank. The XX part of the display would be constantly changing and thus the sketch must define what is fixed and where is that displayed as well as the location on the display of the variable that is changing.

  • To
  • Programming the Software
  •  
  • Note we will provide specific code example that can be put into the software but first want to cover some basics of things that must be in place for the LCD to have allure, charm and magic. get the LCD software to work, you must have the following:

 

  • At the initiation state the You must #include <LiquidCrystal_I2C.h> and the #include<Wire.h> at the beginning of the sketch.
  • You need to indicate the I2C address and LCD type with the following code: The appropriate I2C address [LiquidCrystal_I2C lcd(0x27,16,2); ]
  • In setup [lcd.init();] Start the lcd
  • In setup [lcd.backlight();] Turn on the backlight
  • In setup [lcd.setCursor(0,0);] Start at the 1 st Character 1 st Line
  • In setup [lcd.print(" KK6FUT & N6QW ");]
  • In setup [lcd.setCursor(1,0);] Start at the 1 st Character 2 nd Line
  • In setup [lcd.print(“CODE SPEED = “);] This leaves 4 spaces
  • In void [lcd.setCursor(1,12);] Places cursor for the value
  • In void [lcd.print(val);] Prints the code speed in wpm

 

The LCD will now display, more or less centered, on the first line reads KK6FUT & N6QW and the second line reads CODE SPEED and the Value. You will have to experiment with the LCD, the backpack and the code – our experience has definitely shown that when you pick and choose “bargain” displays, boards and other hardware it is not a simple plug in.

Figure 2 (above).

Model

 

Library

Entries

 

 

 

 

SainSmart 20X4 with integral backpack

 

<LiquidCrystal_I2C.h>

At instantiation: LiquidCrystal_I2C lcd(0x3F, 20, 4);

 

 

 

In void setup: lcd.init();

 

 

 

 

Ada Fruit Back Pack

 

<LiquidCrystal.h>

At instantiation: LiquidCrystal lcd(0);

 

 

 

In void setup; lcd.begin(16,4);

 

 

 

 

Generic Back Pack

 

<LiquidCrystal_I2C.h>

At instantiation: LiquidCrystal_I2C lcd(0x27,16,4); or

 

 

 

LiquidCrystal_I2C lcd(0x27,16,2); [two line versus 4 line]

 

 

 

In void setup: lcd.init();

 

 

 

 

 

Notes: Notice the difference in the Libraries for these three examples and the I2C Address. The Ada Fruit uses lcd.begin(16,4); to designate the

type of display and the others lcd.init(); as the type is designated elsewhere. So depending on the model and make different entries are required.

 

 

 

 

 

~The Sideswiper Keyer Construction ~

 

This is a homebrew "BUG" also known by the Old Timers as a "Sideswiper" that can be built with common parts avaialble from hardware stores and the junk box. The cost is low and is an alternative to spending lots of $$$ for a Vibroplex or Bencher. No it is not chrome plated nor fancy looking or "silky smooth" but it does work and is a great companion to the Arduino CW projects. Below is a photo of the parts that were used to build the BUG.

Construction of the Bug

 

The photo above shows the component parts which are transformed into what is shown in the earlier photo.

  • There is nothing magical about the parts that were selected as anything closely resembling those parts should work. The hacksaw blade however was selected because it comes with mounting holes already in the blade. Because the hacksaw blade is hardened steel drilling holes and cutting the blade to size is not like simply cutting butter. To cut the end tip off of the blade use a 32 tooth hacksaw blade that is compatible with the cutting of steel. The length of the blade after cutting off the tip end is approximately 5.75 inches. The base for the bug is nothing more than a scrap piece of 2 x 4 that is about 8 inches long. It was handy from another project and so it was used!
  • The cutting tooth side of the blade is mounted upwards and that was so the paddle end would be raised above the base. The blade is sharp so step one involves the filing of the cutting teeth so they are rendered dull. A flat files works well and use gloves and eye protection for this step. To drill the 1/8 inch hole which is approximately ¾ of an inch from the end of the blade (after cut off) use a high speed drill bit that is compatible with drilling in hardened steel.
  • The aluminum end brackets are made from 1.5 inch aluminum angle stock that is cut to a length of two inches. Taking one of the brackets trace the outline of the “fat end” of the hacksaw blade onto one of the faces of the bracket so that the dulled teeth are aligned with the top edge of the angle stock and that the end of the blade is flush with what will be the front edge of the key. Mark the mounting holes on the bracket and drill those holes with a 1/8 inch drill. Using the first bracket as a template mark the other bracket and drill those holes. Insure the holes are aligned with the two brackets back to back while sitting on a flat surface. Three eighth inch long 6-32 bolts with a lock washer are used to assemble the sandwich of the two brackets with the blade in the middle. Be certain to scrape away any coating on the saw blade around the mounting holes as this is needed to make a complete circuit and is essentially the ground connection. The base mounting holes for the brackets are ½ inch in from the sides, front edge/back edge of the bracket. No rigorous turning moment, nor stress calculations were involved –1/2 inch seemed like a good number.
  • Four ¾ inch round magnets are used on the bug. Two of the magnets are super glued to the ¾ inch right angle “steel” brackets which are a purchased item. Start by having the magnets attach themselves to steel and align them so that the magnets actually sit above the end of the bracket. Mark that with a pencil and then place a dab of super glue on the magnet and let it attach itself to the bracket. Do a final alignment of the magnet to the bracket using the pencil mark previously placed on the bracket and set those aside to cure. The two magnet assemblies will be located about 3 1/8 inches from the front end of the key and mounted away from the blade which also has two magnets that are in repulsion so that the gap is ¼ inch. The other two magnets are simply slid along the blade until they align with the two magnets, again assuring they are in the repulse mode. The purpose of the magnets is to always force the key back to the center neutral position.
  • For the mounting of the contacts take a 3 inch long by 1 inch wide piece of scrap PC board and cut a 1/16 inch wide gap (a hack saw cut is perfect for this) across the 1 inch dimension at the center of the 3 inch length. This is so you have two isolated contact plates.

The Photo above shows the dimensions for the final assembly and installation of the bug.

  • The contact point assembly is made from ¾ inch aluminum pillars that were tapped using a 4-40 tap. The holes for the tap are drilled approximately 1/16 inch from the top surface. The pillars themselves are tapped for 4-40 screws. Comparable pillars can be purchased at Radio Shack. The pillars are mounted approximately ¾ from the centerline and 1.5 inch long 4-40 screws with a nut are used to adjust the spacing for the dit and dah travel. To make the key work you need to scrape off the coating on the saw blade where the contact point will interface with the saw blade. This is the all important "make the connection to make the key work!"
  • Speaking of connections the wiring to the key is shown in the photo below.

The following short videos show the Key/Arduino at Work!

 

 

Parts list for Part II of the CW Sender Article

Item Part Nomenclature Source and/or Part Number
     
1 8 Ohm Speaker All Electronics CAT # SK-840
2 100 Ohm Resistor Radio Shack / Junk Box
3 5K OHM Linear Pots (2) Jameco Electronics P/N 255514
4 Reed Relay 5 VDC Coil Radio Shack P/N 275-232
5 Knobs ((2) Jameco Electronics P/N 264946
6 10 Ohm Resistor (1/4 W) Radio Shack / Junk Box
7 Silicon Diode (Snubber) 1N4148, 1N4007, 1N914 will work FB
8 Red LED Radio Shack /Junk Box
9 1/8" Stereo Phone Jack Radio Shack / Junk Box
     

The Schematic for the Part II CW Sender Article

Here is a way to tidy things up in a Console!

 

Use of the Serial Port with Part II

 

Part II discusses the use of the Serial Port to view Anaog Data that is being generated in the Arduino code. This data can be viewed on the computer screen but requires a few things to be in place for that to happen. These steps are outlined below.

1. Depending what opearting system is being used a hyperterminal program must be resident on your computer. For those using Windows XP the hyperterminal is built in. For Windows 7 and beyond then a program must be installed. One such prgram is puTTY available as a free dwonload from www.putty.com. After downloading the program insure an icon is installed on your desk top.

2. There is a set up required in the program and involves the following:

* Select Connection first and check Serial

* For Serial Line use the Arduino COM Port and Speed 19,200

* Save the Session as "BugI"

* Close the Window on Exit select "Always"

3. The next time the Serial connection is used simpl LOAD: CW Sender Part II and then select Open

 

 

 

 

 

 

A Short Study of Hardware vs Software!

A short study of Hardware versus Software approaches in using the Arduino. In Part II we discuss the use of the Analog Inputs to addjust Dot Length and Dot/Dash Delay. A specific point is made about using the software to scale the Analog Inputs. Old School N6QW always looks to a hardware solution and an exmaple is presented below. Now the problem with the hardware is that it involves rigorous three equations with three unknowns to solve for the hardware AND on the short side is only good for the range originally selected. A change in range would require another round of calculations and hardware changes. Using the software approach involves but a few lines of code changes. Easy answer --- software!

The example was originally developed to send the number 5.

 

 

 

 

 

 

Next here are the Arduino 'Sketches".

 

Item Project Sketch Description
  LED ON LED OFF In a 1980's movie "The Karate Kid", Mr. Myagi teaches his pupil, Daniel-san the ancient art of Karate using a series of simple practical exercises such as washing and waxing Myagi's car using two simple movements. These are accompanied by the Mantra "Wax On, Wax Off". For our project we are borrowing that same idea only we use "LED ON, LED OFF". Thank you Mr Myagi. Basic CW Sender simple code from Mr Myagi "LED ON LED OFF" Copy and paste this in the Arduino sketch page and save it as LOLO_CW.
     
  CW Sender Part II The Arduino Sketch for the Bug Keyer featured in Part II. Copy and paste this text in an Arduino sketch and save it as bugkeyer_final.
  CW Sender Part III The Arduino Sketch for the Part III Keyboard Keyer. Copy and Paste this text in an Arduino Sketch and save it as keyboard_keyer
  CW Ditter A practical tool for testing a CW transmitter utilizing the Ardduino Analog Input function CW Ditter . This program should be copied and pasted in an Arduino sketech entitled N6QW_Ditter
  Two Tone Tester Another practical tool which builds on the CW Ditter is a Two Tone Tester for testing SSB tansceivers. Copy this link and paste it an Arduino sketech and label it Two_Tone_Tester
     
  SWR Tester This code is for the SWR tester descroibed in QRP Quarterly Volume 55 No 4. SWR Tester. Copy this link and paste it into an Arduino sketch and save it as SWR_Tester
     
     
     
  Detector Here is another tool developed based on prior two sketches. It is called the "Detector". Have you ever wanted to have a flexible alarm system or to know what a specific voltage is prsent in a circuit. Wait no more.Copy the text and paste it in an Arduino sketch then save it as Detector.
     
 

Let's Build Something

Arduino DDS Sketch

This is the sketch fpr the Arduino/DDS used in the Let's Build Something Part I as the Local Oscillator. LBS_DDS