HackerBox 0132: Samuel

by HackerBoxes in Circuits > Electronics

958 Views, 1 Favorites, 0 Comments

HackerBox 0132: Samuel

Welcome to HackerBox 0132. Explore Samuel Morse's development of the single-wire telegraph system and the Morse Code signaling used in both wired telegraph and wireless communications. Practice Morse Code using an electronic, handheld trainer game. Configure the Arduino IDE to target the Arduino Nano with builtin OLED display as well as the Arduino Pro Mini development board. Leverage the Arduino Nano to program the Arduino Pro Mini over its UART interface. Program the Pro Mini to convert English text to electrical and audible Morse Code signals. Configure the Arduino Nano as a three-way Morse decoder capable of decoding an MCU-generated Morse signal, a hand-keyed Morse signal, or an audio Morse signal coupled through an analog biasing circuit. Practice coding and decoding Morse Code by hand using flip sides of a Morse Code Challenge Coin. Experiment with receiving and decoding the WWVB radio clock broadcast transmitted from Fort Collins, Colorado. Assemble a custom breadboard power supply. Practice 678 SMT solder joints on a 256 LED matrix kit. Explore controlling the 16x16 LED matrix using four shift register chips driven by either a preprogrammed microcontroller or a programmable Arduino development board. Take a glimpse into how a Morse Code kit launched the DigiKey Empire and how we are increasingly able to reverse engineer anything.

There is a wealth of information for current and prospective members in the HackerBoxes FAQ. Almost all of the non-technical support emails that we receive are already answered there, so we'd really appreciate it if you can take a few minutes to read the FAQ.

Supplies

This Instructable contains information for getting started with HackerBox 0132. The full box contents are listed on the product page for HackerBox 0132 where the box is also available for purchase while supplies last. If you would like to automatically receive a HackerBox like this right in your mailbox each month, you can subscribe at HackerBoxes.com and join the party. Subscription members save at least $15 every month and automatically receive each new HackerBox shipped immediately off the production line.

A soldering iron, solder, and basic assembly tools are generally needed to work on the monthly HackerBox. A computer for running software tools is also required. Have a look at the HackerBox Workshops for tools and supplies along with a wide array of introductory activities and experiments.

The most import thing you will need is a sense of adventure, hacker spirit, patience, and curiosity. Building and experimenting with electronics, while very rewarding, can be tricky, challenging, and even frustrating at times. The goal is progress, not perfection. When you persist and enjoy the adventure, a great deal of satisfaction can be derived from this hobby. Take each step slowly, mind the details, and don't be afraid to ask for help.

WEAR SAFETY GLASSES WHEN SOLDERING, WHEN TRIMMING WIRE LEADS, OR WHEN CUTTING, DRILLING, ETC.

Samuel F. B. Morse

Morse (1791 – 1872) was an American inventor and painter. After establishing his reputation as a portrait painter, Morse, in his middle age, contributed to the invention of a single-wire telegraph system based on European telegraphs. He was a co-developer and the namesake of Morse code in 1837 and helped to develop the commercial use of telegraphy. (Wikipedia)

The ITU International Morse code encodes the 26 basic Latin letters A to Z, one accented Latin letter É, the Indo-Arabic numerals 0 to 9, and some punctuation and messaging procedural signals (prosigns). There is no distinction between upper and lower case letters. Each code symbol is formed by a sequence of dits and dahs. The dit duration can vary for signal clarity and operator skill, but for any one message, once the rhythm is established, a half-beat is the basic unit of time measurement. The duration of a dah is three times the duration of a dit. Each dit or dah within an encoded character is followed by a period of signal absence, called a space, equal to the dit duration. The letters of a word are separated by a space of duration equal to three dits, and words are separated by a space equal to seven dits.

Morse code is usually transmitted by on-off keying of an information-carrying medium such as electric current, radio waves, visible light, or sound waves. The current or wave is present during the time period of the dit or dah and absent during the time between dits and dahs. Since many natural languages use more than the 26 letters of the Latin alphabet, Morse alphabets have been developed for those, largely by transliteration of existing codes.

