Pulsed DC to constant voltage trigger
JBernard
Posts: 8
Hi all, trying to finish a small project for a street bike and running into a few issues.
Here's the basis of my idea: I'm turning on an accessory (say headlight, gps, ect) on when the arduino input detects a voltage (bike is running).
Think of it as a timer almost. When bike is running i want a smooth low voltage out of the circuit.
I had a rough prototype i thought was working. I took a reading off the killswitch rail which with a voltage meter measured 0-30'ish volts. The problem is that it was a dirty and pulsed signal. Tricking the accessory and turning it on and off constantly. obviously i need a smoother clean signal. I originally tested the on/off with a AA battery hooked up to the prototype and it worked perfect, so thats what kind of signal i'm after.
So my guess is I need to find a circuit that will take 0-30v (maybe a bit more for safety). and upon seeing any voltage, it will trigger something else to bleed say 2.5v out to a pin i can use for a basic on/off (max input on arduino pin is 5v so i want to stay well under).
This is somewhat like a tachometer, but i dont need to measure the pulses at all. if the 30v is an issue, it's possible I could take a inductance voltage reading off the spark plug wire wrap method, but its way more cluttered than what i have in place now.
Thought about using a frequency to voltage converter. But i dont think i need something that elaborate, where it will lock frequency to a specific voltage.
I'm probably vastly over thinking this, maybe a few caps, resistors and transistor will do?
also, i have a Fluke DMM, but no scope. I know reading the killswitch rail voltage with a scope would help me out a lot, but dont have one available at this moment.
Let me know any ideas! I'm pretty basic in terms of electronics experience compared to most of you guys, but I'm willing to learn!
Thanks,
Taylor
Here's the basis of my idea: I'm turning on an accessory (say headlight, gps, ect) on when the arduino input detects a voltage (bike is running).
Think of it as a timer almost. When bike is running i want a smooth low voltage out of the circuit.
I had a rough prototype i thought was working. I took a reading off the killswitch rail which with a voltage meter measured 0-30'ish volts. The problem is that it was a dirty and pulsed signal. Tricking the accessory and turning it on and off constantly. obviously i need a smoother clean signal. I originally tested the on/off with a AA battery hooked up to the prototype and it worked perfect, so thats what kind of signal i'm after.
So my guess is I need to find a circuit that will take 0-30v (maybe a bit more for safety). and upon seeing any voltage, it will trigger something else to bleed say 2.5v out to a pin i can use for a basic on/off (max input on arduino pin is 5v so i want to stay well under).
This is somewhat like a tachometer, but i dont need to measure the pulses at all. if the 30v is an issue, it's possible I could take a inductance voltage reading off the spark plug wire wrap method, but its way more cluttered than what i have in place now.
Thought about using a frequency to voltage converter. But i dont think i need something that elaborate, where it will lock frequency to a specific voltage.
I'm probably vastly over thinking this, maybe a few caps, resistors and transistor will do?
also, i have a Fluke DMM, but no scope. I know reading the killswitch rail voltage with a scope would help me out a lot, but dont have one available at this moment.
Let me know any ideas! I'm pretty basic in terms of electronics experience compared to most of you guys, but I'm willing to learn!
Thanks,
Taylor
Comments
Here's a circuit that should do what you want:
The 2.2K resistor and the two diodes absorb most of the input current, limiting the voltage to 1.2V. That gets applied to the transistor inverter via the 1K limiting resistor.
-Phil
Thanks for the quick reply!
What kind of transistor would you recommend?
BTW, if the input voltage makes any negative excursions, you can add another diode in parallel to the two series diodes, but pointing the opposite way.
-Phil
quick VERY beginner question trying to understand this circuit...how does the +5v powering the transistor pin not constantly output a voltage (5v-4.7K resistor) to the output? so wouldnt i be seeing a voltage even if there was no incoming signal before the diodes?
-Phil
edit*
or does the transistor act like a switch and when it sees an input opens the +5v to enter the output of the circuit?
-Phil
and if i want to test this out with a 9v battery pack to make sure it works...i will be fine with red lead into input and black to circuit ground correct?
sorry for all the beginner questions!
As to the 9V battery test, sure, go ahead with it.
-Phil
only issue is that when battery is off its jumping back up to 4.85 (assume its getting power reading constantly after that 4.7K resistor.
goal is to have it read 0V while off, then that 2.5V when switched on.
Let me know what you think.
Thanks again for all the help so far, learned a good bit today!
Taylor
The circuit I supplied is an inverter. It's supposed to read low when the input is high and vice-versa. But 2.422V is not low enough to read as a logic "0." I may have to juggle some of the values. OTOH, you may have reversed emitter and collector in your circuit, which will put the transistor in a less-optimum conduction mode. In the meantime, are you sure that you can't live with a non-inverted output?
-Phil
good thinking. i goofed up and had the transistor wired backwards.
now she reads 4.85V when off, and .042V when on.
I can probably suffice with this for now. I reckon in code i could just say if 'INPUT VOLTAGE ' then 'START TIMER'. and it will do the same thing.
I'm testing with battery right now so theres no fluctuation in the voltage reading at all. youre saying when i hook this up to a noisy DC circuit it should behave the exact same way it is now?
do you mind clarifying one more time how the circuit above smooths out the pulsed dc current before it hits the transistor? whats to keep the current setup from pulsing the output voltage if the input is pulsed?
I dont have a scope, but another member here was doing something similar and this is what his reading looked like, I would bet my voltage off the killswitch would be VERY similar since its straight from the CDI box as well...
also, the voltage reading i was getting before was higher based on RPM. highest reading i got was around 30V and at idle it was 3-7V.
NewFile0.jpg
you can see why my arduino was giving me problems before. i think it was taking a reading every 100ms or so to check for voltage, so it was a roll of the dice on wether it hit on an actual voltage peak or not to be able to turn on or off.
printing back in the serial window gave results like this when bike was running -> 0,0,0,0,0,0,0,5,5,0,0,0,7,0,0,0,0,15,0,0,4,0,0,8
thus turning the unit on and off constantly. even though the bike was running. it was thinking it was turning on and off rapidly due to the pulsing.
thanks again!
-Phil
also made some edits i think while you were posting, if you dont mind re-reading it.
thanks again, would buy you a beer if you were down in Houston, 103* today. ouch.
one thing i forgot. is that the arduino i'm using has a Atmega328P.
the board is ultra-low power. and i'm powering it with a 3.7v 150mAh micro sized LiPo battery. The board has a stepup 5V rail, but also a 3.3V
will this circuit draw a lot of power? should i use the 3.3V to the transistor instead?