Sending commands to IR transmitter

I have an air cooling system in my house, controlled by IR remote.
I wish to send on/off commands and maybe more using the electric imp.
Assuming I have an infrared transmitter, how do i configure it to do such things?
How can i find out the IR codes to mimic my remote?

the best way to learn IMO would be the arduino site. they have a couple examples, also to build a “learning” IR remote

Well, since i need to learn the remote, i need both receiver and transmitter.
But how do i configure the gpio ports? to what type?
Arduino isnt really known to me, and the variety of examples for imp is a bit low
what is the “concept” of things, in order to interpret a read/write of the IR?

I saw this but couldnt connect much with the current platform

Also, an IR led has only 2 legs, so how do I control it? Analog out / PWM?
has anyone experienced it before to share some knowledge of working with it with the imp?

IR LED is either ON or Off so this is digital. You need to have a transistor to drive it because it will require more current than comes from the Imp. The first thing to do is modulate the ON/OFF status at 38kHz square wave. Some would say to put this at 30% duty cycle meaning ON for 30% and off for 70%, each period being 1/38kHz. The amount of current to allow depends on your parts but it might be roughly from 20mA to 100mA (but only in bursts so average is much lower)

On top of that, the command is a custom stream of information and there are various protocols. One of the more generic ones is NEC -which might be what your product uses.

http://wiki.altium.com/display/ADOH/NEC+Infrared+Transmission+Protocol

to find out which protocol you have, you need to purchase an IR reciver such as SEN-0855 from Sparkfun. Another option is to crack open any electronics gear that has infrared reception. There will likely be a three-terminal component that is demodulating the signal for you. use a digital storage oscilloscope and capture the signal from this device with a falling edge trigger. The components are often reverse logic meaning they will sit at 5V or 3.3V until an IR command is seen and then they drop to 0V for some period to indicate start of transmission. from there of course the signal will be a square wave around 6x or 10x slower than 38kHz.

Some other protocols are Panasonic, Samsung, Yamaha, Sony.

more good stuff here.

http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html

Someone else might have to answer with a good idea about how to do IR transmission with the Imp. I don’t have a feeling for whether the platform would be fast enough or accurate enough with the timing. Might one do a series of imp.wakeup commands with the timing of each pulse passed to the wakeup command and the following function having the next timing, etc. Every other wakeup would result in the pin going high, then low, etc.

It might take 40 or so of these functions in a row to complete a command.

I am also a beginner in C and in Imp , but I have written Arduino software to decode a Panasonic IR command so I know a little.

Hi mjkuwp94,
thank you, thats a whole lot of information in one post. tnx.
I did realize that to do it, i actually need to have one of the pins set to digital out, sending a pulse trough a resistor to lower the current to what the ir led supports.
then, to start modulating with tons of wakeups “1”,“0” and so, in such a way to create a 40± pulses signal. thats seems alot of work.
but it seems like something i could atleast try.
but im not sure im well equiped for recording the signals of my remote.
i dont have any oscilloscope or other equipment.
Is it possible to take an IR receiver (not the one you suggested, something different i have in the nearby shop, and take its “out” signal into DIGITAL_IN of the imp,
and from there to read the timings of the message?
as i understand, its not only the sequence of 1 and 0, but their timing which is highly important.

about imp timing, even if i solve all the rest it does seems quite an issue, because i understand that those wakeups are accurate to 1ms, but in the NEC protocol it seems there’re even 0.5ms pulses.
maybe i should give it up before trying :expressionless:

Have you thought about putting the IMP directly into the circuit board area of your system and not even dealing with the remote? Most heating/cooling systems have schematics available (for service techs). I would think it would be way easier, cheaper, more reliable to have the imp located in your unit’s control panel (control board). The other advantage … if the receiver part of your unit ever failed, you would not be able to use your remote or your IMP. The IMP on the control board would work despite the lack of remote function.

I would do such a thing, if i had a A/C with such control board.
its a small wireless remote, working on batteries.
I could do something else, as R.C board and attach the pin to its power button. that would probably do the magic…but its not a lightweight solution…it becomes complicated (physically)

I read around the internet that my A/C works with most universal remotes. does it means i have a good chance it works with NEC protocol? so i could skip the receiver part, buy the transmitter and just try according to the protocol?

also, another question…A/C signals, are they seperated? meaning, “on” is just “on”, or “on” is also “temp=x”,“type=warm/cool…”, as a complete signal, according to the remote’s memory of last action ?

more research about the timing is necessary. Maybe the Imp is fast and precise enough - maybe not. I see there is a PWM out function and that helps tremendously. The next trick is to see how fast you can turn that PWM ON and off with the same pin or worst case use a second pin and then a circuit for AND function of the two outputs.

You mention that you need a resistor in line with an LED to limit the current; that much is true. However you need to do this in a transistor circuit and let the Imp drive the base of the transistor. The Imp can only provide 4mA at most and that will not be enough to blast IR.

I guess we need to wait for Hugo or someone else who is much familiar with the hardware.
about the current, i have a few bjt ransistors in my drawer, i can use any of them together with some resistor from the 5v supply.
if i take the assumption of NEC protocol,
is it possible to somehow know the address of the A/C without having a receiver to record?

The easiest way to do this is to use an AND gate to combine a PWM pin (38kHz modulation) and a SPI output (envelope modulation).

However, SPI currently puts gaps between bytes, which means that this won’t work neatly. This is on the list to fix.

enough said…i’ll put it on hold for the meanwhile

I’m working on a similar use case: IR remote. Looking forward to hear about support for continuous SPI out or other ways to accurately send out envelope modulation with 300us resolution.

How about using a specialist chip for doing the fiddley stuff?

A quick google came up with this

http://www.innotechsystems.com/ic8205.htm

Thanks for the reference. Looks like a very useful IC. I’ve emailed them to ask about price and availability. As an alternative plan, I’m thinking to hook up a general purpose IC (ATtiny?) to perform the specialist functions.

I will try my first project with imp, it will be a HVAC controller and temperature sesnor integrated.
My conditioner is controled by Infrared and i have a hexa code for remote, captured with my old universal remote (philips Pronto). The first idea is send tcp codes to imp trigger infrared commands to HVAC, and get temperature value over tcp too.
My doubt is if imp can send this code and how do it (manage Hexa to imp)?

Have a look at Sana, which does IR TX & RX: http://devwiki.electricimp.com/doku.php?id=sana

I’ve no idea what code format the Pronto uses though…

http://www.remotecentral.com/features/irdisp2.htm

Looks like it may describe the format

After we moved to the new dev site, that Sana link should be http://electricimp.com/docs/hardware/resources/reference-designs/sana/

look at http://pebbleair.com