ETR241 - Electronic Communications I


ETR241 - Electronic Communications I:
Studies noise, information and bandwidth, modulation and demodulation, transmitters and receivers, wave propagation, antennas and transmission lines. Includes broad band communication systems, microwave, both terrestrial and satellite, fiber optics, multiplexing and associated hardware.

Required Materials:
Adafruit Software-Defined Radio USB
SparkFun Pro RF - LoRa, 915MHz (SAMD21)
Assembled Feather HUZZAH w/ ESP8266 WiFi With Stacking Headers
Bluefruit LE Friend - Bluetooth Low Energy (BLE 4.0) - nRF51822 - v3.0
AM2320 Digital Temperature and Humidity Sensor
Jumper Wires
830 Tie Point Plug In Breadboard
Monoprice USB-A to Micro B 2.0 Cable
10K ohm 5% 1/4W - 25 THT

Online Components:
Course Video YouTube Playlist
Google Groups - Discussion Board

Week 1 - Welcome!

Welcome to ETR241! I will be posting content and labs each Friday and following with solutions and updates each Wednesday. This post serves as an introduction to the course, syllabus, and the structure. Feel free to reach out if you need anything. Make sure to have all the class materials by the end of the week!

Getting Started:
Please make sure you post on the discussion board. If you do not have access through your PVCC Student Account, let me know ASAP.
Watch the introduction video and read the syllabus.
Watch out for the first class posting on Thursday evening!

Supplemental Materials:
00 - Discussion Post Help Video
01 - SDR Tools & Test Setup Video
01 - Zadig Driver Installation for Windows Help Video
How FM Works - Lifewire

Lab 1: Intro to SDR
To make sure everything is working, and to jump into the fun stuff, we will test our setup with the RTL-SDR. This can be done on Windows, Mac, or Linux. Throughout the semester, I will move from Windows to Linux purposefully, but you may stick to whichever OS works for you. Please make sure you can get a signal on FM and NBFM. Send a screenshot to the posted form below. Watch this video to get started. If you need help or want to share anything, use the Groups Discussion on this posting. Thanks!
CubicSDR Releases - Github
Zadig Driver Installer - Windows
Ubuntu-based systems: apt install rtl-sdr librtlsdr-dev libusb-1.0-0-dev
RTL-SDR Getting Started - Adafruit
National Weather Radio Stations - VA

Assignment Submission

Week 2 - Communication Systems

Week 1 Lab:
Make sure you submitted your screenshots and answered the two questions on the form and worked through the supplemental readings and videos. If you are having any trouble with getting a signal, you may want to adjust your gain. I posted a video to explain how to do that in CubicSDR. If you want to communicate with the group, please check the Group Discussion. I will be posting grades by the end of the week for you to keep updated in a separate spreadsheet for your own viewing.

Getting Started:
Please read and watch the supplemental materials before continuing. This will provide background and context into basic radio communication. This includes the first 4 links below.

Supplemental Materials:
Who Invented Wireless - BBC
Fundamentals of RF and Basic Radio Communications - Maxim Integrated
RF for Non-RF Engineers - TI
Intro to RTL-SDR, Principles & Hardware - Ajoo
CubicSDR Manual
Cubic SDR Overview - Signals Everywhere
Radio Reference - Virginia
rtl-sdr Software Package - Osmocom
Driver Installation - Michael Lustig (Berkeley)
02 - Local Frequencies & Command Line - Video

Lab: Intro to SDR
Using your SDR, find the range of AM and FM Bands that you can reach with our antenna. Use the provided video to guide you around CubicSDR.
Use radio reference to find a local amateur station, police/fire/hospital, or if you are close to the airport try them! I was able to pull some AM Ground Control signals poorly.
Try using the rtl_sdr command line tool to sample data. We will be using this next week. If you have the R820T tuner, don't use the -t modifier
Find the datasheets for the RTL2832U and R820T Tuner (or the ones in your particular SDR)
Don't forget to use the discussion if you need it!

Assignment Submission

Week 3 - Radio Frequency & Modulation

Week 2 Lab:
Please make sure that you submitted your assignment in the provided form. You should have had success with the AM and FM in the area as well as using the command line tools to capture data. This video should help get you setup if you ran into any trouble and don't forget to use the discussion if you need it!

Getting Started:
Please make sure you are caught up with the current readings and videos for the week! Read Chapter 1 of Introduction to Communication Systems by Madhow. Check supplemental videos...