To increase transmission efficiency, the original alphabetic code was designed so the duration of each symbol was approximately inverse to the frequency that the character it represents occurs in English text. For instance, the most common letter in English, E, has the shortest code – a single dit.

A-to-Z video demonstration.

Morse Code Trainer Game

The Morse Code Trainer Game supports both LED light indicators on a tree display and audio code prompts. It can be used to train Morse Code keying rhythm. The sounds and lights can be independently disabled, allowing one to practice anytime without disturbing others. A builtin recording and playback feature can be used to save and replay practice sequences. The slim pocket-sized design with sturdy construction easily fits into pockets, bags, and tool kits. The games is suitable for portable operation at home, in the classroom, or outdoors

CR2032 Battery

The Morse Code Trainer Game requires a CR2032 coin cell battery.

Game Operation

K1 is the main on/off switch.

K2 is the silent switch. It turns the audio output on and off.

K4 is the illumination switch. It turns the LED output on and off.

K5 is the record mode switch. When K5 is on, press the record button to record a sequence. When K5 is off, the record function is inactive.

K3 is the playback switch. Flip K3 to playback the recorded sequence.

Further Morse Code Practice

After playing the trainer game, search the web to find various sites for practicing Morse Code decoding skills with various challenges.

Arduino Nano With OLED Display

This Arduino Nano V3 includes and OLED display. Specifically the display is a 0.91 inch 128X32 pixel OLED with an SSD1306 driver chip. The chip has an I2C interface wired to the default A4/A5 I2C port.

Before soldering anything, plug the USB-C port into a computer to apply power. With power applied, the OLED display may display "BOOT Time" and "UART-Baud". Also, the red power LED and one of the green LED may both illuminate without blinking.

SERIAL UART ON THE NANO

If you don't have it, install the Arduino IDE. Run the Arduino IDE.

In the IDE, select Tools > Board > Arduino AVR Boards > Arduino Nano

Also select Tools > Port > (the USB port connected to the Nano)

Select Tools > Serial Monitor, set the baud rate to 9600, and send "AT". The Nano should respond with "AT-OK".

PROGRAM THE NANO

Open the example sketch: File > Examples > Basics > Blink

Compile and upload the modified sketch.

When the upload completes successfully, the green LED should turn off and the red D13 LED should blink.

TEST THE OLED DISPLAY

Use the IDE's Library Manager to search for and install the u8g2 library.

Grab the attached Nano_OLED_Hello.ino sketch file and compile it onto the Nano.

Text should be display onto the Nano's builtin display.

As you can see from the sketch code, the same text is echoed to the serial monitor. The OLED display that is glued onto the Arduino Nano can be flakey, so it helps to also send output to the serial monitor. Similarly, we're using the bare bones u8g2 OLED library which seems to tax little OLED driver chip a bit less than the generally more robust Adafruit_SSD1306 Library. You can certainly give the Adafruit library (along with its example sketch ssd1306_128x32_i2c.ino) a shot if you are willing to experiment a bit. The default settings should work.

SOLDER THE PINS

Once the MCU can be programmed and at least blink D13 and output to the serial monitor, it is time to solder the pins. The two long rows of pins should extend from the underside of the Nano (away from the display). We will not be using the 2x3 pin header, but if you really want to attach it, it needs to extend from the top (OLED side) of the Nano as to not interfere with plugging the Nano onto a breadboard.

Arduino Pro Mini

The Arduino Pro Mini is a small, low-cost microcontroller board based on the ATmega328P microcontroller. We're using the 5V version, which runs runs at 16 MHz. (The Pro Mini is also available in a 3.3V variant.)

The ATmega328P microcontroller features 32 KB Flash, 2 KB SRAM, and 1 KB EEPROM.

The Pro Mini does not have a USB port or USB-to-serial chip, so it has to be programmed over the UART lines using an outside USB-to-serial chip.

SOLDER THE PINS

Similar to the Nano, the two long rows of pins should extend from the underside of the Pro Mini (away from the chip and red reset button). The right angle six pin header must extend from the top (chip side) of the Pro Mini as to not interfere with plugging the module onto a breadboard.

The photo above shows the Nano and the Pro Mini together on a solderless breadboard with seven jumper wires a buzzer. These connections will be made in a stepwise fashion instead of wiring them up all at once.

