Go Down

Topic: Electronic ignition system EIS feedback (Read 8357 times) previous topic - next topic

MorganS

Backups are hard. Really hard. There's so many more failure modes to consider: what if one locks on hard? what if one randomly fires? what if both have the same software fault? It is usually best to put that engineering effort into making one work reliably.

Optocouplers are a good idea except an optocoupler is usually a low-current and low-voltage device. You need some proper transistors on the output side to actually operate the thing you're trying to operate. Coils in particular have extremely nasty ringing voltages that will destroy a transistor of insufficient beefyness.

"The problem is in the code you didn't post."

AndersStenhammar

#31
Feb 11, 2016, 10:40 pm Last Edit: Feb 11, 2016, 10:50 pm by AndersStenhammar
Hello.
Some uppdate on the project now. I have made an engine crank signal simulator (2 signals per revolution). I did then with a lot of testing realize that my advance calculation was not right, so I changed the code and it seems to be working out. But I am pretty sure that the timing is a little late because of the arduino processing time. There is an other fellow who has made this correction and I will look into that.

The uppdated EIS code is in attachments.

Here is a short video of the setup:
https://www.youtube.com/watch?v=QWYuPQbWgTk

Here is my Engine crank simulator:
Code: [Select]
//Use Serial monitor to send rpm setting to the simulator.
//Default RPM is 250

// To be able to manipulate the AVR processor timers:
#include <Avr/interrupt.h>
#include <Avr/io.h>
const int HallPin1 = 13;  // Hall latch sensor output (PORTB,0)
const int HallPin2 = 12;  // Hall latch sensor output (PORTB,0)
int TrimPotPin = A0;    // select the input pin for the potentiometer
unsigned int rpm;
long int timeold;
unsigned int sensorValue;
volatile long int microseconds;          // The microsecondcounter value.
volatile long int half_revolution_time;  // The time it takes for the crank to turn 1/2 revolution (The value of Trimpot.
volatile long half_revolutionStart;
volatile int half_revolutions;      // Hall sensor trigger counter

void setup() {

 Serial.begin(9600);
 pinMode(HallPin1, OUTPUT);    
 digitalWrite(HallPin1, LOW);  

rpm=250;
  microseconds = 0;         // Preset the us counter variable.
 
   /********** Setup timer2*************/
  noInterrupts();
  TCCR2A = 0;               // Turn off Control register for waveform generation
  TCCR2B = 0;               // Turn off noise cancelling, turn off edge select, waveform gen mode 0,
  TCCR2A |= (1 << WGM21);   // Turn on CTC mode (so it will start again) automatically
  TIMSK2 |= (1 << OCIE2A);  // Set interrupt on compare match.
  OCR2A = 8;                // Prescaler of 64 gives 4uS per tick, 4uS * 8 = 32uS (32uS = 1 degree at ~5100rpm).
  TCNT2  = 0;               // Reset timer counter to 0
  TCCR2B |= (1 << CS22);    // Load 64 prescaler, and this starts the timer2!
  interrupts();
 
}
 //The Interrupt Service Routine for Timer2 that will be executed each time the timer reach the compare match register (32uS)*/
 //______________________________________________________________________________________________________________________________
 ISR(TIMER2_COMPA_vect) {
  
  microseconds=microseconds+32;  // Increases the variable "microseconds" by 32 every time the ISR is executed).
  
  if (microseconds <= half_revolution_time){  
     digitalWrite(HallPin1, HIGH); // North magnet is passing the Hall sensor    
     }
     if (microseconds > half_revolution_time){  
     digitalWrite(HallPin1, LOW); // South magnet is passing the Hall sensor
     }
     if (microseconds > (half_revolution_time*2)){  
     half_revolutions=half_revolutions+2;      
     microseconds = 0;         // Reset the us counter variable.  
     TCNT2  = 0;               // Reset timer counter to 0  
     }
 }

void loop() {
  half_revolution_time=30000000/rpm;
  
 if (Serial.available() > 0) { // send data only when you receive data:
                  
  rpm = Serial.parseInt(); //read int or parseFloat for ..float...

  // say what you got:
  Serial.print("rpm: ");
  Serial.println(rpm, DEC);
  }
}




bluejets

#32
Feb 12, 2016, 09:48 am Last Edit: Feb 12, 2016, 09:52 am by bluejets
Anders,
           MorganS mentioned a beefy transistor for your ignition.

We used to use an MJ10012 in our standard ignition both on 6v and 12v.

The above ran from a hall effect and then through a buffer BC640 to the output transistor.

They were essentially designed for ignition switching I believe.

Not too expensive if you shop around. I think I initially bought about 20 in one go and bought them for about Aus $4.00-$6.00 each if I remember correctly.

I can email the circuits over to you if you like.

Should be able to mod the circuit to run on a micro without too much trouble.


AndersStenhammar

Hello. Yes I would realy like to see the wiring diagram. You could attach it here or send it to anders.stenhammar84@gmail.com

I am using a coil pack with built in ignitor (transistors), so i amm not quit sure if it is neccesary to have an extra transistor. Do you think this wiring would be ok?


bluejets

#34
Feb 12, 2016, 11:17 pm Last Edit: Feb 12, 2016, 11:21 pm by bluejets
Powering the opto transistor from the Arduino in my mind defeats the purpose of the isolator.

Similar problems came up in the pic 1840 open source ignition a while back.

Not sure just where it was and many pages to look through so I'll do a look back when I get a chance.

http://www.rcgroups.com/forums/showthread.php?s=0dfb00bdfc046f866207a45a5a5e5ba7&t=1781959&page=91

Not only that but the 5V output on Arduino would not handle any loading such as this I would imagine.

Ok,,,,,didn't know about the inclusion of transistors in your coil packs...... I'll send over the 2 circuits anyhow.
Never know, may come in helpful one day.

AndersStenhammar

That is a good point!  I think I will power the arduino and the ignitor with this power supply wiring (attached).
I will look into that PIC system.

bluejets

Reason for the seperate supply arrangement i.e. one for the micro and one for the ignitor is that ignition systems are very noisy and can cause many headaches.

By isolating the 2 systems can sometimes be an advantage.

Don't know if I like the "high" side switching arrangement you have with the npn opto either.

Others may care to comment but in my opinion, as the micro starts to turn the opto transistor on, the emitter voltage starts to rise due to it's load circuit, turning the transistor off again.

Might be better to look for a logic level mosfet perhaps driven by a slightly different circuit around the opto isolator.

As I say, others more qualified may care to comment there.

AndersStenhammar

#37
Feb 13, 2016, 02:28 pm Last Edit: Feb 13, 2016, 02:34 pm by AndersStenhammar
Ok so here is something for you to get your electro-engineering-teeth in (maybe only a Swedish of saying?)
I have tried to learn from all of you and have put a wiring diagram togheter (attached). What do you think of it?


AndersStenhammar

So is there not anyone who want to comment on this TinyCad circuit?



CrossRoads

5V regulator will get hot stepping 12-14V down to 5V.
5V into Vin will not work well - Vin needs ~6.5V for the Nano regulator to work. Feed the 5V into the 5V pins instead.
Don't know enough about the other 2 chips to comment. Got links to datasheets?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

noisymime

So is there not anyone who want to comment on this TinyCad circuit?


Hey Anders, a few things:
  • The 1n5818 diodes used in multiple areas a Schottky's, not Zeners. May help avoid some confusion
  • On more recent versions of this power circuit, I've moved the schottky to immediately before the regulator. This prevents the 12v source being backfed with 5v in a situation where the ignition is off but USB connected. EG
  • You've gotten the value of the resistors on the outputs from the TC4424 wrong, they should be around 160 Ohm, not 100k. Note also that these need to be rated for at least 1W, preferably 2W
  • As mentioned, the power circuit output should feed into the 5v line, not VIN
  • I use (and would recommend) tantalum caps rather than the electrolytics on this power circuit, but up to you.
  • I'd suggest bumping up the 1k pullup resistor on your tacho output circuit to 10k


Other than that, that tc4424 circuit will work for virtually all logic level ignition modules I've tested with, so that should be OK. Everything else looks like what I've used, so should be fine.

AndersStenhammar

#41
Feb 17, 2016, 06:00 pm Last Edit: Feb 18, 2016, 10:43 am by AndersStenhammar
Ok thank you so much! This help is so valuable. It is so easy to do misstakes when working on this.

Yes I figured it will get hot, so I will connect a heatsink to it and mount the heatsink outside the epoxy filled metal box (isolated from ground).

Quote
The 1n5818 diodes used in multiple areas a Schottky's, not Zeners. May help avoid some confusion
On more recent versions of this power circuit, I've moved the schottky to immediately before the regulator. This prevents the 12v source being backfed with 5v in a situation where the ignition is off but USB connected. EG You've gotten the value of the resistors on the outputs from the TC4424 wrong, they should be around 160 Ohm, not 100k. Note also that these need to be rated for at least 1W, preferably 2W
As mentioned, the power circuit output should feed into the 5v line, not VIN
I use (and would recommend) tantalum caps rather than the electrolytics on this power circuit, but up to you.
I'd suggest bumping up the 1k pullup resistor on your tacho output circuit to 10k
Thank you! I have now made your suggested changes  :)



AndersStenhammar

#42
Mar 04, 2016, 06:52 pm Last Edit: Mar 04, 2016, 07:04 pm by AndersStenhammar
So after a lot of help from an experienced electro Engineer I have redesigned my circuit. What do you think about it?




noisymime

Looking good! Personally I would retain a gate driver on the ignition outputs for better switching, but it will work the way you have it.  :)

I am curious as to why you're splitting the signal and using 2 inputs for the hall sensor? Not that it won't work, just curious as to the reason.

AndersStenhammar

Looking good! Personally I would retain a gate driver on the ignition outputs for better switching, but it will work the way you have it.  :) the

I am curious as to why you're splitting the signal and using 2 inputs for the hall sensor? Not that it won't work, just curious as to the reason.
Thank you very much :-)
One of the reason I have not used your driver for the ignition output, was because my electro engineer friend told me that the regulator was not suitable for the driver that draws 3A. I hope my solution will work out safely.

I am splitting the signal because I want to know were the crankshaft is. I have two magnets on the crankshaft pulley, one facing the latching hall sensor north and one facing it south. When the hall signal goes high, my RISING interrupt routine starts and fires coil A. When it goes low, my FALLING interrupt routine starts and fires coil B. I tried to define both interrupts on one pin, but it did not work.


Go Up