HackerBox 0090: Modem

by HackerBoxes in Circuits > Arduino

3988 Views, 9 Favorites, 0 Comments

HackerBox 0090: Modem

HB0090 Whole Box.png

Welcome to HackerBox 0090. Explore various analog and digital modulation schemes. Learn about the Radio Data System (RDS) standard used to embed small amounts of digital information into FM radio broadcasts. Configure an FM receiver with RDS decoding controlled by an Arduino Nano microcontroller. Assemble and operate a transmitter for FM radio and RDS data also controlled by an Arduino Nano microcontroller. Configure an MP3 player with microSD and USB storage interfaces to decode and supply audio signals for the FM radio transmitter.

HackerBox is the original monthly subscription box for electronics, computer technology, and hacker culture. Each HackerBox is a discovery box, which means all members await and enjoy a new surprise each month. Tech, toys, knowledge, and fun. It's like having a hacker convention, your birthday, and the first day of school - every month - right in your mailbox.

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 0090. The full box contents are listed on the product page for HackerBox 0090 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. Subscribers save at least $15 every month and get each new HackerBox shipped immediately off of 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.

Modems, Modulation, and More

Modulator-Demodulators, or Modems (Bits and Bytes, Episode 5)

Modem is a contraction of the words modulator and demodulator which is a communications device that converts data from a digital format into a signal suitable for transmission over an analog medium such as radio waves, laser beams, or telephone lines. A modem transmits data by modulating carrier wave signals to encode digital information, and receivers data by demodulating the signal to recreate the original digital information.

One generally first encounters the concept of modulation in an analog context, specifically the Frequency Modulation (FM) and Amplitude Modulation (AM) used in broadcast radio to transmit analog audio signals. However, data modems employ digital modulation techniques such as PAM, ASK, FSK, PSK, QAM, and TCM, among others.

