Randomly picks a TV channel for you to watch at the mash of a big button

Similar projects worth following
Have you ever been sat in front of your TV bored looking thought the tv guild, Don't you wish your TV remote had a random button on it.

I have the perfect solution for you, very simple idea. You hit the big button it picks a random number out of a preset range then feeds that number to an IR LED that then tell your TV what channel to put on.


It been awhile since I've played around with the IR library on a arduino, In fact my first project to have a printed PCB was using that library. I wanted to enter the hackaday prize again this year but couldn't think of anything to make, Then it hit me out of the blue. I've always thought it was weird that services like Netflix didn't have a random button that would display when pushed a random movie or TV show. I thought I would do this but for a set-top TV box with IR. While I was using a arduino Leonardo I would also make it into a HID device so it could be used as a make button like this.



As I said earlier that I have made projects before with IR leds. But before I couldn't match the range of the remote I was replicating, I thought it was because I was only using 3v but this was not the case. After looking at a post about making a TV b gone I noticed that they were using a transistor to extend the range of the LED. I only had a 2N2222 transistor to hand but was a drop in replacement for the 2n4401 they were using. To my delight it working, It gave me the same range as a normal TV remote.

I was going to go with an emergency stop button but I found that the enclosure they came with wasn't going to be big enough for the PCB and a decent sized battery. Also I thought the button would be too high to fit in enclosure. I opted for an arcade button that had an embedded LED so it would kill 2 birds with 1 stone as they say, I wouldn't need a separate status LED now. The arcade button was pretty high and I struggled to find an enclosure of it. The enclosure I did find was a little on the big side but it was the smallest I could find that had the height (60mm) for the arcade button.

I couldn't find a female panel mountable micro USB port, Normally I would use a USB type b female port (The kind you find on a printer) that could be panel mounted but there big and no one really has that kind of cable any more. I just ended up cutting a big enough hole in the enclosure so that a micro USB cable could fit in as shown below.


I opted for a latching switch to turn it on/off but the switch also has another purpose. because it can be used as a HID device I didn't want it to be always charging when being plugged into the computer for long periods of time, So when the switch is on and plugged into a computer/charge it will allow the battery to charge but if the switch is in the off position and plugged into the computer/charger it will not charge the battery. I should have added a charging led so you could see the status of the charge cycle but I didn't think of this until after I had designed the board so I just left it out.

Just about done
Just about done
IR LED in mount on the front
IR LED in mount on the front
Rubber feet for a bit of detail


TV remote code -

HID code -

The software side is quite simple on the surface. I got the library from IR led HERE. All was going well when I was using it with a arduino nano but when I moved to using a arduino Leonardo I wouldn't get it to work, After a bit of searching around I found this thread which solved my problem. If you don't want to mess with your library files I've done all the hard work for you HERE.

I was toying with the idea of having one big button for the random button then having a few smaller buttons I could use for different tv channels or other macro uses on the computer. I decided against it because it would just complicate things and take away for the simplicity of this project so I just stuck with the one button. This is when I had my coding epiphany and thought why not have it so I could hold down the button for a few seconds then it would switch to a different mode. I thought I would have a look around because 1. I wasn't sure how I would achieve this and 2. someone else must have thought to do it so no need to reinvent the wheel. Sure enough someone was after the very same thing I was looking for...

Read more »

  • 1 × 940nM IR LED
  • 1 × Arcade Button built in LED + 220 ohm resistor
  • 1 × Arduino Leonardo Pro Micro
  • 1 × Lipo Battery 3.7v
  • 1 × 2n2222 transistor

View all 9 components

  • PCB designed and ordered

    facelessloser05/28/2016 at 10:49 0 comments

    So I've finished the PCB layout using kicad my favourite schematic capture program. I'm still awaiting the PCB to come back from but should be in any day now so I can start stuffing the board and cutting the needed holes in the enclosure.

  • The arrival of the enclosure

    facelessloser05/28/2016 at 10:38 0 comments

    So my enclosure arrived from China, was about the size I was expecting it to be. The arcade button just fits in the height of the enclosure which is why I choose it in the first place.

    That's the good thing about having a big enclosure is that you have plenty of space for the PCB and battery. I think I'm going to be using the enclosure upside down so I don't have to have long wires for when I need to take the lid off while finishing off the firmwar

  • Enclosure ordered

    facelessloser05/02/2016 at 18:35 0 comments

    There are so many great enclousures on ebay and aliexpress. I felt like goldilocks trying to pick the right enclosure, Non were quite what I wanted.

    I eventually picked one but its coming from china so I wont know if its the one till it comes

    One of the problems in picking was the hight of the arcade button. I wish someone would make a slim line arcade button.

    I have wrote the HID build button code but I can only upload it with the arduino IDE, I normally use the Arduino-MK makefiles. I did get the chance to try out the external editor function in the arduion IDE, Works really well if like me you need it but write the code in VIM

  • Hardware nailed down

    facelessloser04/22/2016 at 15:11 0 comments

    So after some testing and debating with myself I have finally settled on the hardware I'm going to be using. I'm going to be keeping it as simple as possible and not let feature creep creep in.

    I'm going to be using a Arduino leonardo pro micro so that I can use it as a HID device as well as a random remote.

    I'm going to be powering this with a lipo battery circuit I designed with a switch so if you do use it as a HID device it wont be charging the battery all the while.

    I have ordered a light up arcade button, I was going to be going with an emergency stop button but the enclosures they come in are all too small for PCB and battery gubbins to fit in. I'm still on the hunt for a enclosure but as of writing I haven't picked one yet .

    P.S. Why the hell doesn't anyone make a female micro USB port that panel mountable. The one I normaly use is a panel mountable USB D female port

View all 4 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates