element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs Li-Fi with Arduino and Python
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: RParkerE
  • Date Created: 18 May 2019 1:57 AM Date Created
  • Views 5448 views
  • Likes 7 likes
  • Comments 10 comments
  • python
  • arduino project
  • python 3
  • arduino due
  • arduino_tutorials
  • ardexpert
  • lifi
  • python3
Related
Recommended

Li-Fi with Arduino and Python

RParkerE
RParkerE
18 May 2019

Light Fidelity

Background:

Light Fidelity (Li-Fi) is a wireless communication method which uses light to transmit data between devices. "In technical terms, Li-Fi is a visible light communications system that is capable of transmitting data at high speeds over the visible light, ultraviolet, and infrared spectrums," (Wikipedia). The actual term "Li-Fi" was termed by Professor Harald Haas in his TED Talk, a co-founder of PureLiFi. This technology is fairly new and many different organizations are trying to standardize it.

 

Project Overview:

Develop a Li-Fi technology that is consumer friendly both in price and application, maximized for distance and speed. Below is a mock up of our final design and the underlying components:

 

imageimage

In this project the micro-controller used was the Arduino Due, due to its ease of use and ability to quickly prototype with it, and the fact that the Due has an ADC. The Arduino itself does no processing of data, it simply forwards the processed data from the UART to the Serial1 TX pin and from the Serial1 RX pin to the UART. The ADC on the Arduino Due is used to set a calibration voltage which is used in a comparator to filter out noise. Both the receive and send circuits can be found below:

 

image

All of the data processing is done on the computer itself. This is done by a Python program with a GUI which makes the selection of files to transfer over the Li-Fi medium more friendly for end users. You can view the code for this "driver", the firmware for the Arduino, and the Eagle files for the custom PCB at https://github.com/RParkerE/LiFi-With-Arduino.

 

image

 

One reason for this blog is to showcase an exciting technology and some cool applications for this community to attempt, but I would also love for this project to be added on to and developed further, and I hope this post brings attention to this and us, as a community, can develop a very cool and unique product available for all to take full and unlimited advantage of.

 

 

How It Works (A Bit More Detail)

 

The Python GUI must be opened on both computers. When opened both Arduinos are by default waiting to Receive (to out.txt), this can be changed in the GUI by selecting different files to receive to or to send, and can be sent by simply clicking the 'SEND' button.

Once the data transfer is initiated by sending data from one device, the data is processed and a meta packet is sent containing the number of packets to be received, the number of null bytes padded to the last packet, and the extension type of the file. After that is sent, the actual data is split into 56 byte chunks, a 4 byte index and a 4 byte checksum is added to the data chunk, creating a 64 byte packet.

These packets are transmitted from the computer to the Arduino over the USB port, which pushes it to the Serial1 TX pin (where the LED is connected). On the receiver side, when the LED goes low, it starts reading the data. if the data is not corrupted it writes it to the file, if the data happens to be corrupted, the packet number is added to a list and is asked to be resent after all of the data has all been transmitted.

The ADC on the Arduino is used to provide a reference voltage to the comparator that takes in the output of the photodetector, in order to provide a threshold to reduce the effect of noise on the signal.

 

Please comment if you have any questions, comments, or suggestions as I would love for this to start some great conversations around this great new technology.

  • Sign in to reply

Top Comments

  • dougw
    dougw over 6 years ago +6
    Cool tech. What data rates can your system achieve? And what distance works?
  • RParkerE
    RParkerE over 6 years ago in reply to dougw +4
    We were able to get up to 115 kbps reliably at a distance of 6 feet. We ran into some limitations with the actual physics of our components which limited the data rate with our simple OOK system. We also…
  • neilk
    neilk over 6 years ago +1
    Very interesting post. Thanks for sharing.
Parents
  • dougw
    dougw over 6 years ago

    Cool tech.

    What data rates can your system achieve?

    And what distance works?

    • Cancel
    • Vote Up +6 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • RParkerE
    RParkerE over 6 years ago in reply to dougw

    We were able to get up to 115 kbps reliably at a distance of 6 feet. We ran into some limitations with the actual physics of our components which limited the data rate with our simple OOK system. We also used an IR LED in order to minimize noise from surrounding sources, allowing us to achieve greater distances.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • RParkerE
    RParkerE over 6 years ago in reply to dougw

    We were able to get up to 115 kbps reliably at a distance of 6 feet. We ran into some limitations with the actual physics of our components which limited the data rate with our simple OOK system. We also used an IR LED in order to minimize noise from surrounding sources, allowing us to achieve greater distances.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube