Author Topic: making a simple IR transmitter  (Read 5281 times)

0 Members and 2 Guests are viewing this topic.

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
making a simple IR transmitter
« on: October 28, 2020, 05:35:17 am »
I want to make a simple IR transmitter to control something controlled by a small Chinese typical remote. I have something to sample the signal.

I have come up with some strategies so far and I wonder what the issues could be

1) Energizing a IR led with a headphone jack. There are IR blasters. They are usually wired 2 leds in opposite direction. I think in some cases frequency filters and transformers are maybe a barrier to arbitrary square waveforms. So maybe they are going back and forth at a high frequency to mimic a solid 1 for example with 0 drop outs.
2) Gating an externally powered flip flop by like a shmitt trigger of the above signal.
3) Using a USB serial bridge to energize the LED if like you can freely and quickly alter the RTS or CTS.
4) Using a USB serial source signal to bias a flip flop discarding the start bit.
5) Get a raspberry pi and tie the led across a GPIO
6) Find some cheap usb device who's led can be set by software and resolder a IR led to.
« Last Edit: October 28, 2020, 08:37:52 am by msuffidy »
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #1 on: October 28, 2020, 06:56:23 am »
I have something I think is a emitter on a 3.5 mm headphone jack I found. It is a clear led in a small reddish case. When I use the diode test on a DMM, it lights up visible red. Does this mean it is a receiver, or does it mean the power is too great?
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #2 on: October 28, 2020, 05:25:24 pm »
Looking around here I recalled I have a remote scrapped, and also I have a devkit I got for free off the internet, so I am thinking hopefully I can solder, or use a jumper header, a IR led over the end and maybe have to add a resistor if it is like 5V. I should be able to program it to, by usb, turn the led off and on. This is what it is regarding, and at this time I am looking to make a high speed color dithering thing between color steps:

« Last Edit: October 28, 2020, 06:07:26 pm by msuffidy »
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: making a simple IR transmitter
« Reply #3 on: October 28, 2020, 06:05:55 pm »
That looks like a debugger for a low end micro.
They normally talk with SWD to a micro.

They have a micro in them programmed to be some kind of usb device type, usually HID and then use that device to transfer  the SWD data stream to the target micro.

Yes, you can re-program it to do what you want but it is a LOT of effort.

Check out this thread
https://www.eevblog.com/forum/testgear/fluke-187-making-an-ir-cable/

You might be better off buying CH340 or CP2102 which are usb to serial converters and just interface to the tx pin. Both the Fluke adapter and Keysight/Aglient adapter are just USB serial chips

 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #4 on: October 28, 2020, 06:09:19 pm »
Thanks for you comment. I'll consider it. Got a week to burn or so, so I don't know. I just downloaded SDCC and it supports the 8051, but there is a learning curve, and I hope it works in the end. It has to make the timings also. Not sure
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Re: making a simple IR transmitter
« Reply #5 on: October 28, 2020, 06:09:50 pm »
I want to make a simple IR transmitter to control something controlled by a small Chinese typical remote. I have something to sample the signal.

I have come up with some strategies so far and I wonder what the issues could be
//
5) Get a raspberry pi and tie the led across a GPIO
//

I did a project where I wanted to increase/decrease the volume on a TV by a set number of steps.

I used a Linkit 7697 and this simple circuit:



IR LED operates from GPIO_P3 with a 1k resistor to the base of a 2N4401 and
an 82 ohm resistor driving a LED 55b IR LED (3.3V, ~40mA, .013 W)

Programming the hard stuff was made easy thanks to some good work in the form of:

Raw codes were initially read using IRrepeater.ino
https://github.com/smallbeetw/arduinosketch/blob/master/IRrepeator/IRrepeator.ino
and the values were smoothed to 560/1690/4500/9000 to make this code data

Spitting the codes back out used IRremote library which is included in the Linkit software but is something of a standard Arduino library  see https://www.arduinolibraries.info/libraries/i-rremote.

