Electronics question

A forum for discussing topics of particular interest to those running MegaSquirt in Australia and New Zealand, including parts sources, group buys, etc.
Metalfab_101
Helpful Squirter
Posts: 61
Joined: Fri Mar 11, 2005 10:30 pm
Location: Qld, Australia

Electronics question

Post by Metalfab_101 »

This is loosely MS related so I figured I am OK to put it in here.

My problem comes from using the factory ECU harness for the MS install. I have a ECU connector from a dead ECU and have used that to make an adapter loom from between the stock loom and the MS DB37. Where I ran into trouble was with the circuitry for the main power relay. The relay's coil is switched on both the positive AND negative side, the positive through the ignition switch, and the negative side through the ECU. When the ECU is removed then that part of the circuit is removed, and the main relay does not turn on. So I have to come up with some way of switching the relay's coil to ground, using a +12v input.

I did some googling and read some on using transistors as a switch. Like this:
Image

Now if my understanding is correct R1 is connected to the base, the emitted goes to GND and the relay coil is connected to the collector. When a voltage is put to the base that allows current to flow from the collector to the emitter. The relay coil already has +12v on one side so it's effectively grounding the other side.
Prior preperation and planning prevents piss poor performance
long283
Helpful Squirter
Posts: 89
Joined: Fri Jun 02, 2006 6:01 pm
Location: Sydney, Australia

Re: Electronics question

Post by long283 »

That circuit will work fine.

If you are switching a few amps or more you may want to add a diode (eg. 1N4004) across the relay to protect the transistor from an emf spike when the relay is switched off. Connect the cathode to the positive (+12V) side of the relay and the anode to the transistor side.
Here's a reference if a picture helps http://en.wikipedia.org/wiki/Flyback_diode
devojet
Helpful Squirter
Posts: 82
Joined: Tue Jun 05, 2007 7:40 pm
Location: Gold Coast

Re: Electronics question

Post by devojet »

Let me know if I have read your post correctly. The 12V side of the relay is switched from the ingition, and the ground side is switched through the Factory ecu. I assume this relay feeds power to the MS, injectors coils etc.

If that is correct, then why not just ground the ground side and rely on the ignition switch to control the relay? Thats how a main relay would be done in a normal MS install.

Otherwise I agree with long283.

Cheers

Daniel.
26 Chev hotrod with a 1UZFE and MS3x, Flex fuel, GPIO Transmission control and LCDash.
LS3 powered Race boat with MS3pro and GPIO.
MS2 on a 22r in a Hilux (mates car).
MS2extra on a turbo EF Falcon (brothers car).
Toyota Supra 1jz MS2extra, COP.
13B Turbo MS2extra.
Metalfab_101
Helpful Squirter
Posts: 61
Joined: Fri Mar 11, 2005 10:30 pm
Location: Qld, Australia

Re: Electronics question

Post by Metalfab_101 »

devojet wrote:Let me know if I have read your post correctly. The 12V side of the relay is switched from the ingition, and the ground side is switched through the Factory ecu. I assume this relay feeds power to the MS, injectors coils etc.

If that is correct, then why not just ground the ground side and rely on the ignition switch to control the relay? Thats how a main relay would be done in a normal MS install.

Otherwise I agree with long283.

Cheers

Daniel.
Actually my description is not quite right because I tried that and even with the ignition off when I ground the -ve side of the relay coil it turns on, so the relay must have constant 12v to it.

The EMF spike was going to be my next question, thanks for mentioning that!!!
Prior preperation and planning prevents piss poor performance
Metalfab_101
Helpful Squirter
Posts: 61
Joined: Fri Mar 11, 2005 10:30 pm
Location: Qld, Australia

Re: Electronics question

Post by Metalfab_101 »

I modified the diagram, with the diode as suggested by long283.

Image

I'll set this up on a proto board and see how it goes. Thanks again!
Prior preperation and planning prevents piss poor performance
long283
Helpful Squirter
Posts: 89
Joined: Fri Jun 02, 2006 6:01 pm
Location: Sydney, Australia

Re: Electronics question

Post by long283 »

I remember my dad had a problem with a commodore v6 in a rodeo. He tried changing the relay switching but it also had a switch that opened when the oil-press went too low. It didn't want to switch off while the engine had oil-press after the wiring mod. :?


That updated diagram is correct.
Another way to protect the transistor is to use a ~22V zener. Connect the cathode to the transistor on the negative side of the coil and the anode to ground. Similar to the wiring in the MS for the fuel-pump, Idle-air Solenoid circuits.
Metalfab_101
Helpful Squirter
Posts: 61
Joined: Fri Mar 11, 2005 10:30 pm
Location: Qld, Australia

Re: Electronics question

Post by Metalfab_101 »

I checked the relay's coil resistance and it's 69.6 ohms. So I calculate the current draw to be about 170mA @ 12v. So a PN2222A should handle that current no problems.

Right? :oops:
Prior preperation and planning prevents piss poor performance
devojet
Helpful Squirter
Posts: 82
Joined: Tue Jun 05, 2007 7:40 pm
Location: Gold Coast

Re: Electronics question

Post by devojet »

Yeah the PN2222A should be fine. The data sheet says it can handle 1A max.

Cheers

Daniel.
26 Chev hotrod with a 1UZFE and MS3x, Flex fuel, GPIO Transmission control and LCDash.
LS3 powered Race boat with MS3pro and GPIO.
MS2 on a 22r in a Hilux (mates car).
MS2extra on a turbo EF Falcon (brothers car).
Toyota Supra 1jz MS2extra, COP.
13B Turbo MS2extra.
Metalfab_101
Helpful Squirter
Posts: 61
Joined: Fri Mar 11, 2005 10:30 pm
Location: Qld, Australia

Re: Electronics question

Post by Metalfab_101 »

Thanks Daniel. I'm trying ti figure out my resistor values now, and need the Hfe. I look on the datasheet but there's half a dozen values. I think 100 is the closest minimum value? As it says 10v and 150mA. What Hfe figure should I use?

EDIT: Added datasheet as attachment
Attachments
KSP2222A.pdf
(104.83 KiB) Downloaded 920 times
Prior preperation and planning prevents piss poor performance
long283
Helpful Squirter
Posts: 89
Joined: Fri Jun 02, 2006 6:01 pm
Location: Sydney, Australia

Re: Electronics question

Post by long283 »

The way you will be using the transistor is more like a switch. You simply want it to turn on or off, like a digital circuit. I believe you should go for maximium gain to keep the gate saturated, as long as the voltage divider keeps the gate below its maximum voltage.

Someone please correct me if I'm wrong.
Post Reply