POWER: THE FIRST TWO JUMPERS

Insert the Nano and the Pro Mini onto the breadboard in exactly the orientation shown in photo above - with the Nano's USB port facing outward and the Pro Mini's right angle six pin header facing outward in the opposite direction.

5V: Nano.VIN to ProMini.VCC (red wire in the photo)

GND: Nano.GND to ProMini.GND (brown wire in the photo)

When USB power is applied to the Nano, it will go back to doing whatever you last programmed it to do, and it will also power up the ProMini.

On the ProMinim the PWR LED (next to the 5 pin regulator) will glow solid red and the "L" LED (next to reset button) will blink slowly.

PROGRAMING THE ProMini: THREE MORE JUMPERS

Unplug the USB power.

Wire Nano.TX0 to ProMini.TXO (blue wire in the photo)

Wire Nano.RX0 to ProMini.RXI (purple wire in the photo)

Short Nano.RST directly to Nano.GND (black wire in the photo)

That RST short will hold the Nano in reset while we borrow its USB-to-serial chip to program the other module (the Pro Mini). The RST short can be a jumper like shown in the photo, or it can be a piece of wire, or just cut a lead from one of the extra 10K resistors and use that.

Re-Plug the USB power.

The Nano will not be doing anything because it is now held in reset, but we can program the Pro Mini.

In the IDE, select Tools > Board > Arduino AVR Boards > Arduino Pro or Pro Mini

Also select Tools > Port > (the USB port connected to the Nano)

Open the example sketch: File > Examples > Basics > Blink

Change both of the delay statements in the sketch from 1000 to 100.

Compile and upload the modified sketch.

To program an Arduino Pro Mini using a serial adapter with using the flow control signals (DTR or RTS), we need to manually trigger the RED RESET BUTTON at the precise moment that the compilation finishes. Since the Pro Mini's bootloader only listens for incoming code for a couple of seconds immediately after booting, the timing is critical. Remember this whenever programming the Pro Mini.

Once blink is programmed (with both delay statements modified from 1000 to 100), the "L" LED on ProMini will blink quickly.

You can pull out the RESET short (black wire in the photo) and Nano will return to doing whatever it was last programmed to do, because the blink demo was not programmed onto the Nano while it was held in reset.

STRING TO MORSE CODE GENERATION

Remove USB power from the setup.

Replace the RESET short from Nano.RST directly to Nano.GND (black wire in the photo).

This will allow us to once again program the ProMini while holding the Nano in reset.

Wire buzzer between pin ProMini pin 5 and GND (white and grey wires in the photo).

Get the attached sketch file String_to_Morse.ino

Compile and upload the sketch to the Pro Mini. It will convert a string into Morse code, and then key the code out to the buzzer on pin 5 as well as the builtin LED on pin 13.

Morse Decoder

Leave the String_to_Morse.ino sketch running on the Pro Mini while programming the Nano.

To do so, remove the purple, blue, and black wires to switch back to Nano programming (instead of Pro Mini).

Download the attached Morse_Decoder.ino sketch.

This sketch attempts to decode the Morse Code signal applied to pin Nano pin A1 and then the sketch outputs the decoded text to the Serial Monitor.

The Morse_Decoder.ino sketch can be fed a Morse Code signal in three ways...

DECODE MORSE SIGNAL FROM PRO MINI

The easiest option is to use the ProMini already generating a Morse Coded signal on pin 5. Jumper the Morse signal from ProMini pin 5 into Nano pin A1. You can removed the buzzer from pin 5, or it is OK to leave it attached to the Morse signal as well - assuming it isn't driving you crazy yet.

Compile and upload the Morse_Decoder.ino sketch into the Nano.

Open the Serial Monitor to view the decoded output, which should match the string hard coded into the transmitting Arduino Pro Mini.

DECODE A KEYED MORSE SIGNAL FROM AN INPUT BUTTON

Instead of triggering the Morse decoder with the Pro Mini output signal, we can remove the Pro Mini from the breadboard and drive the A1 Nano Input with the tactile pushbutton. This will allow practicing Morse Code signal generation by keying the pushbutton.

DECODE AN ANALOG AUDIO MORSE SIGNAL

A third option for triggering the Morse decoder is to assemble the audio biasing circuit shown in the figure above. An audio signal containing Morse Coded (CW) content, for example from a radio receiver, can feed the circuit using a 3.5mm TR(R)S audio cable. The 100nF capacitor coupling blocks any stray DC current and the remaining signal is centered between 0-5V by the voltage divider formed by the two 10KΩ resistors. The final signal is then connected to the A1 pin of the Nano just like the first two options above.

Downloads

Wireless Clock Module

NIST radio station WWVB is located near Fort Collins, Colorado. The WWVB broadcasts are used by millions of people throughout North America to synchronize consumer electronic products like wall clocks, clock radios and wristwatches. In addition, WWVB may be used in other consumer timekeeping applications, such as appliances, cameras, and irrigation controllers, as well as in high level applications such as accurate time synchronization.

WWVB continuously broadcasts digital time codes on a 60 kHz carrier that may serve as a stable frequency reference traceable to the national standard at NIST. The time codes are synchronized with the 60 kHz carrier and are broadcast continuously in two different formats at a rate of 1 bit per second using pulse width modulation (PWM) as well as phase modulation (PM).

NIST WWVB Coverage Map - generally works best in the evening with the ferrite rod antenna outside or near a window and oriented so its long axis is perpendicular to the direction of the WWVB transmitter in Fort Collins, Colorado.

WWVB 60KHz Receiver Module

The module features the CME6005 receiver IC, an attached ferrite rod antenna, and four interface pins:

  1. VDD: 3.3V Positive Supply Voltage
  2. GND: Connect to GND
  3. P: Power control switch - short to GND to force module power ON
  4. T: Data out (TCON) contains time pulse digital data output.

This requires three jumpers to the Nano... 3V3, GND, and any IO pin tied to T pin. Then run one of the WWVB receiver code examples on the Nano. Give it a long time to lock onto the signal. Again note the time of day and antenna positioning tips given above.

Sample Receiver Code

Another Example

WWVB How to with ESP32 Code

WWVB Simulator

Capt.Tagon provided the attached WWVB_Simulator.ino sktech for those bad receive days where you want to work on your data decode, but the signal's not cooperating, which is most of the time down here in Florida. You can run this WWVB Signal Simulator on the Pro Mini. This works mmuch like the Morse Code example above transmitting from the Pro Mini and receiving by the Nano. Just run a jumper wire from the output signal on the Pro Mini to the input (TCON) pin on the Nano.

Solderless Breadboard Power Supply

This little power supply kit is a nice warm-up for some serious SMD soldering practice.

Try out the Stainless Steel Ceramic Tip Tweezers.

The two tantalum capacitors are oriented with the dark line on the top oriented toward the "+" PCB marking.

Cut four pins from the red 1x40 header to mount the USB-C socket breakout. Insert the header into the breakout such that none of the pins extend beyond the top surface of the breakout. Solder the four pins to the breakout in that flush arrangement and then remove the red plastic insulator. Insert the breakout into the power supply PCB, cut the pins flush on the other side and solder them into place with no space between the breakout and the power supply PCB.

The two 2x3 headers for plugging into the solderless board can be cut from the provided 2x8 header.

This SMD Soldering Video is quite useful.

Soldering Practice - SMD LED Matrix Kit

The SMD LED Matrix Kit includes 300 components with 678 solder joints. Obviously, the spirit here is to provide a solid practice opportunity with SMT to improve soldering skills. One could certainly attempt to assemble the kit in a single multi-hour sitting, but we definitely suggest working in several smaller sessions. If your SMT soldering skills are still developing, just work slowly towards small, but meaningful, improvement. The point is not to obtain a working LED matrix that is easily purchased in completed form, the real goal is exercise and skill development, so do not beat yourself up if it seems difficult. If you can get some, or all, of the LEDs to work, that is great. If not, you will be 678 solder points more experienced than when you started!

The 256 SMD LEDs form a 16x16 matrix illuminated using row-column scanning via four 74HC595 8-Bit Shift Registers driven by an STC 8051-based microcontroller.

