Wireless Audio Transmission Using Li-fi

Photo of yeshvanth-m

Made by yeshvanth-m

About the project

Wireless Audio Transmission using Li-Fi using Red Pitaya

Project info

Difficulty: Moderate

Platforms: DigilentRed Pitaya

Estimated time: 6 hours

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

9V Battery Clip 9V Battery Clip x 1
9V battery (generic) 9V battery (generic) x 1
LM386 Audio Amplifier IC LM386 Audio Amplifier IC x 1
Speaker: 0.25W, 8 ohms Speaker: 0.25W, 8 ohms x 1
Through Hole Resistor, 10 ohm Through Hole Resistor, 10 ohm x 1
Multilayer Ceramic Capacitor, 0.047 µF Multilayer Ceramic Capacitor, 0.047 µF x 1
Capacitor 220 µF Capacitor 220 µF x 1
Capacitor 10 µF Capacitor 10 µF x 3
Development Kit Accessory, Solar Cell Development Kit Accessory, Solar Cell x 1
Single Turn Potentiometer- 10k ohms Single Turn Potentiometer- 10k ohms x 1
Breadboard (generic) Breadboard (generic) x 1
Digilent BNC Oscilloscope x1/x10 Probes (Pair) Digilent BNC Oscilloscope x1/x10 Probes (Pair) x 1
SMA to BNC Adap SMA to BNC Adap x 1
Red Pitaya STEMLab 125-10 Red Pitaya STEMLab 125-10 x 1

View all

Story

Wireless Audio Transmission using Li-Fi

Introduction to Li-Fi

Li-Fi (also written as LiFi) acronym for Light Fidelity is a wireless communication technology that utilizes light to transmit data and position between devices. It is capable of transmitting data at high speeds over visible light, ultraviolet, and infrared spectrums. In its present state, only LED lamps can be used for the transmission of data in visible light. In terms of its end-use, the technology is similar to Wi-Fi — the key technical difference being that Wi-Fi uses radio frequency to induce a voltage in an antenna to transmit data, whereas Li-Fi uses the modulation of light intensity to transmit data. Li-Fi can theoretically transmit at speeds of up to 100 Gbit/s. Li-Fi's ability to safely function in areas otherwise susceptible to electromagnetic interference (e.g. aircraft cabins, hospitals, military) is an advantage. The technology is being developed by several organizations across the globe.

Li-Fi Modulator

The Red Pitaya has 2 Fast Analog RF Outputs as shown below in the block diagram:

  • The laser diode can transmit light pulses only in digital form, that is 1s and 0s, it's a 1 if the laser diode is ON and it's a 0 if the laser diode is OFF.
  • The specification of the RF Outputs are ± 1V Max. amplitude and DC-40MHz.
  • Thus, to power the Laser Module, a transistor is used as a switch.

Circuit Diagram of Li-Fi Modulator

Things required for Li-Fi Modulator
  • Red Pitaya STEMlab 125-10 Starter Kit
  • Perf Board and Soldering Kit
  • BNC Connector
  • SMA to BNC Converter
  • Laser Diode Module
  • NPN Transistor (BC547)
  • Resistor (1k)
  • Wires and Jumpers

Building the Li-Fi Modulator
  • Take a BNC connector and connect wires to its terminals

  • Take a perf board and solder the components including the BNC with wires to it according to the circuit diagram

  • Connect the SMA to BNC converter to Red Pitaya

  • Finally connect the BNC of the modulator to Red Pitaya

Analysing the performance of Solar Cell for Li-Fi

Choosing the right solar cell

Different solar cells give different output powers, and so does the amount of noise in the output of the demodulator. Connect the solar cell that is to be analyzed to the input probe and open the oscilloscope and function generator app and analyze the output waveform to different frequencies

Same way analyze the output for different solar cells

Solar Cell #1 Response

Solar Cell #2 Response

Li-Fi Demodulator

The Li-Fi demodulator is a standalone device with Audio Amplifier and a solar cell to demodulate the received light signals. A potentiometer is required to adjust the level of the input signal depending on the solar cell and environment. This is also to reduce the noise level. The solar cell receiver converts the received light signals into corresponding voltage levels which are fed into the amplifier which provides the required gain and then the amplified signal is fed into the speaker, when the frequency is in the audible range to human ears - about 20 Hz to 20 kHz we will be able to hear the sound.

Circuit Diagram of Li-Fi Demodulator