Modulating data into the audio band was used in many early microcomputers to employ audio tapes as storage devices. Check out the Commodore Datasette or "listen" to some oldies from the Apple ][ Game Server.

In the 1960s and 70s, data rates of the first telephone modems evolved from 110 bits per second up to 1200 bits per second. These modems used Frequency Shift Key (FSK) modulation. During the early 1980s, use of 300 and 1200 baud modems became more common and the cutting edge evolved towards 9600 baud leveraging Phase Shift Key (PSK) modulation and Trellis Coded Modulation (TCM). In the 1990s telephone modems continued to evolve with bit rates like 14.4K, 19.2K, 28.8K, 33.6K, and finally 56K. Dialup modem technology eventually gave way to DSL, cable modem, fiber optic, and wireless services often referred to as broadband.

Further detail... From Baud to Awed: The History of the Modem

Radio Data System (RDS)

FM Spectrum.png

While the primary use cases of data communications have gone broadband, simple low-data-rate modulation is still used all around us for remote control systems, utility meters, RFID tags, security systems, and many other applications.

One interesting example is the Radio Data System (RDS) standard used to embed small amounts of digital information into FM radio broadcasts to provide data such as time, text about programming or songs, programming type, alternative frequencies, and traffic information.

Using Binary PSK, RDS can modulate data at a rate of 1,187.5 bits per second on a 57 kHz subcarrier of a broadcast FM channel.

Read more...

ATmega328P Arduino Nano

Arduino Nano USBC.png

The Arduino Nano is possibly the most common microcontroller (MCU) module currently in use. The Arduino Nano is a surface-mount, breadboard-friendly, miniaturized Arduino board with integrated USB. It is amazingly full-featured and easy to hack. The included variant is based on the ATmega328P MCU operating on 5V at 16Mhz. In includes an on-board MiniUSB port connected to a CH340 USB/Serial bridge chip. Detailed information on the CH340 (and drivers, if needed) can be found here.

Leave the pins unsoldered for now. The included Arduino Nano boards comes with header pins, but they are not soldered to the modules. Perform these initial tests on both of the Arduino Nano modules prior to soldering on the header pins.

When you first plug the Arduino Nano into a USB port of your computer, the red power light should come on and shortly after that, another red LED should start to blink slowly. This happens because the Nano is pre-loaded with the BLINK program, which is running on the brand new Arduino Nano.

SOFTWARE: If you do not yet have the Arduino IDE installed, you can download it from Arduino.cc

Plug the Nano into a USB-C cable and the other end of the cable into a USB port on the computer. Launch the Arduino IDE software. Select "Arduino Nano" in the IDE under tools>board and "ATmega328P (Old Bootloader)" under tools>processor. Select the appropriate USB port under tools>port.

Finally, load up a piece of example code:

File->Examples->Basics->Blink

Blink is actually the code that was preloaded onto the Nano and should be running right now to slowly blink the LED. Accordingly, if we load this example code, nothing will change. Instead, let's modify the code a little bit.

Looking closely, you can see that the program turns the LED on, waits 1000 milliseconds (one second), turns the LED off, waits another second, and then does it all again - forever.

Modify the code by changing both of the "delay(1000)" statements to "delay(100)". This modification will cause the LED to blink ten times faster, right?

Let's load the modified code into the Nano by clicking the UPLOAD button (the arrow icon) just above your modified code. Watch below the code for the status info: "compiling" and then "uploading". Eventually, the IDE should indicate "Uploading Complete" and your LED should be blinking faster.

If so, congratulations! You have just hacked your first piece of embedded code.

Once your fast-blink version is loaded and running, why not see if you can you change the code again to cause the LED to blink fast twice and then wait a couple of seconds before repeating? Give it a try! How about some other patterns? Once you succeed at visualizing a desired outcome, coding it, and observing it to work as planned, you have taken an enormous step toward becoming a competent hardware hacker.

Once you have confirmed operation of both Nano modules, go ahead and solder the header pins onto it. Note that the six pin (2x3 pin) header for the end of the board is usually not needed if you want to just leave it off.

If you would like additional introductory information for working in the Arduino ecosystem, we suggest checking out the Guide for the HackerBoxes Starter Workshop, which includes several examples and a link to a PDF Arduino Textbook.

FM + RDS Receiver System

RX.png

The exclusive HackerBox FM receiver board supports a radio receiver module based on the Skyworks Si4703 tuner chip (datasheet). The board also supports an Arduino Nano microcontroller module.

Theory of Operation

The Arduino Nano module provides power, USB connectivity, and firmware control for the receiver system.

The carrier PCB connects the eight pins of the Si4703 tuner module like so:

3V3: connects to the 3V3 pin of the Nano

GND: connects to the GND pins of the Nano

SDIO: connects to pin A4 of the Nano (I2C Data)

SCLK: connects to pin A5 of the Nano (I2C Clock)

SEN: connects to pin D7 of the Nano (pin is pulled high on the module to select I2C mode)

RST: connects to pin A0 (aka D14) of the Nano (can be used to reset the module)

GPIO1: connects to pin D8 of the Nano (not used)

GPIO2: connects to pin D9 of the Nano (not used)

The radio module leverages the headphone cord as the receive antenna, so there is no need to connect a dedicated antenna wire.

Assembly

Mounting the two modules onto the board is pretty straight forward as shown. Both modules mount on the side of the PCB showing the RDS logo. Also, be sure to orient the Arduino Nano module to align the USB port over the USB marking on the PCB silkscreen.

Firmware

Install the PU2CLR SI470X Library from this github repo. (The version obtained through the library manager doesn't seem to have the most up to date files.)

Open, compile, and flash the example sketch:

File > Examples > PU2CLR Si470X > si470x_01_seria_monitor > si470x_01_RDS.ino

Open the IDE Serial Monitor set to 9600 Baud

Use S/s to seek through the FM dial. Text from stations encoding RDS information should be displayed whenever one of those stations is being received.

FM + RDS Transmitter System

TX.png

The exclusive HackerBox FM transmitter board supports a radio transmitter module based on the Skyworks Si4713 chip (datasheet). The board also supports three other modules: an Arduino Nano microcontroller module, an MP3 player module, and a breakout module for a female USB-A socket.

Theory of Operation

The Arduino Nano module provides power, USB connectivity, and firmware control for the transmitter system.

The carrier PCB connects the 11 pins of the Si4713 transmitter module like so:

  • RST: connects to pin D12 of the Nano (can be used to reset the module)
  • CS: not connected (pin is pulled high on the module to set the I2C address)
  • SCL: connects to pin A5 of the Nano (I2C Clock)
  • SDA: connects to pin A4 of the Nano (I2C Data)
  • GP1: not connected (GPIO1)
  • GP2: not connected (GPIO2)
  • 3Vo: not connected (3.3V regulated by transmitter module)
  • GND: connects to the GND pins of the Nano
  • Vin: connects to the 5V pin of the Nano
  • LIN: connects to DAC_L of the MP3 player module (Left Audio In)
  • RIN: connects to DAC_R of the MP3 player module (Right Audio In)
  • The Audio Input pins are also connected to the 3.5mm input jack of the audio module.

The carrier PCB connects the 16 pins of the MP3 player module like so:

  • GND: both GND pins connect to the GND pins of the Nano as well as the GND pin of the USB breakout
  • VCC: connects to the 5V pin of the Nano as well as the VBUS pin of the USB breakout
  • RX: connects to the D11 pin of the Nano (through a 1K resistor)
  • TX: connects to the D10 pin of the Nano
  • USB-: connects to the D- pin of the USB breakout
  • USB+: connects to the D+ pin of the USB breakout
  • DAC_L: connects to the LIN pin of the Si4713 module
  • DAC_R: connects to the RIN pin of the Si4713 module
  • SPK_1: connects to a speaker header under the MP3 player module for optional use
  • SPK_2: connects to a speaker header under the MP3 player module for optional use

The MP3 player module is capable of decoding MP3 files stored on a microSD flash card or stored on a USB flash drive placed in the connected USB breakout module.

Assembly

Mount the four modules and the 1K resistor onto the carrier board as shown. The modules mount on the side of the PCB showing the RDS logo. The Arduino Nano module must be oriented to align the USB port over the USB marking on the PCB silkscreen. Also, the MP3 player module must be oriented such that the SD card slot opens to the edge of the carrier board.

You can solder a wire (try 2-4 feet) to the "Ant" pad of the Si4713 transmitter module to serve as an antenna. It doesn't take much of an antenna to markedly increase signal transmission.

The transmitter requires a good bit of current, so it may not work correctly when connected to an unpowered USB hub.

Firmware

From the IDE menu, use Tools > Manage Libraries to search for and install these two libraries:

  • Adafruit Si4713 Library
  • DFRobotDFPlayerMini by Angelo

Download the mp3_transmitter.ino sketch attached here.

Compile the sketch and flash it to the Arduino Nano on the transmitter board. Use the serial monitor to observe the status of the sketch.

The demo sketch is set up to play the first 45 seconds of any MP3 tracks from an SD card or USB drive. Once you get this working, you can easily modify the sketch to control the MP3 player and the FM transmitter in other ways.

Androiden Trip Auf Elektrische Schafe

CONSCIOUSNESS (Art Film)

We hope you are enjoying this month's HackerBox adventure into electronics, computer technology, and hacker culture. Reach out and share your success in the comments below or other social media. Also, remember that you can email support@hackerboxes.com anytime if you have a question or need some help.

What's Next? Join the party and live the HackLife. Get a cool box of hackable gear delivered right to your mailbox each month and enjoy a generous member discount. Surf over to HackerBoxes.com right now to sign up for your monthly HackerBox subscription.

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