2: Serial and Morse Code
- Page ID
- 433829
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)The earliest forms of serial communication were probably drumbeats and smoke signals. An early alphabetical system would be the Semaphore flag signaling system or optical telegraph that allowed ships to communicate. In the 1830's Samuel Morse and others invented the telegraph, which transmitted electrical signals over a wire, coding information in the forms of dots and dashes (short and long signals). Today information is coded in bits and we have already looked at multiple binary digital data representations like strings, integers and float. Although electronics have evolved since the days of the Morse Code, there is still a common binary component to digital information representation and communication across devices. In this activity we will develop a Morse Code based system as an introduction to digital communication.

Series
Most of the devices we will work in this class transmit data through a variety of series communication protocols, and this class will cover several of this. But first, there are a few terms you need to understand with respect to the description of data transfer across devices. Devices hooked in series have either one wire, or two. When there are two wires each is unidirectional, with one sending data from device A to device B, while the other goes in the opposite direction and sends data from device B to device A.
Modes of Operation
There are three basic modes of operation for data transmission along a wire
- Simplex
- data only goes in one direction
- Would be use for something like controlling an array of LEDs, they do not send data, only receive it
- Half-Duplex
- data transmission goes in both directions, but is not simultaneous.
- Full-Duplex
- simultaneous data transmission in both directions.
Baud (Bd) Rate
Baud rate is a measure of how quick data can be transferred along a line and is named after Émile Baudot for the Baudot code in early telegraphy. The baud rate is the number of symbols (or pulses) per second and the gross baud rate is the number of bits per second. If there are exactly two symbols (0 and 1) then the baud rate equals the bit rate. What is important is that the transmitting device is operating at the same baud rate as the receiving and you may need to check this in your code. Standard baud rates range from 110Bd to 256kBd.
Communication Protocols
It is through protocols that electronic devices can communicate data. The data is transmitted as bits. There are two ways bit can be identified, either as high or low values, or the time a value is high (or low).
Some common serial communications protocols that are germane to IOT are:
- UART (Universal Asnycgronous Receiver-Transmitter)
- I2C (Inter-Integrated Circuit)
- SPI (Serial Peripheral Interface)
- USB (Universal Serial Bus [Wikipedia])
Morse Code
Morse code represents the alphabet by using two characters, dashes and dots, as given in table \(\PageIndex{1}\). Note, there is actually a third entity in the code, which is the space between the dashes and the dots. In Morse code (unlike many digital systems) the number of characters varies from letter to letter, with commonly used letters having few characters and infrequently used letters (or symbols) having more characters ("E" is a dot, "T" is a dash, but a hyphen is dash-dot-dot-dot-dot-dash. Because this is being detected and transmitted by a human the amount of time to send information is very long, but in principle, this is a form of serial communication.
A | • – | K | – • – | U | • • – | 0 | – – – – – |
B | – • • • | L | • – • • | V | • • • – | 1 | • – – – – |
C | – • – • | M | – – | W | • – – | 2 | • • – – – |
D | – • • | N | – • | X | – • • – | 3 | • • • – – |
E | • | O | – – – | Y | – • – – | 4 | • • • • – |
F | • • – • | P | • – – • | Z | – – • • | 5 | • • • • • |
G | – – • | Q | – – • – | Period | • – • – • – | 6 | – • • • • |
H | • • • • | R | • – • | Comma | – – • • – – | 7 | – – • • • |
I | • • | S | • • • | Hyphen | – • • • • – | 8 | – – – • • |
J | • – – – | T | – | Colon | – – – • • • | 9 | – – – – • |
In order to construct a sentence and transmit that information you need to not only identify each character in a letter, but when you are separating letters from letters in the same word, and between different words. For example six dots (\( \cdot \cdot \cdot \cdot \cdot \cdot \)) could be HI or EEEEEE or 5E or E5 or SS or EESE or ESSE or.... you get the problem. So you need to develop a set of protocols to indicate the difference between the dashes, the dots and the time delay between them. Here is a protocol adapted from Bob LeSeyer and FeAtHEr-Cm
Morse Code Translator
The following code comes from GeeksforGeeks. In a future activity you will make an LED Morse code transmitter and some of this code will be useful.
Resources and References
- Morse Code and the Telegraph (History.com)