Utilize those unused buttons on your TV remote ESP8266

Place your projects here
Post Reply
Zim
Posts: 280
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 251 times
Been thanked: 128 times

Utilize those unused buttons on your TV remote ESP8266

Post by Zim »

I want to control the lamp behind my TV without leaving the couch. (as you get older, you will understand!)
Turns out that all buttons on my TV remote are used and needed.......but, if I press the "mute" button twice, it doesn't change the state of the TV and allows me to control my lamp. Double press on, double press off. cicciocb has made it very easy to decipher most any IR remote button press and record the code. I then lucked out and found a combo ESP8266 board which had the necessary infrastructure to minimize wiring. I also used the VS1838B sensor provided in the "Help" file. Total cost was about $9 CAD.

20220821_110526.jpg

Code: [Local Link Removed for Guests]


CODE: xxxx.bas

--------------------------------------------------------------------------------

'Zims IR lamp control

'gosub learn_code ' unmark this line and restart to find codes XXXXXXXXXXXXXXXXXXXXXXXXXX

cls
D1 = 5
D5 = 14
PIN.MODE D1, OUTPUT 'relay control for Lamp or any mains appliance
PIN(D1)= 0
ir.init D5
code$ = ""
togL = 0   'used for double press activation
OnInfrared irReceived
wlog "lite off"
wait

irReceived:
code$ = ir.get$
timer0 1000, clear  'resets press count after 1 second
pause 100
' 290 is the Sony TV code for the mute button
if (code$ = "290") then togL = togL + 1 'counts presses
pause 100
if (code$ = "290")and(togL = 2) gosub lite
pause 100
return

lite:
PIN(D1)= 1 - PIN(D1) 'toggles lite (thanks cicciocb)
if pin(D1) = 0 then wlog "lite off" else wlog "lite on"
return

clear:
timer0 0
togL = 0
return

' The below code is used to display the remote code from your IR remote
learn_code:
wlog "press a button on the remote and see code displayed here"
D5 = 14 
ir.init D5
code$ = ""
OnInfrared irfind
wait

irfind:
code$ = ir.get$
pause 100
wlog code$
return


You do not have the required permissions to view the files attached to this post.
Last edited by Zim on Sun Aug 21, 2022 9:32 pm, edited 1 time in total.
BeanieBots
Posts: 315
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 168 times
Been thanked: 102 times

Re: Utilize those unused buttons on your TV remote

Post by BeanieBots »

Neat idea. What's that board. Looks like it could have a lot of uses.
Zim
Posts: 280
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 251 times
Been thanked: 128 times

Re: Utilize those unused buttons on your TV remote

Post by Zim »

Zim
Posts: 280
Joined: Mon Feb 08, 2021 9:15 pm
Has thanked: 251 times
Been thanked: 128 times

Re: Utilize those unused buttons on your TV remote ESP8266

Post by Zim »

The sensors can be had here.

https://www.ebay.ca/itm/194620561849
Post Reply