5

I just started using the raspberry pi and I intend like many others to use it for home automation. After hours of trying to capture the input of the AC remote with irremote and actually using raw data in the end the AC started and was taking commands and I thought I was ready to move on to installing LAMP and build a webpage from where I could control my devices. What is setting me back is that the IR led needs to be somehow perfectly alined with some devices ( the AC, works better with the TV but still not like it's remote ). I was under the impression that I could get the same kind of input like that of the original remote which I can point at any wall in the room and still have it sending signals.

A little bit about the hardware

I connected a brick IR LED from the Arduino ( see below ) enter image description here

I chose this solution because it has a transistor built in and it's safer to connect directly. I connected the IN ( see image ) to the GPIO pin 23 and the GND to the Ground pin ( the one next to the GPIO PIN 23 ).

The only thing I also have connected is a IR receiver ( could that be taking power if it's not used ? )

How could I increase the range of the LED? Is there a better way to connect it? Should I isolate it and use some foil around it?

Any advice is welcomed!

Many thanks

EDIT: I was looking up solutions for this problem and ( I don't fully understand electronics ) I was thinking of connecting the LED to the 5V pin and to the GPIO thus trying to give it more power, would that be a threat to the GPIO pin or the RPI itself?

SECOND EDIT: I understand now that the 5V pin is not intended to be used that way, it seems like a dead end. ( http://www.raspberrypi.org/forum/viewtopic.php?f=29&t=57018 )

THIRD EDIT: Ok so I was thinking of changing the pin state from LOW to HIGH right now gpio readall outputs this:

+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name   | Mode | Value |
+----------+------+------+--------+------+-------+
|      0   |  17  |  11  | GPIO 0 | IN   | Low   |
|      1   |  18  |  12  | GPIO 1 | IN   | High  |
|      2   |  27  |  13  | GPIO 2 | IN   | Low   |
|      3   |  22  |  15  | GPIO 3 | IN   | Low   |
|      4   |  23  |  16  | GPIO 4 | OUT  | Low   |
|      5   |  24  |  18  | GPIO 5 | IN   | Low   |
|      6   |  25  |  22  | GPIO 6 | IN   | Low   |
|      7   |   4  |   7  | GPIO 7 | IN   | Low   |
|      8   |   2  |   3  | SDA    | IN   | High  |
|      9   |   3  |   5  | SCL    | IN   | High  |
|     10   |   8  |  24  | CE0    | IN   | Low   |
|     11   |   7  |  26  | CE1    | IN   | Low   |
|     12   |  10  |  19  | MOSI   | IN   | Low   |
|     13   |   9  |  21  | MISO   | IN   | Low   |
|     14   |  11  |  23  | SCLK   | IN   | Low   |
|     15   |  14  |   8  | TxD    | ALT0 | High  |
|     16   |  15  |  10  | RxD    | ALT0 | High  |
|     17   |  28  |   3  | GPIO 8 | IN   | Low   |
|     18   |  29  |   4  | GPIO 9 | IN   | Low   |
|     19   |  30  |   5  | GPIO10 | IN   | Low   |
|     20   |  31  |   6  | GPIO11 | IN   | Low   |
+----------+------+------+--------+------+-------+

GPIO nr 4 ( which I am using ) is now set to low, I found that there are ways to change the pin from LOW to HIGH ( http://pi4j.com/usage.html#Control_Pin_State ), could that potentially cause a problem?

  • How many kilometres do you want to extend it by? – Piotr Kula Feb 19 '14 at 11:09
  • Kilometeres? no. I just want it to have a better range, right now if it's not perfectly aligned with the device it doesn't work. I mean perfectly, I have to align it very carefully and I would like to make it more powerful in some way in order to work from anywhere in the room. – Mircea Sandu Feb 19 '14 at 11:49
  • Do you know that you can see the flash of an IR led with a camera (e.g. a smartphone camera)? It's all about light intensity. I don't know how you can increase the range, but you can make it flash and see how it looks from different angles – foibs Feb 19 '14 at 11:56
  • any ideas on how to do that? Right now I don't see a flash with the camera when it sends commands. not even in complete darkness – Mircea Sandu Feb 19 '14 at 11:58
2

Use multiple LEDs grouped together.

You probably need to connect them in parallel, with a current limiting resistor for each LED. Connecting them in series gives problems as each LED needs between 0.6 and 3 volts to operate (depending on the type). With a 5V rails you run out of slack very quickly.

Connect multiple LEDs to the same GPIO pin. They all work together, making a stronger signal. Here's a simple diagram of how to connect them up.

enter image description here

The +V would be your GPIO pin. The resistor R depends on how much current the LEDs can take. This will usually be about 20mA. The GPIO supplies 5V, Ohms law tells us R=U/I => 5/0.02 = 250 Ohm. 250 Ohm resistors are hard to get, take the closest for the E12 range, which will be 270 Ohm.

I think the GPIO pins can supply 100mA max (check this!), so you can connect up to 5 LEDs.

|improve this answer|||||
  • thanks for the answer, so you are suggesting that I connect multiple LEDs which will in fact send the same signal at the same time using different GPIO pins? – Mircea Sandu Feb 19 '14 at 12:23
  • 1
    ...updated my answer – Elmer Feb 19 '14 at 13:24
  • He is not trying to build a nightvision camera. How many remotes do you see with an array of IR's? This is just ridiculous answer! – Piotr Kula Feb 19 '14 at 13:27
  • Take any remote from the '80 and you'll see 2 or more LEDs to do the work. It's a bit of a crude solution, I agree. But ridiculous..? I beg to differ – Elmer Feb 19 '14 at 13:30
  • 1
    It's actually a plausible solution, and although if it wouldn't actually help the distance ( if it works ) it will surely be much easier to target more devices at different angles. I will buy some extra LEDs and try this! – Mircea Sandu Feb 19 '14 at 14:00
2

It not really about the intensity of the light but about the timing.

The Pi is not real time.. that is why you might have issues. The receivers on the TV's are very sensitive (specially designed for IR receiving) but the light signals flash so quick that you cannot even differentiate while looking at an IR with a camera (unless is a high speed camera) What you really need is a RealTime MCU like Atmega with its own oscillator (not built in one) because the frequency must be as perfect as possible each time you want to send your IR signals.

Its like its sending morse code to the tv, in super high speed. Everytime you see a flash on your camera there could actually be tens or more flashing happening within 100 milliseconds sending specific "morse" code style that must be precise.

Commercial devices are very very difficult to work with because if a segment of your IR is off slightly it will get rejected. This is to reduce IR noise from other remotes or remotes that send similar signals.

The reason you have to be perfectly aligned is to do with timing. At an angle the light reflects differently and slight shift in time just gets rejected.

There is nothing you can do to increase the range and increasing intensity of the IR light might make it worse! Because the IR does not need to be fully lit and the reciever can already see this.

Here is an example I found on the internet. This shows that the LED actually flashes 6 times on and off within 1millisecond, with a short silence windows for separating . A remote could send this command 20 times a second but as longas 1 complete command gets to the TV that is fine. If more than 1 the TV knows not to repeat it unless the next second revies the same command (even if its 20 times).

enter image description here

* Some more examples of how binary data is sent as IR

Here is a nice example of crazy remote control protocol, with a total time of data frame that takes 24,889ms (You see the precision here)

enter image description here

|improve this answer|||||
  • I don't really see why the PI not being real-time would make a difference? It sends the same signal only with a delay, but the signal is the same, otherwise the device wouldn't recognize it. Why does the tv remote work even if pointed at another wall? Why can't I achieve the same effect with the PI? It was my belief that the IR signal sent bounces off the wall and goes to the device, which means it's just not powerful enough, doesn't it? – Mircea Sandu Feb 19 '14 at 13:58
  • Because the Pi might generate the signal correctly once because it got lucky and timed it properly. But really that was once out of 20 tries. That is why a normal remote can send singals off walls even because 20/20 signals it sends a second a good fraction of those get to the TV. The TV then recognises to do the command once and not 20 times. This is why timing is important. You need to understand the frequency of which the light is getting sent is so fast it must be accurate. The Pi canot generate such accurate timings because of Event based OS, and not real time OS, like Arduino. – Piotr Kula Feb 19 '14 at 14:01
  • I suggest you use your Arduino and the Arduino IR libraries, then use your Pi to send commands to the Arduino via UART. It will save your head from becoming bald. – Piotr Kula Feb 19 '14 at 14:03
  • so you are saying that a remote actually sends the signals multiple times to make sure that they get received? Because I could replicate that by editing the remote configuration files. I don't really see what difference does the timing do, if I align it with the device it works every time, and it's an AC command which is very large. – Mircea Sandu Feb 19 '14 at 14:11
  • I will try using an Arduino connected to the PI and see if that changes results, I was actually hoping to make it as small as possible – Mircea Sandu Feb 19 '14 at 14:18
-1

use a capacitor in series with the bulb before power supply . This will allow capacitor to store the charge and release it in a burst when a button is pressed. I suggest a capacitor of 100uF . (Please check polarity of capacitor)

|improve this answer|||||
  • A large capacity used in that fashion will render IR transmission of signals a little impossible due to its time constant? – Ghanima Feb 8 '15 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.