No TV Unless You Exercise!

43,473

401

47

Introduction: No TV Unless You Exercise!

When I was a kid, I went to a science museum where there was a TV powered by a stationary bike that was hooked up to a generator. I’ve always thought it would be great if every TV worked that way- it would improve your health and use green energy.

This past winter I was looking for a way to stay in shape and I found an inexpensive bike stand that let me pedal my bike indoors. It worked fine but it was pretty boring, and I have trouble exercising when I'm not motivated. I remembered the TV powered by a bike and thought, "Yeah! THAT would make me want to keep going."

Well it turns out generators are pretty expensive, and turning your TV on and off repeatedly probably isn't good for it. So I made something that does the other part of the job- it makes the TV go dark unless you keep pedaling.

Update: added video of it in action

Step 1: Overview

The system has three components- a detector, an Arduino Nano, and a relay. The relay is hooked up inline to an RCA cable going from a video source to the TV. The Arduino looks for input from the detector, and if it doesn’t receive a signal within a certain amount of time (I’m using 10 seconds), it turns off the relay which opens the circuit and the input to the TV goes dark. I have a warning buzzer that goes off when there’s 2 seconds left in the countdown.

The detector I’m using is a black/white detector normally used for robot line following. I put a strip of black and white tape on the back wheel of my bicycle, which is attached to the bike stand. The Arduino is looking for BOTH black and white detections from the wheel (it is set to look for both so that you can't just position the wheel in a certain way to keep the video on). If it doesn't see both in 10 seconds, it activates a relay that turns off the video to the TV. Note- it doesn’t turn off the DVD player or the TV, it just disconnects the input until the pedaling starts again.

Once I had the code figured out, the only really tricky part was aligning the detector in the right place. You want it to be close to the wheel but not touching. I originally tried using a Hall magnetic detector, but I couldn't get it close enough to detect without it connecting occasionally.

Step 2: The Equipment

The bike stand is this one from Amazon: Amazon link

The sensor is a black/white detector, roughly $4.00 from ebay: ebay link

The Arduino is a Nano, but you could probably use any type: ebay link

The relay is a 5V relay, like this one: ebay link.

The input is a standard RCA cable like this one: Amazon link

The wires are standard F-F breadboard wires like this: ebay link

I don't remember where I got the LED or the buzzer, but they're basic stuff, and they're optional. I also used a mini breadboard but just about any would do

Step 3: Wiring

The logic flow for this is: bike -> sensor -> Arduino -> relay -> TV input

The Arduino wiring shown is as follows:

Red: 5V power to relay

Brown: GND to relay

Orange: D3 control wire to relay

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

Blue: 3.3V power to detector

Green: GND to detector

Yellow: D12 input from detector

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

Detection LED: D11 to ground (optional)

Buzzer: D4 to ground (optional, would work with an LED too)

Step 4: RCA Cable Setup

Cut a standard RCA cable in half, and strip the ends. Inside the outer insulation will be an insulated inner wire and an un-insulated outer wire. Twist the outer wires together. Strip the inner wires, and put them in to the NO and COM terminals of the relay. Hook the RCA ends of the cables up in line between the video source and the TV. Now the video won't be able to go to the TV unless the relay is closed.

Step 5: The Code

Here's the logic behind the code: there are 2 "counter" variables- one for white detection and one for black. At the beginning, they're set to "countmax", which here is 10 seconds. Every 10 milliseconds, the Arduino looks for either a high or low detection, and it sets the counter for what it finds back to countmax while the other counter drops by 10. If either counter drops below "countwarn" (2 seconds), the buzzer sounds. If either counter drops below zero, it turns off the relay so the signal on the RCA cable is opened and nothing goes to the TV.

You can edit the variables to set the max and warning times. There are lots of Instructables here about uploading an .ino file to the Arduino. I'm using a Nano, but the Uno or any other should probably work. There must be better ways to write the code, but I'm a civil engineer not a computer programmer.

If I've done it right, bikerelay.ino is attached and that's the code you need (could somebody put it on github?). Here's the ugly text version if that didn't work:

int ledpin = 13; //activates arduino light when there's a detection
int ledpin2 = 11; //activates external LED or buzzer when there's a detection int outputpin = 3; //pin the relay control is attached to int sensorpin = 12; //pin the detector is attached to int warnpin = 4; //pin used to activate warning LED or buzzer int counter = 0; //countdown since last detection int counter2 = 0; //countdown since last non-detection

//change the next 2 settings to adjust the timer intervals int countmax = 10000; //maximum level of countdown timer. 1000 = 1 second int countwarn = 2000; //when to turn on warning pin. 1000 = 1 second void setup() { pinMode(ledpin, OUTPUT); pinMode(ledpin2, OUTPUT); pinMode(outputpin, OUTPUT); pinMode(warnpin, OUTPUT); pinMode(sensorpin, INPUT); counter = countmax; counter2 = countmax; //any line with "serial" is for debugging and should be commented out if not needed because it will slow the clock down //Serial.begin(9600); //Serial.print("count: "); //Serial.println(counter); //Serial.print("count2: "); //Serial.println(counter2); } void loop() { if ( digitalRead(sensorpin) ) //what to do when there is a non-detection { digitalWrite(ledpin,LOW ); digitalWrite(ledpin2,LOW ); counter = counter - 10; counter2 = countmax; } else //what to do when there is a detection { digitalWrite(ledpin,HIGH); digitalWrite(ledpin2,HIGH); counter = countmax; counter2 = counter2 - 10; }

//serial output lines for debugging //Serial.print("count: "); //Serial.println(counter); //Serial.print("count2: "); //Serial.println(counter2); //Serial.println("-----------"); //sound a warning if either counter is above 0 but under the "countwarn" level if ( counter > 0 && counter < countwarn || counter2 >0 && counter2 < countwarn) { digitalWrite( warnpin,HIGH ); } else { digitalWrite( warnpin,LOW ); }

//turn off the output if either counter drops below 0 //these settings are for an "active low" relay. Switch "HIGH" and LOW for an active high output if ( counter < 0 ) { digitalWrite(outputpin,HIGH ); counter = 0; } else if ( counter2 < 0) { digitalWrite(outputpin,HIGH ); counter2 = 0; } else { digitalWrite( outputpin,LOW ); }

delay(10); // wait time (miliseconds) before going again

}

Step 6: The Results

When you start pedaling, the relay will close and the video will go to the TV. If you stop pedaling for 8 seconds, the alarm will sound. Two more seconds, and the relay will open and no more TV for you. Back to pedaling!!

It would be pretty easy to add this to a treadmill too- just put a strip of white electrical tape on the tread and point the black/white detector at it. If you wanted to get really fancy you could hook it up to a weight set too.

If you build this and like it, it would be nice if you would make a small donation to your local Humane Society.

Thanks for reading!

Coded Creations

Third Prize in the
Coded Creations

Bicycle Contest

Participated in the
Bicycle Contest

1 Person Made This Project!

Recommendations

  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Big and Small Contest

    Big and Small Contest
  • For the Home Contest

    For the Home Contest

47 Comments

0
Windowslifehacker
Windowslifehacker

1 year ago

Actually, I'm a 9-year old kid who loves biking. If we have to bike to power the TV, how are we gonna use it to play video games the same time while biking to power the TV?

0
alcurb
alcurb

7 years ago on Introduction

The idea is great, but I would much prefer to harness the energy output rather than wasting it to friction and heat. Since your project employed a certain level of sophistication, I know you would be able to build a generator system that can smooth out the electrical power output from pedaling. You would need some supercaps for fast charging and smoothing, maybe a storage gel battery for short rest breaks. Of course you'd also need an inverter to provide AC to the the TV. The stand you got is a nice one, but there are cheaper ones on Amazon and Ebay if you do some shopping. On Amazon you get get them for around 50USD. Your initial stumbling block of finding a cheaper generator is not a big one because you can use brushed motors, or other motors with magnets and coils inside, as generators. Motors are pretty cheap if you buy them used pulled from other equipment. They can also be scavenged from some discarded appliances. When you go out to a junk dealer, take a voltmeter with you; hook the voltmeter to the motor terminals and give the motor a spin. If you get some volts, you got a winner.

0
plays in traffic
plays in traffic

Reply 7 years ago on Introduction

This project was more for motivation than generation. I don't think the average TV would handle being turned on-and-off repeatedly very well, which is why instead of turning off the power, I just turned off the input.

If you want to make a generator, I really liked this one:

https://www.instructables.com/id/Bike-Generator/

0
JeraldL2
JeraldL2

Question 4 years ago on Step 1

Is it possible to create a circuit for a stationary bike (or treadmill or a rowing machine) whereby that if no small amount of voltage (5V or 12V) from the exercise machine then no 120 volts to the TV or a computer monitor or whatever? Great work!

0
Pleidig
Pleidig

Question 4 years ago on Introduction

Hi

I know this is an old post, but could you email or ring me on peterleidig@me.com or 07525 757414 - it’s a uk number.

Thinks our idea is great!

Thank you

0
DanielS352
DanielS352

6 years ago

Hey plays in traffic! Great Idea. I am actually working on a variation of this myself.

I just need some clarification on the RCA cable step.

I am currently trying to hook up my Raspberry Pi to this. I am using a 3.5 mm (4 pole) plug to RCA cable to connect it to the TV instead of an HDMI. If I strip this wire and insert into the relay, how will the relay be connected to the TV?

And what does it mean to have the "relay hooked up inline to an RCA cable going from a video source to the TV"? Thanks

0
plays in traffic
plays in traffic

Reply 6 years ago

Instead of the wire going straight from your Pi to the TV, it would go through the relay, which would open and close the connection. If the arduino doesn't see the detection, it will tell the relay to open, which will make the video going into your TV go dark

Hope this helps!

0
DanielS352
DanielS352

Reply 6 years ago

Thanks for your help! I got it to work

0
Darrenl5499
Darrenl5499

7 years ago

This is awesome! I just had a quick question. Would this work the same if you were to use an hdmi connection? If so what would you need to add?

0
plays in traffic
plays in traffic

Reply 7 years ago

Look for an HDMI breakout board, like this:
http://www.ebay.com/itm/HDMI-Male-19P-Plug-Breakout-Terminals-Solderless-Connector-With-Black-Cover-/171841768948

If you get two of them, you can connect all of the pins, except send one set through the relay, so it can be opened and closed. You'd have to experiment to see which pin to open.

Let us know how it goes!

0
Darrenl5499
Darrenl5499

Reply 7 years ago

Thanks!

0
cthomas16
cthomas16

7 years ago on Introduction

My High School English teacher did a similar thing to this -ible back in 1992. His kids had to pedal the bike in order to watch tv and it helped them appreciate books more. Thanks for the -ible!

0
daved10
daved10

7 years ago

Here is my commercial embodiment covered under my patent 6,179,746.

back.jpgfront.jpg
0
daved10
daved10

7 years ago

Here is my commercial embodiment covered under my patent 6,179,746.

0
daved10
daved10

7 years ago

Take a look at www.tvpedaler.com and see this in my patented product.

0
daved10
daved10

7 years ago

There are much easier ways to do this. Take a look at my US patent 6,179,746 that this is copying. Imitation is the sincerest form of flatrery as they say.

0
gotorobart
gotorobart

Reply 7 years ago on Introduction

would a 556 be able to sink the current needed to drive a relay like that? You would have to be pedaling quite fast to keep the design in the patent from cutting out :P

0
daved10
daved10

Reply 7 years ago

A 556 can drive a reed relay.