General > General Technical Chat
making a simple IR transmitter
ledtester:
You might be interested in this project:
https://youtu.be/taZQkVBzl-c
No code, unfortunately, but the details are discussed in depth.
msuffidy:
Hooray I think I got it working before destroying anything with my soldering iron. Just used a 270 ohm resistor. Seems pretty much how you do it. I encased it in glue gun to make it a bit more durable and safe.
msuffidy:
Well either I have the wrong IR EM freq, or I missed the carrier. I have some ideas, but the code may have to be changed. I may just have to oscillate the current sample. Yup I just ran everything so fast it would be like a modulation and a test receiver got something.
I give up, I am starting over with a pure NEC protocol source that inputs the 32 bit transmission. Looks doable. It is not universal, but will allow me to quickly change the light puck, like 5hz or so I guess.
msuffidy:
Well the good news is I seem to have it working, and I can use my arduino as a remote for the light puck. The bad news is my codes seem to be slightly different than the other one as per the linux ir-keytable response. It was doing NOTHING for a while until I experimented with lowering certain timings. I was relying on delay statements instead of using timer operations, and the execution time is different from the official timings.
The input string looks like this:
Y00010000111011110101000010101111Z
Here are the codes that concern me:
the real remote:
41426.337421: event type EV_MSC(0x04): scancode = 0x800a
mine:
42438.193464: event type EV_MSC(0x04): scancode = 0x80a
also:
https://web.ncf.ca/fs864/pickup/sketch_irled1-006.ino
ledtester:
Some immediate observations:
- digitalWrite has a lot of overhead. There are "fast" versions of digitalWrite/Read which do not have the overhead of a subroutine call or Arduino pin to AVR PORT bit conversion at run time. Just google "fast digitalWrite arduino".
- I am not sure about how delayMicroseconds is implemented, but I would use the avr library version:
https://www.nongnu.org/avr-libc/user-manual/group__util__delay.html
which, with the proper compilation flags results in inline code.
- bit-banging the carrier signal is insane. I would set up a PWM pin to do that and then just enable or disable it every 562 us as needed.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version