Most of us spend far too much time in front of the TV. Here is a system for automatically limiting when and how long the TV can be on for. The system works by controlling the input signal going to the TV by adding a relay switch to the input cable. When certain conditions are met, the relay is turned on and the TV is able to receive the input signal. Using an Arduino microcontroller, you can program the system to only allow the TV to be on for a certain amount of time each day or between certain hours. You can setup a pin code so that only certain people can turn it on. You could even set it up so that the TV will not turn on unless you have done a certain amount of exercise that day. The system is very versatile and can be customized to fit your needs.

This project assumes you know the basics of Arduino programming, otherwise read our article on getting started with Arduino.

What You Need To Build The Arduino TV Limiting System

How To Build The Arduino TV Limiting System

The instructions are broken up into three sections, building the relay control circuit, uploading the time limiting sketch to the Arduino and finally adding additional sensors and controls.

Building The Relay Control Circuit

The control circuit for this project is very simple. It is basically just an Arduino microcontroller and a 5 volt relay. In order to power the relay directly from the Arduino, the coil of the relay needs to be rated for 30 mA or less.

relay control circuit

If your relay requires more than 30 mA, then you need to add a transistor to drive the relay.

larger relay coil circuit

The normally open terminal and common terminal of the relay are connected to the input cable. The coil of the relay is connected to one of the digital pins and one of the GND pins on the Arduino. A diode is connected in parallel with the coil of the relay to protect the Arduino from voltage spikes that can occur when the relay turns off.

Normally the digital pin is set LOW. This means that the relay is turned off and the two halves of the input wire are disconnected. In this state, the signal cannot reach the TV. But when the digital pin is set HIGH, the relay turns on and connects the two halves of the input cable. This is how the Arduino determines when the TV receives the signal from the input device.

The first thing that you need to do is get a connector cable that matches the input terminals on your TV and the signal source. The most common types are Coaxial cable, RCA cable, and HDMI cable.

select a cable type

Next we need to cut the connector cable in the middle. Then strip off about 2 inches of the outer most layer of insulation to expose the first layer of internal wires.

cut the signal cable

Separate and peel back these wires to expose the next layer of insulation. Strip off about half of this exposed section of insulation. This will reveal the inner wires. Twist the first set of wires together. Then twist the second set of wires together. You should now have two separate strands of wires that you can connect these wires to a relay switching circuit.

This simple procedure will work well for RCA cables and coxial cables. However, HDMI cables are a little more complicated. There are a lot of wires inside an HDMI cable. If you want to try to manually separate the wires of an HDMI cable you will need a lot of time and patience and you need to be very careful. An alternate method that might make things easier is to use an HDMI break-out board such as this one.

hdmi breakout board

Start with a blank piece of perf board. Solder the relay onto one side of the board. Then solder the diode onto the board adjacent to the relay and connect the leads of the diode to the coil terminals of the relay. Next you need to connect the wires from the input cable.

relay control board

The inner most sets of wires can just be soldered back together by attaching them to adjacent holes and connecting them with a bead of solder. The outer set of wires in each cable will all be grouped together. With RCA cable these wires are all connected together as a ground. So it won’t affect the signal. These wires are soldered to the board. Then a jumper wire connects them to the switch terminals of the relay.

underside of relay control board

The last connections to make are the wires that will connect to the Arduino. Connect one wire to each terminal of the relay’s coil.

completed relay control board

Now you need to connect the relay circuit to the Arduino. Connect the wires from the relay board to the Arduino so that the anode of the diode is connected to one of the GND pins on the board. Then take the wire that is connected to the cathode of the diode and plug that into one of the digital pins on the Arduino board.

connecting control board to arduino

It is very important that you get these polarities correct. If you accidentally reverse them, you could destroy the Arduino.

polarity of a diode

Find a large insulated project enclosure. Then attach the relay circuit and the Arduino to the inside of the housing with a small drop of hot glue. A small drop of hot glue will be just enough to hold the boards in place but still allow you to remove them later if you want.

mount the arduino in an enclosure

Cut holes and slots in the back of the housing for the cables and power cords and sensor wires.

the completed enclosure

Uploading The Time Limiting Sketch

Now you can upload your sketch onto your Arduino, if you haven’t uploaded a sketch before then follow this guide on getting started.

The simplest kind of control program is a window timer. Here is a very basic example of this. Once the system is activated, the TV will be connected for 1 hour (3600000 milliseconds). Then it will be off for 23 hours (82800000 milliseconds). This will create a one hour window each day where the TV can be watched. You can easily change the timing of this by changing the values in the code.

You can download the TVTimeLimiter sketch here.

Alternatively, you could set up a button to activate the TV watching time. This would let the user select when the TV may be on but still limit the total number of hours per day that it is on.

Adding Additional Sensors And Controls

Most ways that you might set up your TV limiting system will requires sensors of one kind or another and these need to be connected to your Arduino. Connecting sensors to an Arduino is easy. There are two main kinds of inputs with an Arduino. There are analog inputs and there are digital inputs.

Analog inputs detect the relative voltage of a signal. To measure an analog input, connect the ground wire of the sensor to one of the GND pin on the Arduino. Then connect the signal wire to one of the analog input pins on the Arduino. Then set this pin to input mode and use the analogRead function in the Arduino code. The Arduino will then measure the voltage of the input signal and turn it into an integer value between 0 and 1023. This corresponds to a voltage between 0 and 5 volts. Analog inputs are a good way to monitor signals that change over time.

Digital inputs just detect whether a signal is above a certain threshold voltage (3 volts for a 5 volt Arduino). These are useful for detecting simple on-off states. Is the signal there or not. To use this king of input, connect the ground wire from the sensor to one of the GND pins on the Arduino. Connect the signal wire to one of the digital pins on the Arduino. Then set this pin to input mode and use the digitalRead function in the Arduino code. The Arduino will then measure the voltage of the input signal and register it as either HIGH (above 3 volts) or LOW (below 3 volts).

You could also customise the TV time limiter to work with various sensors and controls to enable bypasses or restrict use until a certain activity has been carried out. Here are some examples.

Set Up a Pass Code for Authorized Users to Activate the TV

A variation on the design that you could implement involves setting a pass code so that only authorized users can turn the TV on. This can easily be done with the TV remote. All you need to do is add an infrared receiver to the Arduino. You can check out an example of how to do that here:

Create a Sensor to Only Turn on the TV If You Have Exercised

Our favorite way to control a TV limiting system is with exercise. The simplest way to do this is to set up a sensor on an exercise bike that will send a signal to the control circuit when someone is pedaling. This will let you program the system to only let the TV be on while someone is exercising on the exercise bike. The more you want to watch TV, the more you have to exercise. You can see a good example of this kind of system in the project “No TV unless you exercise!“.

no tv unless you exercise

Only Turn The TV On When Someone Is Active

You can use the heart rate sensor to measure how active the person is being. So you can program the system to only let the TV be only while the person’s heart rate is elevated. Or you could program it to only turn on if the person has had their heart rate above a set level for a certain number of minutes a day (indicating that the person has exercised).

Using Your TV Time Limiting System

Set up the box with the control circuit near your TV. Then plug one end of the cable into your TV and plug the other end into the signal source. An RCA cable is used here to connect an XBOX 360 to the TV. Lastly connect your chosen sensors that will control they system.

This system is an interesting way to cut back on the amount of TV that we consume. Use your imagination and have fun.

This post is based on a System for Automatically Limiting TV Time by DIY Hacks and How Tos and is modified and used under the Creative Commons license CC BY NC SA.