The whole project was pretty easy and works well. I didn't have a need for a great distance, but if I did, I would go toward cannibalizing one of the many old remotes still hanging around long after their devices have gone away.

I also used a simple Promini 3v3 but went to the Linkit for BLE capabilities which was part of the project.

Hope it helps.
- Invest in science - it pays big dividends. -
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: making a simple IR transmitter
« Reply #6 on: October 28, 2020, 06:26:40 pm »
Most oft the cheap remote controls are using the NEC IR protocol. And don't forget that the IR signal has usually a carrier frequency of 38 kHz.
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #7 on: October 28, 2020, 06:30:10 pm »
Really good to know about a 'carrier' . Have to check that out.

Oh I think you mean like the square PCM carrier which yes you can see in the capture. That is what you see is like a regular on with a single or double gap.
« Last Edit: October 28, 2020, 08:52:54 pm by msuffidy »
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #8 on: October 28, 2020, 09:21:16 pm »
((I used a Linkit 7697 and this simple circuit:))

Well I guess you would do this to avoid a drain on the GPIO? It is a bit more complex than I was thinking about.
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Re: making a simple IR transmitter
« Reply #9 on: October 28, 2020, 09:39:41 pm »
((I used a Linkit 7697 and this simple circuit:))

Well I guess you would do this to avoid a drain on the GPIO? It is a bit more complex than I was thinking about.

For that SOC [MT7697], the drive strength of the GPIO is programmable (but I never messed with that) but no more than 16mA. Off hand, I don't know of any GPIOs on the chips that I have any experience programming that can source or sink more than 25mA (not that they might not exist).

I think that if you try to get more current out of one, it will drop the voltage and/or damage the chip (that is only my guess) and at my level, I strive to avoid such situations :) On the other hand, if you want to get some distance on the remote, you want more current to the LED(s) than can be provided by the GPIO. It only adds a couple of inexpensive components.

- Invest in science - it pays big dividends. -
 

Offline DrG

  • Super Contributor
  • ***
  • !
  • Posts: 1199
  • Country: us
Re: making a simple IR transmitter
« Reply #10 on: October 28, 2020, 10:17:21 pm »
((I used a Linkit 7697 and this simple circuit:))
 It is a bit more complex than I was thinking about.

Well maybe not as complicated as you might think. I could not see your remote very well in the video, but the ones that I have seen look something like this one: https://www.amazon.com/SUPERNIGHT-Controller-Compatible-Assistant-Working/dp/B08HVVRPBH/ref=sr_1_20?dchild=1&keywords=IF+Rgb+Controller&qid=1603921702&sr=8-20

Basically, there are three LEDs, R, G, B and using PWM you vary the duty cycle of each - that can get you to a mess of colors. So, you need to find the codes for selecting R/G/B and then the ones that bump the duty cycle up or down (likely brightness +/-).

So, if one color is B R=70%, Green=20% and B=50% and you change the PWM duty cycle on blue - by sending the command to increase brightness (duty cycle). It is probably the case that each brightness command increases/decreases duty cycle by a set amount - say 10%, so you would need to track that and provide multiple commands.

Going to preset colors is the same thing, but easier. You could go to duty cycle=0 for all three and then step them up to their presets.

The whole issue of color mixing with LEDs is fascinating. Some years ago (probably 10) I heard about PWM and a little PIC chip (12F1572) that had three 16 bit, PWM registers and I spent a ton of time learning with that chip. I made a "party light" ooooooahhhhh using just that chip and a couple of batteries and a step up. It goes through Roy G. Biv and some other "scripts". Works great, BUT mixing colors smoothly - going from orange to indigo for example is not trivial and there can be more math than my aged neurons can entertain...still it works and I think you should play around with your set up - you have the vision already, now you just need the code and parts to cooperate.

Of course I could be all wrong about this :)





