Author Topic: Sequential Taillight using Arduino Pro Mini (Thread Change from 555 Delay Timer)  (Read 51139 times)

0 Members and 1 Guest are viewing this topic.

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
okay, thank you
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
Something you might want to consider.  If your gonna run a constant lead to the back of the car to power the arduino 24/7 it's gonna put a draw on the car battery when the car is parked.  I found with mine I could power the arduino through diodes from the input wires before the divider circuit and the arduino booted up so fast, instantaneous, that the brakes would work if pressed with the car off and the parking lights would flash with my car alarm etc.    I then ran ignition source to power the board when the car was on.   You can see this on the board jpg in the previous post.

Also when you have it together let it run and feel the temperature of your regulator.  Mine was a 7805 to power the atmel and TLC's and when it got hot the program/operation got wonky, dissipating 9V in heat was too much even with only a few hundred mA.  I changed it to a switching RECOM regulator and other than the price hit ($5-$7), all has been great.   You seem to be going down to only 9V and don't have the TLC's chips, so it might not be a problem.
« Last Edit: January 11, 2016, 12:23:01 am by wguibas »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
no, the 12v constant wire would be hooked up to a relay, via the ignition and battery. ALL power should be off

Oh, wait, that won't work, the Flashers won't be on, hmmm.

Maybe I can run two relays, one to power on if the flashers are activated.. keep the relays up front, then run the wire back.
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
But you not only want the flashers to work with the car off, but the brake lights too.  Also if you end up putting the parking lights thru your circuit then them also.  The power feeding the bulbs now from the truck is more than enough.  In my car if I push my brake with the car off, 12V goes to the back and flows thru a diode and powers my regulator to power the arduino and the brakes light up. Same thing with my parking lights and hazzards.  The diodes keep the juice from the brake circuit flowing into the parking lights and hazzards and vice versa.  It ended up being a very simple solution that works great.   


By the way what type and year of truck does your nephew have?
« Last Edit: January 11, 2016, 12:48:16 am by wguibas »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
I'm worried about this.

hooking up to the Barke/Turn/Hazard wire to run the arduino.

#1...
The Arduino would turn on and off during flashing
#2...
The Arduino would Reset half way through left/right turn signal, because the flashing state of ON/OFF

If I put a big capacitor on that wire to ground, then, the sequencing wont work, nor flashing, as the arduino needs that wire to sense the flashing.

I thought about maybe running a wire back connected to the ignition to power the arduino as well, but then that comes back to the same problem as #2
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
The turn signals would be covered by the ignition source with a diode also.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
i don't understand.

Let me try and draw this, maybe I can figure it out.

Can't figure it out.
If I use a Relay/Mosfet to turn of the i....................
hmm, nm, I don't understand how to do it.
« Last Edit: January 11, 2016, 01:02:25 am by Falcon69 »
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
12V comes in on the input pins  travels to the diodes for each input and feeds the regulator to power the board.  If the ignition is on it also is on the input harness and has a diode so it powers the board if the car is on.  Once one of the inputs provides power the board comes alive.  If the ignition is on and the turn signal is activated the board is already on from the ignition so the power from the turn signal input has no change in the power to the board, it's already on.    You can't see it on the picture but the inputs also feed the voltage divider resistors to trigger the arduino inputs.



The traces that feed the voltage divider cant be seen because they are on a layer disabled.

Here you can see their traces:
« Last Edit: January 11, 2016, 01:13:44 am by wguibas »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
okay, but isnt having the arduino turn off/and on many times over and over again (as in ignition off, arduino powered from turn signal/hazard) bad for it? It doesn't have a lifespan on it based on how many cycles of off/onn....like batteries do?

I know when I was doing car stereos, that the constant draining to zero and recharging, only lasts for about 1-3 times on a conventional car battery, unless you had an optima Deep Cycle.

I'm not sure if the Arduino works the same or electronics in general.

The other thing....that would be there would be a delay in charging/discharging the capacitors, which couold result in delay of lights turning on...I guess with ignition off, that doesn't matter much, unless towing the vehicle.
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
The arduino is not a battery, it's a computer.  It has no problem turning on and off.  On the old thunderbird I did, I did have to up the capacitors and add a relay in line with a capacitor to clean up the noisy 50 year old brake pedal switch output.

What year and model truck does your nephew have?
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
FYI, just so you all know....

And, I hate that it is the fact....I am a visual person. I have trouble understanding things, until I see it drawn or a picture of it or see it working. This is why I have so much trouble in college. I can't see and understand much, unless I see a schematic or drawing of it, then the wheels in my head start working and then I understand what is happening.

Just be patient with me, I'll figure it out.

I'm like a grenade with some things. Gotta pull the pin and wait a minute!  :-DD

The truck is a 1997 Dodge 2500 Cummins Diesel

Okay, I was just concerned with the Arduino cycling alot through On/Off.  I'll redraw my schematic, and post up.
« Last Edit: January 11, 2016, 01:26:20 am by Falcon69 »
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
Not a problem, I'll look up the schematic for the truck and see what your best options are.   
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
NO, I don't need to invert the signal...I just suggested the P-Channel because the Power needs to go INTO the LED's.I just heard it was better to use P-Channel for high side switch.  But that would mean I'd have to invert the signal, hence why an NPN photo transistor.

As I have the schematic now..it goes like....
Vehicle 12v > Drain N-Channel mosFET through Source of mosFET > LED's > Ground

Since the LED's share a Common ground for the Turn/Brake and for the Tail Light (running Light).....I have to run it as a High Side. Switching the common ground is not acceptable, as it would make the running lights flash when turn signals are on...Don't want that happening. Running lights need to STAY on (separate LED's not connected to the turn/brake LEDs within the LED modules themselves)

If the N-Channel still works for that configuration, I'd rather use it. I never liked using P-Channels as switches. But, I'm a newb, what do I know.

The LED's are connected directly to the vehicles factory Turn/Brake, Ground, and Taill Light wires that are already in the back of the truck.  Basically, we cut the wires going to the existing factory taillights, and wired the LED's in.

Voltage Divider would work, however, What if there is a spike voltage? Wouldn't that damage the arduino? a mosfet or optocoupler would provide protection, wouldn't it from that?

Ah... I see. Common cathode for running lights and brake/ts. I missed that bit of info somehow, sorry.

OK, so it looks like you will have to use P-ch mosfets in high-side switch configuration. So the NPN optoisolators will do the necessary inverting for you. Simples.

Except for a P-ch mosfet the Source goes to the +12 rail and the Drain goes to the LED Anode.
So +12V > Source > Drain > LED > Ground. (If this is confusing, consider the polarity of the body diode in the mosfet. If you connect Drain to +12 v as with N-ch mosfets, this diode will be forward-biased and will conduct.)
And LED will be ON when Gate signal is LOW, so the inverting optocoupler circuit for the Gate will provide correct performance with no change in the software, I think.


As far as powering the Arduino directly from the signal lines.... well, it does take a while for the Arduino to boot up and start working. From applying power to first light flash takes 1.5 seconds, in the setup I'm using.
« Last Edit: January 11, 2016, 01:51:35 am by alsetalokin4017 »
The easiest person to fool is yourself. -- Richard Feynman
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
If it's taking 1 and 1/2 seconds to light,   do you have any delays in the setup? The other possibility is mine was designed on and Arduino UNO R3, maybe they have different bootloader delays?  My finished board has the bootloader removed.

Here is mine on the bench:

https://youtu.be/ZQPOCtNm95Y

Just to test, I took a regular UNO CHIP with bootloader and uploaded the sketch via USB and dropped it in my board.  Still quick startup

« Last Edit: January 11, 2016, 03:05:39 am by wguibas »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
video is private, can't see it.
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
fixed, forgot to push publish
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
That's amazing. I know I've never seen an Arduino boot that fast. To test, I just wrote this simple sketch:

Code: [Select]

setup(){
pinMode(8, OUTPUT);
}
void loop(){
digitalWrite(8, HIGH);
}


... and on my genuine Italian made Uno R3, it still takes over a second and a half for the LED to light up after power is applied to the Uno's power-in jack.

So I can only conclude that you are some kind of magician or something.....    :o

The easiest person to fool is yourself. -- Richard Feynman
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Meanwhile, back at the ranch....

Here's a demonstration of using a High-Side Switch P-channel mosfet, with Gate isolated using an inverting optoisolator topology, to switch one of the LEDs on my breadboard test system:

The easiest person to fool is yourself. -- Richard Feynman
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
i appreciate your sarcasm, I guess maybe your not a magician.  The video doesn't lie.  Good luck on your ranch.  I am from NY things move faster here.  I'll see if I can figure out why yours is going slow, maybe it's all the optoisolators.
« Last Edit: January 11, 2016, 04:56:09 am by wguibas »
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
i appreciate your sarcasm, I guess maybe your not a magician.  The video doesn't lie.  Good luck on your ranch.  I am from NY things move faster here.  I'll see if I can figure out why yours is going slow, maybe it's the all the optoisolators.

There is no optoisolator or any delay in my Uno test, just one single LED directly connected to the Pin 8 by a 220R resistor. Nothing else. And as you can see the boot-test sketch is about as minimal as it gets.

No, I'm not a magician, I just build and test, build and test. Maybe Falcon69 should just buy one of your boards, instead of messing about with all this other stuff.


The easiest person to fool is yourself. -- Richard Feynman
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
Your slow boot is your bootloader.  Update it to the optiboot one which I just did on a nano and the delay is gone.  Apparently some boards probably the chinese clones come with the optiboot one already.

the optocoupler comment was sarcasm, kinda like the magician comment.

If he wants one of my boards, he just has to ask, it would still need to be adapted to his task. 

Arduino Nano with optiboot
https://youtu.be/tdtlqz64KmM
« Last Edit: January 11, 2016, 04:54:28 am by wguibas »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
Thank you guys for the videos, and good advice on the bootloader. I will check that once my boards get in.

Thank you Alse..
I can see how the mosFET P-CH is working now. Good.

I think something is wrong with that simulation program I posted.  The lights are still acting weird when brakes are pressed.

I am enjoying, with your guys help, figuring this out. It's one thing to buy the board from someone, then to figure it out, see how it works, do some of the programming and actually understand it.....then it is to just buy one already made.

I like the features of yours wguibas, however, for this truck, it's not feasible, as I cannot break open the LEDs and connect them individually to each of the 10 leds inside each module to get the cool fade/chaser effect while sequencing.  These lights just represent a big 6inch oval LED. Besides, the way he has them mounted, it just wouldn't look right. He has each of the three LED's mounted sloping upward...not in a line like the old 66 mustangs.

However, for my car, a Mazda 6s with aftermarket LED taillights, I plan on doing something like your Camaro, once I learn all this.  I will need to break open the taillights with a Dremel, rewire, then glue it back up. Sounds fun.

Anyway, I redid the schematic, let me know what you think. I think I got it all correct. Correct me if I am wrong.  The Optos will probably be a cheap 4 pin SMD, if I can find one cheap.
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
I was just thinking....

If there was some sort of delay...that wouldn't be god if flashers are on without ignition.  It would not sequence correctly, because of the delay.

So, Is there somehow a way of having a cap to store the energy during the delay of the sequential....that would draw power from the brake/hazard/turn wire to charge it, and supply it to the 78L09 chip...keeping that on continuously until the cap drains without interrupting the sequencing flash rate of the wire?

« Last Edit: January 11, 2016, 05:52:38 am by Falcon69 »
 

Offline wguibas

  • Supporter
  • ****
  • Posts: 125
  • Country: us
Just quick looking at the schematic, You have to add a diode on the ignition line to keep the inputs power from backfeeding to the front of the truck.  Q9 and Q10 are unnecessary.   As far as the hazards working with the ignition off, it could be addressed as a timing thing in programming to have the sequence be as long as the hazard flasher has the wire at 12V.  Then it would cycle all 3 LED's and lose power.

   The problem I see with the setup is the whole 3 step sequence on the brake for the first sequence and the turn signal being on and hitting the brake.  The other side would do a sequence the opposite way for the first sequence.  There is no way to know if the hazards are on or the brake is being pressed in the program? I really think you need to add another input for the brake separate and isolated from the turn signals.  If you grabbed the wires from the front of the truck under the dash at the brake pedal and by the turn signal switch, then you could have true brakes lights and sequential signals and program the logic to know what to display in the back better.
« Last Edit: January 11, 2016, 01:48:43 pm by wguibas »
 

Offline Falcon69Topic starter

  • Super Contributor
  • ***
  • Posts: 1482
  • Country: us
yes, thats exactly what the simulation is doing....

hmm, so that would be two additional wires coming back. One for ignition, one for brake pedal. I was trying to not do that.

so have the last LED pin that after it lights, have a small delay, then code to turn off ALL LED's?  Then Arduino resets and starts over?

But, that would mess up the Brake Lights.....unless I do run another wire back. I was hoping NOT to do that. One wire for ignition was more then I wanted, but if it has to be done, it has to be done I guess.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf