Trail Plug to Propeller Chip
Jeff2
Posts: 46
HI
I will explain the big picture to you. There is A kit that
you can buy for your truck. It plugs into your trail light plug, on the
Truck side.(A led light bar).
It goes below the tailgate and it consists of A bank of led light's. The led's
go from one side of the tailgate to the other side. About 4 feet.
When you step on the brake pedal, all
the led's turn on. When you step off the brake pedal, all led's turn off.
When you use the right turn single. The right side of the led's bar
(witch is half of the led's), turn's on and off, like your turn light does.
When the turn single flasher is switched off the led's are off.
What I am looking to do with the Propeller Chip is.
I want to make the same thing, but I want to change the way the flashing is done. Not on
and off, like A flasher. My way, left to right or one at A time.
I want to use A reed relay, as A switch. The coil part will plug
into the 12v comming from the traler plug,
(witch is both Brake light and turn light). The switch part will have 3.3v
and going into the Propeller Chip as pin (23).
(Trail Plug = Reed Relay = Propeller Chip (23) = Led's)
Propeller Chip Programing.
So when the switch is held down. The (brakelight) program will run untill the switch is let go.
(IN the program now, When you push the switch down the brakelight turn's on, then when you
let go of the switch it turn's off,
then it run's the rightturnlight program). I what it only to run the brakelight program, when
the switch is held down, then let go. This is what I need help with. Is there I way to jump from the
end of the (brakelight) program to the end of the (rightturnlight), so the Led's will just
turn offff.
So you hold down on the button, all the led's come on. When you let go of the button, all
the led's go off.
When you press the button down and released continously, it will run the (rightturnlight) and
only it. Then when you stop pressing it. All led's are off.
1.) button is left alone =(all led's are off)
2.) button is pressed down continoulsy = (brakelight)
3.) button is pressed down and released continously = (rightturnlight)
Last thing is...............................
If you leave the button alone might be caused by the lack of a Pull-down-resistor
between Propeller-IO-Pin 23 and ground. (I have A resistor there.)
This is what someone told me, to fix it.
The next issue is that a switch will bounce when it changes state. So you need some debounce code.
The simplest form is a delay after it switches state. Start with 1 second so you can see the change in your leds.
Will this work as A delay (waitcnt(clkfreq/4 + cnt)?????
Thank you
I will explain the big picture to you. There is A kit that
you can buy for your truck. It plugs into your trail light plug, on the
Truck side.(A led light bar).
It goes below the tailgate and it consists of A bank of led light's. The led's
go from one side of the tailgate to the other side. About 4 feet.
When you step on the brake pedal, all
the led's turn on. When you step off the brake pedal, all led's turn off.
When you use the right turn single. The right side of the led's bar
(witch is half of the led's), turn's on and off, like your turn light does.
When the turn single flasher is switched off the led's are off.
What I am looking to do with the Propeller Chip is.
I want to make the same thing, but I want to change the way the flashing is done. Not on
and off, like A flasher. My way, left to right or one at A time.
I want to use A reed relay, as A switch. The coil part will plug
into the 12v comming from the traler plug,
(witch is both Brake light and turn light). The switch part will have 3.3v
and going into the Propeller Chip as pin (23).
(Trail Plug = Reed Relay = Propeller Chip (23) = Led's)
Propeller Chip Programing.
So when the switch is held down. The (brakelight) program will run untill the switch is let go.
(IN the program now, When you push the switch down the brakelight turn's on, then when you
let go of the switch it turn's off,
then it run's the rightturnlight program). I what it only to run the brakelight program, when
the switch is held down, then let go. This is what I need help with. Is there I way to jump from the
end of the (brakelight) program to the end of the (rightturnlight), so the Led's will just
turn offff.
So you hold down on the button, all the led's come on. When you let go of the button, all
the led's go off.
When you press the button down and released continously, it will run the (rightturnlight) and
only it. Then when you stop pressing it. All led's are off.
1.) button is left alone =(all led's are off)
2.) button is pressed down continoulsy = (brakelight)
3.) button is pressed down and released continously = (rightturnlight)
Last thing is...............................
If you leave the button alone might be caused by the lack of a Pull-down-resistor
between Propeller-IO-Pin 23 and ground. (I have A resistor there.)
This is what someone told me, to fix it.
The next issue is that a switch will bounce when it changes state. So you need some debounce code.
The simplest form is a delay after it switches state. Start with 1 second so you can see the change in your leds.
Will this work as A delay (waitcnt(clkfreq/4 + cnt)?????
Thank you
CON _clkmode = xtal1 + pll16x _xinfreq = 1_000_000 LEDpin1 = 0 LEDPin2 = 17 SwitchPin = 23 OBJ led: "BreakandRightlights" Var long LastSwitchChange long RateThreshold long LastCNTValue long ResultCNT byte SwitchStatus Pub start Dira[noparse][[/noparse]LEDPin1]~~ Dira[noparse][[/noparse]LEDPin2]~~ Dira[noparse][[/noparse]SwitchPin]~ RateThreshold := 001_000_000 LastCNTValue := cnt repeat waitcnt(clkfreq/1000 + cnt) ResultCNT := cnt - LastCNTValue if Ina[noparse][[/noparse]SwitchPin] <> SwitchStatus 'is the state of the switch different from the last time it changed? LastCNTValue := cnt 'lets record this time SwitchStatus := Ina[noparse][[/noparse]SwitchPin] 'store this as the current switch status if ResultCNT > RateThreshold 'we have gone over our threshold with no change in the SwitchStatus 'this means either the switch was held down or not pressed outa[noparse][[/noparse]LEDpin1]~ If SwitchStatus == 1 'Switch was held outa[noparse][[/noparse]LED.BrakeLight]~~ else 'switch was not pressed outa[noparse][[/noparse]LEDpin2]~ 'the switch is changing faster than the threshold r else 'the switch is changing faster than the threshold rate outa[noparse][[/noparse]LED.RightTurnLight]~~
PUB RightTurnlight dira[noparse][[/noparse]0..19] := %11111111111111111111 outa[noparse][[/noparse]0..19] := %00000000000000000000 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]0..19] := %00000000000000000000 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]0..19] := %10000000000000000000 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]0..19] := %11000000000000000000 waitcnt(clkfreq/4 + cnt) '(N100) PUB BrakeLight dira[noparse][[/noparse]0..19] := %11111111111111111111 outa[noparse][[/noparse]0..19] := %11111111111111111111 waitcnt(clkfreq/4 + cnt) outa[noparse][[/noparse]0..19] := %00000000000000000000 '(N10)
Comments
LED's require current limiting resistors to set the current (and hence intensity) of the LED. Different LEDs have different intensity outputs and the LEDs used in cars and trucks are the high power LEDs. I have not looked at their specifications, but they are usually driven with a switching circuit, and require much more current than the prop can safely output. This is an area you will have to look at. For testing, try a 330R (minimum) to the LED (if grounded) to limit the current so you will not destroy your prop. But I am sure you will require a driver per LED to use a much higher current. You will probably need to put the LED to +12V instead of ground and switch with a transistor driver or·other. This depends on the LEDs used and you will need to check this out. If you do not have 12V permanently available, use a diode (1N4004 will only handle 1 Amp max) from each pin capable of being switched on to a common 12v point to power the LEDs or drivers.
Next thing is a question. Does your trailer connection have 12V always available? You will need something to power the propeller when the brake/indicator/tail lights are off.
Now for your indication. Since you are showing lights for safety, you should keep them on while debouncing. That is, the brake light should go on without any debounce delay, and you should only debounce to turn it off. Rather than 1 switch, you should be looking at the brake, the left indicator, and the right indicator. Perhaps even the reverse could flash the LEDs too. What are you doing about the tail lights (for night-time) or is this in addition to normal trailer lights? Don't forget about the legal requirements.
For sensing the inputs, just use 2 x 10K per input pin. Connect the·prop pin to 2 x 10K, one to ground, and one to the car/truck connector pin. When the connector is +12V, a "1" will be at the prop pin, and when 0V (or open), a "0" will be at the prop pin. No coils required.·You could use a·small cap across the 10K (needs reducing to maybe 1K)·to ground to serve as a debounce (needs calculation).
Once you are sensing all the inputs, it is a simple matter to drive the appropriate LEDs (prop output pins) as you desire.
Once you work out what is required, then we can talk about the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
So the brake light will have 3.3v. The Right Turn Light will have 3.3v on and off 3.3v on and off going into the Propeller Chip.
So the brake light will have 3.3v. The Right Turn Light will have 3.3v on and off 3.3v on and off going into the Propeller Chip.
http://www.customdynamics.com/truck_led_light_bar.htm
Post Edited (Jeff2) : 2/10/2010 12:34:53 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1986 Chevy EL Camino·· No prop yet
1984 Suzukie GS1100GK No prop yet
I'm a liitle confused at what you are looking for, because the product does what you have explained you want.
Also check local laws as to the legality of lighting add ons. Post Edited (hover1) : 2/7/2010 9:12:10 PM GMT
As far as how to have it tell the difference between whether your braking or turning that will be a little harder and personally I wouldn't worry about it. I would let it sequence every time power is applied and just make sure it happens before the light would turn off and back on. That way if your just applying the brake it sequence and as long as the input to the prop stays high it will stay on fully. But if the pin cycles high to low then back high it would restart the sequence.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1986 Chevy EL Camino·· No prop yet
1984 Suzukie GS1100GK No prop yet
light is on, turn all the led's. If the right turn light is on make the Right side of the led's sequential to the right. I don't know how to program this. I wish I did. I do know how to hook up the Propeller Chip, and all the led's, don't need help with this, ((Just the Programing to the Propeller Chip.))
OK, a few more questions...
Do you have to use this trailer plug or can you have a different plug ?
If you can use a different plug, then just tap off 3 wires via 10K as shown. You do not require reed relays.
Otherwise, just use·the two wires as you have shown and the circuit with the reed relays.
The rest can be achieved in software for either case.
In the case of 2 wires, if both inputs are on then you turn on all leds and it is a brake signal. Otherwise check each input to see if either is on, and flash the appropriate leds.
You are going to have to show how many leds you have and how you are driving them from the prop as this effects how you program the prop.
What you can do is something like this...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Post Edited (Cluso99) : 2/8/2010 2:41:16 AM GMT
I want to use the trailer plug comming from the truck. Because it's easy to plug into, it's in the back, of the truck......
What you people are missing, Is. (The Right Turn Light and the Brake Light, are on the same Light bulb.) So if pin23 has 3.3v going to it, for A long time. The brake light is lit. If that same pin has 3.3v and it goes on and off, on and off. Then the Right Turn flasher is on. So some how the Propeller Chip need to know how much time pin23 is on for. So if pin23 has 10s that it is on for, then make it sequential to the right.
If pin23 is on for 100s, then make the brake light led's come on.
Worth emphasizing this bit. Quite a lot of US made vehicles use combined Brake/Indicator lights. No separate indicators. So when the plonker in front of you has a brake light out, you never know if he's indicating or just tapping the brake pedal.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.
Well, it is easy with software to detect... 1=on
L R
0 0 = Off or else in off state for L or R flashing
0 1 = R flashing or Brake & L flashing and in off cycle
1 0 = L flashing or Brake & R flashing and in off cycle
1 1 = Brake
You just need to store the previous state to decode the current state. Also have a minimum debounce time to ignore glitches. But you do not want to have a big delay as you want the leds to come up quickly.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
just the right side. Bake and right
turn light. So pin23 will be the only
one hooked up to tailer plug, the right
side.
what would happen if you turn and brake at the same time?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Rudy's CNC Freeware·· http://www.enter.net/~schleinkofer
It flashes. What did you think it would do?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.
The green and yellow are for the turn and brake light. The brown, is for the running light's and the white is ground.
All I need help with, is the programing of the Propeller Chip. I will try to make this easy.....
(1=on)
(0=off)
If pin23 has A input of (1111111111111111111) Then goto (PUB BrakeLight)
If pin23 has A input of (1001001001001001001) then goto (PUB Turnlight)
If pin23 has A input of (0000000000000000000) Then nothing.
PUB Turnlight
dira[noparse][[/noparse]0..19] := %11111111111111111111
outa[noparse][[/noparse]0..19] := %00000000000000000000
waitcnt(clkfreq/4 + cnt)
outa[noparse][[/noparse]0..19] := %00000000000000000000
waitcnt(clkfreq/4 + cnt)
outa[noparse][[/noparse]0..19] := %10000000000000000000
waitcnt(clkfreq/4 + cnt)
outa[noparse][[/noparse]0..19] := %11111111111000000000
waitcnt(clkfreq/4 + cnt)
outa[noparse][[/noparse]0..19] := %00000000000000000000
PUB BrakeLight
dira[noparse][[/noparse]0..19] := %11111111111111111111
outa[noparse][[/noparse]0..19] := %11111111111111111111
waitcnt(clkfreq/4 + cnt)
outa[noparse][[/noparse]0..19] := %00000000000000000000
Thank you if you can help.
But I only what the Propeller chip to run the right side of the car..............
Brake and right turn light..........
Post Edited (Jeff2) : 2/10/2010 12:33:41 AM GMT
I would suggest doing a flow chart http://en.wikipedia.org/wiki/Flowchart to make it easier to arrive at your goal and make it easier for other people to read.
I think after you made a flowchart, you should see that this could be done with a handfull of descrete components. There is no need for a microcontroller. There are many examples of this on the web.
Post Edited (hover1) : 2/10/2010 1:51:25 AM GMT
When his turn signal is on, the Propeller will see a pulse train on pin 23. For concreteness, let's say 1 second high, 2 seconds low.
If the brake light is on, pin 23 will be high for longer than 1 second.
If neither the brake nor turn signal is on, pin 23 will be low for more than 2 seconds.
The challenge is to watch pin 23 and figure out if he's turning/braking/neither.
Is that correct, J2?
You would power the prop and LEDs from the brown wire.
If you brake the light have to come on right way.
If you use the turn signal the prop would have to figure that out by timing the signal.
And how does it know that you are not pumping the brake pedal etc?
I would try to get a turn-signal from the truck somewhere
that have not been muxed with the brake signal.
Because I want to some day use 2 Propeller chip. One for the right side and one for the left side. But I don't think it's going to be easy.......
Otherwise, you are going to either...
* Have to delay long enough (by skipping the first flash) to determine if it is a brake or flash
* Show the brake (all leds on one side) until it goes off indicating a flash.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
White: Ground
Brown: Running
Yellow: LT and Stop
Green: RT and Stop
1157 bulbs (brake light) has a dual filament , one for turn/brake (bigger filament), the smaller filament is for the running/side marker lights (brown wire).
Post Edited (kf4ixm) : 2/10/2010 10:26:22 AM GMT