I need some kind of USB infra-red receiver and transmitter that I can program...

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
I'm not really sure what to look for. I need something that I can receive IR signals with as input to my program, as well as transmit IR as output from my program.

I have a "Windows Media Center" USB remote, but I'm not sure if this would be of any use. The reason why I'm looking for a USB solution is that my laptop doesn't have a serial or parallel port.

Thanks in advance!
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
You could build your own pretty easily with a microcontroller. Use a USB-to-serial cable or get a microcontroller board which already has a USB connector on it.
 

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
I have never worked with microcontrollers. I don't have a programmer or any other dev tools for them.
 

CycloWizard

Lifer
Sep 10, 2001
12,348
1
81
I have never worked with microcontrollers. I don't have a programmer or any other dev tools for them.
Most will come with all the dev tools you need and are pretty straightforward to program if you have any programming background. I can't recommend any that will be good for your specific application, but I'm sure someone here can.
 

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
Well I need the software to run on a PC, not a microcontroller... So I don't mind learning about MCU's and building something, but it must serve this function:

- Plug into a USB port
- Provide IR input to software on the PC
- Provide IR output from the PC

I'd really like to avoid MCU's for the time being, but if this is the only way, then so be it.
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
What he wants is a USB dev board. The IR signal is really going to be just a straight forward blinking led (on or off) which a dev board should be able to easily power. The receiver, on the other hand will need two parts, an ADC (analog to digital converter) and the actual IR receiver. The IR receiver will output a voltage that varies with the input voltage and the brightness of the IR light hitting it.

Over all, the most expensive component will be the usb dev board.
 
Last edited:

Cogman

Lifer
Sep 19, 2000
10,284
138
106
I should note, I haven't had good experiences with USB dev boards. The ones I dealt with were flaky, they would go into an unrecoverable fail state randomly throughout operation. :(
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Well I need the software to run on a PC, not a microcontroller... So I don't mind learning about MCU's and building something, but it must serve this function:

- Plug into a USB port
- Provide IR input to software on the PC
- Provide IR output from the PC

I'd really like to avoid MCU's for the time being, but if this is the only way, then so be it.

You can buy an Arduino for $25 or so. It interfaces to the computer with USB (its really a serial connection with a USB-to-serial adapter). Arduino was desgined to be super simple. All of the hardware interfacing you need will be abstracted away.

On the PC side, you will interface using the serial port. This is as simple as I/O with the console. Any langauge you're using should have some serial library already available.

On the Arduino side, you also interface using the serial port. Same thing, as simple as I/O with the console. The Arduino has a simple serial library available.

Blinking an IR LED will be as easy as saying DigitalWrite(Pin1, high) or DigitalWrite(Pin1,low).

Reading the input LED will be as easy as saying DigitalRead(Pin2).

Since you're not running anything else on the Arduino, you can handle timing by just using waits or sleeps.

The only hardware you'll need is the Arduino, a usb cable, a few IR LEDs, and a few resistors. The LEDs and resistors will be extremely cheap.
 
Last edited:

dighn

Lifer
Aug 12, 2001
22,820
4
81
if you want to actually transmit and receive data over IR in a real environment, you'll probably need to modulate the IR on the transmitter and filter it on the receiver, or ambient light will likely make it unusable if you simply toggle an LED directly based on data (unless you choose an uncommon wavelength and use a proper optical filter, which I think is not easy to get. or make it very directional etc.).

is the IR you receive what you send or is it from another source?
 
Last edited:

Leros

Lifer
Jul 11, 2004
21,867
7
81
if you want to actually transmit and receive data over IR in a real environment, you'll probably need to modulate the IR on the transmitter and filter it on the receiver, or ambient light will likely make it unusable if you simply toggle an LED directly based on data (unless you choose an uncommon wavelength and use a proper optical filter, which I think is not easy to get. or make it very directional etc.).

is the IR you receive what you send or is it from another source?

They sell little IR receivers for <$5 that have all the filtering built in.
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
They sell little IR receivers for <$5 that have all the filtering built in.

true. just need to modulate it on the sending side which is relatively easy to do even without a specialized module.
 

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
dighn and Leros,

All I know is that the signal must be modulated at 28.8 khz and data is transmitted at 2400 bps, 8-n-1. Would the Arduino still be appropriate for this? I haven't a clue how to modulate a signal and transmit at a specific baud rate.

I'm trying to abstract as much of the hardware as possible. Really trying to just focus on software. I know I can't avoid dealing with hardware, that's fine, but I'm really just looking for an easy solution.

Thanks guys!
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
dighn and Leros,

All I know is that the signal must be modulated at 28.8 khz and data is transmitted at 2400 bps, 8-n-1. Would the Arduino still be appropriate for this? I haven't a clue how to modulate a signal and transmit at a specific baud rate.

I'm trying to abstract as much of the hardware as possible. Really trying to just focus on software. I know I can't avoid dealing with hardware, that's fine, but I'm really just looking for an easy solution.

Thanks guys!

I'm not very familiar with IR protocols but I think 28.8 khz is a relatively uncommon carrier frequency, so either you'll have to find specialized transmitters and receivers, or you'll have to build your own.

Building your own is definitely not ideal: modulation is relatively simple because you should be able to just drive any plain IR LED with a square wave at the carrier frequency, and toggle the carrier with data e.g. send the wave when it's a "1" and don't send anything when it's a "0" - this can probably be done easily with a PWM module, found on most microcontrollers. Demodulation is a bit trickier. Something like the LM567 might work (not sure if it'll meet your bandwidth requirement), or you can use a bandpass filter and demodulate the result (it's essential AM).

It'd be much easier if you can use a common carrier frequency like 38 kHZ because there are readily made receiver modules that'll do the demodulation for you and output a digital signal.
 

Colt45

Lifer
Apr 18, 2001
19,720
1
0
The old IR modules stuck on the serial port, and I presume the USB ones just have an integral USB<>RS-232 converter, and probably show up as a serial port. Should be cake to interface to then. I'd presume you can jam buttons on an 347-in-1 $3 remote, see what comes up on the serial port, and go from there.

Could use micros, but if the above works you don't really need to.
 

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
Well the carrier frequency has to be 28.8 kHz and I have no option to change it. This is because it's being used with old laser tag equipment.

I did come across a Vishay TSOP4830 IR receiver module. It has a carrier frequency of 30 kHz. Do you think this is close enough to do the job? If this would take care of demodulating the signal for me, then I'm pretty much set...

I'm thinking of just buying a USB<->Serial adapter and just modulating the transmission via software.

Thoughts?
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
28.8 is close enough to 30, and within the 3db (half power) range according to the datasheet, so you should be fine with that module.

as for the transmitter, I'm not sure if you have that level of control in software to reliably create a 30 khz carrier. though it's pretty easy to make your own with a 555 timer or something; just need to gate it from RS232 (you may need a level shifter (or even a simple resistor divider for receiving only) if the RS232 outputs the standard 10+v signals).
 
Last edited:

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
Since you don't want to get into the MCU part of things the easiest way to do this that I know of is with this :
http://dangerousprototypes.com/usb-ir-toy-manual/

It is $20 and ready to use and can send and receive IR and even has analyzer modes so you can see on the pc what the signal looks like . The one thing you will have to change is the receiver, the one on the board is 38Khz. Unsolder the one it comes with and replace it with the one you need.


Sending and receiving IR with pure software isn't a good idea, especially with windows. It doesn't like to allow direct access to ports and often will screw with the timing of the signals. Better to use a device that does all the processing then just forwards the data like the device above.
 
Last edited:

Crusty

Lifer
Sep 30, 2001
12,684
2
81
I've built a IR receiver from parts @ radio shack, hooked into my serial port and used lirc on Linux to control it. This was years ago and was fairly straightforward IIRC.
 

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
Well I ordered an RS232 <-> USB dev board that has FTDI's controller built in. All the hassle of getting stable +5v and converting levels to TTL is abstracted for me. Sweet and easy way to get started, I'd say? I could use it in the future for other tinkering ideas, too. And I digress.

A friend says hes got an old 8 bit PIC - one of the low end chips (8 pin). So I'm thinking I could wire everything up on a breadboard and program the PIC to accept serial data, then blink the IR LED at the appropriate rate/pattern. All instructions are 1 clock, except for branches (2 clocks), so the rest is pretty simple arithmetic.

I ordered a couple IR receiver modules too. These should work out of the box, theoretically, in conjunction with the FT232 dev board. The carrier signal is abstracted by the module, and the baud rate is handled by the drivers.

Any thoughts? Input?
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
Well I ordered an RS232 <-> USB dev board that has FTDI's controller built in. All the hassle of getting stable +5v and converting levels to TTL is abstracted for me. Sweet and easy way to get started, I'd say? I could use it in the future for other tinkering ideas, too. And I digress.

A friend says hes got an old 8 bit PIC - one of the low end chips (8 pin). So I'm thinking I could wire everything up on a breadboard and program the PIC to accept serial data, then blink the IR LED at the appropriate rate/pattern. All instructions are 1 clock, except for branches (2 clocks), so the rest is pretty simple arithmetic.

Do you have a PIC programmer ? You will need one to program the PIC with your code.

I ordered a couple IR receiver modules too. These should work out of the box, theoretically, in conjunction with the FT232 dev board. The carrier signal is abstracted by the module, and the baud rate is handled by the drivers.

Any thoughts? Input?

IR receivers have one pin for output. That pin is usually active low meaning it will always be high until it receives a signal then it will go low. Attach a 10K resistor to this pin connected to +5V to prevent false signals. The output pin will go low then high and continue that for the length of the signal it receives. That cannot be connected directly to the ftdi chip in serial mode to process the data. The data would read on the pc as just a bunch of garbage without some sort of software designed to read that format on the pc and timing would be critical. I would connect the receiver to the PIC then the PIC to the ftdi chip rx and tx lines. The PIC can process that data and output it as text over the UART lines.

I think you would have been better to have gone the arduino route as it would be much simpler. With arduino you don't need a compiler on the pc or PIC programmer, and the code is pretty easy to write.
http://www.sparkfun.com/commerce/product_info.php?products_id=666


For the PIC here is some good info with schematics on how to use it for IR send/receive.
http://jap.hu/electronic/codec.html
 
Last edited: