Shop OBEX P1 Docs P2 Docs Learn Events
car lights — Parallax Forums

car lights

ArchiverArchiver Posts: 46,084
edited 2003-02-10 18:23 in General Discussion
I want to use my BS2 so that it controls alot of the things in my
car (94 eclipse). I want the headlights to flash back and forth
(like a police cars headlights) when I dim or brighten them. So if
they are dim, I pull the dimmer switch, the lights cycle back and
forth really fast for a few seconds, and then go bright. it should
do the same thing when I dim them. I know how to write basic things
for the stamp, but don't know how to get this program wrote so that
it picks up the change in the dimmer switch, and then only flashes
them for a second before going to the right stage.. please help me
with the program.. this is driving my crazy. thank you.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-02-09 21:15
    Be aware that some states make it illegal for other than emergency
    vehicles to have this capability. With that said here is one technique:

    You need to isolate, individually, each high and low beam light with a
    relay, each relay controlled by a stamp output thru a transistor switch
    so you will use four stamp outputs. It is the same as turning an LED on
    or off but you'll be turning a relay on or off thru a transistor. This
    technique is well documented in the Stamp documentation and examples.

    You need to use one stamp input to sense whether the voltage to the high
    beam lamp is high or low. This is also well documented in the Stamp
    documentation.

    Your program needs to continuously test the high beam voltage sense
    input and when it senses a change in the state of the high beam voltage,
    it will go into a loop that toggles the stamp outputs controlling the
    left low beam and right high beam light for your desired length of time,
    then switches them off while turning on the opposite lights for the same
    amount of time. Once this loop has executed however many times you want,
    you turn on (or off depending on the state of the high beam sense) the
    two stamp outputs that either turn your low beams on/high beams off, or
    low beams off/high beams on.

    The programming is simple, the electrical interface will be the
    difficult part to ensure you have weatherproof relays/connections for
    reliability. Plus if you make a change to the factory wiring and have an
    accident due to loss of lighting and it is determined that your wiring
    caused the loss of lighting, you can probably kiss your insurance
    coverage good-bye.

    Otherwise, Have fun.


    rs4_3_ss wrote:

    > I want to use my BS2 so that it controls alot of the things in my
    > car (94 eclipse). I want the headlights to flash back and forth
    > (like a police cars headlights) when I dim or brighten them. So if
    > they are dim, I pull the dimmer switch, the lights cycle back and
    > forth really fast for a few seconds, and then go bright. it should
    > do the same thing when I dim them. I know how to write basic things
    > for the stamp, but don't know how to get this program wrote so that
    > it picks up the change in the dimmer switch, and then only flashes
    > them for a second before going to the right stage.. please help me
    > with the program.. this is driving my crazy. thank you.
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-09 21:55
    In a message dated 2/9/2003 12:15:48 PM Pacific Standard Time,
    vormulac35@h... writes:

    > I want to use my BS2 so that it controls alot of the things in my
    > car (94 eclipse). I want the headlights to flash back and forth
    > (like a police cars headlights) when I dim or brighten them. So if
    > they are dim, I pull the dimmer switch, the lights cycle back and
    > forth really fast for a few seconds, and then go bright. it should
    > do the same thing when I dim them. I know how to write basic things
    > for the stamp, but don't know how to get this program wrote so that
    > it picks up the change in the dimmer switch, and then only flashes
    > them for a second before going to the right stage.. please help me
    > with the program.. this is driving my crazy. thank you.
    >
    >

    First of all, I stronly emphasize that whatever you do, the system has a
    default mode that leaves the headlights on. This is in case, if you are on a
    dark road, in the middle of a turn and for some unknown reason the stamp or
    circuitry fails you will still be able to see......
    Also, many vehicles these days split the left and right headlight circuits,
    so that if there is a failure in one side you still have one headlight....

    With all the legal mumbo jumbo out of the way, at your OWN RISK consider the
    following...


    My fisrt question is: Do you know how to interface a relay to the Stamp?

    And you have a solid foundation on how a relay works, that is to turn it off
    and on.

    Some systems headlamp switches supply a ground to a relay where the relay
    contacts then send power to your dimmer switch. With the dimmer switch at
    "rest" power is routed to the headlamp low beams, and then when you switch to
    brights, power is routed to the high beams.

    Therefore, the dimmer switch will be similar to the contacts of a single pole
    double throw relay, that is one power wire in, and two outputs. Your manual
    activation of the switch simulates the relay coil energized or not.

    You will install a single pole double throw relay in place of the dimmer
    switch.
    With the relay off, power is routed to the low beams (just at the dimmer
    switch in one position) and then when the relay is turned on, power is routed
    to the high beams, ( just as the dimmer switch does in the high beam
    position)


    Next, you will wire +5 volts to the "single pole" side of the dimmer switch,
    and the low beam output of the dimmer switch into an input pin of the stamp (
    and there are some resistors needed to protect the stamp).

    You will monitor the output of the dimmer switch and write your program to do
    the following....

    When the stamp senses 5 volts on the lowbeam output of the dimmer switch,
    keep the relay (the newly installed stamp controlled relay) turned off so the
    low beams are on.
    When the stamp senses no 5 volts on the lowbeam output of the dimmer switch,
    turn the relay on and off several times (with appropriate delays to get the
    flashing you want) then leave the realy energized, and the high beams are on.

    When the stamp again senses 5 volts on the lowbeam output of the dimmer
    switch, turn the relay on and off several times (with appropriate delays to
    get the flashing you want) then leave the realy DE-energized, and the LOW
    beams are on.


    Progam example- IDEA ONLY, not actual code.......


    Loop
    5v on lowbeam output?
    if yes jump to loop ;do nothing, stay in low beam state
    if not jump to High_Beam

    High_Beam
    cycle relay on and off
    leave relay on ;high beams now on after being cycled

    Remain_High
    5v on lowbeam output?
    if not jump to Remain_High ;do nothing stay in high beam mode
    if yes cycle relay on and off
    leave relay off
    jump to Loop


    The wiring is a bit much to explain in words, If you give a FAX number, I can
    "whip up" a simple diagram that will get you started...

    Ken


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 03:03
    just wondering why in the wourld do you want to do this.

    Richey
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 04:21
    --- In basicstamps@yahoogroups.com, Richey brooks <richey@c...>
    wrote:
    > just wondering why in the wourld do you want to do this.
    >
    > Richey


    Doing it for looks, it's getting turned in to an all out show car.
    As to the other two responces, I know everything about the car's
    wiring and how to hook it up and what to do, my question was with
    the code... I don't know how to write it to make it do what I
    want. "Dim, hit the dimmer switch, flash like a cops, then go
    bright." and vice versa.. But like I said up top, SHOW CAR, I
    already have the stamp running a series of different things like the
    power windows, climate control, stereo, etc.... and it's all run
    through a remote control. The receiver is wired to the stamp, and
    different buttons give it the different inputs to react from (I geek
    out on this stuff cuz I'm an electronics major, but programming
    isn't my strong point). I just need code.... code, code, code...
    thanks
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 04:26
    I forgot to add that I wanted the lights to flash side by side (i.e.
    left, right, left, right) I should have mentioned that... rs4_3_ss















    --- In basicstamps@yahoogroups.com, smartdim@a... wrote:
    > In a message dated 2/9/2003 12:15:48 PM Pacific Standard Time,
    > vormulac35@h... writes:
    >
    > > I want to use my BS2 so that it controls alot of the things in
    my
    > > car (94 eclipse). I want the headlights to flash back and forth
    > > (like a police cars headlights) when I dim or brighten them. So
    if
    > > they are dim, I pull the dimmer switch, the lights cycle back
    and
    > > forth really fast for a few seconds, and then go bright. it
    should
    > > do the same thing when I dim them. I know how to write basic
    things
    > > for the stamp, but don't know how to get this program wrote so
    that
    > > it picks up the change in the dimmer switch, and then only
    flashes
    > > them for a second before going to the right stage.. please help
    me
    > > with the program.. this is driving my crazy. thank you.
    > >
    > >
    >
    > First of all, I stronly emphasize that whatever you do, the system
    has a
    > default mode that leaves the headlights on. This is in case, if
    you are on a
    > dark road, in the middle of a turn and for some unknown reason the
    stamp or
    > circuitry fails you will still be able to see......
    > Also, many vehicles these days split the left and right headlight
    circuits,
    > so that if there is a failure in one side you still have one
    headlight....
    >
    > With all the legal mumbo jumbo out of the way, at your OWN RISK
    consider the
    > following...
    >
    >
    > My fisrt question is: Do you know how to interface a relay to the
    Stamp?
    >
    > And you have a solid foundation on how a relay works, that is to
    turn it off
    > and on.
    >
    > Some systems headlamp switches supply a ground to a relay where
    the relay
    > contacts then send power to your dimmer switch. With the dimmer
    switch at
    > "rest" power is routed to the headlamp low beams, and then when
    you switch to
    > brights, power is routed to the high beams.
    >
    > Therefore, the dimmer switch will be similar to the contacts of a
    single pole
    > double throw relay, that is one power wire in, and two outputs.
    Your manual
    > activation of the switch simulates the relay coil energized or not.
    >
    > You will install a single pole double throw relay in place of the
    dimmer
    > switch.
    > With the relay off, power is routed to the low beams (just at the
    dimmer
    > switch in one position) and then when the relay is turned on,
    power is routed
    > to the high beams, ( just as the dimmer switch does in the high
    beam
    > position)
    >
    >
    > Next, you will wire +5 volts to the "single pole" side of the
    dimmer switch,
    > and the low beam output of the dimmer switch into an input pin of
    the stamp (
    > and there are some resistors needed to protect the stamp).
    >
    > You will monitor the output of the dimmer switch and write your
    program to do
    > the following....
    >
    > When the stamp senses 5 volts on the lowbeam output of the dimmer
    switch,
    > keep the relay (the newly installed stamp controlled relay) turned
    off so the
    > low beams are on.
    > When the stamp senses no 5 volts on the lowbeam output of the
    dimmer switch,
    > turn the relay on and off several times (with appropriate delays
    to get the
    > flashing you want) then leave the realy energized, and the high
    beams are on.
    >
    > When the stamp again senses 5 volts on the lowbeam output of the
    dimmer
    > switch, turn the relay on and off several times (with appropriate
    delays to
    > get the flashing you want) then leave the realy DE-energized, and
    the LOW
    > beams are on.
    >
    >
    > Progam example- IDEA ONLY, not actual code.......
    >
    >
    > Loop
    > 5v on lowbeam output?
    > if yes jump to loop ;do nothing, stay in low beam state
    > if not jump to High_Beam
    >
    > High_Beam
    > cycle relay on and off
    > leave relay on ;high beams now on after being
    cycled
    >
    > Remain_High
    > 5v on lowbeam output?
    > if not jump to Remain_High ;do nothing stay in high
    beam mode
    > if yes cycle relay on and off
    > leave relay off
    > jump to Loop
    >
    >
    > The wiring is a bit much to explain in words, If you give a FAX
    number, I can
    > "whip up" a simple diagram that will get you started...
    >
    > Ken
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 04:59
    This is called wig-wag.

    Original Message

    > I forgot to add that I wanted the lights to flash side by side (i.e.
    > left, right, left, right) I should have mentioned that... rs4_3_ss

    > >
    > > > I want to use my BS2 so that it controls alot of the things in
    > my
    > > > car (94 eclipse). I want the headlights to flash back and forth
    > > > (like a police cars headlights) when I dim or brighten them. So
    > if
    > > > they are dim, I pull the dimmer switch, the lights cycle back
    > and
    > > > forth really fast for a few seconds, and then go bright. it
    > should
    > > > do the same thing when I dim them. I know how to write basic
    > things
    > > > for the stamp, but don't know how to get this program wrote so
    > that
    > > > it picks up the change in the dimmer switch, and then only
    > flashes
    > > > them for a second before going to the right stage.. please help
    > me
    > > > with the program.. this is driving my crazy.
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 05:52
    In a message dated 2/9/2003 8:29:30 PM Pacific Standard Time,
    vormulac35@h... writes:

    > I forgot to add that I wanted the lights to flash side by side (i.e.
    > left, right, left, right) I should have mentioned that... rs4_3_ss


    using the same sensing technique posted earlier, except you will then control
    two seperate relays,
    I don't use the stamp anymore these days (using the SX) but from what I
    remember some code is posted below....
    I am almost sure there are some syntax errors and there probably a logic
    error, but you should get the jist of what to do......

    Assuming you are monitoring the output of the dimmer switch on pin 0, left
    relay control is pin 1, and right relay control is pin 2...


    Program is shown below

    Low_Beam
    if pin 0 = 1 then Low_Beam
    else Go_High

    Go_High
    gosub Flash_Low_To_High ;jump to subroutine to flash the lights
    pin 1 = 1 ;now left side high beams on
    pin 2 = 1 ;now right side high beams on

    Wait_For_Low
    if pin 0 = 0 then Wait_For_Low
    else gosub Flash_High_To_Low
    pin 1 = 0 ;low beam on
    pin 2 = 0 ;low beam on
    goto Low_Beam

    Flash_Low_To_High
    pin 2 = 1 ;turn on high beam right side
    pause 500 ;pause 1/2 second
    pin 1 = 1 ;turn on high beam left side
    pin 2 = 0 ;turn off high beam right side
    pause 500 ;pause 1/2 second
    pin 1 = 0 ;turn off high beam left side
    REPEAT THIS SUBROUTINE A FEW TIMES (you stampers, I know this is ineffecient
    but this is just a QUICK AND DIRTY CODE)
    return




    Flash_High_To_Low
    pin 2 = 0 ;turn off high beam right side
    pause 500 ;pause 1/2 second
    pin 1 = 0 ;turn off high beam left side
    pin 2 = 1 ;turn on high beam right side
    pause 500 ;pause 1/2 second
    pin 1 = 1 ;turn on high beam left side
    Repeat the above as many times as you want it to flash
    return


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 06:58
    Learn to think logically. Don't expect someone else to solve your total
    programming challenge. Would you say to a Professor give me the answers to a
    question that I am too lazy to learn how to solve?
    In the real world, THINK IT MAY BE A NEW EXPERIENCE.
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 07:29
    --- In basicstamps@yahoogroups.com, "Stephen H Chapman"
    <chapman@t...> wrote:
    > Learn to think logically. Don't expect someone else to solve your
    total
    > programming challenge. Would you say to a Professor give me the
    answers to a
    > question that I am too lazy to learn how to solve?
    > In the real world, THINK IT MAY BE A NEW EXPERIENCE.



    Think, it may be a new experience... buddy, after three years of
    electronics, with one more to go, I think that it should be you
    thinking before you run your mouth about something that is none of
    your business. The time I have after everything I do for college
    leaves me no time to be working on the "the bugs" of a program. and
    for your info, if you want to see how lazy I am, we can set up a
    meeting between the two of us over email, and I'll show you. Now,
    Smile off.
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 13:30
    Waah!

    College is alot easier now than when most of us were doing it. Programming
    on punch cards and paper tape, typing papers on a typewriter, using a
    physical card catalog to do research. I'll bet the classes focus more on the
    degree and less on liberal arts too... Sounds like you have it so rough.
    Notice the sig line below -- this should apply to life every day

    **********

    To be conscious that you are ignorant is a great step to knowledge.

    -- Benjamin Disraeli


    Original Message

    > > Learn to think logically. Don't expect someone else to solve your
    > total
    > > programming challenge. Would you say to a Professor give me the
    > answers to a
    > > question that I am too lazy to learn how to solve?
    > > In the real world, THINK IT MAY BE A NEW EXPERIENCE.
    >
    >
    >
    > Think, it may be a new experience... buddy, after three years of
    > electronics, with one more to go, I think that it should be you
    > thinking before you run your mouth about something that is none of
    > your business. The time I have after everything I do for college
    > leaves me no time to be working on the "the bugs" of a program. and
    > for your info, if you want to see how lazy I am, we can set up a
    > meeting between the two of us over email, and I'll show you. Now,
    > Smile off.
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 13:38
    I doubt swearing/insulting and the like will get someone to help you. Most
    of the people that frequent this board get paid big $$ to do exactly what
    you are asking them to do for free. They spend their time that they could
    use to make money helping others like yourself and I for free. Everyone
    I've seen on here is more than willing to unlock the door for you, even hold
    it open for you. Its up to you to walk through [noparse]:)[/noparse]

    Now I've done something along those lines for a haunted house, beam-break
    triggered events with alternating flashing lights that returned to a dimmed
    state. Not directly related, but basically similar.

    I can't speak for everyone on this point though, but I know why some won't
    help. Its illegal in most states. Plus they probably have had the same
    kind of experience I have had around my home town. The few kids here that
    have this kind of thing done to their "show cars" are using them during
    burn-out shows in parking lots after 11pm and generally don't behave like
    adults with them.

    Besides from your last post I can tell the maturity level just isn't there
    on your end to make me want to help you.

    Rob


    Original Message
    From: <vormulac35@h...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, February 10, 2003 2:29 AM
    Subject: [noparse][[/noparse]basicstamps] Re: car lights


    > --- In basicstamps@yahoogroups.com, "Stephen H Chapman"
    > <chapman@t...> wrote:
    > > Learn to think logically. Don't expect someone else to solve your
    > total
    > > programming challenge. Would you say to a Professor give me the
    > answers to a
    > > question that I am too lazy to learn how to solve?
    > > In the real world, THINK IT MAY BE A NEW EXPERIENCE.
    >
    >
    >
    > Think, it may be a new experience... buddy, after three years of
    > electronics, with one more to go, I think that it should be you
    > thinking before you run your mouth about something that is none of
    > your business. The time I have after everything I do for college
    > leaves me no time to be working on the "the bugs" of a program. and
    > for your info, if you want to see how lazy I am, we can set up a
    > meeting between the two of us over email, and I'll show you. Now,
    > Smile off.
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-10 18:23
    rs4_3_ss wrote:


    >
    > Think, it may be a new experience... buddy, after three years of
    > electronics, with one more to go, I think that it should be you
    > thinking before you run your mouth about something that is none of
    > your business. The time I have after everything I do for college
    > leaves me no time to be working on the "the bugs" of a program.


    Sigh... you seem to be expecting someone here to provide you
    with debugged code for your project... because you're too busy
    to do it?? That's a lot to ask for two reasons. First most of
    us are pretty busy too and while we love to provide hints and
    ideas and realate personal experience, expecting a turn-key
    solution is a bit much to ask. Second, and MOST important IMHO
    is the fact that your application has SERIOUS liablilty issues.
    Why should any of us assume a major part of this liablity
    (for free no less) by writing the code? It really is asking a
    lot, don't you agree? I am not interested in being named a
    party in a personal injury suit because I supplied code for this
    project - sorry but that's life in the USA...


    Michael Burr
Sign In or Register to comment.