« Last Edit: October 29, 2020, 02:52:20 pm by DrG »
- Invest in science - it pays big dividends. -
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #11 on: October 29, 2020, 04:32:05 am »
I harvested a IR led that is seen by the sensor that also saw the remote for the lights. I can see it using only the reverse cam of my iphone. I hooked it directly to an AAA battery, which is maybe not a great idea to see if it worked but also the sensor got random trash as it connected/disconnected it. What I am expecting to see is this light thing, which I got for $6 Canadian is probably just going to have codes for like 12 colors. It seems I can switch pretty fast between them so I can make fast switching transitions, kind of pwm, but they may become stroboscopic. I am reviewing the 8051 dongle to see what the pins are exactly. I am not sure any of these pins can be used as a GPIO if this is the correct diagram. I suppose I could recalculate powering it from the 5V rail. I don't know what the source amperages are, I guess I could measure them first. I should be going for 1.2 V on the IR led and 20mA? If things work out I would run a small ribbon cable from the pinout to a small network of soldered components, and probably incase  them all in a glue gun blob.

I also have a Renesas M16C thing that appears to have GPIO headers. Maybe this one is OK, I think the diagram is not the right one. Now I am unsure if I can actively send it USB comm after using the USB to program it. I was going to send it a transmit frame at a time through USB.
« Last Edit: October 29, 2020, 07:19:04 am by msuffidy »
 

Online Peabody

  • Super Contributor
  • ***
  • Posts: 2161
  • Country: us
Re: making a simple IR transmitter
« Reply #12 on: October 29, 2020, 02:42:54 pm »
Here's info about the NEC IR protocol:

https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol

All IR remotes use a carrier so they can't be triggered by ambient light, even direct sunlight.  The NEC protocol is the most widely used, but manufacturers can use their own system.

If you want to mess with an Arduino, they have an IRremote library that does most of the code for you.  It will even capture what the Chinese remote is sending if you have an IR photodiode sensor.  Or you may find that your IR LED can be used as a weak sensor.  But you can also probably capture the pattern on your scope if you connect the probe to the the LED driving pin of the Chinese remote.

Also, don't forget about one of the few free lunches in electronics.  If you have enough voltage on the rail, you can drive two IR LEDs in series after adjusting the resistor value.  Instead of dropping half the power in the resistor as heat, you use that power to generate twice as much IR.   Same total current.
 


 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #13 on: October 29, 2020, 03:28:14 pm »
I agree the Arduino solution would be the easiest, just I want to do this buying $0 of new equipment. I suspect it can be done.  It is pretty straightforward to just sample the signals and send individual ones. Decomposing and generating them is another problem.

Actually I have been thinking about the problem and what would be just the easiest thing to do without really knowing what is involved is say like output has an address or some other API call and the usb bridge thing may have a chip address. Just keep polling the input character for say 0 or 01 and set the output led. Then the computer can send a constant stream of 1 or 0s through the usb and use the devkit dongle as a led switch. It may be more like static like it is usually 00 but if it is 01 or 02 for example you could set it 1 or 0.  Nope this may be a job for getchar() of fgetc().

Does this mean the GPIOs are 15mA?

I have 2 of these transistors from a CFL light here. Are they too far from the 5V range? I am thinking they will work.
« Last Edit: October 30, 2020, 09:10:04 pm by msuffidy »
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #14 on: October 31, 2020, 07:54:21 am »
I had 2 usb devkits. The Renesas one right away looks like the programmer is USB and otherwise there is no communication with the computer. The other one, the Uscale X800 looks like you can program the chips, and also there is a serial uart line open to the host. The big problem is if you are not using the windows devel software I am not sure the program runs on startup or not. There are 3 different controllers sharing the same pin header, and I don't specifically know how this all works unless the devel software is controlling them all by JTAG before they start.