Things required for Li-Fi Modulator
  • Perf Board and Soldering Kit / Bread Board
  • LM386 Audio Amplifier IC
  • Solar Cell
  • 10k Potentiometer (Preset)
  • Capacitors - 1 × 0.047uF, 3 × 10uF, 1 × 220uF
  • Resistor - 10 Ohms
  • Speaker 8 Ohms, 0.5W
  • 9V Battery and Cap
  • Wires and Jumpers
  • 4 Ohms Coil if using 4 Ohms Speaker

Building the Prototype

Gather the components and prototype using the breadboard

Assembled Prototype

Testing the prototype with Red Pitaya Function Generator

Test Setup

Frequency Test up to 20kHz

The above video shows the frequency response of the Li-Fi system. The next stage is building the Li-Fi Receiver

Building the Li-Fi Demodulator

Assemble the circuit in a perf board and finish the soldering.

Generating Piano Music using Python

SCPI Server

Red Pitaya board can be controlled remotely over LAN or wireless interface using MATLAB, LabVIEW, Scilab, or Python via Red Pitaya SCPI (Standard Commands for Programmable Instrumentation) list of commands. SCPI interface/environment is commonly used to control T&M instruments for development, research, or test automation purposes. SCPI uses a set of SCPI commands that are recognized by the instruments to enable specific actions to be taken (e.g.: acquiring data from fast analog inputs, generating signals, and controlling other peripheries of the Red Pitaya platform). The SCPI commands are extremely useful when a complex signal analysis is required where SW environment such as MATLAB provides powerful data analysis tools and SCPI commands simple access to raw data acquired on the Red Pitaya board.

Features

  • Quickly write control routines and programs using MATLAB, LabVIEW, Scilab, or Python
  • Write testing scripts and routines
  • Take quick measurements directly with your PC

Block Diagram explaining SCPI on Red Pitaya

SCPI Commands over Python

The Red Pitaya Module in Python provides methods that are easy to implement. Refer to the documentation for more information on SCPI.

The following SCPI command is used to set the frequency of the fast analog output channel in Python:

rp_s.tx_txt('SOUR1:FREQ:FIX ' + str(f))

Where f is desired frequency to be outputted.

To know more about interfacing Red Pitaya with Python, watch the following video:

Playing tones

To play the keyboard notes, we need to know the frequency of each note. For simplicity reasons, I took the 5th octave.

Here's an image from Digilent's Reference:

The respective frequencies of the keyboard notes for a song with the required delay are to be sent to the SCPI server. Refer to the code in the Python directory of this repository.

Testing the Li-Fi Audio System

Li-Fi Audio System with Multiple Receivers

Reflective Solar Cell

To have multiple receivers to the same light signal, a reflective solar cell is required as shown in the image below.

This specific type of Solar Cell absorbs some light falling on it and reflects the rest.

Block Diagram of the Multiple Receiver Setup

When light is reflected from a surface, the angle of incidence is always equal to the angle of reflection, where both angles are measured from the path of the light to the normal to the surface at the point at which light strikes the surface. This is called the law of reflection. Thus, multiple receivers can be used by proper placement of Solar Cells.

Two sets of receivers are to be built for this model

Final Setup

Working of the Li-Fi Audio System with Multiple Receivers Model

Software Requirements
  • Python version 3.10.0 or above

Installation
  • Once you're done with the hardware, make sure you give the right connections as mentioned in the circuit diagrams.
  • Go to the Red Pitaya's Home Page > Development > Run
  • Note down the IP address in which the SCPI server is hosted.
  • Create a directory in your local machine and clone this repository using the command
$ git clone https://github.com/yeshvanth-m/Wireless-Audio-Transmission-using-Li-Fi.git
  • Navigate to the Python Folder and then run the following command, say the IP address of the SCPI server is "192.168.137.43"
$ python Play_Music.py 192.168.137.43

How to Use the Code

The Play_Music.py file contains the code for generating the Piano Music. I've set the frequencies corresponding to the 5th Octave, however, you may modify the code and add additional functionalities.

The string notes contain the keyboard notes and the delays for a particular song. You can play any music of your choice just by editing the notes string. For example, the Piano Notes for “London Bridge is falling down” is given as

notes = "g a g f e f g , d e f , e f g , g a g f e f g . d , g . e c"

And, the notes for "Mary Had a Little Lamb" is give as

notes = "e d c d e e e , d d d , e e e , e d c d e e e e d d e d c"

You can write notes for any other piano song the same way.

Acknowledgements

I would like to thank the Red Pitaya team for sending me the STEMlab 125-10 Starter Kit and giving me this opportunity to explore and learn new things!

Code

Python Code

Credits

Leave your feedback...