data>binary----binary>data

(Before reading this. Im a complete noob :confused: (only in programming). I just went through all the basic projects. But this project is kinda my dream to do so and what compelled me to buy arduino)

So i have a Arduino Nano and a NodeMCU. I want to figure out a way that both can send and recieve data from pc in binary format. More like a lifi system. I think its more plausible if the pc s do the binary coding and decoding. But they have to transmit that to the arduino/nodemcu in order to lightup a laser and to recive with ldr. Now i cant figure out a code to do this. Help is extremely apriciated. (Moreover i havent found any clean resources to learn coding solely for arduino/nodemcu)

P.s this is a completely personal project. Nothing-nobody asociated

food for thought. I thought of using the serial plotter basic tutorial . the ldr values should have been consistent in dark enviorment. But again i dont know how to talk with the machine so it can do the right thing

The PC, the Nano and the NodeMCU are all digital devices. This means that, "under the covers" everything is in binary. Everything. It may appear to us humans to be decimal or text or whatever, but that's just a trick. A trick that's done in binary! When data is transferred between devices, it's all binary.

I can't quite figure out what your project will look like. Can you draw a "box diagram" showing the various devices, how they are connected and what information is being transferred?

Yeah, here it isā€¦
Its pretty basic actually.
Ps. Iā€™m not exaggerating but pretty desperate for help right now


Ok, that's what I imagined you meant. But the comms between the NodeMCU and the PC and between the Nano and the PC are bi-directional, right? Otherwise a bit pointless.

The theory is ok, but I am concerned that LDR will not be fast enough. LDR react faster than the human eye, but not fast enough for serial comms. Photo-transistors may be better.

Look at this data sheet: LDR and find the rise and fall time for the signals.

Those will be the time for a single BIT in your communication scheme. Makes me wonder why you are using lasers which can be turned on and off on microseconds.

Paul

Unless you're happy with really slow comms, I'd ditch the LDRs and use photodiodes instead.

Edit: beaten to it.

@kaseftamjid, please do not cross-post. Other thread removed.

Yes.. Im sorry i found programming thread after i posted

The problem i have is with coding. I didnt know of the ldr's so low response (compared to laser) and after proper study, i happily will make the move to suggested sensor.

Basic stuff i want the code to do

Sender end:

Read a file from pc through usb>read the byte>light laser accordingly.

Googling and common sense requires some sort of data corrupt prevention method. I can think of sending N of byte beforehand for the computer to check if the file is corrupt. OR, the data could be encrypted as small packets in certain form so IF a packet is interrupted it is sent again before moving on. (Frankly said even im confused if what im saying is hard to understand or not(not in a smartypants way))

Reciever end:

Recive byte data from diode> check encrypted packet for corruption>store in pc

N of packets can be sent beforehand. All is possible in theory, but as i said, im struggling with the code

Useful Google search term "Arduino IRDA"

Hey guys.

Im sorry it took a long time to get back but i was studying a bit. a BIG thanks to AWOL for pointing me towards irda. That helped, a LOT. Few main problems is solved but many came up.

  1. What is the practical maximum hence acceptable error percentage baud rate of the nano. As stated before, the laser can turn on and off in micro seconds. (Yes, AWOL, i saw your response on a previous answer) which also means that its way too fast for the arduino to handle. So what baud rate am i limited to? (Id like to avoid external hardware but please do say if you know any)

  2. Can the arduino usb to serial chip(in my case the ch340) reach the 60MBps cap of usb 2.0?

Ps. I think the arduino cant reach 60MBps/480mbps rate, but still question 2

  1. Is a photodiode limited to the set frequency? (i got one from a tv shop hence 38khz)

  2. Considering "newly" found bottlenecks, do you people see other limitation other than above 3?

There is one other parameter you need to look into. That is your LASER. Many LASERS pulse the laser in order to limit the heat generated. IF yours is doing that, it will definitely interfere with your additional modulation scheme.

Paul