ASSEMBLY: DO NOT SOLDER THE U1 MICROCONTROLLER

  1. Do not solder the U1 microcontroller to the LED Matrix PCB
  2. The 256 LEDs must be oriented as shown in the image above
  3. The 16 transistors only fit in one orientation
  4. The 6 surface mount capacitors can be oriented in either direction
  5. The 16 resistors can be oriented in either direction
  6. The four 74HC595 ICs must be oriented according to the pin 1 markings on the PCB
  7. The electrolytic capacitor C0 must be oriented to match the PCB marking
  8. Cut six pins from red 1x40 header and solder then into the JP1 connector

PARTIAL ASSEMBLY

256 SMT LEDs is quite a lot. One assembly option is to only solder one row and one column of the LEDs, or perhaps just the diagonal. Then connect an MCU and play with the shift registers to illuminate the subset of LEDs one at a time or with interesting timing patterns. Later, you can return to add more LEDs as time and patience allows.

Control Matrix With MCU or Arduino

DRIVE LEDS WITH PREPROGRAMMED STC 15F104W CHIP

Solder the STC 15F104W microcontroller onto the SOP-8 to DIP-8 adapter board being sure to match the pin one designator of the chip to the marking on the adapter board. Break two 4-pin sets from the red 1x40 header. Solder the pin headers onto the adapter board with pins extending from the back of the adapter (opposite the MCU).

Also break two single pins from the red 1x40 header and solder them into pins JP1 and JP2 on the LED Matrix PCB.

Jumper pins 1-6 of the SOP-DIP adapter board to the JP1 header of the LED Matrix PCB matching up the signal names in the photo, not matching the pin numbers. For example, the top pin on JP1 is the OE signal, so jumper it to pin 5 of the U1 adapter which is also the OE signal. The bottom pin of JP1 is the CLK signal, so jumper it to pin 3 of the U1 adapter which is also the CLK signal.

Jumper JP1 and JP2 from the LED Matrix PCB to 5V and GND pins on either the Nano or the Solderless Power Supply.

Turn the power on, and the pre-programmed MCU will be controlling the LED Matrix PCB.

DRIVE LEDS WITH THE ARDUINO NANO (OR OTHER MCU)

Five pins (D8, D11, D12, GND, 5V) from the Nano (or similar microcontroller) can be jumpered to connector JP1 on the LED Matrix PCB as shown in the upper left of the image above.

The Arduino can then be programmed to row-column scan via the four 74HC595 chips as explored here.

MORE DETAILS ABOUT LEVERAGING 74HC595 SHIFT REGISTERS

Review Step 8 of the Box Guide for HackerBox 0084: Rework or this Arduino Doc.

A Morse Code Kit Launched the DigiKey Empire

DigiKey is an American electronic components distributor. The company was founded in 1972 by Ronald Stordahl. As of 2013, DigiKey is the fourth largest electronic component distributor in North America and the fifth largest electronic component distributor overall. The name "Digi-Key" is a reference to the "Digi-Keyer Kit", a digital-electronic Morse Code keyer kit. Stordahl developed and marketed the Digi-Keyer Kit to amateur radio enthusiasts. Electrical schematics for the electronic keyer were published in April 1968 by the radio publication QST. (Wikipedia)

Updating the Original Digi-Keyer with modern components

QST Magazine - April 1968 - Digi-Keyer (Video)

Reverse Engineer Anything

REA: Reverse Engineer Anything

Truly we are living in an age of wonders.

What Hath God Wrought

We hope you are enjoying this month's HackerBox adventures into electronics, computer technology, and hacker culture. We aim to curate a challenging and rewarding experience of learning through experimentation and exploration. Thank you for joining us on this journey.

Reach out and share your success in the comments below. Email support@hackerboxes.com anytime with questions or whenever you need some help.

Hungry for more? Surf over to HackerBoxes.com and join us as a monthly HackerBox subscription member. You'll get a cool box of hackable gear delivered right to your mailbox every month and you'll enjoy a generous member discount.

Please consider sharing this free Instructable with others who may be interested in learning about these subjects. Word of mouth advertising is the greatest compliment that we can receive. We sincerely appreciate your support.