Supplemental Materials:
Introduction to Communication Systems - Upamanyu Madhow
03 - Local Radio & Command Line Details
RTL-SDR Tools - Prebuilt Windows - .zip
Ubuntu-based systems: sudo apt install rtl-sdr librtlsdr-dev libusb-1.0-0-dev
Mac OSX Systems: Install macports, Xcode, Xcode command line tools,then in terminal sudo port install rtl-sdr
GNU Octave
GNU Octave Documentation
Lab Screenshots - .zip

Lab: SDR Signal Plotting
Find your sample rate and gain values using the rtl_test -p command.
Collect sample data using rtl_sdr setting a center frequency, gain (choose from your previous test), sample rate, and save the file as a .dat file.
Install GNU Octave to plot and manipulate your data.
Use the loadFile.m provided to load the data you just saved from your SDR as a vector. The msg.m will create a spectrogram of your data
Start with d = loadFile('YOURSAMPLE.dat') then use msg(d,1,1024,2000); to display your data.
ds = msg(d,1,1024,2000); will assign the output to a variable
plot(abs(ds(:,1000))); will plot the spectrum at a time of .5 sec of column 1000
plot(abs(ds(313,:))); would show a strong plot at 313...
dd = msg(d,1,256,8000); would sample at 8kHz in blocks that are 256 samples
As a bonus, see if you can find your sample and play it back through your sound card...
Week 3 Discussion!

Assignment Submission

Week 4 - Signals

Week 3 Lab:
Please make sure that you submitted your assignment in the provided form. Make sure you captured your own data and created a unique plot in GNU Octave. Don't forget to use the discussion if you need it! Here is a step by step video of the lab.

Getting Started:
Read the 3 articles below to gain a basic understanding of modulation, demodulation and RF filters...

Supplemental Materials:
04 - Command Line SDR & GNU Octave
Basics of Modulation & Demodulation - J. Browne
Applications of RF Filters - nuWave Engineering
Getting an RF Low Pass Filter Right - Jenny List

Lab: Narrow Band Scanner
Use the amateur raio repeater near your area to find a signal, capture the Narrow Band frequency. Albemarle is listed here.
Autmatically find signals in your captured data using the ffreq.m program in GNU Octave.
This should automatically compute the spectrogram from the previous lab for every .1 second, finds which frequencies have a signal over the squelch threshold of 10% of the peak, then returns frequency offsets!
Use the command f = ffreq(d) where f is your output and d is the dataset you loaded with loadFile.m from the amateur radio station.
The results are all Hz frequencies. We need to demodulate and create a low pass filter.
We can demodulate the data using a few parameters in the ffreq.m program. In GNU Octave you can set these, for example:
fs = 2048000 would be the sampling frequency
dt = 1/fs would be the sampling time
t = [1:length(d)]*dt; would be the time of each sample of d
dm = d.*exp(-i*2*pi*(-396000)*t); is the demodulated data of d, the data loaded
Now we can decimate the dm by 64 to bring our sample from 2.048 MHz to 16 kHz. Do this by a factor of 8 two times for efficiency.
dmd = decimate(dm,8,'fir'); will decimate one time, dmdd = decimate(dmd,8,'fir'); will be our second...
msg(dmdd, 1, 256,1024) to plot this data. Try using the FIR and the IIR filters...
sound(abs(dmdd), 32000); to playback your signal, and try to plot your data as well like in the previous lab...
Week 4 Discussion!

Assignment Submission

Week 5 - Signals of LORA

Week 4 Lab:
Please make sure that you submitted your assignment in the provided form. Make sure you captured your own data and filtered your AM data, and also played it back. Don't forget to use the discussion if you need it! Here is a step by step video of the lab.

Getting Started:
Make sure you look at readings for LoRa WAN and capturing the signals with your SDR! Follow the lab and look at all the supplied resources.

Supplemental Materials:
SparkFun Pro RF LoRa WAN Hookup Guide
IoT Devices and Applications based on LoRa/LoRaWAN - Khutsoane, Isong & Abu-Mahfouz
Arduino IDE
RadioHead Packet Library - .zip
Installing Library into Arduino
Client Firmware for Sparkfun Pro RF - .ino
RF95W Datasheet - .pdf

Lab: Detecting Nodes
The goal of this lab is to setup your SparkFun Pro RF LoRa WAN Dev Board and capture it using the SDR. We will get used to the Arduino interface to install the appropriate firmware, send out a signal, and read it out on the SDR.
Make sure you follow the SparkFun Hookup Guide to setup your Arduino Environment. You will need to add the board and install a library. The URL for the Boards Manager is for your convenience. Just copy and paste it into File -> Preferences, Additional Boards Manager URLs
Under Tools -> Board -> Boards Manager make sure you download the Arduino SAMD Boards (Cortex M0+) and the SparkFun SAMD Boards.
Open the client firmware provided above in the Arduino, and change the message it is sending as well as the frequency. Make sure it falls under the range of the frequency of this particular RF chipset. Check out the datasheet for detailed info...
To upload this code to your board, make sure that it is plugged into the USB, under Tools -> Board make sure you scroll down and select SparkFun SAMD21 ProRF, then select the Port that your device is plugged into. For Windows it will show up as a COM and for Linux and Mac is shows up as a /dev/ttyACM or /dev/tty.usbmodem or similar. Click the Upload button in the top left of the screen in the Arduino IDE to flash your board.
Our next goal is to read the frequency using your RTL-SDR and CubicSDR. This will ensure that you are sending from the Pro RF board and we can read what the output is and see what the signal looks like.
Open up CubicSDR and match it to your frequency you chose in the firmware code.
Week 5 Discussion!

Assignment Submission

Week 6 - Decoding LoRa

Week 5 Lab:
Please make sure that you submitted your assignment in the provided form. Don't forget to use the discussion if you need it! Here is a step by step video of the lab.

Getting Started:
Make sure you look at readings for this week on decoding signals! Follow the lab and look at all the supplied resources.

Supplemental Materials:
Reversing and Implementing the LoRA PHY with SDR - Matt Knight (GnuRadio Con)
Decoding LoRa: Realizing a Modern LPWAN with SDR - Matt Knight
More Research on Decoding LoRa - Matt Knight
Setting up your SparkFun ProRF Dev Board
AM2320 Temperature/Humidity Sensor Overview - Adafruit
AM2320 Datasheet
SparkFun Qwiic Connectors

Lab: Decoding Nodes
The goal of this lab is to decode the SparkFun Pro RF LoRa signal using the SDR. You will be required to change some of the messages and make sure that the signals and the messages you send match.
You need to add the Adafruit Sensor Library and the AM2320 Temperature/Humidity Sensor Library to your Arduino IDE. Place the dtostrf.h file in the same folder as your sketch (.ino) file.
We will be combining the previous sketch and the basic temperature sketch example. Find this new sketch in File -> Examples -> Adafruit_AM2320_basictest.
Using the breadboard, make sure to wire your circuit appropriately. You will need the AM2320 Sensor, 2x 10K Ohm Resistors, a few jumper wires, and your SparkFun ProRF Microcontroller Board. Use the schematic to help guide your wiring!
If you have trouble combining the inital portions of the sketch, then use this for reference. The normal SDA/SCL (i2c) Pins on this board are used for the black connector on the rear of the board. Use this sketch .ino file to get started and don't forget to include the dtostrf.h file in the same folder as your sketch when compiling! You will also need the RadioHead Library from the previous class. Here is a video going over the whole process.
Use the magnifier icon in the top right of the Arduino IDE to open up the Serial Port. This should display the temperature readings and any strings you put into your initial firmware.
On another computer, or with your ProRF board plugged into another power source, open CubicSDR and find your LoRa signal.
Make sure to record the audio of the signal through CubicSDR as a wave file. We are going to use this coming up...
Begin your strategy for decoding and analyzing the signal as it is coming in. Compare this to what you are getting from the Serial Port data being streamed from the device.
Week 6 Discussion!

Assignment Submission

Bonus Labs

Week 6 Lab:
Please make sure that you submitted your assignment in the provided form. Don't forget to use the discussion if you need it! Here is a step by step video of the lab.

Bonus Lab!
If you struggled a bit with one of the labs, feel free to use this as a replacement or for extra credit on labs you submitted that were not fully complete. We did not get to the WiFi and Bluetooth modules, but below are some guides to getting started. Feel free to do EITHER the bluetooth or the wifi examples. You do not need to do both to obtain credit for one of the labs. Good luck!

Bluetooth nRF51822 LE 4.0:
You should have purchased the Bluefruit LE Friend as part of this class. Follow the below tutorial to create a bluetooth enabled beacon using the USB dongle and your smartphone! You may need to look at some of the previous examples to get everything up and running properly. This page is your last step.
Creating a Bluetooth Beacon - Adafruit

WiFi ESP8266 Microcontroller:
Create a webclient and change the page address using your HUZZAH Feather ESP8266. You can place this on your home network or over student at PVCC. You should be able to connect using an IP address and point to the specific web page. You may need to reference some of the previous examples in the tutorial before getting started on using NodeMCU Lua.
NodeMCU Lua WebClient- Adafruit

Week 6 Discussion!
Bonus Lab Submission

All assignments must be submitted by 11:59 PM on Monday, May 13 to be considered. Thank you.