Question

What would be the best way to make it so that there would be no error when sending a message using binary via infrared. Currently I am sending messages by having them encoded into their binary ascii values then having two Arduinos with infrared lights and sensors that check for a starting bit light then read in the messages by checking if the infrared light is on or off in 3 millisecond intervals.

I need to make it so that no matter what happens (i.e. interference from a remote or other Arduinos) the correct message will still send.

I would also like to make is so that even if both Arduinos try to send a message at the same time they will both get their messages to each other.

I am sending and receiving the messages through the serial monitor of the Arduino IDE.

PS: I am getting a problem where if I send a lot of letters at once, they start to be jumbled after a certain number of characters. I.e. if I were to type 1 - 30 with spaces in between the numbers, I would get as result: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 14 15 a s .... after 17 the numbers would become jumbled.

If you have any idea on what the problem could be I would be very grateful!

Was it helpful?

Solution

Getting no errors with IR is going to be tough. The problem is if it misses one blink, it gets all shifted, then your screwed. Sending 2 at a time will also be hard, as the arduino an't do parallel processing.

I would recommend a different protocol. IR is not great for lots of info. serial is super easy if you don't need wireless, if you do, go with bluetooth, such as 2 blueSMIRFs. you will have to set one up as a master, but then it is just like serial communication.

Do some googling, but I think IR is not going to work out with whole messages. 1 or 2 numbers, sure, but a whole sentence or something is just not going to work out well.

the one thing to try would be to send the message 2 or 3 times, and compare to see if they are the same. if yes, chances are it is right, but if different, you could request a resend.

you might also want to slow it down if you can, and use longer pulses and pauses, that will give it more time to register, meaning it should be more accurate.

good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top