I started by testing with my Arduino Uno with Ethernet Shield attached. It was the nearest to hand so I thought I might as well see if the TSOP1838 works with it.
| TSOP1838 on small board with pins for use with breadboard |
After finding a blog post that explains the Pins are transposed. From top to bottom in the picture above it is
OUT - connected ot digital pin on the Arduino
VCC - VCC
GND - GND
Compared to the actual pin outs for the PSOP1838 OUT and VCC are swapped.
Then as I expected I'm late to the party I checked if there was a handy library already in place to take if the decoding and I found the fantastic Ken Shirriff Library
Wired it all up correctly and used the library provided.
Uploaded the IRrecvDemo sketch provided with the library and when I pressed a button a remote control the LED on the IR board flashed so date was being received but nothing was appearing on the Serial Monitor.
I tried switching pins.
I added an extra Serial.prinln to output directly the logic on Pin 11 (default in the Example)
I looked at the code and noted it uses Interrupts
Then I remembered the Ethernet Shield uses Interrupts. Maybe the Ethernet Shield is was stopping the IR Receiver from working. So, off came the Ethernet Shield. Rewired the circuit. All 3 wires...and it worked perfectly and reliably.
Then it was onto seeing it it would work with the Pro Mini from eBay.
| Wired OUTto Pin4. Note VCC middle and GND on the right above. |
This time it worked first time. No reconfiguring. No modification of the code.
It means for £1.18 (TSOP1838) and £2.15 (Pro Mini) a total of £3.33 I can read remote Infra Red Remote controls and with the simple addition of an IR LED and a resistor I can also send IR codes. I have IR LEDs somewhere in my box of wires, so a little hunt will be needed to find them. It will be fun to see if I can send codes to my TV.
NOTE: The Ken Shirriff Library includes codes to emulate various remote controls, so the library can handle send and receive.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.