dual transistors to dual relays

Somewhat new to all this DC electronics, but I try to research alot and learn. But I have one issue with a module for my motorcykle i can't figure out.

I'm trying to start the bike trough my Arduino board. two connections and relays, one is power to the bike and fulepump etc that needs power all the time, the other is the ignition that just needs power at the start, so I have to split it up.

Both have 150mA at start and then down to around 40mA, with 12v.

If i connect one circit to ether the power circuit/relay or to the ignition circuit/relay it works fine.

But as soon as I connect both of them (as the diagram) at the same time all hell breaks loose. Ether nothing works, or the bike starts right away or only the ignition works etc etc. Everything but correct. It feels like the ground to the Arduino is the issue, but I dont know how to solve it any other way.

I start to get crazy with this now and have searched for days, but I cant find a simular problem. Please have understanding with my bad diagram but I try as good as I can.

The Arduino GND must be connected to the minus of the bike. I would use logic MOSFET N-channel transistors.

You tell about 2 circuits, fuel pump and ignition. How do You intend to activate the starter motor?

Naturly the fuel pump must get time to get fuel pressure in order. ( I have a Yamaha Dragstar 1100).
As I think the power to all systems, lights, fuel pump, ignition unit, starter relay, etc. are supplied by one main relay. Waiting for the fuel pump to get ready, then the starter can be activated.

Right?

Freddp:
Please have understanding with my bad diagram but I try as good as I can.

The diagram's OK but, does it accurately depict what you have wired?

OP's schematic:

Tried connecting the arduino GND directly to ground, but then the transistor never cuts off. Its always on, no ide why. Only when I connect GND to Collector pin I get it to work with ONE relay. When i try two it gets really strange.

I start it with Bluetooth. But I could use any input to the arduino.
Yes, I wait for the fulepump to get ready, then I activate the ignite relay with other input.
But like I said. If i connect the fulepump directly and just connect ignition with Arduino/transistor it works great. And same other way. If i connect fulepump through arduino/transistor and ignition with a simple button etc it works great too.
Its just when both are connected as the diagram it dont work.

You ned a [u]flyback diode[/u] across each relay coil.

...When current through an inductor is switched-off the magnetic field collapses temporarily turning the inductor in to a generator. It tries to keep the same current flowing and with an infinite resistance it will "try" to generate an infinite "reverse" voltage to keep current flowing. The high voltage spike can fry your transistors or your Arduino, or simply cause a glitch that resets the Arduino.

In your schematic, both LED terminals are grounded. And when you get them wired correctly, they'll each need a current limiting resistor.

Both have 150mA at start and then down to around 40mA, with 12v.

150mA shouldn't be a problem but that's probably a measurement error. An inductor (such as the relay coil) "resists changes in current". (The same phenomenon that cause the back-EMF voltage-kick when it's switched off.) So the current will start-off lower, and then reach maximum in a matter of milliseconds or microseconds (faster than your meter can respond).

dougp:
The diagram's OK but, does it accurately depict what you have wired?

OP's schematic:

Yes but I see some small wirebugs (connection break bottom right and the small connection nob at the left relay), other than that its what i have done. I have tired several other things too, been on this for several days. But this is the way I feel it should work, so I wanna see what I have done wrong.

Where is the Arduino code hiding? I can't find it...….

Freddp:
other than that its what i have done.

See this guide to connecting outputs.

Freddp:
Somewhat new to all this DC electronics,

I start to get crazy with this now and have searched for days, but I cant find a simular problem. Please have understanding with my bad diagram but I try as good as I can.

Aside from your current problems, motorcycles, just like cars or whatever with ignition systems, electric fuel pumps, are a source of a lot of electrical noise.
So basically, problems now could be a drop in the ocean compared to what may lie in front of you.

Using good practise in cabeling, deoupling capacitors etc. it doesn't need to be that difficult. I run a home made single board computer in my car for 10 years without any noice disturbing its functionality.

Hi,
How do you expect the LEDs to work?

Double check the number and PINOUT of the 2N2222 as there are 2N2222A and others with different pinout configurations.

Pull your project out of the motorcycle and put it on the bench.
Replace the relays with LEDs and see what happens, REMEMBER to use current limit resistors with your LEDs.

Where is the rest of your circuit, how do you start the sequence?
Can please post a copy of your complete circuit, in CAD or a picture of a hand drawn circuit in jpg, png, especially showing your power circuit?
Hand drawn picture is usually the easiest and quickest.

How are you powering the UNO, do you have bypassing on the power supply to the UNO?
As suggested, place back EMF protection diodes across the relay coils.

PLEASE post your code....
Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Tom.... :slight_smile:

dougp:
See this guide to connecting outputs.

Perfect, thanks!

Just as @Railroader said in the first post, that he recomended a logic MOSFET N-channel. I have one on order that is ariving on friday. I hope that will work better.

There is so many questions I have but hard to explain. I have made a messy drawing from the real wire diagram of the bike, so you get a better understanding for how its connected.

I understand that this might create more problems or its not easy or not safe etc. But I like to create and challenge myself, even if it cost me money. So please, dont tell me how this is not going to work. Insted help me how i can change it and make it work. Thanks

How much current do the relay coils require (what is their resistance)?

Hi,
The way you have the connections will work, but as stated before you need protection diodes on the relay coils.

MOSFETs will make a difference current wise.
How are you powering the UNO?
How have you got your input configured, wired?
Some code will help to.

Tom.... :slight_smile:

TomGeorge:
Hi,
How do you expect the LEDs to work?

Double check the number and PINOUT of the 2N2222 as there are 2N2222A and others with different pinout configurations.

Pull your project out of the motorcycle and put it on the bench.
Replace the relays with LEDs and see what happens, REMEMBER to use current limit resistors with your LEDs.

Where is the rest of your circuit, how do you start the sequence?
Can please post a copy of your complete circuit, in CAD or a picture of a hand drawn circuit in jpg, png, especially showing your power circuit?
Hand drawn picture is usually the easiest and quickest.

How are you powering the UNO, do you have bypassing on the power supply to the UNO?
As suggested, place back EMF protection diodes across the relay coils.

PLEASE post your code....
Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Tom.... :slight_smile:

Thanks for the suggestions.
I really regret that I put a LED there. It was just a symbol for some other things that I dont know what it is in it, a TSSM and a ECM. The diagram didnt have symbols for that, but now I understand that i should have put someting else there then a LED.
Though I beleve it goes directly to ground, maybe just a inicator that register that fulepump is on etc.

The code is really secunday here, its just to turn the DP on at this point. I will build this after i figured out this mess.

int FuelPump = 13;
int Ignition = 12;
int inPinFuel = 6;
int inPinIgnition = 7; 
int valFuel = 0;
int valIgn = 0;

void setup() {
  pinMode(FuelPump, OUTPUT); 
  pinMode(inPinFuel , INPUT); 
  pinMode(Ignition, OUTPUT); 
  pinMode(inPinIgnition, INPUT); 
}

void loop(){
  valFuel = digitalRead(inPinFuel);
  valIgn = digitalRead(inPinIgnition);
  if (valFuel == HIGH) {
    digitalWrite(FuelPump, HIGH);
  } else {
    digitalWrite(FuelPump, LOW);
  }
  if (valIgn == HIGH) {
    digitalWrite(Ignition, HIGH);
  } else {
    digitalWrite(Ignition, LOW);
  }
}

The ESP32 is powerd by USB from computer, does this matter? I have not tried changing that, do you think the outcome could change with other powersupp?

I could try disconnect the bike and bench it with LEDs insted of relays to try it out. But still, in my head it should work like i have drawn it in the diagram.

JCA34F:
How much current do the relay coils require (what is their resistance)?

~150mA each.

Bring down the total project in smaller pieces and make them work. Then add one more piece and make that work. I see no problem that will stop Your. project.
You intend to use ESPxxx. They consume some current that would need to handle properly. That day, that question.