I'm building a bicycle-generator-powered modern version of a mutoscope (http://en.wikipedia.org/wiki/Mutoscope), and I'm stuck on one problem - I need to start video playback when the generator brings voltage to acceptable levels. I'm using either a Duracell power pack or a UPS to buffer the spiky output of the generator, and need to turn on the power of a DVD player (or VCR if I can't make DVD work) and trigger playback when power comes up (I'll use a DVD player with last position memory so playback will resume if interrupted).

I've got a solution based on X10 controllers, a delay circuit, and an IR sender, which will do what I need, but seems like it would be slow and probably flaky. I'd much rather figure out how to hack the player to turn on and start playback immediately.

You could build a time delay circuit that will wait a few seconds after power up, press the power button (by hacking into the power button control), then waiting again until the unit powers up then pressing the play button.

This would require some simple timing circuits or a microcontroller which could give you much more flexibility.

sounds like a simple enough solution - i've been perusing the schematics for a dvd player, and with my limited understanding, it looks like i've got to send a low voltage signal to the correct traces on the main IC in the machine to 'press' the power and then play buttons. am i getting that right?

is there a microcontroller kit that i could use for this? i've done some programming, so i think i could handle the programming piece of the problem.

it also occurred to me that some car DVD players might include this feature (so that i wouldn't have to hack the controls), but i can't get straight answers from distributors. will be calling a couple manufacturers today/tomorrow.

I use PIC microcontrollers but that is only because I know them well and have invested in programming equipment and software. If I were to pick a controller for a project like this and start from scratch I would pick an Arduino. It is a self contained system, no separate programmer needed since it just plugs into your USB port. The programming language is C like and is free. You can find the controllers from about $15 for a bare bones version (do a Google search) or get a typical model like the one listed below.
http://www.sparkfun.com/commerce/product_info.php?products_id=666

You may want to consider using a relay to "press the buttons".
http://www.sparkfun.com/commerce/product_info.php?products_id=524
This way you don't need to worry about tying into the CD player electronics and doing something wrong. The button will most likely be a simple normally open connection, connecting two wires to the switch over to a relay will allow the microcontroller to activate the button when needed.

Nice thing about the microcontroller option would be the ability to adjust timing and add options with ease.

So, to be clear, I'd power the arduino from the player power supply, connect it to two relays which would bridge the player power and play button contacts, write the appropriate code to detect power state, close the power button relay, delay, then close the play button relay? Is it really that simple?

What I would do is feed the raw DC voltage into a big capacitor to smooth the rough DC. Not sure how stable the voltage will be out of your rig, if it is 11.5 to 15 volts you should be fine to pump it directly into a power inverter. Most inverters will make nice AC power with the variable DC input and fail nice and quick as soon as the DC is removed.

You could then plug all the AC items into the inverter (TV and DVD player). Instead of using the DVD player power supply I would just use a wall wart and plug it into the inverter. This way as soon as the system is making AC power the microcontroller will wake up, it will delay to allow the other units a bit of time before they are commanded to turn on, then a bit later the play button can be simulated. Only reason I don't recommend stealing the power from the DVD player is that a relay can have a significant inrush current and the DVD player power supply may not like that.

The Duracell 600 portable power pack is what is recommended by the generator plans I'm using - it's a combination inverter and battery pack, which should serve to buffer the spiky output of the genny, and also store up excess charging capacity, so that if a user cranks for a while, it will continue to feed voltage to the components until the battery runs dry. Its manual says that it will shut down clean when input voltage (I assume that's from either an external input or the internal battery pack) runs below 10.5VDC.

I've read through the Arduino programming reference, and it looks like what I need to do is super easy. I'm ordering a couple Arduinos and a handful of relays today...will power via wall wart per Alan's advice. I'm sure I'll have more questions when I actually break open boxes and such. Thanks for all the help so far.

OK - I've got my Arduinos and relays (omron g5v-1), and I'm trying to figure out how to connect everything together, and have some more questions.

Problem 1: Detect power

I've decided to leave a charge in the battery of the system at all times, to avoid destroying the battery by running it in undervoltage situations, and to simplify some other parts of the problem (like feeding constant power to the Arduino, which gives me more flexibility there).

What I need to do instead is detect that the generator is producing adequate voltage, at which point I'll start to do things to the machine. I found a schematic that I think will fit the application: http://www.arduino.cc/playground/uploads/Learning/Level_shifting_4_arduino.pdf , but I don't entirely understand it (I suppose I could just build it, but I'd like to know why I'm doing what I'm doing as well). Here are some questions:

- I think for my purposes (detect generator output in the range 0-15V), using the transistor-based circuit at the link above is adequate - is this true? (There's a battery charge controller in the circuit which will prevent voltage exceeding 15V, so I'm not worried about overvoltage).
- How do I determine the proper sizing for the resistor on the input leg (R1)? It's indicated at 1K-3.3K ohm on the schematic.
- What's the purpose of the diode connected between the anode and cathode on the input circuit?
- I don't understand the connections to the Arduino, between the C on the transistor, +5V on the Arduino (via resistor) and the desired input pin on the Arduino...is it simply that the Collector output subtracts from the +5V as the voltage across the Emitter leg of the transistor increases? I'm fuzzy on how transistors actually do their business.

- R1 is "1K or 2.2K" - which & why? What's the purpose of this resistor, anyway?
- I can't for the life of me figure out which pins of the relay (http://www.sparkfun.com/datasheets/Components/G5V-1.pdf) to wire to which parts of this circuit.... My guess is that the circuit which is normally open and which I want to close when I send voltage from the arduino to the relay is wired on pin 10 and ground, and that the digital out from the Arduino goes to 2, with 9 to ground (labeled as 1 and 16 on the circuit schematic)...but as I type this, I'm pretty sure it's wrong...
- What's the purpose of the shunt around the relay with the diode in this circuit?

I am assuming that the arduino ground and the charger ground are common. You can pick any resistor combination that allows the analog input to be less than 5 volts when the charger is putting out full power.

For example if the positive of the charger goes into a 10K resistor, then the other side of the 10K goes through a 3.3K resistor to ground there will be only 3.72 volts on the center of the two resistors when the charge voltage is at 15 volts.http://forum.hackedgadgets.com/posting.php?mode=reply&t=2215

(15V / 13.3K) * 3.3K = 3.72V

As far as the relay circuit goes, the 1K resistor is there to provide the correct base current, it is actually just fully turning on the transistor and preventing too much current to flow and damage the arduino or the transistor.

As far as the relay goes, have a look on page 3, there is a diagram of the relay.

The coil on your relay is pins 2 and 9. It is shown as 1 and 16 on the arduino diagram.

As far as the contact goes, 5 and 6 are both common, 1 is N/C and 10 is N/O.

N/O means normally open and is probably what you need. The way this works is when the arduino pin goes high it will provide a voltage on the base of the transistor and turn the transistor on. Now that the transistor is on there will be a ground applied to the lower part of the coil (listed on the arduino diagram as pin 16). Since there is always positive voltage applied to the top of the coil this will activate the coil.

When the coil is activated internally it will change the state of the contacts, the open contact will close and the closed contact will open. If you place you ohm meter between the common and the N/O contacts when this happens you will see the contacts close. Most buttons on DVD players and other electronics are N/O and close when pushed. By connecting the relay to the button you will be able to simulate the button press.

Sorry for the long post and please excuse me if I stated things that you already knew. But if there is anything you need some assistance on please let me know.

The reverse biased diode that is placed across the relay coil is to prevent reverse EMF when the coil turns off (magnetic field collapses). This would otherwise produce a negative voltage spike that can cause all sorts of problems.

Those voltage sensing circuits are basically going to give you an on or off indication.

I thought that a transistor would amplify (or in this case, de-amplify) a current...shouldn't I see a scaled-down input voltage across the transistor (similar to what I'd get in the voltage divider output)?

Alan wrote:

What you might want to do is simply monitor the actual voltage of the charger. The Arduino can only take a max of 5 volts (I think) into the analog input so you will have to scale the input down. This can be done with 2 resistors.

This seems simple enough, but should I be concerned about the amount of current this would draw vs. the transistor option?

Surprisingly (to me, anyway), I correctly figured out the the relay function on my own...thanks for confirming my understanding. And thanks for all the help on this.

I'm going to pop by the local electronix shop tomorrow and pick up some of these components and play with different versions of these circuits to try to understand them better. Hopefully, my generator components will arrive later in the week and I can start to put all the chunks together.

(Thanks to Brad at pedalpowergenerator.com for plans, assistance, and parts for the generator part of this - he was incredibly helpful)
- I've got a generator powered from the bike's rear wheel, which consists of a permanent magnet motor, and which passes its output through a battery charge controller which limits voltage to avoid sending big spikes to the battery and blowing anything up
- The output of the generator passes into a Duracell power pack, which carries a constant full charge - when the system is running, the user is replenishing the battery charge with the generator - this gives me smooth, clean power, and also allows me to provide constant power to my controller, which simplifies some other parts of the problem

- I built a controller around an Arduino, which does several things:
1) detects generated voltage - I pass the unbuffered output of the generator through two 10K resistors and measure the current between them
2) controls an LED array which is a primitive voltmeter - this gives the user feedback about acceptable effort/voltage
3) when acceptable power is detected, power is provided to TV and VCR - I hacked a power strip and replaced the switch with a relay which is driven by the Arduino
4) after a short delay, briefly closes another relay which bridges the power button on the DVD player - the DVD player auto-loads and plays the inserted disc, so no need for any other actions here
5) after another (much longer) delay, which allows the DVD player to load the disc and begin playback, I close another relay which provides power to an active RF modulator (which I need in the signal path to convert composite RCA video signal to coax) - this initiates playback of the DVD without displaying the stupid DVD load screen

Next step is to take all the electronics off the breadboard and wire them more permanently, and build an enclosure for all the components.

That is great! I am looking forward to seeing some pictures of this project.

I wonder if the voltage divider may need to be tweaked though, is the voltage that is being fed into the voltage divider ever more than 10 volts? If it is this would mean that the Arduino could see more than the 5 volts that I think is its max input voltage.

The arduino can handle up to 12V, although it's calibrated to 5V - I haven't looked hard about how to recalibrate, because I don't need to read higher voltages. Also, I have to look again, but I don't think I'm getting voltage above 5V in the voltage divider at all, even when generator voltage is above 12V...hmm.