Maker Pro
Maker Pro

Will this blow up or work?

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
Hi, I'm new and the names julian and I'm all new to this electronic stuff (I'm a programmer) and decided to have a go at making a circuit to start my car with a button (which started with the loss of my car keys :mad:!) and I'm just after some advice please :)

In short I just want to check if my calculations are right with the transistors/resistors so I don't blow anything up :D since its not going to be a fun situation if they do! - ignore the pic since I haven't worked all that out yet, although it seems pretty straight forward with just a few caps here and there :)

I've only got a couple of questions besides that to do with current, the pic can supply/sink 20mA per pin, is there a lowest amount of current needed for the pic to "see" it or is it just voltage driven? and also on my circuit i've got 7 buttons each with their own resistor and i did that because I'm not sure if having just one resistor before all the buttons would be ok if say 2 or 3 buttons were pushed at the same time.

Finally in the pdf linked below on page 55 is the wiring for my car, and I'm basically replacing the "IGNITION SW" with relays, but the fuse Amps confuse me because the main amp before the switch is less than all the smaller fuses after the switch, so I'm a little worried about what happens if something spikes and takes a relay out (hence the 30A and 40A relays). Is there any suggestions maybe on things I can read that might help?

My circuit is here and the pdf of my car wiring is here.

Sorry for the long post with lots of questions, I'm just a little unsure at this point about some things and thought I would ask from people who will know :)

Thanks
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I just posted an enormous reply that didn't get posted :( Here goes again...

Hi, I'm new and the names julian and I'm all new to this electronic stuff

Hi there Julian and welcome to Electronics Point.

(I'm a programmer) and decided to have a go at making a circuit to start my car with a button (which started with the loss of my car keys :mad:!) and I'm just after some advice please :)

Always a wise thing to get someone else to cast their beady eye over your work...

In short I just want to check if my calculations are right with the transistors/resistors so I don't blow anything up :D since its not going to be a fun situation if they do!

:)

- ignore the pic since I haven't worked all that out yet, although it seems pretty straight forward with just a few caps here and there :)

I'll try

I've only got a couple of questions besides that to do with current, the pic can supply/sink 20mA per pin

An output pin on a PIC can (in most circumstances) sink or source up to about 20mA. That's up to, it can be as low as zero if you don't need 20mA.

is there a lowest amount of current needed for the pic to "see" it or is it just voltage driven?

This sounds like a question about the pins used as inputs. Again. generally, the pins are a high impedance and can be considered voltage driven.

Note however that if a pin is not connected, what voltage is it at? The answer is that it is undefined and can float up down and all around. It is normally advisable to ensure that the input pin is not left in this state.

and also on my circuit i've got 7 buttons each with their own resistor and i did that because I'm not sure if having just one resistor before all the buttons would be ok if say 2 or 3 buttons were pushed at the same time.

The typical answer is to have a resistor for each input pulling it high (or low) and a switch forcing the input low (or high).

Finally in the pdf linked below on page 55 is the wiring for my car, and I'm basically replacing the "IGNITION SW" with relays, but the fuse Amps confuse me because the main amp before the switch is less than all the smaller fuses after the switch, so I'm a little worried about what happens if something spikes and takes a relay out (hence the 30A and 40A relays). Is there any suggestions maybe on things I can read that might help?

The best advice is to use a relay rated for at least the maximum current. If the fuse before the switch is 30A, use a 30 A relay at a minimum.

My circuit is here and the pdf of my car wiring is here.

carev.png


There are a number of issues (let see if I remember them all)

* Use the same outputs that you use to control the relays to control your indicator lights.
* Protect the circuit from voltage transients (power supply and via the tacho input)
* Why the tw 12V inputs?
* Use a fixed regulator rather than an adjustable one
* Input and output caps on the regulator.
* Switches as described above.
* Power supply connections to the uC
 

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
I just posted an enormous reply that didn't get posted :( Here goes again...

Thats a really horrible experience, but thanks for writing it twice :)

Note however that if a pin is not connected, what voltage is it at? The answer is that it is undefined and can float up down and all around. It is normally advisable to ensure that the input pin is not left in this state.

Thats an interesting thought i didn't consider, time to connect all those floaters up :cool:

The typical answer is to have a resistor for each input pulling it high (or low) and a switch forcing the input low (or high).

So it would be best to keep it the way I have it?


The best advice is to use a relay rated for at least the maximum current. If the fuse before the switch is 30A, use a 30 A relay at a minimum.

That was what I thought, but theres on input of 50A which goes to 3 separate circuits:
  • Accessories (ACC) which has 2 fused outputs of 7.5A and 15A, hence the 30A relay
  • Ignition 1 (IG1) which has 5 fused outputs totaling 55A, so I used a 40A (my reasoning below)
  • Starter motor (ST) which has 1 fused output of 7.5A, so I could probably use a 10A relay

so even though the input is 50A, the combined total of all fused outputs is 85A, but ACC will be off when ST is on so it should never reach that, so I thought the input to ACC should at max be 22.5A so i thought 30A relay.

The current to IG1 could in theory be 55A if everything shorted at once (unlikely?!) so I thought if ACC is always on and IG1 is always on, both shouldn't exceed 50A, but a 30A and 40A is well over 50A.

Is that sort of logic going to be dangerous to my health and I should use 50A relays all round just for the safety side or does my thinking make sense?

Edit: I just found a relay that takes 70A of current that isn't too expensive so in the interest of I don't want them blowing up during use I'll get these :)

Use the same outputs that you use to control the relays to control your indicator lights.
I'm not controlling the indicators, the led's im using are just some indication of whats on/off, or are you referring to something else?

Protect the circuit from voltage transients (power supply and via the tacho input)
I've just done some reading on "transient-voltage-suppression diode" (i feel tingly saying that :)) and is it safe to say that I need to get one with a Reverse Stand-Off Voltage of 3.3V since thats what the pic can take on each pin? would this be a safe bet? (I cant find on for 3.3V that is the same package type as a resistor with the wires)

Why the tw 12V inputs?
Toyota thought it would be fun to have 2, 1 for IG2 and 1 for everything else :/

Use a fixed regulator rather than an adjustable one
Is there any rules as to when fixed should be used or adjustable? or is it just why waste resistors?

I looked at a UA78M33 and it has a max current of 500mA, I'm going to use a PIC24FJ64GA104 which can take 250mA max and possibly a RN131 wireless module which can take 212mA max.
If it runs at 460mA for a long time will it be ok? I'm going to put a heatsink on it to be sure but is it considered ok to run it near max for a long time (peak is 700mA) or is it best to use 2?

Input and output caps on the regulator.
A good plan! forgot about them completly

So overall I haven't gone too wrong with it then? I was expecting to get the transistors wrong :)
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
So it would be best to keep it the way I have it?

No, a resistor from each input to ground and switch between the input and +ve rail.

That was what I thought, but...

Your reasoning seems OK. But I'm not an expert on automotive wiring.

Is that sort of logic going to be dangerous to my health and I should use 50A relays all round just for the safety side or does my thinking make sense?

Conservative design is generally a good thing. Using the same parts means that you can carry less spares.

Edit: I just found a relay that takes 70A of current that isn't too expensive so in the interest of I don't want them blowing up during use I'll get these :)

Yep. I'd agree with that. (I wouldn't if one circuit only carried 100mA, but in your case all will carry at least a couple of amps)

I'm not controlling the indicators, the led's im using are just some indication of whats on/off, or are you referring to something else?

That's exactly what I mean. You are using separate outputs to control little lights that show when other outputs are on or off. This means the display is only as good as your software. The lights should be switched by the same circuit as the relay, or even be switched BY the relay so you know that the lights really mean something.

I've just done some reading on "transient-voltage-suppression diode" (i feel tingly saying that :)) and is it safe to say that I need to get one with a Reverse Stand-Off Voltage of 3.3V since thats what the pic can take on each pin? would this be a safe bet? (I cant find on for 3.3V that is the same package type as a resistor with the wires)

They can be a solution but you can also build a protective circuit (for the inputs) using diodes and resistors. Google for circuits on the net that interface to a car's electrics and see what they use. Beware, there will be many that use nothing (and won't last as long in real service)

Toyota thought it would be fun to have 2, 1 for IG2 and 1 for everything else :/

And they probably have a good reason. Follow their lead.

Is there any rules as to when fixed should be used or adjustable? or is it just why waste resistors?

There's less to go wrong (voltage will be correct)
Quiescent current is lower
The voltage you require is a standard one
Less components
Possibly cheaper

I looked at a UA78M33 and it has a max current of 500mA, I'm going to use a PIC24FJ64GA104 which can take 250mA max and possibly a RN131 wireless module which can take 212mA max.

I've not checked, but I assume the relays are running from an unregulated 12V, so the PIC will probably draw a couple of mA. I imagine the wireless module requires only brief peaks at that current.

Check the current once you've built it, but I suspect that as long as the quiescent current of the wireless module is high, you may be able to get away with no heatsinking other than physically securing the regulator to something (remember insulation).

If it runs at 460mA for a long time will it be ok? I'm going to put a heatsink on it to be sure but is it considered ok to run it near max for a long time (peak is 700mA) or is it best to use 2?

The specs of the regulator will tell you how much heatsinking you require at any load. Determine that load first, then go back to the datasheet and we can help you with that.

So overall I haven't gone too wrong with it then? I was expecting to get the transistors wrong :)

No, I think my original reply was along the lines that you have done remarkably well for a first draft.

(Did I mention power supply connections to the uC that are not shown?)
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I was expecting to get the transistors wrong :)

Q5, 6, 7, and 8 are not connected optimally as switches. However there is little need for this section of the circuit at all.
 

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
Steve you've been a total legend, thanks for your input and help!

I've had a big researching weekend with this pic and voltage transients etc and I've now got the attached, it seems to have gotten a bit messy around the power pins :( but I think its all ok! the pic's datasheets are extremely detailed :)

Q5, 6, 7, and 8 are not connected optimally as switches. However there is little need for this section of the circuit at all.

I originally thought to power the LED's from the PIC, but the LED's i wanted to use (they are part of the buttons) run at 12V, so I did think about running them off the relays but I wanted to have them off when in the software I decide I'm not near the car (even if the output is still on to the relays, which will be a valid case e.g. turbo timer) so instead I'm going to run them off the same pins that activate the relay coil (which makes much more sense!)

Now the optimal part, they way I've calculated that is:
Ice across Q5/6/7 is about 21mA, so the base needs about 2.1mA to be saturated
Vbe is 0.7V so:
I = V/R
I = 2.6/1200
I = 0.00216 A (2.16A)

In an ideal world with components that are exact is the theory right? - I'm guessing its best to go over instead of dead on? Might be best to switch to a 1K res if thats right.

Just a final question, I've got very little information about the ground on pin 5 of the PIC, basically my alarm pulls to ground when its activated, the exact wording is:

"Indicates that the unit is armed by pulling low (to ground). Can be used to enable or arm other devices such as additional Led’s, scanners etc"

I don't know if that means the connection is comply disconnected when the system is disarmed (after reading about floating pins I very much doubt it! but I wouldn't be surprised) so I'm going to find it and see what my multi-meter says :)
but the question really is if they do completely disconnect the pin when disarmed, the PIC will get 3.3V, which is fine, but when they connect to ground what happens if the ground is the same ground the alarm circuit runs on and its at 9-12V? I've been googling it all evening and basically it seems to depend on the situation if its ok or not. But in theory it should be ok since at ground its 0V (or close to)?

Thanks again
 

Attachments

  • car.png
    car.png
    76 KB · Views: 153

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Aaagh, just lost my reply again.

1) LEDs should be in the collector circuit with the emitter grounded

2) transistor enabling LEDs should be between the emitters and ground

3) 15V zener protecting regulator may be too low a value. 15V is not an unusual voltage. Perhaps a 30V zener would be better.

4) Switches wrong. Should be +ve -- switch -- X -- resistor -- gnd. X is connected to the input pin.

5) Presume the zener shown on the tacho input is 5.1V or similar? It is also worth placing an additional resisto between the junction of the resistor and zener and the uC input pin (something around 10k should be fine).
 

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
Aaagh, just lost my reply again.

It appears your cursed on the forum then ;)

3) 15V zener protecting regulator may be too low a value. 15V is not an unusual voltage. Perhaps a 30V zener would be better.

I was looking at the clamping voltage thinking that was the important one, not the reverse standoff :eek:

4) Switches wrong. Should be +ve -- switch -- X -- resistor -- gnd. X is connected to the input pin.

Thinking "if the switch goes straight to the pin thats a short" i added a short straight to ground instead lol! my brain is still hurting with those switchs, I can't help but see it as a short to the pin, but the res to ground limits the current.

5) Presume the zener shown on the tacho input is 5.1V or similar? It is also worth placing an additional resisto between the junction of the resistor and zener and the uC input pin (something around 10k should be fine).

I was going to use a 3.3V one to make sure the input doesn't go above what the pic can take (i think the term is a clipping?)
 

Attachments

  • car.png
    car.png
    41.2 KB · Views: 167

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
It appears your cursed on the forum then ;)

Just being careless.

I was looking at the clamping voltage thinking that was the important one, not the reverse standoff :eek:
The issue is that there is nothing to limit the current if it exceeds the zener voltage. So you want to make it as high as possible, but consistent with protecting the regulator.

Check the maximum input voltage for the regulator and make the zener a few volts less than that. Typically you have maximum input voltages in the range of 30V to 35V, and that's what I'm relying on.

Thinking "if the switch goes straight to the pin thats a short" i added a short straight to ground instead lol! my brain is still hurting with those switchs, I can't help but see it as a short to the pin, but the res to ground limits the current.
When being used as an input, the pin is a high impedance. Not much current (uAs at most) is going to flow in or out of it. The highest current will be through the resistor and the switch to ground. The resistor is there to pull the input to ground when the switch is open.

I was going to use a 3.3V one to make sure the input doesn't go above what the pic can take (i think the term is a clipping?)
OK, that's fine. I was expecting a 5V rail and you're using 3V3. OK, a 3V3 zener is OK. The 390K resistor may need to be reduced significantly though, since low voltage zeners have very soft knees and will probably end up clamping the voltage to 2V or so (this has bitten people before!)

The other issue is Q8. You have it wired up to short the supply to ground. Disconnect the collector and connect it to the emitters of the three transistors driving the LEDs (and disconnect them from ground)

edit: Didn't lose it this time!
 
Last edited:

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
The issue is that there is nothing to limit the current if it exceeds the zener voltage. So you want to make it as high as possible, but consistent with protecting the regulator.

Check the maximum input voltage for the regulator and make the zener a few volts less than that. Typically you have maximum input voltages in the range of 30V to 35V, and that's what I'm relying on.

The regulator goes to 30V max, so would a 30V zener be best, but the breakdown voltage is 33.33V (am I right thinking the breakdown voltage is when almost no current flows?)
Or a 26V zener with a 29V breakdown?

OK, that's fine. I was expecting a 5V rail and you're using 3V3. OK, a 3V3 zener is OK. The 390K resistor may need to be reduced significantly though, since low voltage zeners have very soft knees and will probably end up clamping the voltage to 2V or so (this has bitten people before!)

I've been reading more stuff about these zeners, and it seems not so straight forward, I originally just went with 2 resistors to do a voltage divider but I wanted to add some sort of protection but the zeners seem a unstable at low voltages and low currents. I don't really want to have high current from the tacho input since i'm not sure what its max output is and I dont want to do too much harm :/

Any suggestions on a safe way round it?

The other issue is Q8. You have it wired up to short the supply to ground. Disconnect the collector and connect it to the emitters of the three transistors driving the LEDs (and disconnect them from ground)

My bad! :eek: I was in a bit of a rush yesterday and didn't think that through, nothing like a good short

edit: Didn't lose it this time!

Sounds like progress :D
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
The regulator goes to 30V max, so would a 30V zener be best, but the breakdown voltage is 33.33V (am I right thinking the breakdown voltage is when almost no current flows?)
Or a 26V zener with a 29V breakdown?

A 30V zener should have a breakdown voltage a little under 30V. Show me the data you're working from.

The 26V zener is what I'd pick anyway.

I've been reading more stuff about these zeners, and it seems not so straight forward, I originally just went with 2 resistors to do a voltage divider but I wanted to add some sort of protection but the zeners seem a unstable at low voltages and low currents. I don't really want to have high current from the tacho input since i'm not sure what its max output is and I dont want to do too much harm :/

Any suggestions on a safe way round it?

I originally thought the input was 12V to a 5V system. You have a 5V input to a 3.3V system.

I would do the following. 1k resistor to 5.1V zener (to ground) from this junction a voltage divider as you originally had, with resistors in the tens of Kokms.
 

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
A 30V zener should have a breakdown voltage a little under 30V. Show me the data you're working from.

Heres the data sheet I was looking at - page 4.

I would do the following. 1k resistor to 5.1V zener (to ground) from this junction a voltage divider as you originally had, with resistors in the tens of Kokms.

I think I got the "junction" in the right place, hopefully, not sure if it should be between R21 and D7 but I don't think so...
 

Attachments

  • car.png
    car.png
    41.6 KB · Views: 109

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Heres the data sheet I was looking at - page 4.

That's a transient voltage supressor, not a zener, but it's better suited to the task. Use the 26V one.

I think I got the "junction" in the right place, hopefully, not sure if it should be between R21 and D7 but I don't think so...

R24 should not be connected to the tach pulse, but to the junction between R21 and D7.
 

AlmightyJu

Nov 17, 2012
7
Joined
Nov 17, 2012
Messages
7
R24 should not be connected to the tach pulse, but to the junction between R21 and D7.

That makes more sense! - definitely not something I should be doing after midnight I don't think :)

thanks again, you've been really awesome
 

Attachments

  • car.png
    car.png
    41.7 KB · Views: 113
Top