Visible Light Communication (VLC) using Arduino Uno

Hi, everyone!

I have this project to connect a computer to the internet via VLC using two Arduino Uno boards, like the diagram bellow:

Home Gateway<-----Ethernet Cable----->Arduino<----VLC---->Arduino<-----Ethernet Cable----->Computer

I'm using the Ethernet ENC28J60 module on both Arduino. The main idea is to get data from internet and then retransmit it by blinking a LED, according to the bit information. The receiver would recognize the light variation and turn it into bits and then forward the information to computer.

The problem is: How do I take this bit information from the Ethernet ENC28J60 module? Is that possible?

If anyone could help me, that would be great! Thanks!

Google "free space optical communication" - also google "ronja twibright labs".

What you are wanting to do is possible, but depending on the distance and speeds you are trying to achieve, it can range from "easy" to "very difficult and expensive".

I'm going to assume that you can get the data to and from the Arduino with this setup (there's plenty of code out there on how to connect via ethernet to the Arduino using the module you have - so no need to detail that here).

What you want to know is how to convert the data into light and the reverse.

Well, if you google "arduino fiber optic communication" you'll be halfway there - just replace the fiber optic with "free air" and the rest (optics and such).

The other half? Well, you also need to be able to discriminate between the light from the LED and ambient light. The way to do that is to use modulation. A simple modulation scheme good for light communication is to use FM modulation. Basically, you set up a "carrier wave" (for light, that would be a known continuous set of pulses of a known frequency - think of the LED blinking at a set speed), then you would vary that modulation by some amount to represent a "HIGH" and by another amount to represent a "LOW". You might also vary it to represent the "START" and "STOP" of a packet of information.

Say you blinked your LED at 10 KHz. Your other Arduino could detect this, and see that it has the carrier wave signal - so it knows it is connected and receiving ok. Then the first Arduino sends a "START" by changing the carrier wave to 9.5 KHz. The second Arduino see this, and readies its buffer for receiving data. Then the HIGH and LOW bits are sent by varying the carrier between 10.5 KHz (LOW) and 11 KHz (HIGH) - then another 9.5 KHz is sent to represent the end of the packet of information.

You'd also have to set up your communications protocol so that each side knows when it is sending vs receiving (this is called asynchronous serial communication) - so that both sides aren't sending at the same time and causing problems (I am not sure if the Arduino is fast enough to allow for bi-directional comms - also called bisynchronous - but you could experiment with it).

For distance, you need not only to use bright LEDs (or lasers), but you also need good optics and alignment on each end (which isn't as easy as you may think), plus probably amplifiers and filtering on the receiving end. Speed will be a matter of how fast you can blink the LEDs.

For how to do the optical side of stuff - besides the info on the RONJA site - look into Forrest M. Mims III's mini-engineers notebook on communications projects - in there, he has some info for the optics side (and you might be able to adapt some of the amplifier/filtering circuits he uses for his audio transmitter). Alternatively, using the optics from a telescope or binoculars could possibly help.

Thanks for the reply!

I've been thinking on how to proceed with this modulation and communication stuff, but with your sugestions that will be a lot easier, thanks.

However, my doubt is more about how to get data from Ethernet Module. I've seen some posts and codes where you can get a text from a particular website and make it be dispayed on an Arduino LCD screen. Link or Link

But, what I'd like to do is to access internet from the computer. That is, from a web browser on computer I could access any webpage, not just downloading files using HTTP get. The Arduino+VLC+Arduino would work only as a bridge device, like a hub or something like that, sending and receiving data through air.

For that, I think I would have to get the bit information (that would be TCP/IP packets) from the Ethernet Module, and transmit to receiver. I don't know if there is a better way to do this (probably there is).

Anyway, thank you again for the help.

I think this library UIPEthernet Library can be useful somehow. I'll try to discover more about it. Any help is welcome :slight_smile:

Serial data can be sent over a broad range of physical channels (wires, wireless, infrared...), by only exchanging the transmitter and receiver hardware. Provided that your (VLC) channel supports the incoming bitrate, it's sufficient to shift out the incoming stream of bits and bytes over your channel. In this case the Arduino does not have to care about transmission protocols, it simply acts as a dumb relay station. In the simplest case you only connect the digital receiver output to your digital transmitter input, with no controller hardware or software in between. Otherwise, if you have to handle a communication protocol and data packets, an ordinary (8 bit) Arduino may not be the right hardware for such a network node.

You do realise that this is going to be slower than Mr Slow on a slow day.

Grumpy_Mike:
You do realise that this is going to be slower than Mr Slow on a slow day.

Of course, OP never mentioned specs, speed, bandwidth needed, etc; I would like to think that s/he knows this, but I have been on this forum too long (as you well know) for that to be thinkable.

@ArthurBedor:

Realize that if you get this working, you'll probably be very lucky to have this link run at 9600 bps over a distance of 100 meters.

If you (somehow) managed to use SPI to send/receive data via an LED (this could potentially be done, but you would definitely need additional hardware outside the Arduino in the form of something to convert the SPI serial stream into the light pulses and back for receiving - plus amplification, etc - essentially, you would be building a hardware - instead of software - modem for light) - you would still likely only get (max, though I am guessing here) in the 100's K baud range.

Again - check out that Ronja project I mention - take a look at their schematics for the trasnceivers, and note the complexity. They were only working with 10BaseT ethernet, too.

This isn't an easy project if you are expecting long distances and high speed. If, on the other hand, you're needs are much more modest, then a DIY system like this can certainly be done.

I never really understood why people say "9600bps" for LEDs.

Rise-Fall time for an LED is about 0.1 microseconds (some LEDs are more...some are even 10s of nano seconds).

Assuming it takes a microsecond (for the fun):
Then thats 1Mbps right?

Then there are plentiful photo-diode designs over over 1Mhz bandwidth...

What is it I am missing?

What is it I am missing?

The middle.
You need some sort of modulation you can't just use on and off because it is too prone to interference by ambient light.

Grumpy_Mike:
The middle.
You need some sort of modulation you can't just use on and off because it is too prone to interference by ambient light.

Right, so I assume carrier frequency for the medium is the limiting factor? Thanks btw, never thought this was the reason for the whole "IR @ 38kHz" etc.

cr0sh:
This isn't an easy project if you are expecting long distances and high speed. If, on the other hand, you're needs are much more modest, then a DIY system like this can certainly be done.

I'm not concerned about speed. This is a small project of mine, just to prove the concept of light communication. The distance is about few meters, one or two.

I took a look at that UIPEthernet Library and I don't think it can help me. I'd need a specific library that would give me these packets unchanged. Although it's quite likely that this library have access to these packets, I have no idea how to extract and use them.

ArthurBedor:
I'm not concerned about speed. This is a small project of mine, just to prove the concept of light communication.

The concept is already proven.

Grumpy_Mike:
You need some sort of modulation you can't just use on and off because it is too prone to interference by ambient light.

This is generally taken care of in the packetisation protocol. Ethernet uses isolation transformers with quite a high pass frequency, in the order of some kilohertz.

Johnny010:
Right, so I assume carrier frequency for the medium is the limiting factor? Thanks btw, never thought this was the reason for the whole "IR @ 38kHz" etc.

It is if the data frequency is low and intermittent as with an appliance remote control. As noted above, if you are sending serious data, the packetisation protocol itself becomes the carrier.

i was looking also for the same project and i cant find any thing on the internet expect your post so if you come out with new results i hope you send it to me or help me reach that point thank you