The uscale xc800 has a JTAG unit and a serial unit. It may be possible to just write address into the microcontrollers to set GPIO without them even properly running using JTAG. Or if may be possible to get them running using JTAG from linux.
« Last Edit: October 31, 2020, 09:34:26 am by msuffidy »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: making a simple IR transmitter
« Reply #15 on: October 31, 2020, 10:25:03 am »
I have 2 of these transistors from a CFL light here. Are they too far from the 5V range? I am thinking they will work.

Those are meant to switch high voltages and have a low hFE. Use a jelly bean NPN, like 2N2222 or BC547.
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #16 on: October 31, 2020, 11:04:31 am »
Thanks. I do have a lot of scrap I can review. I still think this is like I have the dongle. I have to get the JTAG thing working. Connect the dongle to a resistor and the led. Probably work. I mean sorry, I think it is 15mA gpio, so I think I can use it?
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: making a simple IR transmitter
« Reply #17 on: October 31, 2020, 11:41:14 am »
It should work, but it won't give you much range. Many IR LEDs are rated for 100mA (as long as they stay cool).
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #18 on: October 31, 2020, 08:10:09 pm »
I am starting to feel like I am bothering this group much, but the uscale xc800 is not looking promising. This is because it does not simply start up outside of its windows IDE as I want to use linux. Getting it to a starting manner requires undocumented JTAG calls to the micros or a analog multiplex switcher on board. I am now reviewing getting an arduino atmega 328p for $10 in town someone is selling, or programming the Renesas devkit to trigger on a signal to its pin header GPIO in, or uart, and then turning on a GPIO out. So like a signal control switch. I am not sure what state the micros start up in with the uscale, and I am not sure if any standard source can translate into a JTAG device address access tool.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: making a simple IR transmitter
« Reply #19 on: October 31, 2020, 09:47:09 pm »
No bother.

I did warn you that trying to re-purpose debuggers would be a lot of work.

Do yourself a favour, just buy a regular usb to serial adapter, preferably a well supported one like CH340 or CP2102, and then you can just use the Tx output to drive IR LED.

 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #20 on: November 01, 2020, 03:59:22 am »
I just picked up 2 arduinos one was totally sealed so I am hoping one will do it.
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #21 on: November 02, 2020, 03:35:47 am »
I wasn't actually expecting to get this far today, but I potentially got the arduino code part done. It is kind of hard to tell. It is set up to light up the onboard led, which is maybe the same as one of the board headers. But the idea is what I decided to do was make it so I would upload the sample set and then it would execute it at a regular rate specified by the upload. So here is my source and a copy of the test sample. I have not hooked it to the IR led yet.
« Last Edit: November 02, 2020, 05:59:10 am by msuffidy »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3248
  • Country: us
Re: making a simple IR transmitter
« Reply #22 on: November 02, 2020, 04:01:12 am »
Just a couple of coding tips...

In transmit_ir you can simply write:
Code: [Select]
digitalWrite(LED_BUILTIN, sample_array[array_position]);
and this code handles both cases.

For bool variables C++ has the predefined constants true and false. You can also use 1 and 0, but it makes it more obvious that you are setting a boolean value.

You can also just write if (loadstate) { ... } - there's no need to compare it to a true value.
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #23 on: November 02, 2020, 06:00:55 am »
Yes I guess those are good points. I made an assumption about the code I snipped in that it was waiting for serial to be ok before getting a char. It just skipped over it if it wasn't. Now it seems to work great because I wait for it. Oh I tried TRUE and FALSE and maybe it wanted the lower case ones.
« Last Edit: November 02, 2020, 06:02:39 am by msuffidy »
 

Offline msuffidyTopic starter

  • Regular Contributor
  • *
  • Posts: 247
  • Country: ca
Re: making a simple IR transmitter
« Reply #24 on: November 02, 2020, 06:34:40 am »
« Last Edit: November 02, 2020, 07:42:04 am by msuffidy »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf