Shop OBEX P1 Docs P2 Docs Learn Events
12 v — Parallax Forums

12 v

panchapancha Posts: 8
edited 2009-09-22 10:13 in BASIC Stamp
HOW TO CONNECT A BS2 TO 12 VOLTS INPUTS AND·OUTPUTS·(cars)

I want to connect my parallax·to my car,·but i dont know how is the·easer way to conect it, how to do the pull up and pulldown inputs,·and how to activate·12 relays ·I NEED HELP!!!

Post Edited (pancha) : 9/16/2009 3:23:12 AM GMT
«1

Comments

  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-09-16 03:32
    Welcome to the Parallax Forum

    You might want to start here

    You will learn a lot when you do the lessons

    http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Wamv2_2.pdf

    I hope this helps

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-16 04:46
    You can use the Super Carrier Board to create a safe platform for the BASIC Stamp modules within an automotive electrical system. The voltage regulator on the SCB will power the BASIC Stamp safely at 5V and you can use opto-couplers and/or relays for interfacing to existing systems. I have even used MOSFETs to drive lights on a car before.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • panchapancha Posts: 8
    edited 2009-09-16 05:05
    thanks to sam_sam_sam i olready have that book, but it doesnt show how to conect relays. or how to conect input from the out, for example my car
  • panchapancha Posts: 8
    edited 2009-09-16 05:11
    thanks for the information chris, i do have de super carrier, can u show me how to do the connection (DIAGRAM) of the MOSFET and the opto-couplers?
  • dev/nulldev/null Posts: 381
    edited 2009-09-16 16:21
    If your current is small (milliamps) you might do with a normal power transistor like BC547 or 2N2222.
    For medium currents, 0.5 - 3 amps, you can use Darlington transistors, like TIP125.
    For large currents you can use MOSFET's, relays or opto-isolators.

    MOSFET's and Darlingtons are logically the same as transistors. MOSFET's come in two types, P-channel and N-channel. This is locically equivalent to PNP and NPN transistors. To sink current (Drain to load and Source to ground), you use N-channel. To source current (Source to postiive supply and Drain to load), use P-channel. MOSFET's generally have longer switching times than transistors, and might pose problems if you want to generate PWM signals.

    Opto-couplers are logically equivalent to relays.

    Attached is a basic circuit for controlling a relay. ("HIGH P0" turns the relay on, "LOW P0" turns it off).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
    369 x 260 - 10K
  • YoshtiYoshti Posts: 108
    edited 2009-09-17 01:13
    Hi,
    While on the subjet:
    Can I use a Board of Education Development Board (USB), for the 12v in a car, and buy the BS2PX24 for that board?
    Since I don't see anything about it (if it is not written, better ask before you buy) !

    Cheers!
    Resistance is futile! yeah! right... !
  • panchapancha Posts: 8
    edited 2009-09-17 02:21
    CAN THE optocouplers BE CONECTED IN BOTH WAYS?
  • dev/nulldev/null Posts: 381
    edited 2009-09-17 06:14
    You can't use the Board of Education (BOE) directly in the car, as it requires power supply between 6 and 9V. You will have to put a voltage regulator (like LM317) between the car battery and the BOE.

    No the opto-couplers cant be connected both ways, if I understand your question correctly. You connect the Stamp to the Input pin of the opto, and the Output to ground (Vss). On the other end, you connect the collector to the load, and the emitter to ground. Leave the base unconnected (if there is one). Be aware that optoisoloators are usually low current drivers in the mA range (even if they have darlingtons inside). But they provide the best protection for your Stamp, and are preferable instead of the 2N3904 in my schematic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • dev/nulldev/null Posts: 381
    edited 2009-09-17 11:51
    Also note that there are many inductive sources in a car. The use of a protective diode (rectifier like 1N4001) in series with the power lines going to the Stamp is recommended.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • YoshtiYoshti Posts: 108
    edited 2009-09-17 14:27
    Hi,

    I thought the 1N4001 is for protection for EMF stuff...
    How would you connect it in series.... (Don't forget .. you are taking to a NOOB here!)
    I know what in "series" is, but a max of 50v emf wouldn't that damage the BS2 anyway?

    A little diag would help me see things your way wink.gif

    Cheers
    Resistan.... Ah! enough already! Just use it!
  • dev/nulldev/null Posts: 381
    edited 2009-09-17 15:29
    See attachment. The resistor values are not correct. Look in the datasheet for the right values to get approx 8-9 volts out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
    458 x 221 - 12K
  • icepuckicepuck Posts: 466
    edited 2009-09-17 16:05
    I use a universal vehicle dc-to-dc adapter with my boe board when I run it from the solar panels. It works and I didn't have to build it.
    -dan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Arguing with myself--sometimes me, myself, and I don't always agree.
    Of the things I've lost, I miss my mind the most.

    Post Edited (icepuck) : 9/17/2009 4:10:53 PM GMT
    1024 x 1280 - 229K
  • YoshtiYoshti Posts: 108
    edited 2009-09-17 16:35
    Hi,
    So in all , especially for me, It would be the best option to have a DC to DC adapter... so I don't fry my BS2 wink.gif

    But if I had a SUPER CARRIER Board and trying to keep my cost to a minimum, would I just add a 1N4001 in series (just like Dev/Null) shows in his diagram then directly in the POWER input of the board (plug).

    Cheers

    Res...
  • dev/nulldev/null Posts: 381
    edited 2009-09-17 19:45
    Yes Yoshti, that would work fine. If you don't have the 1N4001, consider using 1N4936 instead (a fast recovery diode), it will give you better responses to transients if you are running frequency dependent applications. The cost are the same. The difference is that the 1N4936 will "recover" from a voltage spark much quicker and give a smoother supply. I use 1N4001 in my car and it works great, but if I did it again, I'd use 1N4936.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • panchapancha Posts: 8
    edited 2009-09-18 05:26
    dev/null thanks 4 da answer, i need to know if i can conect 12 directly to the stamp as an input, usin a resistor to reduce voltage? or maybe i can conect ground directly to the stram usin a diodes and resistors, can you helpme? i need something to conecti inputs from my car
  • dev/nulldev/null Posts: 381
    edited 2009-09-18 14:02
    You can do it with resistors (a voltage divider), but the problem with this is that your circuit will perform poorly if you have devices that need varying currents (like servos or other frequency devices). Some commands in the Stamp might not even work, since the Stamp have internal RC circuits. It is not recommended. You should use a switching regulator like LM317 or a LM7805. The 7805 can connect directly to the Vin pin on the Stamp. The ground on the Stamp (Vss) should be connected to ground in the car (minus on the battery).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • panchapancha Posts: 8
    edited 2009-09-20 02:15
    dev/null thanks but not still clear for me, in need to know the easyer way to conec many input and outputs to mar car, do you have a diagram?
  • YoshtiYoshti Posts: 108
    edited 2009-09-20 02:34
    Hi Dev/Null

    For arguments: If I want to tell BS2 that the Backup lights are on, If I run a wire from the power from the light bulb(+) to the BS2 on a pin,
    Would a proper resistance, would be ok to use to trigger high on that BS2's pin??

    Cheers

    Resistance is futile.... yeah sure say that to the BS2 !

    Yosh
  • Larry~Larry~ Posts: 242
    edited 2009-09-20 02:41
    Just be aware !! that when dealing with automotive stuff they sometimes switch the ground not the hot !!
  • dev/nulldev/null Posts: 381
    edited 2009-09-20 11:03
    A voltage divider would be adequate for sensing a 12V current, together with smoothing capacitors (preferably 100uF and 100nF) and a rectifier. You won't see me endorce anything connected from a car battery to a Stamp without a rectifier and smoothing capacitors. You can do it, but your Stamp pin will probably blow.

    See attachment

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
    415 x 233 - 10K
  • dev/nulldev/null Posts: 381
    edited 2009-09-20 12:43
    Opto circuit with 4N33 isolator.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
    427 x 281 - 11K
  • Larry~Larry~ Posts: 242
    edited 2009-09-20 15:52
    Well an 1157 uses 2.10 amps so a voltage divider will be fairly large, I think I would use a current hall effect sensor, sense current on the line (could sense all wires under dash) and would hook up direct to stamp.
  • FranklinFranklin Posts: 4,747
    edited 2009-09-20 15:58
    Larry~ said...
    Well an 1157 uses 2.10 amps so a voltage divider will be fairly large
    I don't think the devider is carrying any of the lamp current so it can be high resistance and low amps. (ma)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen

    Post Edited (Franklin) : 9/20/2009 4:03:16 PM GMT
  • Larry~Larry~ Posts: 242
    edited 2009-09-20 16:16
    In these last two circuts, the voltage divider and the opto if the bulb is switched via ground will the voltage change going to your circuts or will it see 12 volts at all times ?
  • FranklinFranklin Posts: 4,747
    edited 2009-09-20 16:30
    Larry~ IF they were switched by ground they would stay at 12v but they were not designed for a system that switches the ground and would be different if they had been. Could you give me the model of a car that uses the ground to control the lights?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Larry~Larry~ Posts: 242
    edited 2009-09-20 16:45
    In BASIC Stamp, franklin97355 wrote:

    Larry~ IF they were switched by ground they would stay at 12v but they were not designed for a system that switches the ground and would be different if they had been. Could you give me the model of a car that uses the ground to control the lights?

    Most of the Older Cars I have had have a brake light switch mounted on the break peddal and this switches to ground, not sure on the newer cars with PCM !



    Also backup lights are switched through a switch on the tranny to ground

    Post Edited (Larry~) : 9/20/2009 5:15:04 PM GMT
  • dev/nulldev/null Posts: 381
    edited 2009-09-20 17:12
    The Stamp will see 4.3V, the same as across the 2K resistor. The voltage divider drops the voltage over the 2K resistor to 4.8V, and the diode drops another 0.5V.
    The current going to the Stamp from the voltage divider is 4.3V / 3K = 1mA.

    The opto isolator isolates the Stamp from the car battery (hence the name). The Stamp pin will see 0V or Vdd. The 10K going into the opto drops the current to about 1.2 mA, enough to trigger the opto.

    If the lamp is switched via ground you will introduce more resistance to the voltage divider, and the voltage will drop below 4.3V.
    But the resistance in a bulb is usually very low (a few ohms) compared to the values in the circuit, and won't have any impact.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • YoshtiYoshti Posts: 108
    edited 2009-09-21 02:26
    Hi,
    Heu... I'm lost !

    Let have it 2 ways then.
    One is the switching via ground, and the other the source is positive switch.

    help !
    Cheers
    Yosh
  • dev/nulldev/null Posts: 381
    edited 2009-09-21 10:06
    Yohsti, it doesn't matter if the switch is connected to ground or plus. In my schematics, always connect the line to Stamp to the plus side of the light bulb. Don't forget to put a 10k pulldown (a 10K resistor from the pin to Vss) on the input pin if you are using the voltage divider circuit. I forgot to draw it in the schematic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't worry. Be happy
  • panchapancha Posts: 8
    edited 2009-09-21 23:16
    Thanks brother FOR THE INFORMATION
Sign In or Register to comment.