# Theoretical maximum data rate possible for LiFi implemented with webcams

## Background

If you do a quick search you can quickly find more than two million articles about LiFi.  Recent articles I’ve seen have talked about obtaining data transfer rates of GB/s. What I became interested in was whether I could transmit using some sort of cheap light source and then receive using a cheap webcam.  The idea is to simply flash the light and have the webcam detect the flash. So in principle we are treating the webcam as a one pixel device and not taking into account the fact that a webcam can provide spatial awareness.

## Generous Hardware Specifications

Let’s assume some rather generous specifications. Say the webcam can refresh at 30 frames per second and presents 256 levels in each of the YUV channels. This means that the number of unique levels the camera can detect are 256 * 256 * 256 =  16777216 (i.e., 24 bits). I’ll assume that my light source can match or exceed these specifications.

## Hartley’s Law

It turns out that in 1928 Hartley cracked the problem of determining the maximum data rate (R) that you can send a information at given the frequency (B) at which you can send “symbols” and the number of separate resolvable “symbols” you can receive (M)

$R\leq 2B\log_2(M)$

Plugging the above, overly generous, numbers into Hartley’s Law we find that the maximum rate we could send is a depressingly low 1440 bits per second.

## Going faster than 1440 bps

So using the above equipment in the way I specified, 1.4kbps is the limit. So to go faster we need to change the assumptions. One way would be to get a receiver that can go much faster than 30 Hz, which means not a webcam.  Another way to go faster is to make use of the spatial ability of the webcam.  Perhaps some sort of QR Code movie?