I need stable DC for the relay. The idea is simple.
Turn the turn signal on, the signal going to the Attiny which make the signal stable, then it goes to the 5V relay which in one way turn the day lights off and turn the signal light on, then when the signal will go off then the relay turn itself and the day light will go on.
So:
1 .after attiny detect the signal it make it stable using own power from VIN.
2. Stable signal going to the relay and change its position.
3. after signal is gone more than i dont know, maybe 2 seconds then the attiny turn off the stabilized signal.
Yes Michael, the 12V from the car will be stabilized to the 5V via 7805 stabilizer.
You need a circuit or algorithm called a "missing pulse detector".
This will output one level if there are no pulses and another level if there are pulses.
You can make this with a capacitor that is charging up and a transistor across it that discharges the capacitor when it gets the pulse. Arrange the time constant so that in the absence of a pulse the capacitor charges up to some threshold voltage that triggers a circuit. This could be monitored on an analogue input.
Alternatively you have a software program that records the millis() time on each pulse. The loop then checks how long it has been since the last pulse and triggers a variable if it has been too long.
i wonder whether hardware solution can be enough precise, and how about durability?
Can the capacitor will charge up enough after one pulse, of course i will put the Schottky diode but will be enough?
I think the software solution will be more flexible and precise ?
Before Arduino times we did this with a simple cmos IC. e.g CD4538.
AFAIK, the circuit is called a "pulse stretcher".
A re-triggerable mono.
Like this.
Leo..
I think the software solution will be more flexible and precise ?
Statements with question marks on the end are hard to follow.
NexusPrime (is that from Star Trek?) FYI, "a stable signal" is called a logic HIGH or LOW, to distinguish it from a steady state analog signal. You can also call it a TTL signal. TTL
That i know and i am fighting with the code provided by Michael for hour and i cant get i to work. I corrected the letters, bracket and the semicolon. Tried in different configuration and nothing work. I am close to give up because i am working on this whole day without results. I tried also with the NE555 and finally failed. Probably i will pay somebody for do the code. I have a work and i cant spend all my time on this one thing because this is not a part of my work...
When i wrote more flexible i was talking about i dont need to change the elements, desoldier it and soldier back. Just need to pull the chip and make some changes in values.
according to the nick, i dont know. At first i wanted Nexus but in many places was unavible so decided to the nexusprime.
but i love the StarTrek, watched it all many times.
nexusprime:
That i know and i am fighting with the code provided by Michael for hour and i cant get i to work. I corrected the letters, bracket and the semicolon.
Well, I looked over the code and it should work. It's really simple logic. So look at your electronics.
Did you test it first with a simple switch and LED? Or try to plunk it into a car, with all the interface circuitry?