Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:11 16 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : $1 IR remotes on eBay and code...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9593
Posted: 01:36am 25 Feb 2016
Copy link to clipboard 
Print this post

Hi all.

This thread might be of interest to some, but probably CG(CircuitGizmos), as I know he has some of these remotes.

After a bit of tinkering around, I have these remotes working well with the MM.

They are extremely cheap, averaging US$1 on eBay..





They are a universal remote designed for TV use, and thus, they can output many different codes. In my case, I found a device code and keycode combination that seems to work well, and then wrote a very simple code to allow you to search for the correct settings in the remote, without having a TV set to experiment on.

The code will prompt you of what to do, and all you have to do, is follow your nose.

I have run the code several times, and the keycodes always come out the same, so I think I have it such that the codes will be consistantly correct from this remote, but this code should be treated as alpha, and the idea as experimental.

I have tried this with both 38kHz and 40kHz IR receivers, and both work fine.
The 40kHz receiver gives best range, so I think we have hopped onto a Sony frequency - that or this is just good luck.

REMOTE LEARN CODE:

IR DevCode, KeyCode, IR_Int
Print "Press and HOLD the mute button to scan for a compatible code."
Print "Release MUTE button immediately when prompted."
Print "Remote will memorize code even if battery is removed."
Print
Print "Waiting for valid code....."
Print
Do
If DevCode=128 Then
Print
Print "Release MUTE key now!"
Print
Print "Device code is 128."
Print "Key codes:"
Print
Print "POWER: 250"
Print " UP: 50"
Print " DOWN: 210"
Print " LEFT: 42"
Print "RIGHT: 26"
Print " MUTE: 218"
Print "AV/TV: 66"
IR Close
End
EndIf
Loop

End

Sub IR_Int
Print "*";
End Sub

TEST:
IR DevCode, KeyCode, IR_Int2
Print "IR keycode tester."
Print
Print "Press any key......"
Do:Loop

HUNT:
IR DevCode, KeyCode, IR_Int2
Do:Loop

End

Sub IR_Int2
Print "DevCode: " DevCode ", KeyCode: " KeyCode
End Sub


This code is nothing fancy at all, but it will help you setup the remote with very little pain.

RESULTS:



Smoke makes things work. When the smoke gets out, it stops!
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2934
Posted: 01:53am 25 Feb 2016
Copy link to clipboard 
Print this post

Useful code there Grogs.

Just one question; Should the Hunt and Test labels be removed (i.e. are they left-overs from earlier code); likewise with IR_Int2 which is called from Hunt & Test.

If these are removable then your code length is almost halved in size

Now to go find my remote which I put somewhere safe . . .
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9593
Posted: 02:03am 25 Feb 2016
Copy link to clipboard 
Print this post

I left them in there, so people can play with those routines by calling them directly at the command prompt. So, goto test will allow you to double-check the codes coming out of the remote. goto hunt will just show whatever is compatible codes coming from the remote, but these can be all over the place as it searches.

You absolutely could remove those routines.
They are only there as extra bits, and under normal execution, the code would never run either the test or hunt routines.
Smoke makes things work. When the smoke gets out, it stops!
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2934
Posted: 03:00am 25 Feb 2016
Copy link to clipboard 
Print this post

  Grogster said   I left them in there, so people can play with those routines


Sounds good to me!

I still can't find my remote but I know they sell 2 for £1 in the local Pound Shop so off to town this afternoon
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 05:57am 25 Feb 2016
Copy link to clipboard 
Print this post

Thanks for sharing, Grogs! Now I need to dig up those remotes and try again.

I'm beginning to suspect that the remote I pulled out last time I tried to use it is the issue. I tested the IR sensor on a scope and saw signal. I wrote nearly the same code you have in TEST. Tried a known good remote. Then tried the $1 remote and got nothing. Perhaps my old $1 remotes are different, or that one remote picked that moment to go kaput.
Micromites and Maximites! - Beginning Maximite
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:03am 25 Feb 2016
Copy link to clipboard 
Print this post

If I wanted to use these with a micromite to make a simple on/off remote switch say for a power supply
How could I do this?

I've got a set of led strip lights here in the house and a wired controller for them, its a decent controller so I don't want to get rid of it and get a remote one.

I was thinking of making a simple remote on/off switch to control the power supply for the led's

40kHz IR receiver on one of the input pins
a relay on another switching the power to the led's?
Edited by lew247 2016-02-26
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2934
Posted: 02:03pm 25 Feb 2016
Copy link to clipboard 
Print this post

  lew247 said  I was thinking of making a simple remote on/off switch to control the power supply for the led's

40kHz IR receiver on one of the input pins
a relay on another switching the power to the led's?


Are the LEDs running from effectively a 12v supply? Most 'LED strip kits' I have seen seem to have a Mains(AC)-to-12v(DC) PSU.

What I have done with some 12v LED lights here at my house is to simply use a MicroMite output to drive a MOSFET (IRLML6401) and then switch the 12v DC on/off between the LEDs PSU and the LEDs themselves. This is an example of the 'output' side of things that you need.

As for the IR input using a remote like Grogster has posted about; yes you just need an IR receiver on the IR input of the MicroMite. Refer to the MicroMite User Manual (Page 23 v5.1). I personally like the TSOP48xx receivers which are the type referred to in the manual

Then you just have some 'simple' code to listen for an IR signal, and control your output (MOSFET) pin. Rather than toggle - you may find it more simple to start with two IR Tx buttons; one for On, the other for Off. Again, refer to the manual for sample code (bottom of page 23). Simply look at the 'keycode' number, and set the output with PIN(x)=0 for the Off keycode value, and PIN(x)=1 for the On keycode value.

You could use a relay as you mention - just a bit 'clunky'. Avoid switching mains by the way - too risky if you're not sure what you're doing

Hope this gives you some ideas . . .

WW

 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 12:11am 26 Feb 2016
Copy link to clipboard 
Print this post

Thanks WW
It's actually a 24V led strip, your idea is much better than mine, switching the dc output rather than the ac mains
Thanks
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2934
Posted: 12:15am 26 Feb 2016
Copy link to clipboard 
Print this post

@lew247

You can still use a MOSFET (EDIT: to switch 24v) - just one which is rated at the correct voltage and current.

If you're not confident with that, then a relay is fine for DC switching. You will need a simple relay driver circuit (transistor + couple of resistors, and a diode (for back emf).

One thing if you want to use a relay that I would recommend, rather than continually powering the relay coil when the LEDs are on (or off depending on the relay contacts you use); consider a latching relay that has two coils.

Then simply use two MicroMite output pins, one for the ON coil, and the other for the OFF coil. Needs a second driver circuit, BUT will consume a lot less power!!

WW Edited by WhiteWizzard 2016-02-27
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9593
Posted: 02:01am 26 Feb 2016
Copy link to clipboard 
Print this post

As WW says, MOSFET's are gate things when you get used to using them.
Pun intended......

Low-side N-channel MOSFET switching is dead easy, but high-side P-channel switching almost always needs a blower transistor to help the gate along.

Low-side switch:



...and high-side switch with blower transistor:



Either of these will do equally as well as the relay, use less power to operate, and can pass surprising amounts of current with very little heat dissipation - that's one of many of the beauties of MOSFETS.

Relays still have their place though if you need circuit isolation in what you are switching. Mains is an example, but as WW said, best not to play with mains juice unless you really are sure you know what you are doing. A mistake with mains voltage could end up being..........unfortunate.
Edited by Grogster 2016-02-27
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025