IR Data Transfer with USART

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Freaks ..

I want to transfer about 480 byte from one atmega8 to another 1m(or less) far atmega8.

I will use USART protocol because it is easier to decode on the receiver side.

I've read some topics about it which they use in it an Tsop1738 receiver , but I only have SM0038 receiver and the receiver ic in the image below ( it dose not have any text on it at , i think it is TSOP4838 but i'm not sure)

IR Receiver

I'm planning to follow this topic : 

https://www.electronicwings.com/avr-atmega/ir-communication-using-atmega1632

Can i change the buadrate from 1200 to like 9600 ?

How can i replace the TCOP1738 with one of the ICs I have ? And what to change in code ?

Any other notes or recommendations ?

THANKS

 

A Beam of Light out of the War

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's using IR remote control protocol - not great for sending arbitrary data.

 

What you want is an IRDA SIR transciever.

 

Some microcontrollers have that built into the UART ...

 

https://www.maximintegrated.com/en/design/technical-documents/app-notes/3/3024.html

 

http://www.ti.com/lit/an/slaa044/slaa044.pdf

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are going to have the transmitter and receiver be about 1 meter apart, I suggest using a physical wire connection. Even wire-wrap AWG30 is good for 1 meter. Since nothing in electronics, embedded-systems, or computer software is ever as easy as you think that it is going to be when you are in the planning stages, I recommend getting the system functioning at a applications level using the physical wire interface, and then implementing a wireless connection (if really needed for a 1 meter distance.)

 

The basic IR technology is 30-40 years old, which means that it is going to be complex and expensive to implement compared to more modern technology.  Today, most people implementing an in-the-room wireless solution for less than about 30 meters will be using Bluetooth.  A pair of HC--05 modules between two computer systems can implement a much higher than 1200 baud linkage for about the same amount of development work as an old-technology IR system.  There's a bit of a learning curve for Bluetooth, but it is relevant skill that you will be using repeatedly in the future.  Whereas IR is an obsolete technology with fewer implementations every year.

 

Another approach is to switch from an AVR to a WeMOS processor module board.   This CPU includes a full TCP/IP WiFi software/hardware implementation, full duplex Bluetooth, and a 32-bit microcontroller with 4Megabytes of program/data RAM.  This device costs the same as a AVR CPU plus printed circuit board combination (about $3-$5 US) and has an Arduino implementation for ease-of-programming.  It won't be obsolete for at least 20 years, and there is lots of memory space and bandwidth to add many future features into your product without having to do a hardware upgrade.

 

IR systems are slow and 1200 baud may be your max speed for the IR components.  IR is designed for television remote control hand-held devices, and 1200 baud is considered plenty enough fast for that application.   And you need to oscillate your IR carrier signal at 38KHz.  Nor do I believe that the BC547 transistor is strong enough to blast the IR transmit diode off and on at 38KHz in pulses that will saturate the photo-transistor on the IR receiver, regardless of what the Internet schematic and project plans say.  And it would be wise to implement some kind of error-checking protocol-formatting when you are sending a block of data that is 480 bytes in size.   The Bluetooth protocol implemented internally on the WeMOS CPU will or should handle this protocol-formatting for you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
The basic IR technology is 30-40 years old, which means that it is going to be complex and expensive to implement compared to more modern technology

and then

Simonetta wrote:
Bluetooth

LOL !!!

 

laugh laugh laugh laugh laugh laugh laugh laugh 

 

BT is infinitely more complex than SIR!

 

likely also more expensive.

 

There's a bit (sic) of a learning curve for Bluetooth

No kidding!!

 

 

IR systems are slow and 1200 baud may be your max speed for the IR components.

SIR does 115200.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

awneil wrote:
No kidding!!

 

awneil, we are all sharing knowledge here :)....

 

Anyway, I agree with simonette. nordic right now are in the forefront, their libraries made everything easy and possible...coding something in 10 lines can be done in one line (e.g. application timer). I find that the learning curve also became easier, they have tutorials, a very active forum, blogs...etc. even if you lack basic knowledge you will not find it that hard to start....

 

ofcurse apart from setting up the development enviroment which is a little bit messy. but overall, blutooth mesh and threads are now becoming more easier to understand way more than some years ago.

 

Regards,

Moe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

As the others have mentioned, using uart with a remote control ir receiver is not the best idea.
Here’s why:
The remote controls like for your aircon and tv do not use uart formatted data. They use manchester or pulse position encoding for reliability. These formats allow the receiver to set the slicing level reliably. Uart data doesn’t allow this. So whilst uart data ‘works’, its not going to be reliable and not at 9600 baud. 1200 is the limit.
Either accept the limitations of what you have or look for something else more suited.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

but the fact remains that BT/BLE is infinitely more complex than a simple SIR link - which, as far as software goes, requires nothing more than the standard UART.

 

and the hardware is trivial, too.

 

Sure, the tools help you a lot - but my point was the irony of calling IR "complex" and then suggesting BT.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes sure, I agree with you in this points. In terms of complexity the comparison between UART and BT/BLE is nonsense.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks all for the awesome info 

awneil wrote:
What you want is an IRDA SIR transciever.

Actually I wanted to make the connection with the components I have. And Noob friendly 

I already have an HC-05 BT shield and i made dozens of projects on it , and it's ridiculously easy to use with USART .

But I want a cheaper solution

Simonetta wrote:
I suggest using a physical wire connection

My receiver circuit is rotating on a motor ( It's a POV display) so that's not an option

 

For the IR , I said 1m as a Max .

Any way i will try sending 480 byte via the ir as mentioned in the article (with replacing the  tsop1738 with my sm0038 ) and I'll post the results  .

Any idea on a  reliable cheap wireless data transmission ? Please note that i want it to use as low as possible code in the receiver side . 

Thanks Freaks ..

A Beam of Light out of the War

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I'll second (or it is third now) the recommendation for IrDA SIR. I successfully used this in a product back in 1999/2000 and achieved your 9600 baud 1m distance requirements.

 

Our Silicon Overlords; Microchip, offer PIC24 and PIC32 microcontrollers with UARTS that have built-in support for IrDA SIP. They also offer an IrDA software stack but that's probably irrelevant because you only want to talk to your second device and can rely on the physical layer only.

 

UART: http://ww1.microchip.com/downloads/en/DeviceDoc/70000582e.pdf

STACK: http://ww1.microchip.com/downloads/en/AppNotes/01071B.pdf

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Some microcontrollers have that built into the UART ...

N.Winterbottom wrote:
PIC24 and PIC32 microcontrollers with UARTS that have built-in support for IrDA SIP.

Thanks for the examples!

 

Are they any AVRs ?

 

ISTR that (some of) the SAM D have it ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
offer PIC24 and PIC32 microcontrollers

Thanks for the info , 

unfortunately those are not available at all in Syria (where i live) , even if they did , they would by extremely expensive.

 Any other ideas  ??

Thanks again for your time

A Beam of Light out of the War

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AbDoO_ wrote:
{re. Microchip PIC24 & PIC32} unfortunately those are not available at all in Syria

So you can buy AVR but not PIC, how bizarre.

 

Well the XMEGA series pretty much passed me by, even the Atmel reps that I saw at the time of it's introduction didn't really push it much. Anyway as far as I can tell, all the XMEGA series have an "IRCOM – IR Communication Module". This connects between any one UART and external RX/TX pins.

 

Beware - despite the name similarity, it's a completely different microcontroller to megaAVR. To those seasoned to megaAVR there will be much re-learning on the peripherals.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AbDoO_ wrote:
 Any other ideas  ??

Now that you know what to look for, search for parts which are available in your area, and support SIR ...

 

Or use an external ENDEC ...

 

Is this transmit only?

If so, it may be possible to do it in software - like a soft UART ... ?

 

Or go back to the IR remote control, and adapt that - remembering that it is not going to be a simple UART;

you would have to encode your data as if they were presses on an IR remote control's keypad ...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Sat. Sep 28, 2019 - 10:11 AM