A new DIY electronic coil tester.

Discuss all things Model T related.
Forum rules
If you need help logging in, or have question about how something works, use the Support forum located here Support Forum
Complete set of Forum Rules Forum Rules
User avatar

JohnH
Posts: 85
Joined: Sun Jan 06, 2019 6:57 pm
First Name: John
Last Name: Hunter
Location: Blue Mountains, Australia
Board Member Since: 2002
Contact:

Re: A new DIY electronic coil tester.

Post by JohnH » Wed Jan 01, 2020 7:32 pm

Chris Barker wrote:
Wed Jan 01, 2020 10:30 am
When I got my car, I found it had no magneto, and running on 6v required ALL the available advance! Reading of others' experiences, it seems that 12v is almost as good as magneto.
Chris, there was a dyno test done some years ago where 12v operation was found to be at least as good as magneto, if not slightly better.
As far as 6V operation is concerned, I think part of the 'problem' is the initial timing setting. The initial adjustment recommendation is for 15 degrees ATDC, apparently to prevent kick back when starting on magneto, and for this purpose a timing gauge is available. In Australia with our RHD cars, that gauge is of no use, so most ignition systems are simply adjusted for firing just as the piston leaves TDC. This gives almost another 15 degrees of advance. Several cars I know of with no magneto and 6V operation are also getting good results. Most of the time I don't run with the timing lever all the way down unless driving at more than about 65km/h.


Tom_Carnegie
Posts: 19
Joined: Mon Jan 07, 2019 6:17 pm
First Name: Tom
Last Name: Carnegie
Location: Spokane Valley, WA
MTFCA Number: 14685

Re: A new DIY electronic coil tester.

Post by Tom_Carnegie » Wed Jan 01, 2020 8:11 pm

Just to try to clear up what I think might be a misunderstanding of what I was wondering: I was not wondering about different voltages, I was wondering about different frequencies. The "shape" of the magneto waveform (or other triggering voltage waveform) has a large bearing on when the coil ramps up to firing amperage. A square wave DC signal used to power a coil has no specific "frequency".


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Roundup, now self-contained, new code

Post by Luke » Thu Jan 02, 2020 1:00 am

Perhaps time for brief recap on the tester.

Remember this came about because I was having trouble with my T and had thought it might be the coils. As it happened it wasn't, but by the time I determined that I'd started down the track of making a tester to check the coils out. I'd never seen a HCCT for sale here in NZ, and I didn't then know anyone with such a beast, so it was necessary for me to make something. Since I could I thought I'd make an electronic tester that might even be more accurate than the original 'old school' machine :idea:

I was further encouraged to do this because a while ago I'd been given some chassis gussets from Chris, another local T owner. This was helpful to me, and it seemed to me having a usable tester was something I could do in return should Chris' coils needed setting too. As it turned out he had a homemade HCCT but I thought it worth carrying on nevertheless. Taking it one step further it seemed it could be useful to release whatever work I did as 'open source', potentially benefiting a wider range of T owners.

The result has been gratifying, there's been quite some interest, several people have contributed to the project and we've got a more or less working tester that runs via a PC. It appears to have stimulated a fair bit of related discussion on testing methodologies too. Given the open code it allows for changing as needed so that useful data can be sent to a PC for later analysis (from which I hope some more information may fruitfully come in time).

However the tester I had in mind should be portable and able to work anywhere without connection to a PC. The original idea was a small unit that would simply, easily, and reliably test coils to see if they were 'in spec' and assist in adjusting the coils if not.

To this end I've just completed the connection of the LCD screen I had in mind at the outset, thus making the unit truly portable and able to run without connection to a PC. This doesn't finish the project because there is still quite some further beta testing and improvement/ironing out of any bugs etc to go. Additionally, having decided it would be useful, I want to add a capacitance meter, and possibly a rudimentary ohmmeter in case of any tracking between terminals across the wood (or a leaky capacitor).

However the code as it stands would make a working portable unit, so I include it here for anyone that wants to try it out. As a result of changes over the short life of the tester the original block diagram is now obsolete, so you'd need to follow the thread before connecting anything up. I won't produce a new diagram until I've settled on the other two test functions as they will require some additional wiring, but the intent is to make the basic unit even simpler to connect up than before.

Once that's done,and when the tester is more or less finished Martynn has kindly offered to draw it up so as to make it easier for anyone that wants to make one. Given this, and the attempt to 'modularise' the system I hope it should be reasonably straightforward for someone with minimal electronic experience to construct the tester, should they be interested.

Here's what it looks like presently:

Startup display - showing software version and build number

fact_lcd_Start.jpg

Single-shot test results showing test number, time to fire in msec, and current in amps.

fact_lcd_single_test.jpg

Start of multi-fire test showing RPM set

fact_lcd_multi_test_start.jpg

Results of multi-fire test showing mean firing time, standard deviation, min/max firing time, and degrees of rotation variabilty in firing time across the test (bear in mind this is a sick coil - JohnH's results suggest we'd expect a much smaller jitter).

fact_lcd_multi_test_result.jpg

Still a way to go, and as always keen to hear from anyone with suggestions/contributions and results of any tests you're doing!

Here's the code:

Code: Select all

/* The Ford Arduino Coil Tester ('FACT'), a prog to test Model T 'buzz coils'
 *  
 * Released under the GNU General Public Licence (https://www.gnu.org/licenses/gpl-3.0.html)
 *
 * -----------------------------------------------------------------------------
 *
 * Version 0.7 written by Luke P and Robert R, Christchurch, New Zealand, 17th December 2019.
 * 
 *  (1) turn on Model T coil for [interval] milliseconds (typically 4-5 msec)
 *  (2) measure the current max value 
 *  (3) measure time from 0 to max val (rise/ramp time)
 *  (4) measure time from max val to min val (decay time) 
 *  (5) calc and present results via USB serial
 *  
 * Makes use of fast ADC read (set presecale to 16, giving read times of ~ 24 us)
 * Leading on from initial proof of concept to usable code
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.8 (Luke P), 28th Dec 2019
 * 
 * Collect data much as for 0.7, tidy code, sep into functions for: 
 *   (a) Multi-firing of coil as if running in vehicle at specific RPM
 *       This in order to check consistency between firings and present results
 *   (b) Single fire as before (and present results)
 *   
 * Utilise switch press longevity for multi-fire or single-fire tests
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.81 (Luke P), 29th Dec 2019
 * 
 * Bugfix - need to reset results array at start of multi-test otherwise it only outputted every 2nd trial
 * Alter calculation of rpmdelay to incorporate interval time at start
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.88 (Luke P), 29th Dec 2019
 * 
 * Calculate some stats on results (incl affect on degrees of rotation) and display
 * Bugfix where using rpmdelay to calc degree variation (should be rpm)
 * Intro discard variable to discard first few results from multi-fire test that are often higher
 * than following results. Prob due to coil 'warming up from rest' these could skew stat calcs
 * 
 * -----------------------------------------------------------------------------
 *  
 *  Version 0.89 (Luke P), 30th Dec 2019
 *  
 *  Ability to use CT or ACS712 for current reading
 *  Some changes to stats calcs / display
 * 
 *   -----------------------------------------------------------------------------
 *  
 *  Version 0.89.1 (Luke P), 2 Jan 2020
 * 
 * Bugfix - multiple 60000/rpm by 2 for rpm delay, not divide!
 * 
 *  -----------------------------------------------------------------------------
 * 
 * Version 0.9 (Luke P), 2 Jan 2020
 * 
 * Include LCD setup and output data to LCD
 * This uses a lot more memory so begin on some code optimisation to reduce
 * Set missfire variable
 * RPM to global and std at 900RPM
 * 
 * -----------------------------------------------------------------------------
 *  
 * Version 0.9.1 (Luke P), 3 Jan 2020
 * 
 * Bugfixes incl testnum after multi-fire, memory optimisation contd
 */

#define ver 0.91
  
// Include any required libraries

#include <LiquidCrystal_I2C.h> // presently utilising the library from https://github.com/johnrickman/LiquidCrystal_I2C

// Set global variables etc
  
 unsigned long time_now = 0;  // use long in case micros count gets big
 unsigned int interval = 4000;           // interval at which to turn on (microseconds)
 const byte outPin = 7;  //output pin to ss relay for coil
 const byte swPin = 8; //input pin for switch, normally high 
 byte testnum = 0; // use byte for mem reduce, assume testnum < 255
 long mVolts = 0.0;
 float amps = 0.0;

//Initialise the LCD
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // set the address, columns and line

//set variables for collect_data function array 

 const byte numReadings = 150; //max number of values in array, 150 = approx 3ms
 const byte numTests = 50; //number of test cycles in multi test
 unsigned int analogVals[numReadings][2]; // array name & columns
 unsigned int x = 0; // initialise array input

//set variables for multi_test function array 

 unsigned int resultVals[numTests][2]; // array name
 unsigned int y = 0; // initialise array input

// set desired 'rpm' for multitest - facsimile of single coil running at this speed
 int rpm = 900; 

//setup for fast ADC read

 #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
 #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

//setup for switch reading
 
 const unsigned long short_in = 60;
 const unsigned long  long_in = 600;
 unsigned long swTimer=0;
 boolean swPrevState = HIGH;
 boolean swPresentState;

//begin setup for prog proper
  
void setup() 
   {
    pinMode(swPin, INPUT_PULLUP); // set the switch pin as input and apply resistor to +5
    pinMode(outPin, OUTPUT);// define output pin
    sbi(ADCSRA, ADPS2); //more stuff for fast ADC read
    cbi(ADCSRA, ADPS1);
    cbi(ADCSRA, ADPS0);
    Serial.begin(115200); // open the serial port 
    lcd.init(); // setup the LCD for printing
    lcd.backlight(); // turn on LCD backlight
    lcd.print (F("FACT v")); // initial text on lcd display at startup
    lcd.print (ver); // prints version number from define
    lcd.print (F(" LP_20")); // build number
    lcd.setCursor (0,1);
    lcd.print (F("Ready to test?"));
    lcd.blink();
   }

// --- Function to switch coil on for [interval], collect current values over time, analyse and output test number, max current, time to decay ---//

//void collect_data(int *maxv, int *ttf)
void collect_data(int *maxv, int *ttf, int *test) //function to toggle coil on, read and put resultant data into array, calculate various values and return as pointers to call
   // see https://stackoverflow.com/questions/2620146/how-do-i-return-multiple-values-from-a-function-in-c for returning multiple values from function (I'm using pointers)
   {
    analogRead(A0); // perform a read to clear register
    digitalWrite(7, HIGH); //set pin 7 high to power coil for time interval
    time_now = micros();
    x=0;  // reset array
    testnum = testnum + 1;
    while(micros() < time_now + interval)
       {
        if (x < numReadings) 
          {
           analogVals[x][0] = analogRead(A0); // read pin 0 volts (which is actually current from CT) and input value to array col 1
           analogVals[x][1] = (micros() - time_now); // time since start of loop (thus sample time), input to array col 2
           x++; //increment array
          }  
            
        }
    digitalWrite(7, LOW); // reset 7 to low and turn off power to coil
//begin data analysis
    int maxval = 0; // use float to get decimal places but int uses less mem
    long sum = 0;
    int val = 0;
    int prev_val = 0;
    int initialdecaytime = 0;
    int completedecaytime = 0;
    int maxI = 0;
   
//    delay(10);

    for(int i = 0; i < numReadings; i++)
      { 
       prev_val = val;
       val = analogVals[i][0];
       sum += val;
        
//     if ((val > maxval) && (initialdecaytime == 0)) //detect current increasing and write to 'maxval'
       if (val > maxval) //detect current increasing and write to 'maxval'
         {
          maxval = val; 
         }
// uncomment for ACS712   
       if ((val > 520) && (val < maxval) && (initialdecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime' ACS712
// uncomment for CT
//       if ((val > 100) && (val < maxval) && (initialdecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime' CT
//      if ((prev_val = maxval) && (val < prev_val) && (completedecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime'
         {
          initialdecaytime = analogVals[i][1];
         }   
// uncomment for ACS712         
        if ((initialdecaytime != 0) && (completedecaytime == 0) && (val <= 511))  //get total time from initialise to complete decay to zero ACS712
// uncomment for CT
//        if ((initialdecaytime != 0) && (completedecaytime == 0) && (val <= 0))  //get total time from initialise to complete decay to zero CT
         {
          completedecaytime = analogVals[i][1];
          maxI = i;
         }
 //Debug stuff       
 /*     Serial.print(analogVals[i][0]); // adc value
      Serial.print(" -- ");
      Serial.print(analogVals[i][1]); // time in micros
      Serial.print(" .. ");
      if (i != 0) Serial.print(analogVals[i][1]-analogVals[i-1][1]); // how long did each read take (in micros)
      Serial.println();
 */
      }
/* More debug
    Serial.print ("Maximum current = ");
    Serial.print (long(maxval) * 120.5);
    Serial.println ("mA");   
    Serial.print ("Decay time = ");
    Serial.print (completedecaytime);
    Serial.println ("usec");   
    Serial.println();
*/
    *ttf = completedecaytime;
    *maxv = maxval;
    *test = testnum;
   }
   
//--- Function to do a single fire test on a coil ---//

void single_test()
   {
    int maxv, ttf, test; // declare variables to use
    mVolts = 0.0;
    collect_data(&maxv, &ttf, &test);  // get data from collect_data function
    //collect_data(&maxv, &ttf);
    // uncomment two lines for ACS712
    mVolts = (maxv / 1024.0) * 5000.0; // raw analog read val to millvolts
    amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range
    // uncomment for CT    
    // amps = (maxv * .0222); // millivolts to amps (utilise scale factor for CT
    
    // write results to serial port
    Serial.print (F("*** Test number "));
    Serial.print (test);
    Serial.println (F(" ***"));
    Serial.print (F("Total cycle time (to fire) = "));
    Serial.print (float(ttf)/1000.00); // convert to ms
    Serial.println (F("msec"));
    // write results to LCD
    lcd.clear();
    lcd.setCursor (0,0); //set cursor first col, first row
    lcd.print (F("Single test #"));
    lcd.print (test);
    lcd.setCursor (0,1); //set cursor first col, second row
    lcd.print (F("TTF="));
    lcd.print (float(ttf)/1000.00); // convert to ms
    lcd.print (F("ms"));
// DEBUG    Serial.println (maxv);
// DEBUG    Serial.println (mVolts);  
    Serial.print (F("Maximum current = "));
    Serial.print (amps); 
    Serial.println (F("A")); 
    Serial.println();
    lcd.print(F(" "));
    lcd.print (amps);
    lcd.print(F("A"));
   }

//--- Function to do a multi-fire test on a coil as if running in vehicle ---//

void multi_test()  
   {
    // do some calcs on rpm as needed for delay (four-stroke, so single cyl ign fires every second cycle therefore div 2)
    byte rpmdelay = ((60000 / rpm)*2) - (interval/1000);  // attempts to roughly account for time in data_collect process ('interval') - byte means not much slower than 500RPM

    y=0;  // reset array
    
    // begin proper
    
    for(byte i = 0; i < numTests; i++)  // number of test firings
      {
       int maxv, ttf, test; // declare variables to use
       collect_data(&maxv, &ttf, &test);  // get data from collect_data function
       //collect_data(&maxv, &ttf); 
       resultVals[y][0] = (ttf); //1st col of result array gets ttf
       resultVals[y][1] = (maxv); // 2nd col of result array gets max current
       y++; //increment array           
       
/* use for debugging output from collect_data function
 *

    Serial.print ("*** Test number ");
    Serial.print (test);
    Serial.println (" ***");
    Serial.print ("2Maximum current = ");
    Serial.print (long(maxv) * 120.5);
    Serial.println ("mA");   
    Serial.print ("2Decay time = ");
    Serial.print (ttf);
    Serial.println ("usec");   
    Serial.println();
 *
 */    
       delay(rpmdelay); // sets 'rpm' delay between each test firing, 
      }
      
   testnum = 0;
   float results_sum = 0;
   float results_std_dev = 0;
   float msec_ttf = 0;
   float results_mean = 0;
   float results_var = 0; 
   float results_max = 0;
   float results_min = 10;
   boolean miss = 0;
   byte discard = 2; // first few results from multi-test show higher ttf than normal, discard to give more accurate result
   for(byte i = discard; i < numTests; i++) // get results from each test and print to serial
      { 
       testnum = (testnum + 1);
       Serial.print (F("*** Test number "));
       Serial.print (testnum);
       Serial.println (F(" ***"));
       Serial.print (F("Total cycle time (to fire) = "));
//       Serial.print (float((resultVals[i][0])/1000.00)); // convert to ms
       msec_ttf = ((resultVals[i][0])/1000.00); // convert to ms
       results_sum += msec_ttf;
       if (msec_ttf > results_max)
          {
           results_max = msec_ttf;
          }
       if (msec_ttf < results_min)
          {
           results_min = msec_ttf;
          }
       Serial.print (msec_ttf);
       Serial.println (F("msec"));
// uncomment two lines for ACS712
       mVolts = ((resultVals[i][1]) / 1024.0) * 5000.0; // raw analog read val to millvolts
       amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range
// uncomment for CT
//       amps = (long(resultVals[i][1]) * 0.02222); 
//       Serial.println (mVolts);  
       Serial.print (F("Maximum current = "));
       Serial.print (amps);
       Serial.println (F("A")); 
      }
    results_mean = (results_sum / (numTests - discard)); //get mean of array results for ttf ***using testnum cost of discard
    for(byte i = 2; i < numTests; i++)
       {
        //results_var += pow(results_mean - (float((resultVals[i][0])/1000.00)), 2); // get variance
        results_var += pow(results_mean - (((resultVals[i][0])/1000.00)), 2); // get variance
        results_std_dev = sqrt(results_var/(numTests - discard)); // get std deviation ***using testnum cost of discard instead numTests
        if (results_min ==0)  // if we have a 0 for ttf it suggests firing issues
        {
         miss = 1;
        }
       }
       
    Serial.println ();
    Serial.print (F("Mean time to fire = "));
    Serial.print (results_mean);
    Serial.println (F("mSec"));
    Serial.print (F("Standard deviation = "));
    Serial.print (results_std_dev);
    Serial.println (F("mSec")); 
    Serial.print (F("Results Max = "));
    Serial.print (results_max);
    Serial.println (F("mSec")); 
    Serial.print (F("Results Min = "));
    Serial.print (results_min);
    Serial.print (F("mSec")); 
    if (miss)
    {
     Serial.println (F(" *** MISFIRE ***")); 
    }
    else 
    {
     Serial.println();
    }
    // DEBUG    Serial.println (maxv);
    // DEBUG    Serial.println (mVolts);  
    Serial.print (F("Range = "));
    Serial.print (results_max - results_min);
    Serial.println (F("mSec"));     
    Serial.print (F("Degrees of variation at "));
    Serial.print (rpm);  
    Serial.print (F(" RPM = "));  
    Serial.print ((results_max - results_min)/(float(60000 / rpm)/360));
    Serial.println (F(" degree(s)")); 
    
    // LCD print
    lcd.clear();
    lcd.setCursor (0,0); //set cursor first col, first row
    lcd.print (F("M="));
    lcd.print (results_mean);
    lcd.print(F("ms"));
    lcd.setCursor (9,0); //set cursor 9th col, first row
    lcd.print (F("SD="));
    lcd.print (results_std_dev);
    lcd.setCursor (0,1); //set cursor first col, second row
    if (miss)
       {
        lcd.print(F("***MISFIRE***"));
       }
    else
       {   
        lcd.print(results_min);
        lcd.print(F("-"));
        lcd.print(results_max);
        lcd.print(F("  "));
        lcd.print ((results_max - results_min)/(float(60000 / rpm)/360));
        lcd.print ((char)223); // let's print the degree symbol!
        Serial.print (F("Maximum current = "));
        Serial.print (amps); 
        Serial.println (F("A")); 
        Serial.println();
        lcd.print(F(" "));
        lcd.print (amps);
        lcd.print(F("A")); 
       }
       testnum = 0;  
   }


//--- Main loop, detect short press of switch to call single fire, long press to call multi-fire ---//

void loop() 
   {
    swPresentState = digitalRead(swPin); // what's the switch doing
    if (swPresentState != swPrevState) // if not same as prev then...
      {
       delay(20); //debounce delay
       swPresentState = digitalRead(swPin); // check again after debounce delay to be sure
       if (swPresentState == LOW) // if switch is still on then it's real
          {
           swTimer = millis(); // set timer from on
          }
       if (swPresentState == HIGH) // sw not on now
         {
          unsigned long currentMillis = millis();
          //if ((currentMillis - swTimer >= 60) && !(currentMillis - swTimer >= 600)) // sw short press
          if ((currentMillis - swTimer >= short_in) && !(currentMillis - swTimer >= long_in)) // sw short press
            {        
             Serial.println (F("- Single shot test -"));
             //lcd.clear();
             //lcd.print(F("Single shot test")); // use F() macro to reduce memory use
             //testnum = (testnum + 1);
             single_test();
            }
          if ((currentMillis - swTimer >= long_in)) // sw long press
            {
          // the long press was detected
             Serial.println ();
             Serial.println (F("- Multi-fire test -"));
             Serial.println ();
             lcd.clear();
             lcd.print(rpm);
             lcd.print(F("RPM multifire"));
             lcd.setCursor (0,1);
             lcd.print(F("test in progress"));
             multi_test();
            }
         }
        swPrevState = swPresentState; // has state changed?
      } 

   }   

I reiterate the usual disclaimer around errors and omissions, that it's beta code etc etc. If you find a bug please help out and let us know!
Last edited by Luke on Thu Jan 02, 2020 10:23 pm, edited 1 time in total.

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Thu Jan 02, 2020 9:16 am

Hi Luke,

You asked... "To that end if you had a 'scope (or used the earlier code with the python plotter) and could could confirm that your 3.x msec is the main ramp and decay, or something else, I'd be keen to know?" ...Hope this helps.

VERY keen to see latest block diagram with the addition of the screen.
Attachments
pic_28_3.png

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Thu Jan 02, 2020 12:02 pm

Luke,
I wanted to confirm the latest Bill of Materials (BOM):
  • Price part # Description
  • $8 ATmega16U2 ARDUINO UNO R3 Development Board & USB Cable
  • $2-5 ACS712 Current Sensor Module (20A?) for Arduino
  • $3 L298N DC Stepper Motor Driver Module
  • $3-5 ??? LCD Module for Arduino

All prices are from ebay. Prices very depending on shipping location (i.e. China = waiting time).

I bring up the BOM just to confirm for myself, but also so that others can get an idea of how much the electronics cost.

Matt


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Thu Jan 02, 2020 3:44 pm

John,

Thank you, that's very helpful - your trace seems to me the epitome of what I'd thought a good coil would look like, with the possible exception of the plateau time, and with no further spikes I expect the tester will be reporting just what the trace shows.

A couple of things arise. Having re-read JohnH's article; he has good to reason to suggest that around 2msec is a good fire-time for a coil running on 12v, and more than 3msec for one at 6V. I agree with his logic in that it's more efficient and better for the coils themselves to not be on for any longer than they need to. If you're testing yours at 12V then, particularly given the plateau 'length', it seems to me it could be brought back from a timing perspective to less than 2.4msec or less.

The other is that (also given the plateau) if you're not showing any more than 4A (which I think would be right after you adjusted the ACS712 sensitivity?) then a 5A version of the sensor would be fine. It would give a little more resolution too. Should we get an overcurrent for any reason then, given how we're using them, I believe it shouldn't destroy the device as the datasheet says the devices may be operated at higher primary current levels (prov temp is kept down).

My only hesitation on that is that we've not tested many coils (at least I assume you've not!) and although the current level is in rough agreement with what JohnH reports, and what I've found, it is quite a bit less than Mike Kossor has reported in his posts, utilising his machine. It may be that Mike is also taking the reverse current peaks into account, or there's something else we're missing so until we've tested a few more coils I guess the jury is out on that. Mike?

I'm happy to put up a block diagram but in order not to have to do another in quick succession I'd like to get a working cap tester first so I know what pins I'm going to use :-)

Matt,

For me things from eBay take roughly the same length of time as direct from China, and they're generally more expensive - certainly the shipping is - so my BOM would be approx ($USD):

Arduino Nano $2
ACS712 20A $1.40
L298 board $2
Pushbutton switch $1.60 (that's for 10!)
i2C 16x2 LCD $1.95

I think I'm going to order some 20x4 LCD's for something else so will try one of them in this project - it'd mean a more intelligible display, not having to truncate things the same. The cost for them is around $3.50 so even with that the cost comes in well less than the $15 I mentioned. If we add a resistor or two and another switch to include a capacitor test then maybe we're getting closer! Mind you I've assumed that one already has some wire and a box to put the completed tester in (and a 6-12V source)...

Tom,

I'm sorry, I'd not forgotten your interest in frequency. I think it's likely that looking at different voltages may well still give you an idea (since you could slice a sine wave magneto output into discrete voltages) but, that said, it wouldn't be impossible to produce a reasonable test for what you want.

Certainly the basic code from here could read and collect the necessary data to analyse if you fed an appropriate sine wave into a coil via the ACS712 (or CT) and maybe triggered the reads at the start of each cycle. You might just want to look at the positive curves perhaps (give the Arduino some time to catch up!) but it'd be doable. You could use an HCCT, or better still a function generator into a high-current bipolar transistor in series with the power feed to the coil.

It'd be an interesting thing to do but just at the moment I want to more or less complete this tester first, and then make the speedo/rev counter (and possibly an indicator setup, Jeff :-) I mentioned earlier before I look at anything else T related.

However maybe you could take this code and give it a go yourself? Happy to help if you wanted to try that.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Code update.

Post by Luke » Thu Jan 02, 2020 10:24 pm

Just in case anyone downloaded the code from last night I've just now replaced it with a minor version number update (rather than post it all again)...

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sat Jan 04, 2020 2:04 am

Luke,
The BOM is very impressive. If we working as it seems to be, it is well worth it. I have on order the ACS712 & L298 boards. But for now I I played more with with the MCCT and the Current Transformer. The results are looking good, but I imagine with the MOSFET switching things it will look a lot better!

LCD
As far as a display I agree a four line display is desired. I have also seen some displays with pushbuttons. That may be desired, so people don't have much soldering.

Capacitor Test
I think you could do a capacitor test buy adding a large resister in series with a output. Additionally you would want to connect a analog input between the resistor and cap. Don't forget that the points must be held open perhaps with a small piece of paper.

Matt
Last edited by Matt in California on Sat Jan 04, 2020 2:10 am, edited 1 time in total.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Some results from experimenting

Post by Luke » Sat Jan 04, 2020 2:04 am

I was going to code in the capacitor tester today but got sidetracked for several reasons.

One of these was that, in wanting to make this easy for people to replicate I'm not switching the coils the way I would do it personally (using a FET), rather I'm using a module that essentially just requires one to screw in a few wires. These modules also nicely cope with back emf, so no need to have a flyback diode etc.

Unfortunately this makes it a little harder to easily switch in and out the capacitor tester. So while I was thinking about that I thought I'd see what happened when I paralleled the two H-bridge outputs of the L298 I was using. I had wondered if it was current limiting at one point (although it wasn't apparent on the 'scope), so this seemed like a way to allay that thought.

As it turned out this gave a usable boost in current handling (the 298 is a bipolar device and as an H-bridge it has a fair voltage drop) and I could get more current at a given input voltage than before. This led me on to think about another module I had here (after making a balancing scooter some years ago - a.k.a. a segway) that could be even better - a BTS7960. This is a FET switching half-bridge with low RON and easily enough capacity to handle a Model T coil.

Having connected that up I am of the view that it's a good thing; I can now show upwards of 6A at 13.5V in, mostly I suspect due to the much lower voltage drop.

However the really interesting thing was (thinking of Tom's enquiry) when I lowered the input voltage to the coils. What I noticed was that although the current went down (and thus energy out) the timing became less erratic. If I tried a coil at ~7V it may show a SD of 0.01 and a 0.31deg variation in rotational timing at 900RPM, but if I lifted the same coil to say 13.5V it could give a SD or .12 and 2.1deg variation or so (note I'm just quoting typical results, there was some variation between each test).

Although it's a small sample set I have now tested three coils and they all show the same characteristics - timing scatter reduces at the lower voltage and, to take an example of one coil, ttf increases from ~2.2ms to ~3.5ms [mean]. I expect the latter, but not the former.

My initial thoughts are that this could be due to points bounce with a more vigorous magnetic field (and therefore contact/arm movement), however this is just surmise and I would be interested in other comments/ideas?


Chris Barker
Posts: 62
Joined: Sun Jan 06, 2019 5:08 pm
First Name: Chris
Last Name: Barker
Location: Somerset, Eng;and

Re: A new DIY electronic coil tester.

Post by Chris Barker » Sat Jan 04, 2020 12:16 pm

Luke,
to be clear, are you saying that the coil takes LONGER to fire with higher applied volts?

As Ron told me, the T coil has traps for the logical mind!

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sat Jan 04, 2020 12:38 pm

Luke you said:
However the really interesting thing was (thinking of Tom's enquiry) when I lowered the input voltage to the coils. What I noticed was that although the current went down (and thus energy out) the timing became less erratic. If I tried a coil at ~7V it may show a SD of 0.01 and a 0.31deg variation in rotational timing at 900RPM, but if I lifted the same coil to say 13.5V it could give a SD or .12 and 2.1deg variation or so (note I'm just quoting typical results, there was some variation between each test).

Although it's a small sample set I have now tested three coils and they all show the same characteristics - timing scatter reduces at the lower voltage and, to take an example of one coil, ttf increases from ~2.2ms to ~3.5ms [mean]. I expect the latter, but not the former.

My initial thoughts are that this could be due to points bounce with a more vigorous magnetic field (and therefore contact/arm movement), however this is just surmise and I would be interested in other comments/ideas?
Mike Kossor sent me this and I posted it on another thread on June 6th:
Firing Consistency Degradation.pdf
(1.58 MiB) Downloaded 21 times
As you can see Mike documents the same issue. The standard deviation is larger with faster RPM. I would guess this is due to a shorter settling time on the points/springs.

Matt


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Sat Jan 04, 2020 4:12 pm

Chris,

No, the ramp time for the coils increases with reduced voltage, as I think one could expect.

I can imagine Ron's comment was due to some exasperation over a particularly recalcitrant coil? Personally I think the coil operation is reasonably logical and predictable, it's just that they're not very precise. Given they're a ~120 year old electro-mechanical oscillator design (and possibly 100 y.o. or more coils in the car!) I'm not particularly astonished by that.

For their time I think they were a very ingenious product, and that many still work well after all this time is a tribute to the designers and manufacturers, and the material used. Whether one is able to improve the system further by adjusting the coils differently today, utilising much more accurate equipment than they ever had, is a question that's been exercising my mind these past few days (as it clearly has others).

I've no conclusion to that, I have a very small sample set of coils and a limited range of data. If/when others make up a similar tester and collect some more data we might be able to reach a more informed view but for the moment I'm leaning to the thought that while a modest improvement may be possible, the inherent variability of the coils will always limit the extent of that.

However I could be proved wrong, indeed I'd be rapt (if a little surprised) were it demonstrated that coils could be exactly the same, and precise, firing time across voltage and pulse ranges, and that the coils I have been testing - or even the way I've been testing them - are simply an anomaly.

Anyway, I digress, sorry.

Matt,

See my comment re the L298, it's probably worth paralleling those outputs - just make sure, if you do, that you have the polarity correct for when you command them both in one direction or the other.

I've got a 2-line display here with pushbuttons and did wonder if I could utilise them. However I think for the reason I espoused earlier I might stick to a single separate pushbutton switch and perhaps a toggle switch for on/off/capacitor/coil test function (and get a 4-line display).

Yes, the capacitor test is very simple, the thing I was thinking of was how to connect it up in a way that made it easier for someone with little electronic knowledge. It would be nice if people who've never done anything like this before could have a go and be reasonably sure of having a positive result. Keeping the connections as straightforward as possible should assist that, I hope!

Thanks for passing on that detail that Mike K has produced. From my limited tests I concur with his results, however what I was discussing here was the difference in ttf variability between coils set up at 12V to when they were tested at 7V, i.e. a voltage change affects consistency in timing, not just cycle time (RPM).

I also have an idea the absolute timing may vary between coils set up the same at one voltage to when they are asked to operate at another. If this is the case it lends credence to Tom's thoughts, and it would be useful information for people such as JohnH and me who operate our vehicles solely on battery. As such it would suggest that one should set the coils at the voltage one is going to use them at (realising of course it's a moot point if you've using the magneto, in which case 12V is probably a good compromise but you'd be stuck with variability nevertheless).

Now I must reiterate I've a very small sample set and that these comments I've made are very tentative and could be proven very wrong. It would be useful to test the hypothesis when you and others have an opportunity to test some more coils at different voltages.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Some data from different voltage testing

Post by Luke » Sat Jan 04, 2020 5:10 pm

I had occasion to test four coils this morning. Given the intended mode of these, and the interest I had in operational voltage I did a quick comparison at two discrete voltage inputs.

All four coils were set to fire at Mean 3.31-3.33 msecs at 7V. One a multi-fire test of 50 cycles at an equivalent engine RPM of 900 they typically exhibited a standard deviation of .04.

At 12V the following typical results were obtained:

Coil 1 - Mean 2.22msec / SD .12
Coil 2 - Mean 2.08msec / SD.09
Coil 3 - Mean 2.10msec / SD .11
Coil 4 - Mean 2.16msec / SD .13

To clarify and expand a little - at 6V it was much more probable that each series of 50 firings on a single coil would give the same or a very close mean result (ie. it was quite consistent) whereas the same coils, and same test conditions - with the sole exception of the voltage change - were much less consistent. A coil could vary between Mean 2.11msec to 2.22msec at 12V, but only between 3.31 to 3.33msec at 6V for example.

I make no specific conclusion, one would need a lot more data, and be more rigorous in how it were collected and analysed to do that, however I think that if I were setting up coils for a car that was driven on battery vs a car typical driven on the mag I might set them differently...

Addendum:


All four coils had a similar capacitance at around 0.48uF but the inductance varied from 1.98mH to 2.7mH. Unfortunately I measured this later and can't now correlate between coil results above. However the difference in inductance between them is worth remarking on, and may lend credence to Tom's observations and attempt to match coils on characteristics other than just timing.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sat Jan 04, 2020 10:51 pm

Luke,
After reflecting and before seeing you response I understood your issue with doing the capacitor test AND connecting up with the MOSFET. I think the issue would be measuring w/o the Radio Frequency Interference destroying the chip when running with the MOSFET. I think we have two options:
  • Build so there is just one place for the coil in and follows by all the tests...
  • Have two different tests: passive & active.
I am leaning toward the second option. I see how both would be good, but it would be easy to have one fixture (i.e a coil box) that someone moved the coil from one location to the next. In addition to measuring capacitance we could measure: resistance and inductance.

Captive Tester
Luke, I will blame you that my living room has turned into a workshop :roll:
49574296-63B6-4046-B5DC-DB190E844013.jpeg
I connected a 10Kohm resistor to an output. The other side of the resistor is connected to a analog input (A1) and the coil.

I wrote the following code to test the capacitor.

Code: Select all

     
     if (digitalRead(Pin_11)) //10K ohm resistor is connected to output pin; other end of resistor is connected to A1 and capacitor.
      {
        digitalWrite(Test_Cap_Pin, LOW); //set pin 2 low so that capacitor drains
        delay (1000); //wait a second
        digitalWrite(Test_Cap_Pin, HIGH);
        time_now = micros();
        //warning this is an infinite loop if A1 does not reach value could cause program to hang
        while(analogRead(A1)<642 && digitalRead(Pin_11)); //to reach 63% voltage; 5 volts = 1020; 1020 x 63% = 642
        time_constant = micros() - time_now;  
        capacitor_value = time_constant/10; //C=T/R; time_contant ms / 10K ohm  = C (Nanofarads)
        
        Serial.print("Capacitor_Value: ");
        Serial.print(capacitor_value);
        Serial.print(" Nanofarads");
        Serial.println();
      }
      
Basically it turns on the output waits until the value reaches 63% of the full value and records this time. Since it is a 10 K resistor the actual capacitor value in pico Farads is just the time divided by 10 (T = RC or C = T/R).

I got a nice RC curve on the oscilloscope (note: it turns off right at 63%).
2E37E109-500F-4952-A7AB-F01952CCD066.jpeg
Here are my results on a good capacitor.
Cap_Test.JPG
Here are my test results on different coils:
Coils with New Caps:
0.462 uF
0.475 uF
0.465 uF
0.469 uF

Original Ford Coil Capacitors:
1.433 uF
1.232 uF
1.700 uF
1.244 uF

Original KW Coil Capacitors:
0.132 uF (KW? Painted over)
0.151 uF
0.144 uF

Well if nothing else, I now have a good capacitor tester. But we need to figure out what is considered an acceptable range.

Matt
Last edited by Matt in California on Mon Jan 06, 2020 12:32 am, edited 1 time in total.


jab35
Posts: 228
Joined: Sun Jan 06, 2019 12:28 pm
First Name: James
Last Name: Bartsch
Location: Dryden, NY 13053
MTFCA Number: 30615

Re: A new DIY electronic coil tester.

Post by jab35 » Sun Jan 05, 2020 2:28 pm

Nice work and good results. First a question, is capacitor leakage important? and if so, how difficult to measure?

I suspect the first 4 values for 4 new caps is indicative of the variation one will find in new parts. If the variation affects coil performance in a negative way, I suppose you could select and match the caps in each 4 coil set. I suspect that level of precision might not be needed, but if desired you now have the means to do so. Thanks again for all this information, jb

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Sun Jan 05, 2020 2:54 pm

Good job Matt with the capacitance code I will give that a try later. Like jab35 says a leakage test of the capacitor would definitely be desirable but I am not sure how possible that would be to include in your code? A big failing of old coils is capacitor leakage. Regeards John


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Sun Jan 05, 2020 3:09 pm

Matt,

Yes, I don't know what it is about electronic projects but they're the messiest things around! I've taken aeroplanes to pieces (and put them back together!) that never seems to generate the same amount of cr*p :roll:

Good job with the code. You're now at the point where I was/am wrt to connecting it up to the cap under test. If it were just me it would be long done (and the switching device would be different) but I'm trying to maintain the simplest possible approach from a constructors perspective, hence the interlude to think about that.

A couple of things though - I think you might want to check your scale. Model T caps are circa 0.47uF as I recall, which would be 470,000pF. Also, in my view, they're not a precision item and anything from 0.42uF to 0.56uF or so should be fine. It'd be easy enough to test this empirically with a coil that doesn't have a cap installed (or a failed one) - you could connect them up externally and try the combination out to see how it went.

Apropos James' enquiry, and moving to my second point. In my cap tester I don't discharge at the 62.3% level, rather I use a higher value charge resistor and carry on the charge after the requisite TC point to see if there is any leakage. After a short (further) time the Arduino should read the full input voltage across the cap, if not there's a leak (which is easily calculated using Ohm's law).

To my mind while it's not common for caps to leak they sometimes do, but perhaps more importantly this is also a useful test to ensure there's no tracking on the coil box. I don't know if this is a 'thing' or not, but it's not hard to test so I include it.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Mon Jan 06, 2020 12:50 am

James, John & Luke,
Thanks for your comments. I hadn't considered the leakage. I figured that just determining the value in a desired range, would confirm that the cap is likely okay. It would be good to see what Luke comes up with as a solution. I am just trying to figure out if leakage is a issue. If the charge leaks before the points short, is that a issue? I thought the cap is there just as the points open and spark due to the high inductive load. But again, no harm in verifying it.

Also, I am wondering if the values that I got for the Ford and KW coils is acceptable. It am wondering what values they would have had originally.

I agree that I could let the capacitor fully charge, but my thought is that if it is bad it is unlikely for it to come up to 63% in an acceptable range. A bigger issue is if it is shorted or never comes up to range then my test hangs. Obviously this "feature" should be improved.

Luke,
Thanks for pointing out my blunder with the units! I guess I jumped to pico because I havn't heard many refer to nano farads. Good thing we didn't send this off to Mars! I edited the post above, so as not to confuse the intelligent life out there looking at our posts :mrgreen:

Thoughts for future advancements on the static passive tests:
-ground the top side contact (timer input)
-measure resistance from bottom contact to verify points and primary coil resistance
-do an inductance test for above
-also measure inductance and resistance of secondary

Looking forward to seeing your solutions!

Matt


Chris Barker
Posts: 62
Joined: Sun Jan 06, 2019 5:08 pm
First Name: Chris
Last Name: Barker
Location: Somerset, Eng;and

Re: A new DIY electronic coil tester.

Post by Chris Barker » Mon Jan 06, 2020 6:22 am

The figures Matt quoted are the same as I have encountered when rebuilding coils - as measured by Strobospark.

Lots of people run cars with a mixture of original and modern caps - few have ever thought about the effect on timing and hardly anyone had a means of measuring it.

The majority of old Ford capacitors DO leak, and most rebuilders will replace them as a matter of course.

Note that our elders have established that there are very few modern capacitors that are up to the task. They must have a high 'dv/dt' rating or they fail quite quickly. The two I know of that do work (and are supplied by the specialists) are an orange cylindrical type and a red rectangular one. Both are 0.47uf
e.g.
https://www.snydersantiqueauto.com/Prod ... hByKeyword
and
https://www.modeltford.com/item/5009B.aspx


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Capacitor value and coilbox leakage test - interim code

Post by Luke » Tue Jan 07, 2020 4:23 am

So my (work) year has started already, meaning I have less time to mess with T stuff :(

Fortunately I'd written a rudimentary function for the capacitor value and coil-box leakage tests I was interested in. This forms part of v0.95 of the main code, which I've yet to complete and release. However for your interest I'll put the function up here in its present form 'cos it will show you what my thinking was on how to simply complete both tests (on a coil that has the points held open by an insulated item - such as a plastic pen or whatever).

How does it work? In essence the coil cap has one side to ground and we apply a voltage to the other side via a resistor (in my case 487K) and measure the time it takes to charge the cap to 63.2% of the resistor's source voltage. This value is recorded for later calculation of capacitance and delivery, and the charge continues.

At the end of a specified time (long after 63.2% charge time of the correct value cap) the voltage across the cap is measured and entered into a formula that calculates the resistance of the previously unknown resistance (leakage). In theory this should be infinite because, in the absence of any leak, the cap should have charged to full source potential. However if there's a leak somewhere then the cap charge will be less than the source voltage and a value of resistance calculated and delivered.

In both cases (capacitance and resistance) I've put in some if statements to declare whether the coil passes the test or not. Given we're not needing a precise test to ten decimal places I'm reasonably happy that this should competently identify a good capacitor/(lack of) leakage, or otherwise.

There are some variables that exist outside the function as they are part of the main code, but this should be evident.

Please consider this alpha code, it's very crude and there are some hiccups still to address, but it's a foundation and it more or less works for me...

Code: Select all

//--- Function to check capacitor value and resistance ---//

void cap_test()

   {
    int cap_time = 0;
    int r_volts = 0;
    long r_val = 487000; // charge resistor value in ohms
    float cap_val = 0.0;
    long leak = 0;
    digitalWrite(cap_chg_pin, HIGH); // use digi pin 13 to charge the cap via a resistor
    time_now = millis();
    for (int i = 0; i < 2000; i++)
      {
        time_gone = millis() - time_now;
        mVolts = analogRead (A2);  //use analog pin A2 to read volts across unknown cap
//        Serial.print (time_gone);
//        Serial.print (" - ");
//        Serial.println (mVolts);
        if (mVolts <= (source_volts * .632))
           {
            cap_time = time_gone; // time at which cap charge has reached 63.2% source_volts
           }
       }
     cap_val = ((float)cap_time/r_val) * 1000.0;
     leak = mVolts * r_val / (source_volts - mVolts); // calculate the resistance of the unknown resistance (leakage) in voltage divider cct
     if (leak < 0)
        {
         leak = 20000000; // if we get variable source volts then could go negative - may need to say 're-test!'?
        }
     Serial.print (cap_val);
     if (cap_val > 0.4 && cap_val < 0.6)
        {
         Serial.print (F("uF")); 
         Serial.println (F(" **OK** :)"));
        }
     else
        {
         Serial.print (F("uF"));
         Serial.println (F(" **BAD** :-("));
        }
     Serial.print (leak);
          if (leak > 10000000)
          //if (leak > 10000000 || leak < 0)
        {
         Serial.print (F(" ohms")); 
         Serial.println (F(" **OK** :)"));
        }
     else
        {
         Serial.print (F(" ohms"));
         Serial.println (F(" **BAD** :-("));
        }
     digitalWrite(cap_chg_pin, LOW);
   }
Chris,

I didn't know the Strobospark measured capacitance as well, that's useful info thanks.

I've yet to try varying cap value to see if it should differentially affect timing at different frequencies/voltages, but I guess it would be interesting to check it out some time.

Somewhere I'm hoping I've still got some caps I used to use in CRT line output stages many many years ago. With luck they'd be a suitable value for Ford coils because they'd be just fine in terms of current capability, but that's probably a forlorn hope.

Matt,

Hopefully the code I've put up will give you a better idea of what I was getting at earlier.

With regard to further tests of inductance etc to both coils within the box, I'm inclined to think that's getting beyond what this simple tester is intended for, and there are several very inexpensive devices that will do that already (less than $10 USD).

To my mind if the cap/leakage check out ok, the points/timing is able to be set, and there's a good spark at the spark gap then that's about all one needs to know - and it's practically all one can do. I doubt anyone would want to mess with replacing individual windings today, and if you're keen enough to want to match inductance then I guess you'd have a LC meter already (or get one).

That's my thinking at the moment, but if I were to find a major change in characteristics due to inductance values etc I might rethink. Mind you, as the code is open it could be something you might like to add at some point - it's not particularly hard to measure inductance. Bear in mind though that to switch around the various contacts on the coil etc complicates things further and would make it more difficult for the average person to wire up, something I'm acutely aware of in what I've been doing to date.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

More progress

Post by Luke » Wed Jan 08, 2020 5:23 am

A brief report on a couple of useful things that arose today.

The first is that I was able to try out the tester on some other coils (thanks Chris), and we later tried some setup by the tester in a car.

Qualitatively the car went at least as well as it did with coils set on the HCCT. Coils set up on the 'FACT' tested well on the HCCT, and a faulty coil we'd earlier identified was also shown to be faulty in the HCCT.

The latter was a little different though, in the 'FACT' it showed as having reduced peak current cf the others (~5A vs ~6A), whereas in the HCCT it was quite a lot higher average current (3A-4A as I recall - the others were 1.3A-1.5A). A simple resistance test suggested this coil may have shorted turns on the secondary because it was showing 2.7k vs 3.3k for the others. I've yet to consider this further, so this is more information than conclusion.

As I'd done some more on the code, and hardware wiring, we were also able to use the capacitance and leakage testing functions to ID a faulty capacitor on one of the coils (turned out to be an original capacitor), and check that the remainder were ok. This function appears to be working as expected.

Here's some more screenshots of the new function in operation:

Tester switched to cap/leak test and button pressed

fact_cap_test_progress.jpg

Result from a good coil

fact_cap_test_ok.jpg

Result from a bad coil

fact_cap_test_bad.jpg

This latter coil did show a few ohms (ie. it wasn't completely shorted out) but as I'm knocking off the decimal places and reporting only in M ohms anything less than 1M will show as 0, in any event it's clearly identified as a faulty coil (which it is).

There's a bit more to do with the code before putting it up, and some testing to be carried out from there, but I think this is getting reasonably close to being a useable tool.


Chris Barker
Posts: 62
Joined: Sun Jan 06, 2019 5:08 pm
First Name: Chris
Last Name: Barker
Location: Somerset, Eng;and

Re: A new DIY electronic coil tester.

Post by Chris Barker » Wed Jan 08, 2020 11:26 am

2.7 kohms is just within the range I have measured. Probably OK.

What made you think it is 'bad' - either in the HCCT or FACT?

I would be tempted to try to 'mend' (re-set) it using either the HCCT or the FACT, then, if successful, try it in the other tool.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Wed Jan 08, 2020 12:54 pm

Luke,
Thanks for sharing your results. I like the concept of the display. I think I would prefer more digits on the resistance value, unless there is a limiting factor outside of hardware.

Like Chris, I am with confused on your capacitance value. Here is what John Carter developed for simple multi-meter tests:
coil_testing.jpg
Matt


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 08, 2020 5:04 pm

Chris,

The faulty coil showed a low current draw in the 'FACT', and IIRC it had a reasonably high SD. In the HCCT it was also erratic, but it showed a particularly high averaged current.

These issues continued after several attempts at setting the coil, including a new set of points. Although not a perfect test the lower secondary resistance, coupled with the current anomalies, suggested possible shorted turn(s).

We need to consider this further, my recollection of the shorted turns tester I made nearly 40 years ago (for a TV LOPT) was that it used an AC signal to measure the inductive reactance of the coil. As the HCCT uses an AC source with a series AC current meter, I suspect it could effectively become a shorted turns tester of sorts.

What I don't know, and to which I ask in general, is whether it's common to have such a fault in the coils? Given their age, and the secondary voltage, and knowing how often LOPT's died as a result of shorted turns, it wouldn't surprise me - but there are several factors that contribute so I guess until we got a steer on that it's hard to know.

It's interesting that you've measure some coils at 2.7k, I assume they worked ok? Were you using the Strobospark with them, if so does that measure average current too?

Matt,

I'd deliberately reduced the precision on the resistance display because (1) I wanted to fit it on the screen! (2) I don't think it matters much - if it's more than say 20M why would one want to know to ten digits, and conversely if it's less than say 1M what does it matter 'cos it's clearly too low? Also it's a fairly crude test and I'm not sure it's highly accurate (but it is accurate enough for this purpose IMV). Anyway it's easy to change in the code if personal preference dictates more detail :-)

I'm sorry but I'm not sure I understand your question on the cap value?

This good coil had a replacement 0.47uF cap in it. That the tester displayed .01uF more doesn't bother me, I expect the cap will be a 20% component and in any event I don't think it's terribly important if it were a few nF either way in this location.

The bad coil was outside the tolerance I'd set, and had significant leakage anyway, so I'm ok with that too.

Incidentally the accuracy of both tests would improve if I were to more accurately determine the source voltage at the start. This appeared to float around a little so maybe some more work on that is warranted at some stage, but right now I think it does the job reasonably well?

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sun Jan 12, 2020 3:33 am

Luke,
Please ignore my comments above. I confused the secondary resistance and the capacitor leakage resistance. I don't recall anyone having a concern with leakage resistance in the past. It took me a little while to understand how you were calculating the leakage resistance. I still don't have a 100% grasp on understanding the "leak" equation. I plan to do some testing in the future and see if the blue spark is greater with higher leakage current.

ACS712 & L298N- In the last few days I received ACS712 current chip and the L298N motor driver. So I was finally able to test your code to determine the standard deviation. (Prior to this I was using the MCCT and with the bounce on the switch it was not reliable.) I did use the the 20 amp current chip and changed the calculation from divide by 66 to divide by 100. I believe that the ACS712 is the way to go and we should not plan on using that CT in the future. I was not pleased with the ramp I received with the L298N chip. It became clear that the current was limiting (rounding off) and giving a waveform like Chris has above (see Jan 2nd). I connected two inputs/outputs in parallel on the driver chip got a sharper ramp as I desired (similar to Mike's post on Dec 21st). Eventually we may want to use a different driver, but I am really pleased with the results when I connect to outputs in parrallel for now.

RFI- When I do the multi test I loose USB connection with the PC sometimes. I think that noise interferes with the USB chip. It is likely that if I were able to clean up my wiring things would improve. At this point I am not too concerned because the micro-controller seems to keep running just fine. It is just an issue for me displaying stuff on the serial monitor on the PC.

LCD- I see that you are using the I2C to control the LCD. I wanted to confirm that you are connecting SDA to A4 and SCL to A5.

fritzing- I was looking at some youtube videos related to Arduino and came across some software called "fritzing". It allows you to make schematics, pictural diagrams and layout PCBs especially for Arduinos. It cost me around $8 to download. When we have a more finalized design I can draw up something. Here is an screen shot of the example LCD program (this is not I2C, so it is likely different than the wiring that you are using).
fritzing screenshot.JPG

PCBs- Recently I found jlcpcb.com can make some very cheap PCB's. They have a special of $2 for small boards. I used them a couple weeks back. I had 10 2x2" boards made and it costed $18 including shipping and I had them in 1 week shipped from China. Additionally they can add SMT components for a fee. I was thinking as we settle on hardware this may be a way to go vs. multiple modules.

Matt


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Sun Jan 12, 2020 6:06 am

Matt,

Thanks for the explanation, certainly it confused me :-)

I felt it useful to to do a resistance test because I thought there could be a fault from leakage across the old coil box, or a leaky cap that might otherwise test ok.

In order to grasp how it works just consider the cap as a resistor (leak) and what you'll get is a simple resistive divider with the A1 pin of the Arduino measuring the result. Ordinarily I'd expect the 'ground resistor' (cap) to be infinite, so [once the cap is fully charged] it should present the full source voltage to A1. I hope that makes sense?

Yes I think you need to parallel the L298 outputs, you'll see I'm using a BTS7960 now... sorry, that's one of the things about public prototyping!

Likewise with the ACS712, I now believe it works better than the CT in this environment. With the latter I've had a few odd traces where I suspect there was no change in current so the output dropped to nil, even though there was current still being drawn (i.e. when the current draw was effectively DC). It's also much easier to calibrate than the CT since it has a standard known output.

I've passed my USB cable a couple of turns around a toroid, this reduces the connection issues you've noticed. If you use the unit completely standalone with the LCD it continues to run happily regardless of what's going on at the USB input. I expect that shortening the cable runs and boxing the unit would assist further, along with a little decoupling if needed.

Yes it's an i2C LCD (less wiring needed!), and you have the correct pin connections.

It would be nice to produce some wiring instructions and perhaps a PCB once the prototyping is finished. Martynn has kindly offered to draw some of this up but while we're changing things around that fritzing software you have looks useful.

As for a PCB I think if you were going down that track it may be best to solder on a simple FET with some flyback diodes etc for the switching? It would reduce the bulk somewhat, and maybe make the switching easier. Anyway that'd be a good project for you perhaps? Certainly I'm not big on PCB design these days and I've more than enough other things to do now!

Unfortunately I've still no steer as to whether shorted turns are a common thing with these coils or not? I'd hoped we may have had some responses, but perhaps no-one has come across the issue before, or has dismissed the coil as faulty for some other reason. Based on my earlier experience with LOPT's, and the issues that Chris' coil exhibited, I'd have thought it wouldn't be unheard of so I've been mulling over my ideas around a testing regime for this.

Once again it's less how to write the code or utilise the hardware so much as keeping the connections as simple as possible that's been the issue. I hope to have decided that in the next day or so. There are several ways to do it, none are inherently 'wrong', but I like to think of any possible impact a little further down the track before settling on things.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 15, 2020 4:56 am

A brief update.

I made up a quick shorted turns tester. I was happy with the theory and it worked well enough in terms of what I'd expect, but in testing the Model T coils I wasn't sure it was reporting quite what I'd want (if it were faulty).

Chris has been kind enough to lend me the coil that was giving trouble and which originally led to this question. Hopefully I'll have some time to investigate further in the weekend and see how it checks out. With luck that will lead to a conclusion.

There was also another interesting development with some other coils that we tested. I won't report on this right now because there is an issue around these that needs to be resolved, but suffice it to say the tester was able to identify some specific problems that the HCCT couldn't. This isn't to put the HCCT down, it's just a function of the different and additional capability of this device.

Of course I've now been apprised of a further possible test function that could be useful, but perhaps I should stop for the moment :geek:

User avatar

JohnH
Posts: 85
Joined: Sun Jan 06, 2019 6:57 pm
First Name: John
Last Name: Hunter
Location: Blue Mountains, Australia
Board Member Since: 2002
Contact:

Re: A new DIY electronic coil tester.

Post by JohnH » Wed Jan 15, 2020 6:59 am

On the subject of shorted turns, I can't recall encountering any coils that I've restored with the problem. I use the Q function of an inductance meter to test for it. So far, the only winding fault has been the occasional open circuit secondary.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 15, 2020 4:05 pm

Thanks John, I appreciate the input as I'm flying blind a little on some of this. Fundamentals are all very well but there's nothing like experience in the field!

Given what you say, and if it turns out to be a non-event (as it now seems likely to be) I may well leave the shorted turns function out, it will only complicate things.

I'd thought about including a simple inductance measure too but I'm inclined to the view that by the time people get around to wanting to know this sort of thing then they'll probably have (or can get) an inductance meter already. Have you found it to be of much practical use?

User avatar

JohnH
Posts: 85
Joined: Sun Jan 06, 2019 6:57 pm
First Name: John
Last Name: Hunter
Location: Blue Mountains, Australia
Board Member Since: 2002
Contact:

Re: A new DIY electronic coil tester.

Post by JohnH » Wed Jan 15, 2020 8:22 pm

Luke, just to give you an idea of what to expect with inductance and Q measurements, my "test"coil secondary measures 8.4 Henries with a Q of 7.66. When the primary is shorted to simulate shorted turns, the inductance drops to 1.1H and Q is now 1.6.
I have to say it's a long time since I've bothered to test for shorted turns. If the coil performs correctly in terms of adjusting to the correct dwell time and current, and produces a normal spark, I find that to be reliable enough.
Somewhere I have a tester for TV line output transformers (an EA project from the early 70's); I must see how it performs with a Ford coil.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Wed Jan 15, 2020 9:09 pm

Luke thanks for the update! John, I appreciate your insight!

Here are my thoughts:
  • Inductance tester - I use the Model T to teach basic mechanic/electrical systems. The more things I can teach with just a Model T coil the better in my opinion! I look forward to seeing the solutions for both the inductance and Q factor. But in the end I have to agree that a simple ohm reading of a coil would work for most people.
  • Megger - Is anyone using a mega-ohm meter to test coils. This is a common way to test the degrading of the winding (insulation) in electric motors. I would suggest a test between the core and the inductor terminals. I have seen sparks from the core to the points. I have yet to try a megger, but was wonder if that would show a failing coil.
Incidentally, I have two coils that fail the resistance test on the secondary, but produce spark... I assume they have a open and the gap is jumped along with the spark gap...

I wonder if one way to make instructors fail is to run them with a oversize spark gap (i.e. not connected to a spark plug). This would force the coil to find another path to bleed off the spark and burn up the isolation. Just a thought.

Enjoy these posts.

Matt
Last edited by Matt in California on Thu Jan 16, 2020 1:10 am, edited 1 time in total.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 15, 2020 11:55 pm

John,

Thanks for the info. I'd not bothered to check the inductance of the secondary but will check that out with the suspect unit I've presently got.

I would be interested to know what result you get from the LOPT tester. I think I know the one you're talking about, DS or somebody like that did a kitset at one stage?

My reason for this interest is that in testing from the primary (using a similar methodology to most shorted turns testers - simple pulse and measure the resultant ringing) I get a much better shape ring when I short the secondary than if I don't (looking at it on a 'scope). Admittedly it's shorter in terms of time/wavelength, but no less cycles per se - in fact it could even be more. Not quite the anticipated outcome I'd have to say!


Matt,

Although I've got a megger I'm not sure I'd want to put it near the Ford coils? You raise an interesting point which I'll think about further but I'm not entirely sure of the validity of the test, and I suppose in the wrong place it could possibly cause an issue to already elderly insulation? Initially I think a simple multimeter check for leakage between the core and windings might be best.

One could include an inductance test in this tester but, as John rightly comments, if you can adjust a coil to where it needs to be and there's a decent output then is there any advantage in going further? I don't want to over-complicate the tester unnecessarily, hence my call for those with experience to comment on the issues they've found, and if it's a non-issue then we can dispense with that..

I guess what piqued my initial interest was this odd coil we tested a few days ago. As I've now got it and can run further tests I need to check it out to see how its inductance pans out and whether it's significantly different to any other. Even if it proves to be then I think for all the effort it may be better to simply use an external inductance meter for the odd time such tests would be useful.

With regard to the coils you're saying fail the resistance test - in what way? Are the they completely open-cct, or just higher resistance than they should be? Assuming them to be completely open then yes I'd tend to agree with your surmise on a spark jumping the break.

Not completely clear on your comment re making the coils fail, but I should think that running them completely disconnected on the output wouldn't be the best idea around. More so than a megger I'd anticipate this could result in arcing across areas you wouldn't want things to track, however a 1/4" - 3/8" gap in free air should be ok at the output (and is what I use).

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Thu Jan 16, 2020 1:15 am

Luke,
Yes, the coils that I mentioned have secondaries that are completely open. What I am wondering is how that would happen. My best guess would be that they were left completely disconnected. I would image that is worse than shorting the output. I can see your concern with a Megger, but I image this is much harder on the coil.

I believe more important than anything is that those who would choose to make/use this tester is that they would need some help understanding how to adjust the coil to get the desired dwell and current. We would have to work on making it very user friendly to do that.

Matt
Last edited by Matt in California on Thu Jan 16, 2020 1:27 am, edited 1 time in total.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Thu Jan 16, 2020 1:19 am

Yesterday I received this display and stayed up late making my $5 Oscilloscope (for the display only)!
BE853994-2566-49A8-882A-8416E106AC42.jpeg
Here is what I got on my Tektronixs real scope:
E7104F35-CF4B-4F0D-8D98-2596504BB5AC.jpeg
Here is what a good coil looks like on the 128x64 OLED display.
5BEE9BB0-5316-4610-8B80-12F343A265AC.jpeg
Again on a coil that has issues (double spark?):
B40CDC94-5041-487C-9027-B78C648EA0E3.jpeg
You can see it on the cheap display:
B3F38D96-572D-4D95-9F35-DB68126B121F.jpeg
I have some ideas on improvements, but as I said I stayed up to late last night. And even these results are satisfying!

Matt
Last edited by Matt in California on Thu Jan 16, 2020 1:30 am, edited 1 time in total.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Thu Jan 16, 2020 1:30 am

Here is the multi-fire test results:
8386E483-15F1-4447-B4C9-96E647277343.jpeg
Here is when I forced a misfire (just to verify the display):
578D287D-8E27-4160-8B41-ED2BA8A8E51D.jpeg
Enjoy,
Matt


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Thu Jan 16, 2020 3:41 pm

Good job on that display Matt! I'm also pleased to read someone else burns the midnight oil on such projects :-)

I'd got a monochrome version of one of those displays coming from some time ago but they take a while to get here, so it's great that you've done that work. FYI at a later stage I was going to look at using one of the Nextion screens which would give a really nice display and also allow touch screen setting of RPM etc, but that's a way further down the track...

At this stage I need to complete the basic code to a level that I think will produce reasonable and consistent results. It's also been important to get a good feel of the likely coil issues someone would come across, and whether it's worth testing for them. I'm getting a bit closer to that, but each time I think I've resolved that something else crops up, sigh.

However, in order to move things on I think I'll put up the code I have completed in the next day or so. There's a few more refinements to go but I'm reasonably happy that it's now relatively useable. Incidentally I agree with you that some clear detail on the steps needed to complete a test and interpret the results would be good.

Once I post up the latest (now sans the shorted turns and ESR tests) you might want to look at merging your display detail with that, once you're happy with it, and posting that up too?

User avatar

JohnH
Posts: 85
Joined: Sun Jan 06, 2019 6:57 pm
First Name: John
Last Name: Hunter
Location: Blue Mountains, Australia
Board Member Since: 2002
Contact:

Re: A new DIY electronic coil tester.

Post by JohnH » Thu Jan 16, 2020 9:04 pm

Luke,
The LOPT tester unfortunately didn't work as hoped. Ironically, it showed the coil as better with the shorted turns introduced! The principle on which it operates is simply that the coil under test is used to load a self oscillating tuned circuit (operating at the normal line frequency of 15,625Hz). The AC across the tuned circuit is rectified and amplified to drive a meter.
rsz_ea_july72.jpg
So, naturally, if the coil under test has shorted turns it will load down or kill altogether the oscillator. Presumably, as the Ford coil was never meant to be driven with TV line frequency pulses we shouldn't be surprised at the results. Perhaps if the oscillator frequency was reduced it would work.
Modern LOPT testers use a ringing test which would probably work better for this. I do recall there was a later EA article and DSE kit operating on this principle - sometime in the 1990's I think. The one I'm using is from EA July 1972. Might look through my EA's to find it.

Matt,
I'm impressed with your CRO display. You're onto something there - it's perfect for the application. I'm tempted to build one into my existing tester making it a completely self contained instrument. Besides, there's really no need to use a lab quality CRO just to see the current ramp.


Scott_Conger
Posts: 2673
Joined: Sun Jan 06, 2019 11:18 am
First Name: Scott
Last Name: Conger
Location: Clark, WY
Board Member Since: 2005

Re: A new DIY electronic coil tester.

Post by Scott_Conger » Thu Jan 16, 2020 10:21 pm

Matt and Luke

most anyone rebuilding coils and wishing to create high quality, long lasting and reliable coils will periodically run into a situation where using a Megger during the rebuild process is all but mandatory, unless their time has no value and they're happy with a rebuilt coil which will not work. In that case, the rebuilder can dispense with it.
Scott Conger

Full Flow Float Valves - deliver fuel like Henry intended!


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Thu Jan 16, 2020 11:31 pm

John,

Thanks for that - it brings back memories!

Your experience re the coil working better with a shorted output was similar as mine, except I had written some software to utilise the ringing principle similar to what you describe. Oh well!

Yes, that's a good idea of Matt's, the shape of the ramp, and resultant ringing (or double-sparking etc) is useful to see and although our 'scopes are probably all a lot lighter and smaller than they used to be it's good to have everything one needs all in one box.

Scott,

Thanks, I've not needed to use my megger on the coils as yet - what in particular did you use yours to check, and what results did you find?


Scott_Conger
Posts: 2673
Joined: Sun Jan 06, 2019 11:18 am
First Name: Scott
Last Name: Conger
Location: Clark, WY
Board Member Since: 2005

Re: A new DIY electronic coil tester.

Post by Scott_Conger » Thu Jan 16, 2020 11:50 pm

My use of "periodically" was probably ill-advised. "Rare Occasion" would be more apt. Still, it happens. The casual mechanic may never encounter it, but do enough coil repairs, and you will run across it. Between iron core and primary, or between primary and secondary. Ohmeters will not catch this issue, in that insulation breakdown will only occur at high voltage. Breakdown between primary/secondary may manifest itself in erratic sparking during test, and yet operate seemingly OK in the car, but they are not destined for long or reliable service. More often, though, the coil will measure correctly across all windings, buzz merrily, and show no spark whatsoever. This is the most common manifestation. This is generally a carbon track from primary to secondary and will pose an eternal question to the casual mechanic if he does not posess the knowledge or equipment to test. It is typically a fatal flaw and religates the coil to being a tar donor.
Scott Conger

Full Flow Float Valves - deliver fuel like Henry intended!

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Fri Jan 17, 2020 4:32 am

Having successfully restored 100's of Model T coils I can defiantly confirm Scott's findings where a coil has good secondary and primary resistance, perfectly set up new points and cushion spring, correct new capacitor, and cosmetically a good, and even sounds right (yes after restoring so many you actually get an ear for the correct sort of buzz, sad I know!) but there is low (very reduced spark gap) or no output. Its quite infuriating after time spent restoring it only to have to scrap it. I dont have a mega Scott could you advise from your experience what insulation test voltage you use 500v or 1Kv maybe and what sort of resistance measurement would you consider acceptable using a mega? Thanks, John.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sat Jan 18, 2020 6:44 pm

I look forward to hearing experiences of using a Megger on coils. Obviously we want to find bad coils before putting lots of work into them!

I worked on the Oscilloscope a bit. I needed to adjust things, so that I could see issues with bad coils.

Here is a coil with a double spark:
AB1A748A-873E-4323-A9DE-AD47DA6F170F.jpeg
F1773FB1-66A3-4045-BFBF-DD5DE2DFACA0.jpeg
Here is a coil that was not sparking very well. But notice it is obviously getting plenty of current.
EAE102FD-F93D-4B5F-BC64-54F6FBC8C4D5.jpeg
C92EFA20-249F-4A95-ADD8-33E762C8441C.jpeg
The reason it doesn't have a sharp drop on the back side of the ramp is because the points never open.

I am still working on the code, but if anyone is ready for the OLED IIC (I2C) Display code, I can post it here. Just let me know. I am looking into a larger display, but I the touchscreen that I got is not I2C and takes a lot of I/O pins. A larger touchscreen would be nice.

Anyway, I am now ready to try to make a match set of coils. I understand that we want 2ms dwell. But wanted to confirm the operating voltage and the desired current.

Matt

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sun Jan 19, 2020 1:04 am

Someone contacted me regarding wiring up there own. Here are the parts that I am currently using:
  • Solid State Relay- I am using the L298N motor driver with two inputs/outputs connected in parallel. (Luke is using BTS7960.)
  • Current Sensor- I am using the ACS712-20Aamp chip/board.
  • OLED- I am using the0.92 inch 32X128 I2C display. This is a tiny, but powerful display. I would like to find a larger display because I want to make an Oscilloscope for another project, but in reality this tiny display is doing the job and could be idea for making a small coil tester.
  • Microcontroller- I am using a genuine Arduino Uno. I don't see any issue going smaller or using a generic as long as the voltage levels are correct for the peripherals (5 volts in my case).
Picture Schematic-Here is my attempt of making a schematic. I found that the Fritzing software does have a ton of different Arduino add-ons. Not necessarily generic ones, but close enough. In the future it would be nice to make a shield (a board to plug into Arduino) with the push button, solid state relay, current sensor IC and a header for the display. Here is my attempt:
FACT_OLED_bb.jpg
If anyone sees any issues let me know I will fix them and update the picture above. Yes, you will need a battery larger than a 9 volt battery :roll:

I hope that this helps anyone attempting to build one of these. Obviously these are still in development, but I imagine more than one person who is lurking on the forum is attempting to get in the action.

Matt

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Sun Jan 19, 2020 6:16 am

Matt, nice job indeed. That oled screen form factor looks more like 128x64 rather than 128x32? If so I have one in my junk box so would be interesting to have a play if you are prepared to share your code? I have Lukes 1602 screen and his code here running at the moment, works well. Thanks John


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Sun Jan 19, 2020 7:01 am

Matt & John,

I use a Nano, it's a bit cheaper/smaller than the Uno, and you can solder directly to it if you want. It has the regulator just like an Uno so you can run it on 12V. Just commenting here - there's nothing wrong with the Uno!

With the diagram just bear in mind there's another switch to go in when I have a moment to review the code and post it. This to switch in the capacitor/leakage test. Sorry I've not got to that yet but as it's past 0100 here I'm not going to do that now!

I do intend trying a Nextion screen when one arrives for a different job. These are connected via serial and should allow some control back to the tester, as well as provide a reasonable display (they're available in several sizes). Downside is that they only have M$ based software to lay them out :x

So for me at least there's still some prototyping going on. While I think the code is working reasonably well - and it's pleasing to hear that from John too, thanks - I'd suggest if you wanted to make a board up it might be useful to hold off in case there are any more changes'/additions that come along. I should add that, in addition to the cap test, I include a source volt meter in this later code because it's important to know the supply voltage for the absolute timing value.

User avatar

AdminJeff
Posts: 724
Joined: Wed Jan 16, 2019 6:32 pm
First Name: Jeff
Last Name: Stevenson
Location: CA
MTFCA Number: 50006
Board Member Since: 2017

Re: A new DIY electronic coil tester.

Post by AdminJeff » Sun Jan 19, 2020 10:11 am

PCBs- Recently I found jlcpcb.com can make some very cheap PCB's. They have a special of $2 for small boards. I used them a couple weeks back. I had 10 2x2" boards made and it costed $18 including shipping and I had them in 1 week shipped from China. Additionally they can add SMT components for a fee. I was thinking as we settle on hardware this may be a way to go vs. multiple modules.
Matt
I'm really enjoying the progression of this thread. If only Henry Ford could see what the passage of 100+ years has done to test his some of his components!

I love the pc board source. $2. That's just Insane. I see new ESP8266 boards for my automated chicken coop in my future! I have such fond memories of creating masks and photo sensitive trace solution and caustic pc board etching. I ruined several of my moms pots as a kid heating it on the stove to speed up the etching process. Holy crap, it's true, I really am getting old!

AdminJeff
Assistant to the Grand Poobah MTFCA Site Admin
1921 Touring

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sun Jan 19, 2020 10:49 pm

John,
I bought the display as a 0.96" 128x64, but even if you look at the pictures I think you can count and see it looks like a 128x32. (My understanding is these 0.96" come in both sizes.) I also switched to SCREEN_HEIGHT 64 and nothing displayed) Perhaps I made a mistake, either way please let me know your results either way.

Here is the code that I have:

Code: Select all

/* The Ford Arduino Coil Tester ('FACT'), a prog to test Model T 'buzz coils'
 *  
 * Released under the GNU General Public Licence (https://www.gnu.org/licenses/gpl-3.0.html)
 *
 * -----------------------------------------------------------------------------
 *
 * Version 0.7 written by Luke P and Robert R, Christchurch, New Zealand, 17th December 2019.
 * 
 *  (1) turn on Model T coil for [interval] milliseconds (typically 4-5 msec)
 *  (2) measure the current max value 
 *  (3) measure time from 0 to max val (rise/ramp time)
 *  (4) measure time from max val to min val (decay time) 
 *  (5) calc and present results via USB serial
 *  
 * Makes use of fast ADC read (set presecale to 16, giving read times of ~ 24 us)
 * Leading on from initial proof of concept to usable code
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.8 (Luke P), 28th Dec 2019
 * 
 * Collect data much as for 0.7, tidy code, sep into functions for: 
 *   (a) Multi-firing of coil as if running in vehicle at specific RPM
 *       This in order to check consistency between firings and present results
 *   (b) Single fire as before (and present results)
 *   
 * Utilise switch press longevity for multi-fire or single-fire tests
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.81 (Luke P), 29th Dec 2019
 * 
 * Bugfix - need to reset results array at start of multi-test otherwise it only outputted every 2nd trial
 * Alter calculation of rpmdelay to incorporate interval time at start
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.88 (Luke P), 29th Dec 2019
 * 
 * Calculate some stats on results (incl affect on degrees of rotation) and display
 * Bugfix where using rpmdelay to calc degree variation (should be rpm)
 * Intro discard variable to discard first few results from multi-fire test that are often higher
 * than following results. Prob due to coil 'warming up from rest' these could skew stat calcs
 * 
 * -----------------------------------------------------------------------------
 *  
 *  Version 0.89 (Luke P), 30th Dec 2019
 *  
 *  Ability to use CT or ACS712 for current reading
 *  Some changes to stats calcs / display
 * 
 *   -----------------------------------------------------------------------------
 *  
 *  Version 0.89.1 (Luke P), 2 Jan 2020
 * 
 * Bugfix - multiple 60000/rpm by 2 for rpm delay, not divide!
 * 
 *  -----------------------------------------------------------------------------
 * 
 * Version 0.9 (Luke P), 2 Jan 2020
 * 
 * Include LCD setup and output data to LCD
 * This uses a lot more memory so begin on some code optimisation to reduce
 * Set missfire variable
 * RPM to global and std at 900RPM
 * 
 * -----------------------------------------------------------------------------
 *  
 * Version 0.9.1 (Luke P), 3 Jan 2020
 * 
 * Bugfixes incl testnum after multi-fire, memory optimisation contd
 * 
  * -----------------------------------------------------------------------------
 * Version 0.9.1 (Matt), 14 Jan 2020
 * 
 * Added OLED
 * 
 * 
  Arduino   device
  Ground    OLED ground
  +5VDC     Vcc
  A0    input for data read from curren sensor (5 VDC limit)
  A1    
  A2
  A3
  A4    SDA (if no SDA pin)
  A5    SCL (if not SCL pin)
  1
  2
  3
  4
  5
  6     Output to Solid State Switch (MOSFET)
  7
  8     Pushbutton (other side connected to GND
  9     
  10
  11
  12
  13
 * 
 */

#define ver 0.91
  
// Include any required libraries

//#include <LiquidCrystal_I2C.h> // presently utilising the library from https://github.com/johnrickman/LiquidCrystal_I2C
#include <Adafruit_SSD1306.h>
#define OLED_RESET    4
#define SCREEN_WIDTH 128 //OLED Width
#define SCREEN_HEIGHT 32 //OLED Height
Adafruit_SSD1306 display(SCREEN_WIDTH,SCREEN_HEIGHT, &Wire, OLED_RESET);

// Set global variables etc
  
 unsigned long time_now = 0;  // use long in case micros count gets big
 unsigned int interval = 4000;           // interval at which to turn on (microseconds)
 const byte outPin = 6;  //output pin to ss relay for coil
 const byte swPin = 8; //input pin for switch, normally high 
 byte testnum = 0; // use byte for mem reduce, assume testnum < 255
 long mVolts = 0.0;
 float amps = 0.0;

//Initialise the LCD
//LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // set the address, columns and line

//set variables for collect_data function array 

 const byte numReadings = 150; //max number of values in array, 150 = approx 3ms
 const byte numTests = 50; //number of test cycles in multi test
 unsigned int analogVals[numReadings][2]; // array name & columns
 unsigned int x = 0; // initialise array input

//set variables for multi_test function array 

 unsigned int resultVals[numTests][2]; // array name
 unsigned int y = 0; // initialise array input

// set desired 'rpm' for multitest - facsimile of single coil running at this speed
 int rpm = 900; 
 //int rpm = 1500;

//setup for fast ADC read

 #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
 #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

//setup for switch reading
 
 const unsigned long short_in = 60;
 const unsigned long  long_in = 600;
 unsigned long swTimer=0;
 boolean swPrevState = HIGH;
 boolean swPresentState;

//begin setup for prog proper
  
void setup() 
   {
    pinMode(swPin, INPUT_PULLUP); // set the switch pin as input and apply resistor to +5
    pinMode(outPin, OUTPUT);// define output pin
    sbi(ADCSRA, ADPS2); //more stuff for fast ADC read
    cbi(ADCSRA, ADPS1);
    cbi(ADCSRA, ADPS0);
    Serial.begin(115200); // open the serial port 
    /*lcd.init(); // setup the LCD for printing
    lcd.backlight(); // turn on LCD backlight
    lcd.print (F("FACT v")); // initial text on lcd display at startup
    lcd.print (ver); // prints version number from define
    lcd.print (F(" LP_20")); // build number
    lcd.setCursor (0,1);
    lcd.print (F("Ready to test?"));
    lcd.blink();
    */
    //Serial.begin(9600);
    
    display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
    
    display.clearDisplay();
    display.setTextSize(1);             // Normal 1:1 pixel scale
    display.setTextColor(WHITE, BLACK);        // Draw white text
    display.setCursor(0,0);             // Start at top-left corner
    display.println(F("Ford Arduino Coil Tst"));
    display.setTextSize(2);             // Draw 2X-scale text
    //display.setTextColor(SSD1306_WHITE, SSD1306_BLACK);
    display.print(F("FACT v")); display.println (ver);
    display.setTextSize(1);             // Normal 1:1 pixel scale
    display.println(F(".96 OLED OSCILLOSCOPE"));
    display.display();
   }

// --- Function to switch coil on for [interval], collect current values over time, analyse and output test number, max current, time to decay ---//

//void collect_data(int *maxv, int *ttf)
void collect_data(int *maxv, int *ttf, int *test) //function to toggle coil on, read and put resultant data into array, calculate various values and return as pointers to call
   // see https://stackoverflow.com/questions/2620146/how-do-i-return-multiple-values-from-a-function-in-c for returning multiple values from function (I'm using pointers)
   {
    analogRead(A0); // perform a read to clear register
    digitalWrite(outPin, HIGH); //set pin outPin high to power coil for time interval
    time_now = micros();
    x=0;  // reset array
    testnum = testnum + 1;
    while(micros() < time_now + interval)
       {
        if (x < numReadings) 
          {
           analogVals[x][0] = analogRead(A0); // read pin 0 volts (which is actually current from CT) and input value to array col 1
           analogVals[x][1] = (micros() - time_now); // time since start of loop (thus sample time), input to array col 2
           x++; //increment array
           analogVals[x][0] = (analogVals[x][0]+analogRead(A0))/2; // read pin 0 volts (which is actually current from CT) and input value to array col 1
          
          }  
            
        }
    digitalWrite(outPin, LOW); // reset outPin to low and turn off power to coil
//begin data analysis
    int maxval = 0; // use float to get decimal places but int uses less mem
    long sum = 0;
    int val = 0;
    int prev_val = 0;
    int initialdecaytime = 0;
    int completedecaytime = 0;
    int maxI = 0;
   
//    delay(10);

    for(int i = 0; i < numReadings; i++)
      { 
       prev_val = val;
       val = analogVals[i][0];
       sum += val;
        
//     if ((val > maxval) && (initialdecaytime == 0)) //detect current increasing and write to 'maxval'
       if (val > maxval) //detect current increasing and write to 'maxval'
         {
          maxval = val; 
         }
// uncomment for ACS712   
       if ((val > 520) && (val < maxval) && (initialdecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime' ACS712
// uncomment for CT
//       if ((val > 100) && (val < maxval) && (initialdecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime' CT
//      if ((prev_val = maxval) && (val < prev_val) && (completedecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime'
         {
          initialdecaytime = analogVals[i][1];
         }   
// uncomment for ACS712         
        if ((initialdecaytime != 0) && (completedecaytime == 0) && (val <= 511))  //get total time from initialise to complete decay to zero ACS712
// uncomment for CT
//        if ((initialdecaytime != 0) && (completedecaytime == 0) && (val <= 0))  //get total time from initialise to complete decay to zero CT
         {
          completedecaytime = analogVals[i][1];
          maxI = i;
         }
 //Debug stuff       
 /*     Serial.print(analogVals[i][0]); // adc value
      Serial.print(" -- ");
      Serial.print(analogVals[i][1]); // time in micros
      Serial.print(" .. ");
      if (i != 0) Serial.print(analogVals[i][1]-analogVals[i-1][1]); // how long did each read take (in micros)
      Serial.println();
 */
      }
/* More debug
    Serial.print ("Maximum current = ");
    Serial.print (long(maxval) * 120.5);
    Serial.println ("mA");   
    Serial.print ("Decay time = ");
    Serial.print (completedecaytime);
    Serial.println ("usec");   
    Serial.println();
*/
    *ttf = completedecaytime;
    *maxv = maxval;
    *test = testnum;
   }
   
//--- Function to do a single fire test on a coil ---//

void single_test()
   {
    int maxv, ttf, test; // declare variables to use
    mVolts = 0.0;
    collect_data(&maxv, &ttf, &test);  // get data from collect_data function
    //collect_data(&maxv, &ttf);
    // uncomment two lines for ACS712
    mVolts = (maxv / 1024.0) * 5000.0; // raw analog read val to millvolts
    amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range
    //amps = ((mVolts - 2500.0)/185.0); // millivolts to amps (utilise scale factor for ACS sensor range 5A chip
    amps = ((mVolts - 2500.0)/100.0); // millivolts to amps (utilise scale factor for ACS sensor range 20A chip
    //amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range 30A chip

    
    // uncomment for CT    
    // amps = (maxv * .0222); // millivolts to amps (utilise scale factor for CT
    
    // write results to serial port
    for (x = 1; x <= 127; x++) {
        Serial.println (analogVals[x-1][0]);
    }
    Serial.print (F("*** Test number "));
    Serial.print (test);
    Serial.println (F(" ***"));
    Serial.print (F("Total cycle time (to fire) = "));
    Serial.print (float(ttf)/1000.00); // convert to ms
    Serial.println (F("msec"));
    // DEBUG    Serial.println (maxv);
    // DEBUG    Serial.println (mVolts);  
    Serial.print (F("Maximum current = "));
    Serial.print (amps); 
    Serial.println (F("A")); 
    Serial.println();
    // write results to LCD
    //lcd.clear();
    //lcd.setCursor (0,0); //set cursor first col, first row
    //lcd.print (F("Single test #"));
    //lcd.print (test);
    //lcd.setCursor (0,1); //set cursor first col, second row
    //lcd.print (F("TTF="));
    //lcd.print (float(ttf)/1000.00); // convert to ms
    //lcd.print (F("ms"));
    //lcd.print(F(" "));
    //lcd.print (amps);
    //lcd.print(F("A"));
    /*
    display.clearDisplay();
    display.setTextSize(1);
    display.setCursor(0, 0);
    display.print("Single test #");
    display.println(test);    
    display.print("TTF = ");
    display.print(float(ttf)/1000.00);   
    display.println("ms");  
    display.print(F("Max current = "));
    display.print(amps);   
    display.println(F("A"));  
    display.display();// now that the display buffer is built, display it*/
//analogVals[x][0] = analogRead(A0);
    //Start of O-Scope
    //for (x = 10; x <= 127; x++) {
    //  data[x] = (analogRead(READ_PIN) / 21.7659);
    //}
    
    display.clearDisplay(); 
    for (x = 1; x <= 112; x++) {

       // digital value of max current in =660; 5= digital values of current range/#lines = 150/32 = 4.68
       display.drawLine(x+10 , ((660-analogVals[x-1][0]))/4.68, x+10 , (660-(analogVals[x][0]))/4.68, WHITE);

    }
    // draw the axis, lables and tick marks
    for (int y = 0; y < 5; y++) {
      display.drawFastHLine(7, y * (32) / 7 + 9, 3, WHITE);
    }
    for (int x = 0; x < 6; x++) {
      display.drawFastVLine(x*23+10, 29, 3, WHITE);
    }
    display.setTextColor(WHITE, BLACK);
    display.setTextSize(1);
    display.setCursor(0, 24);
    display.println("0");
    display.setCursor(0, 8);
    display.println("5");

    //Yellow text at top
    //display.fillRect(0, 0,  127 , 14, WHITE);
    display.setTextColor(WHITE, BLACK);
    display.drawFastHLine(10, 31,  128 - 10, WHITE);
    display.drawFastVLine(10, 8,  32, WHITE);
    display.setTextSize(1);
    display.setCursor(0, 0);
    display.print("TTF=");
    display.print(float(ttf)/1000.00);   
    display.print("ms ");  
    display.print(F("Imax="));
    display.print(amps);   
    display.println(F("A"));  
    display.display();
   }

//--- Function to do a multi-fire test on a coil as if running in vehicle ---//

void multi_test()  
   {
    // do some calcs on rpm as needed for delay (four-stroke, so single cyl ign fires every second cycle therefore div 2)
    byte rpmdelay = ((60000 / rpm)*2) - (interval/1000);  // attempts to roughly account for time in data_collect process ('interval') - byte means not much slower than 500RPM

    y=0;  // reset array
    
    // begin proper
    
    for(byte i = 0; i < numTests; i++)  // number of test firings
      {
       int maxv, ttf, test; // declare variables to use
       collect_data(&maxv, &ttf, &test);  // get data from collect_data function
       //collect_data(&maxv, &ttf); 
       resultVals[y][0] = (ttf); //1st col of result array gets ttf
       resultVals[y][1] = (maxv); // 2nd col of result array gets max current
       y++; //increment array           
       
/* use for debugging output from collect_data function
 *

    Serial.print ("*** Test number ");
    Serial.print (test);
    Serial.println (" ***");
    Serial.print ("2Maximum current = ");
    Serial.print (long(maxv) * 120.5);
    Serial.println ("mA");   
    Serial.print ("2Decay time = ");
    Serial.print (ttf);
    Serial.println ("usec");   
    Serial.println();
 *
 */    
       delay(rpmdelay); // sets 'rpm' delay between each test firing, 
      }
      
   testnum = 0;
   float results_sum = 0;
   float results_std_dev = 0;
   float msec_ttf = 0;
   float results_mean = 0;
   float results_var = 0; 
   float results_max = 0;
   float results_min = 10;
   boolean miss = 0;
   byte discard = 2; // first few results from multi-test show higher ttf than normal, discard to give more accurate result
   for(byte i = discard; i < numTests; i++) // get results from each test and print to serial
      { 
       testnum = (testnum + 1);
       Serial.print (F("*** Test number "));
       Serial.print (testnum);
       Serial.println (F(" ***"));
       Serial.print (F("Total cycle time (to fire) = "));
//       Serial.print (float((resultVals[i][0])/1000.00)); // convert to ms
       msec_ttf = ((resultVals[i][0])/1000.00); // convert to ms
       results_sum += msec_ttf;
       if (msec_ttf > results_max)
          {
           results_max = msec_ttf;
          }
       if (msec_ttf < results_min)
          {
           results_min = msec_ttf;
          }
       Serial.print (msec_ttf);
       Serial.println (F("msec"));
// uncomment two lines for ACS712
       mVolts = ((resultVals[i][1]) / 1024.0) * 5000.0; // raw analog read val to millvolts
       //amps = ((mVolts - 2500.0)/185.0); // millivolts to amps (utilise scale factor for ACS sensor range 5A chip
       amps = ((mVolts - 2500.0)/100.0); // millivolts to amps (utilise scale factor for ACS sensor range 20A chip
       //amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range 30A chip

       
// uncomment for CT
//       amps = (long(resultVals[i][1]) * 0.02222); 
       //Serial.print (F("Maximum voltage (mV) = "));
       //Serial.println (mVolts);  
       Serial.print (F("Maximum current = "));
       Serial.print (amps);
       Serial.println (F("A")); 
      }
    results_mean = (results_sum / (numTests - discard)); //get mean of array results for ttf ***using testnum cost of discard
    for(byte i = 2; i < numTests; i++)
       {
        //results_var += pow(results_mean - (float((resultVals[i][0])/1000.00)), 2); // get variance
        results_var += pow(results_mean - (((resultVals[i][0])/1000.00)), 2); // get variance
        results_std_dev = sqrt(results_var/(numTests - discard)); // get std deviation ***using testnum cost of discard instead numTests
        if (results_min ==0)  // if we have a 0 for ttf it suggests firing issues
        {
         miss = 1;
        }
       }
       
    Serial.println ();
    Serial.print (F("Mean time to fire = "));
    Serial.print (results_mean);
    Serial.println (F("mSec"));
    Serial.print (F("Standard deviation = "));
    Serial.print (results_std_dev);
    Serial.println (F("mSec")); 
    Serial.print (F("Results Max = "));
    Serial.print (results_max);
    Serial.println (F("mSec")); 
    Serial.print (F("Results Min = "));
    Serial.print (results_min);
    Serial.print (F("mSec")); 
    if (miss)
    {
     Serial.println (F(" *** MISFIRE ***")); 
    }
    else 
    {
     Serial.println();
    }
    // DEBUG    Serial.println (maxv);
    // DEBUG    Serial.println (mVolts);  
    Serial.print (F("Range = "));
    Serial.print (results_max - results_min);
    Serial.println (F("mSec"));     
    Serial.print (F("Degrees of variation at "));
    Serial.print (rpm);  
    Serial.print (F(" RPM = "));  
    Serial.print ((results_max - results_min)/(float(60000 / rpm)/360));
    Serial.println (F(" degree(s)")); 
    Serial.println(F("A"));    
    Serial.print (F("Maximum current = "));
    Serial.print (amps); 
    Serial.println();    
    // LCD print
    //lcd.clear();
    //lcd.setCursor (0,0); //set cursor first col, first row
    //lcd.print (F("M="));
    //lcd.print (results_mean);
    //lcd.print(F("ms"));
    //lcd.setCursor (9,0); //set cursor 9th col, first row
    //lcd.print (F("SD="));
    //lcd.print (results_std_dev);
    //lcd.setCursor (0,1); //set cursor first col, second row

    display.clearDisplay();
    display.setCursor(0, 0);
    display.print(F("M="));
    display.print(results_mean);
    display.print(F("ms  ("));
    display.print(results_min);
    display.print(F("-"));
    display.print(results_max);
    display.println(F(")"));
    display.setCursor(0, 8);
    display.print(F("SD="));
    display.print(results_std_dev);
    display.print(F("; Dwell ="));
    display.print((results_max - results_min)/(float(60000 / rpm)/360));
    display.println((char)167); // let's print the degree symbol!
    display.setCursor(0, 16);
    display.print(F("Max Current ="));
    display.print(amps);
    display.println(F("amps"));
        
    if (miss)
       {
        //lcd.print(F("***MISFIRE***"));
        display.setCursor(0, 24);
        display.println(F("***MISFIRE***"));
       }
    else
       {   
        //lcd.print(results_min);
        //lcd.print(F("-"));
        //lcd.print(results_max);
        //lcd.print(F("  "));
        //lcd.print ((results_max - results_min)/(float(60000 / rpm)/360));
        //lcd.print ((char)223); // let's print the degree symbol!
        //lcd.print(F(" "));
        //lcd.print (amps);
        //lcd.print(F("A")); 
       }
     display.display();// now that the display buffer is built, display it
     testnum = 0;  
   }


//--- Main loop, detect short press of switch to call single fire, long press to call multi-fire ---//

void loop() 
   {
    swPresentState = digitalRead(swPin); // what's the switch doing
    if (swPresentState != swPrevState) // if not same as prev then...
      {
       delay(20); //debounce delay
       swPresentState = digitalRead(swPin); // check again after debounce delay to be sure
       if (swPresentState == LOW) // if switch is still on then it's real
          {
           swTimer = millis(); // set timer from on
          }
       if (swPresentState == HIGH) // sw not on now
         {
          unsigned long currentMillis = millis();
          //if ((currentMillis - swTimer >= 60) && !(currentMillis - swTimer >= 600)) // sw short press
          if ((currentMillis - swTimer >= short_in) && !(currentMillis - swTimer >= long_in)) // sw short press
            {        
             Serial.println (F("- Single shot test -"));
             //lcd.clear();
             //lcd.print(F("Single shot test")); // use F() macro to reduce memory use
             //testnum = (testnum + 1);
             single_test();
            }
          if ((currentMillis - swTimer >= long_in)) // sw long press
            {
          // the long press was detected
             Serial.println ();
             Serial.println (F("- Multi-fire test -"));
             Serial.println ();
             //lcd.clear();
             //lcd.print(rpm);
             //lcd.print(F("RPM multifire"));
             //lcd.setCursor (0,1);
             //lcd.print(F("test in progress"));

             display.clearDisplay();
             display.setTextColor(WHITE, BLACK);
             display.setTextSize(1);
             display.setCursor(0,0);
             display.print(rpm);
             display.println(F("RPM multifire"));
             display.setCursor(0,8);
             display.println(F("test in progress"));
             display.display();// now that the display buffer is built, display it

             multi_test();
             
            }
         }
        swPrevState = swPresentState; // has state changed?
      } 

   }    
   
You will see for the most part I just commented out the code that Luke make and put my own in.

Luke, The Nextion display looks great! Please enlighten me on what is needed to develop code for that. I would like to find something a bit cheaper, but something like these would defiantly make an amazing display. I posted with the Uno because that is what I am using, but I agree there really is no major difference. Could you please send me the info on the wiring changes? I can just update the drawing above. (BTW I am using pin 6 because I burned out pin four on my module.

Jeff, I agree that $2 for a pcb is amazing and I appreciate your experiences in the past, I can relate. My brother-in-law shared with me a story of how he used the mask upside down, and he really needed to complete a board so he bent all the IC pens upside down on each chip...

As the design seems to solidify I look forward to making the "shield" board.

Matt

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Mon Jan 20, 2020 3:46 am

Thanks for that Matt I will have a play with that later and let you know how I get on. I agree on the Lukes suggestion of the Nextion screen that looks really good indeed and may be worth considering once the software is finalised.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Version update, responses

Post by Luke » Mon Jan 20, 2020 4:48 am

Jeff,

My memories of etching PCB's are less 'fond' than yours methinks! I seem to recall adding acid to the solution to speed things up (and heating it) :shock: but the bit I really didn't like was drilling all the holes, now that was particularly painful.

I too have wondered what Henry would think. Sometimes I feel that as a consummate innovator and experimenter he would approve, but at other times I recollect he really didn't like anyone messing with his beloved T - so I've never reached a conclusion :|


Matt,

We might need to sort out a contributing arrangement so things don't get out of kilter?

With the OLED/LCD display etc it may also be a good idea to initially #define the display perhaps, that way it'd be easier for anyone who wants to replicate the project and wishes to use a 16x2 or 20x4 LCD, or Xx128 OLED display (or whatever else). What do you think?

Just for the moment I'll keep to my versioning with this next piece of fundamental code as I'd already mostly completed it before your contribution arrived. You can then intro your contribution to it as you see best, and we'll work out what to do for the future in email.

When my other displays arrive (unfortunately they'll take several weeks to get here) I'll put up whatever comes out of the Nextion work. You are right of course that they're more costly, thereby messing up my original claim on the cost of this little tester, but I suppose we could just call that version 2 or something ;)


Version 0.95


This version introduces testing for capacitor value and leakage of the cap or across the box. This is a useful check to run through before first testing a coil as it will determine whether it's worth going further and/or it may confirm certain characteristics of the firing test (excessive sparking at the points etc).

The tester will also display the test voltage in use when first turned on. Given some of the things we've discovered I think it may be worthwhile for some to test their coils at different voltages, but more importantly this allows flexible adjustment of a target TTF based on the input voltage.

Remember that a lower voltage returns a longer TTF, and if we assume it's a reasonably linear relationship it should be a simple thing to automatically calculate and include the target time within the code and display as necessary. This display could take the form of presenting the target time alongside the test time, or internally comparing it with the actual test time and declaring the coil a pass or fail - or some variation on this.

At this point I've shied away from being so definitive but it may be time to consider it now? JohnH, I seem to recall you saying that the optimum time at 12V was 2msec, and at 6V it was something around 3.3msec? Was that dead on 12V (ie. not 13.8 or whatever?), and do you still consider these times to be optimum?

Connecting it up

Here's a quick/rudimentary block diagram of how to connect things up.

I view the tester as still in prototype so this could change somewhat, and whatever screen, switcher, and current sense you use could affect the connections you'll need, however it should be enough to get a keen person underway

Before you power it up I suggest you check for any wiring mistakes (mine included!), there's definately no warranty here!

fact_block_diag_v0.95.png

Some more detail below.

Capacitor test

Cap test is via resistor from D13 to A2, then from A2 to one side of the coil input, the other side to ground. I used a 487k resistor, which is why that value appears in the code, but it could be anything reasonable (100's of k's). You can just change the code to whatever value you wish to use. I happen to have some odd value resistors and this one fitted the bill for this task.

When this test is run the connection to the high-current switching device needs to be cut, and an input on the Arduino grounded to tell it which test is to be conducted. To this end I used a double-throw triple-pole toggle switch that takes the two wires to the coil and connects them either to the two pins above (A2 + GND), or the switching device. It also grounds pin D5, telling the Arduino we're performing a capacitor test.

It's important to get the switching right because otherwise A2 could receive some unwanted inputs well above its capacity!

In order to run the test the toggle switch needs to be in the correct position, and the coil points held open via an insulated device (pen etc, or you could just stick some plastic between the points). Once ready just press the main switch once.

I've previously shown LCD screen shots you'd expect here. There is no change to them.

Voltage test

Voltage test conducted via a resistive divider from +ve & -ve in to pin A7 (A7 being the centre point where the two resistors connect to each other). The higher value resistor goes to +ve, the lower value to -ve. The ratio should be around 3:1 or 4:1, and be in the 10's of k's or more. Again I just happened to use what I had on hand, and you can set the values you're using in the code, as you'll see.

Voltage will be displayed by the initial startup screen. If you change the input supply and want to re-check just reset the Arduino (or if you turned it off to change it will correctly display the new supply voltage).

At some point this will probably update itself as changes occur. Here's a shot of the the present initial screen.

fact_initial_screen_v_0.95.jpg

Operation

As the code is at present the system should continue to work if either, or both, of these new test facilities are not physically connected. IOW if you just upload this code it should work, although the initial screen wouldn't display the correct voltage.

On that, I've not included some of the niceties that one otherwise might if this were for a more wide-ranging test unit. In this case we've got a relatively homogeneous device under test, with an anticipated capacitor value and leakage, time to fire, and current draw, and we use a limited input voltage range. As a result we have expected outcomes within a certain range and anything outside of that can simply be treated as foreign - but at present it may give an 'odd' reading in some cases rather than nicely zero something, or declaring it void.

These things can be addressed as part of a final tidy-up, once the dust has settled on the main function(s) of the tester and it's running more or less as we'd like.

As always please let me know if you run across any bugs, have some useful input on what we might expect from our tests, improvements to contribute etc:

Code: Select all


/* The Ford Arduino Coil Tester ('FACT'), a prog to test Model T 'buzz coils'
 *  
 * Released under the GNU General Public Licence (https://www.gnu.org/licenses/gpl-3.0.html)
 *
 * -----------------------------------------------------------------------------
 *
 * Version 0.7 written by Luke P and Robert R, Christchurch, New Zealand, 17th December 2019.
 * 
 *  (1) turn on Model T coil for [interval] milliseconds (typically 4-5 msec)
 *  (2) measure the current max value 
 *  (3) measure time from 0 to max val (rise/ramp time)
 *  (4) measure time from max val to min val (decay time) 
 *  (5) calc and present results via USB serial
 *  
 * Makes use of fast ADC read (set presecale to 16, giving read times of ~ 24 us)
 * Leading on from initial proof of concept to usable code
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.8 (Luke P), 28th Dec 2019
 * 
 * Collect data much as for 0.7, tidy code, sep into functions for: 
 *   (a) Multi-firing of coil as if running in vehicle at specific RPM
 *       This in order to check consistency between firings and present results
 *   (b) Single fire as before (and present results)
 *   
 * Utilise switch press longevity for multi-fire or single-fire tests
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.81 (Luke P), 29th Dec 2019
 * 
 * Bugfix - need to reset results array at start of multi-test otherwise it only outputted every 2nd trial
 * Alter calculation of rpmdelay to incorporate interval time at start
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.88 (Luke P), 29th Dec 2019
 * 
 * Calculate some stats on results (incl affect on degrees of rotation) and display
 * Bugfix where using rpmdelay to calc degree variation (should be rpm)
 * Intro discard variable to discard first few results from multi-fire test that are often higher
 * than following results. Prob due to coil 'warming up from rest' these could skew stat calcs
 * 
 * -----------------------------------------------------------------------------
 *  
 *  Version 0.89 (Luke P), 30th Dec 2019
 *  
 *  Ability to use CT or ACS712 for current reading
 *  Some changes to stats calcs / display
 * 
 *   -----------------------------------------------------------------------------
 *  
 *  Version 0.89.1 (Luke P), 2 Jan 2020
 * 
 * Bugfix - multiple 60000/rpm by 2 for rpm delay, not divide!
 * 
 *  -----------------------------------------------------------------------------
 * 
 * Version 0.9 (Luke P), 2 Jan 2020
 * 
 * Include LCD setup and output data to LCD
 * This uses a lot more memory so begin on some code optimisation to reduce
 * Set missfire variable
 * RPM to global and std at 900RPM
 * 
 * -----------------------------------------------------------------------------
 *  
 * Version 0.9.1 (Luke P), 3 Jan 2020
 * 
 * Bugfixes incl testnum after multi-fire, memory optimisation contd
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.92 (Luke P), 3 Jan 2020
 * 
 * Include capacitor test and leakage / tracking resistance check
 *  * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.93 (Luke P), 13 Jan 2020
 * 
 * Shorted turns (ringing) test via 0,47uF, reactance test.
 * 
 * -----------------------------------------------------------------------------
 * 
 * Version 0.94 (Luke P), 15 Jan 2020
 * 
 * ESR test for capacitors (check able to deliver requisite current)
 *  
 * -----------------------------------------------------------------------------
 * 
 * Version 0.95 (Luke P), 20 Jan 2020
 * 
 * Remove short/ESR tests as probably unnecessary and complicated
 * Add input voltage reading - eventually use to track & ID correct firing time
 * per given input voltage
 * 
 */

#define ver 0.95 
  
// Include any required libraries

#include <LiquidCrystal_I2C.h> // presently utilising the library from https://github.com/johnrickman/LiquidCrystal_I2C

// Set global variables etc
  
 unsigned long time_now = 0;  // use long in case micros count gets big
 unsigned long time_gone = 0;
 unsigned int interval = 4000;           // interval at which to turn on (microseconds)
 const byte outPin = 7;  //output pin to ss relay for coil
 const byte swPin = 8; //input pin for switch, normally high 
 const byte cap_swPin = 5; // input pin for cap/coil test switch. Low for cap
 const byte cap_chg_pin = 13;
 byte testnum = 0; // use byte for mem reduce, assume testnum < 255
 long mVolts = 0.0;
 float amps = 0.0;
 const int source_volts = 1010; // source voltage for cap test (should check this at start)

//Initialise the LCD

 LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // set the address, columns and line

//set variables for collect_data function array 

 const byte numReadings = 170; //max number of values in array, 150 = approx 3ms
 const byte numTests = 50; //number of test cycles in multi test
 unsigned int analogVals[numReadings][2]; // array name & columns
 unsigned int x = 0; // initialise array input

//set variables for multi_test function array 

 unsigned int resultVals[numTests][2]; // array name
 unsigned int y = 0; // initialise array input

// set desired 'rpm' for multitest - facsimile of single coil running at this speed

 int rpm = 900; 

//setup for fast ADC read

 #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
 #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

//setup for switch reading
 
 const unsigned long short_in = 60;
 const unsigned long  long_in = 600;
 unsigned long swTimer=0;
 boolean swPrevState = HIGH;
 boolean swPresentState;
 boolean cap_swPinState;

 //create the omega symbol to print to LCD
 // ohm sign
  byte omega[8] = 
  {
   B00000,
   B01110,
   B10001,
   B10001,
   B10001,
   B01010,
   B11011,
   B00000
  }; // creating the omega (ohms) symbol, thanks to https://www.hackmeister.dk/2010/08/custom-lcd-characters-with-arduino/

// voltmeter + resistor divider details
  float input_volts = 0.0;
  float interim_val = 0.0;
  float R1 = 32400.0; // resistor to ground
  float R2 = 120000.0; // resistor to input supply

//begin setup for prog proper
  
void setup() 
   {
    pinMode(swPin, INPUT_PULLUP); // set the switch pin as input and apply resistor to +5
    pinMode(outPin, OUTPUT);// define output pin
    pinMode(cap_chg_pin, OUTPUT);// define output pin
    pinMode (cap_swPin, INPUT_PULLUP);
    pinMode(swPin, INPUT_PULLUP);
    sbi(ADCSRA, ADPS2); //more stuff for fast ADC read
    cbi(ADCSRA, ADPS1);
    cbi(ADCSRA, ADPS0);
    Serial.begin(115200); // open the serial port 
    // let's get the input voltage to display
    int a7val = analogRead(A7);
    interim_val = (a7val*5.0)/1024.0;
    input_volts = interim_val / (R1/(R1+R2));
    // begin display detail
    lcd.init(); // setup the LCD for printing
    lcd.backlight(); // turn on LCD backlight
    lcd.print (F("FACT v")); // initial text on lcd display at startup
    lcd.print (ver); // prints version number from define
    lcd.print (F(" LP_20")); // build number
    lcd.setCursor (0,1);
    lcd.print (F("Test @"));
    lcd.print (input_volts,1); // print voltage to 1 decimal place
    lcd.print (F(" volts"));
    lcd.blink();
    lcd.createChar(0, omega);
   }

// --- Function to switch coil on for [interval], collect current values over time, analyse and output test number, max current, time to decay ---//

void collect_data(int *maxv, int *ttf, int *test) //function to toggle coil on, read and put resultant data into array, calculate various values and return as pointers to call
   // see https://stackoverflow.com/questions/2620146/how-do-i-return-multiple-values-from-a-function-in-c for returning multiple values from function (I'm using pointers)
   {
    analogRead(A0); // perform a read to clear register
    digitalWrite(7, HIGH); //set pin 7 high to power coil for time interval
    time_now = micros();
    x=0;  // reset array
    testnum = testnum + 1;
    while(micros() < time_now + interval)
       {
        if (x < numReadings) 
          {
           analogVals[x][0] = analogRead(A0); // read pin 0 volts (which is actually current from CT) and input value to array col 1
           analogVals[x][1] = (micros() - time_now); // time since start of loop (thus sample time), input to array col 2
           x++; //increment array
          }  
            
        }
    digitalWrite(7, LOW); // reset 7 to low and turn off power to coil
//begin data analysis
    int maxval = 0; // use float to get decimal places but int uses less mem
    long sum = 0;
    int val = 0;
    int prev_val = 0;
    int initialdecaytime = 0;
    int completedecaytime = 0;
    int maxI = 0;
   
//    delay(10);

    for(int i = 0; i < numReadings; i++)
      { 
       prev_val = val;
       val = analogVals[i][0];
       sum += val;
        
//     if ((val > maxval) && (initialdecaytime == 0)) //detect current increasing and write to 'maxval'
       if (val > maxval) //detect current increasing and write to 'maxval'
         {
          maxval = val; 
         }
// uncomment for ACS712   
       if ((val > 520) && (val < maxval) && (initialdecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime' ACS712
// uncomment for CT
//       if ((val > 100) && (val < maxval) && (initialdecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime' CT
//      if ((prev_val = maxval) && (val < prev_val) && (completedecaytime == 0)) //detect initial time of current decay and write to 'initialdecaytime'
         {
          initialdecaytime = analogVals[i][1];
         }   
// uncomment for ACS712         
        if ((initialdecaytime != 0) && (completedecaytime == 0) && (val <= 511))  //get total time from initialise to complete decay to zero ACS712
// uncomment for CT
//        if ((initialdecaytime != 0) && (completedecaytime == 0) && (val <= 0))  //get total time from initialise to complete decay to zero CT
         {
          completedecaytime = analogVals[i][1];
          maxI = i;
         }
 //Debug stuff       
 /*     Serial.print(analogVals[i][0]); // adc value
      Serial.print(" -- ");
      Serial.print(analogVals[i][1]); // time in micros
      Serial.print(" .. ");
      if (i != 0) Serial.print(analogVals[i][1]-analogVals[i-1][1]); // how long did each read take (in micros)
      Serial.println();
 */
      }
/* More debug
    Serial.print ("Maximum current = ");
    Serial.print (long(maxval) * 120.5);
    Serial.println ("mA");   
    Serial.print ("Decay time = ");
    Serial.print (completedecaytime);
    Serial.println ("usec");   
    Serial.println();
*/
    *ttf = completedecaytime;
    *maxv = maxval;
    *test = testnum;
   }
   
//--- Function to do a single fire test on a coil ---//

void single_test()
   {
    int maxv, ttf, test; // declare variables to use
    mVolts = 0.0;
    collect_data(&maxv, &ttf, &test);  // get data from collect_data function
    //collect_data(&maxv, &ttf);
    // uncomment two lines for ACS712
    mVolts = (maxv / 1024.0) * 5000.0; // raw analog read val to millvolts
    amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range
    // uncomment for CT    
    // amps = (maxv * .0222); // millivolts to amps (utilise scale factor for CT
    
    // write results to serial port
    Serial.print (F("*** Test number "));
    Serial.print (test);
    Serial.println (F(" ***"));
    Serial.print (F("Total cycle time (to fire) = "));
    Serial.print (float(ttf)/1000.00); // convert to ms
    Serial.println (F("msec"));
    // write results to LCD
    lcd.clear();
    lcd.setCursor (0,0); //set cursor first col, first row
    lcd.print (F("Single test #"));
    lcd.print (test);
    lcd.setCursor (0,1); //set cursor first col, second row
    lcd.print (F("TTF="));
    lcd.print (float(ttf)/1000.00); // convert to ms
    lcd.print (F("ms"));
// DEBUG    Serial.println (maxv);
// DEBUG    Serial.println (mVolts);  
    Serial.print (F("Maximum current = "));
    Serial.print (amps); 
    Serial.println (F("A")); 
    Serial.println();
    lcd.print(F(" "));
    lcd.print (amps);
    lcd.print(F("A"));
   }

//--- Function to do a multi-fire test on a coil as if running in vehicle ---//

void multi_test()  
   {
    // do some calcs on rpm as needed for delay (four-stroke, so single cyl ign fires every second cycle therefore div 2)
    byte rpmdelay = ((60000 / rpm)*2) - (interval/1000);  // attempts to roughly account for time in data_collect process ('interval') - byte means not much slower than 500RPM

    y=0;  // reset array
    
    // begin proper
    
    for(byte i = 0; i < numTests; i++)  // number of test firings
      {
       int maxv, ttf, test; // declare variables to use
       collect_data(&maxv, &ttf, &test);  // get data from collect_data function
       //collect_data(&maxv, &ttf); 
       resultVals[y][0] = (ttf); //1st col of result array gets ttf
       resultVals[y][1] = (maxv); // 2nd col of result array gets max current
       y++; //increment array           
       
/* use for debugging output from collect_data function
 *

    Serial.print ("*** Test number ");
    Serial.print (test);
    Serial.println (" ***");
    Serial.print ("2Maximum current = ");
    Serial.print (long(maxv) * 120.5);
    Serial.println ("mA");   
    Serial.print ("2Decay time = ");
    Serial.print (ttf);
    Serial.println ("usec");   
    Serial.println();
 *
 */    
       delay(rpmdelay); // sets 'rpm' delay between each test firing, 
      }
      
   testnum = 0;
   float results_sum = 0;
   float results_std_dev = 0;
   float msec_ttf = 0;
   float results_mean = 0;
   float results_var = 0; 
   float results_max = 0;
   float results_min = 10;
   boolean miss = 0;
   byte discard = 2; // first few results from multi-test show higher ttf than normal, discard to give more accurate result
   for(byte i = discard; i < numTests; i++) // get results from each test and print to serial
      { 
       testnum = (testnum + 1);
       Serial.print (F("*** Test number "));
       Serial.print (testnum);
       Serial.println (F(" ***"));
       Serial.print (F("Total cycle time (to fire) = "));
//       Serial.print (float((resultVals[i][0])/1000.00)); // convert to ms
       msec_ttf = ((resultVals[i][0])/1000.00); // convert to ms
       results_sum += msec_ttf;
       if (msec_ttf > results_max)
          {
           results_max = msec_ttf;
          }
       if (msec_ttf < results_min)
          {
           results_min = msec_ttf;
          }
       Serial.print (msec_ttf);
       Serial.println (F("msec"));
// uncomment two lines for ACS712
       mVolts = ((resultVals[i][1]) / 1024.0) * 5000.0; // raw analog read val to millvolts
       amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range
// uncomment for CT
//       amps = (long(resultVals[i][1]) * 0.02222); 
//       Serial.println (mVolts);  
       Serial.print (F("Maximum current = "));
       Serial.print (amps);
       Serial.println (F("A")); 
      }
    results_mean = (results_sum / (numTests - discard)); //get mean of array results for ttf ***using testnum cost of discard
    for(byte i = 2; i < numTests; i++)
       {
        //results_var += pow(results_mean - (float((resultVals[i][0])/1000.00)), 2); // get variance
        results_var += pow(results_mean - (((resultVals[i][0])/1000.00)), 2); // get variance
        results_std_dev = sqrt(results_var/(numTests - discard)); // get std deviation ***using testnum cost of discard instead numTests
        if (results_min ==0)  // if we have a 0 for ttf it suggests firing issues
        {
         miss = 1;
        }
       }
       
    Serial.println ();
    Serial.print (F("Mean time to fire = "));
    Serial.print (results_mean);
    Serial.println (F("mSec"));
    Serial.print (F("Standard deviation = "));
    Serial.print (results_std_dev);
    Serial.println (F("mSec")); 
    Serial.print (F("Results Max = "));
    Serial.print (results_max);
    Serial.println (F("mSec")); 
    Serial.print (F("Results Min = "));
    Serial.print (results_min);
    Serial.print (F("mSec")); 
    if (miss)
    {
     Serial.println (F(" *** MISFIRE ***")); 
    }
    else 
    {
     Serial.println();
    }
    // DEBUG    Serial.println (maxv);
    // DEBUG    Serial.println (mVolts);  
    Serial.print (F("Range = "));
    Serial.print (results_max - results_min);
    Serial.println (F("mSec"));     
    Serial.print (F("Degrees of variation at "));
    Serial.print (rpm);  
    Serial.print (F(" RPM = "));  
    Serial.print ((results_max - results_min)/(float(60000 / rpm)/360));
    Serial.println (F(" degree(s)")); 
    
    // LCD print
    lcd.clear();
    lcd.setCursor (0,0); //set cursor first col, first row
    lcd.print (F("M="));
    lcd.print (results_mean);
    lcd.print(F("ms"));
    lcd.setCursor (9,0); //set cursor 9th col, first row
    lcd.print (F("SD="));
    lcd.print (results_std_dev);
    lcd.setCursor (0,1); //set cursor first col, second row
    if (miss)
       {
        lcd.print(F("***MISFIRE***"));
       }
    else
       {   
        lcd.print(results_min);
        lcd.print(F("-"));
        lcd.print(results_max);
        lcd.print(F("  "));
        lcd.print ((results_max - results_min)/(float(60000 / rpm)/360));
        lcd.print ((char)223); // let's print the degree symbol!
        Serial.print (F("Maximum current = "));
        Serial.print (amps); 
        Serial.println (F("A")); 
        Serial.println();
        lcd.print(F(" "));
        lcd.print (amps);
        lcd.print(F("A")); 
       }
       testnum = 0;  
   }


//--- Function to check capacitor value and resistance ---//

void cap_test()

   {
    mVolts = 0;
    int cap_time = 0;
    int r_volts = 0;
    long r_val = 487000; // charge resistor value in ohms
    float cap_val = 0.0;
    long leak = 0;
    digitalWrite(cap_chg_pin, LOW); 
    lcd.clear();
    lcd.setCursor (0,0); //set cursor first col, first row
    lcd.print (F("Capacitor test"));
    lcd.setCursor (0,1); //set cursor first col, second row
    lcd.print (F("in progress..."));
    delay (90); //ensure the cap is discharged via charge pin low
    digitalWrite(cap_chg_pin, HIGH); // use digi pin 13 to charge the cap via a resistor
    time_now = millis();
    for (int i = 0; i < 2000; i++)
      {
        time_gone = millis() - time_now;
//        delay (1);
        mVolts = analogRead (A2);  //use analog pin A2 to read volts across unknown cap
        Serial.print (time_gone);
        Serial.print (" - ");
        Serial.println (mVolts);
        if (mVolts <= (source_volts * .632))
           {
            cap_time = time_gone; // time at which cap charge has reached 63.2% source_volts
           }
       }
     cap_val = ((float)cap_time/r_val) * 1000.0;
     leak = mVolts * r_val / (source_volts - mVolts); // calculate the resistance of the unknown resistance (leakage) in voltage divider cct
     lcd.clear();
     if (leak < 0)
        {
         leak = 20000000; // if we get variable source volts then could go negative - may need to say 're-test!'?
        }
     Serial.print (cap_val);
     if (cap_val > 0.4 && cap_val < 0.6)
        {
         Serial.print (F("uF")); 
         Serial.println (F(" **OK** :)"));
         lcd.setCursor (0,0);
         lcd.print (F("C="));
         lcd.print (cap_val);
         lcd.print (F("uF *OK*"));
        }
     else
        {
         Serial.print (F("uF"));
         Serial.println (F(" **BAD** :-("));
         lcd.setCursor (0,0);
         lcd.print (F("C="));
         lcd.print (cap_val);
         lcd.print (F("uF *BAD*"));
        }
     Serial.print (leak);
          if (leak > 10000000)
          //if (leak > 10000000 || leak < 0)
        {
         Serial.print (F(" ohms")); 
         Serial.println (F(" **OK** :)"));
         lcd.setCursor (0,1);
         lcd.print (F("R="));
         lcd.print ((leak)/1000000);
         lcd.print ("M");
         lcd.write (0);
         lcd.print (F(" *OK*"));
        }
     else
        {
         Serial.print (F(" ohms"));
         Serial.println (F(" **BAD** :-("));
         lcd.setCursor (0,1);
         lcd.print (F("R="));
         lcd.print ((leak)/1000000);
         lcd.print ("M");
         lcd.write (0);
         lcd.print (F(" *BAD*"));
        }
     digitalWrite(cap_chg_pin, LOW); 
   }


//--- Main loop, detect short press of switch to call single fire, long press to call multi-fire ---//


void loop() 
{
cap_swPinState = digitalRead(cap_swPin);
if (cap_swPinState == HIGH) 
   {
    swPresentState = digitalRead(swPin); // what's the switch doing
    if (swPresentState != swPrevState) // if not same as prev then...
      {
       delay(20); //debounce delay
       swPresentState = digitalRead(swPin); // check again after debounce delay to be sure
       if (swPresentState == LOW) // if switch is still on then it's real
          {
           swTimer = millis(); // set timer from on
          }
       if (swPresentState == HIGH) // sw not on now
         {
          unsigned long currentMillis = millis();
          //if ((currentMillis - swTimer >= 60) && !(currentMillis - swTimer >= 600)) // sw short press
          if ((currentMillis - swTimer >= short_in) && !(currentMillis - swTimer >= long_in)) // sw short press
            {        
             Serial.println (F("- Single shot test -"));
             //lcd.clear();
             //lcd.print(F("Single shot test")); // use F() macro to reduce memory use
             //testnum = (testnum + 1);
             single_test();
            }
          if ((currentMillis - swTimer >= long_in)) // sw long press
            {
          // the long press was detected
             Serial.println ();
             Serial.println (F("- Multi-fire test -"));
             Serial.println ();
             lcd.clear();
             lcd.print(rpm);
             lcd.print(F("RPM multifire"));
             lcd.setCursor (0,1);
             lcd.print(F("test in progress"));
             multi_test();
            }
         }
        swPrevState = swPresentState; // has state changed?
      } 

   }   
   
if (cap_swPinState == LOW) 
   {
    digitalWrite(cap_chg_pin, LOW); 
    swPresentState = digitalRead(swPin); // what's the switch doing
    if (swPresentState != swPrevState) // if not same as prev then...
      {
       delay(20); //debounce delay
       swPresentState = digitalRead(swPin); // check again after debounce delay to be sure
       if (swPresentState == LOW) // if switch is still on then it's real
          {
           swTimer = millis(); // set timer from on
          }
       if (swPresentState == HIGH) // sw not on now
         {
          unsigned long currentMillis = millis();
          //if ((currentMillis - swTimer >= 60) && !(currentMillis - swTimer >= 600)) // sw short press
          if ((currentMillis - swTimer >= short_in) && !(currentMillis - swTimer >= long_in)) // sw short press
            {        
             Serial.println (F("Cap test"));
             cap_test();
            }
         }
         swPrevState = swPresentState; // has state changed?
      }
   }
}


[/doe]

User avatar

JohnH
Posts: 85
Joined: Sun Jan 06, 2019 6:57 pm
First Name: John
Last Name: Hunter
Location: Blue Mountains, Australia
Board Member Since: 2002
Contact:

Re: A new DIY electronic coil tester.

Post by JohnH » Mon Jan 20, 2020 7:07 pm

Luke,
The test voltages I use are 6 and 12V. I suppose that for more 'real world' testing the 6V should be closer to 7V, since the battery will be under charge when the engine is actually running. The regulation of the power supply in my tester is not perfect anyway, being just a simple zener diode and emitter follower circuit. It's quite adequate for the purpose, but not as good as a three terminal regulator IC.
The ideal dwell time to fire periods were determined by observing how long it took for the current waveform to flatten out. Beyond this time the coil begins to saturate. The times I chose 3.5ms at 6V, and 2ms at 12V, were determined after examining several different coils. Of course, chances are one coil might begin to saturate at 3.3ms and another at 3.7ms, but it isn't that critical. The important thing is the firing time is set to be the same for a set of coils at whatever test voltage is used.
The ECCT uses a regulated switchmode power supply providing 12V and is set to 2ms firing time.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Mon Jan 20, 2020 8:36 pm

John,

Quite agree it's the consistency across coils that matters most, but thanks especially for your views on absolute time.

It was some time ago that you wrote your article and I'd wondered if you'd discovered anything in the interim. Clearly you've tested a lot of coils and would have a very good idea on where they would typically sit ttf-wise, so it's good to have that confirmed, along with the voltages you use.

With this in mind I can't see why the ultimate saturation time (ideal ttf) wouldn't be (inversely) linear to voltage so I think it is probably worth including a calc to give a target time in the code, according to whatever test voltage is used. At this time I'll assume 3.5msec for 6.0V bottom limit and 2msec for 12.0V, and whatever it works out to be between.

That said from the little testing I've done I suspect it's a little arbitrary anyway; the single-shot tests do not always seem to meet with the same ttf for the same coil, despite no change in conditions between tests. I've come to the conclusion that it's just not possible for them to be particularly precise given the nature/age of the design, so we need to work with them and allow a little leeway. How much is too much [leeway] is something I've yet to conclude.

Partly to deal with this I may look at some sort of frequency table histogram or scatter plot for the multifire test. This should give an easily grasped visual cue as to how consistent an individual coil is - some of the numbers the system presently outputs may be a little esoteric to some.


Chris Barker
Posts: 62
Joined: Sun Jan 06, 2019 5:08 pm
First Name: Chris
Last Name: Barker
Location: Somerset, Eng;and

Re: A new DIY electronic coil tester.

Post by Chris Barker » Tue Jan 21, 2020 3:33 am

I follow the logic about ttf at 6v and 12v, but should there be a check at 30v (or more) to represent the real magneto environment?

User avatar

JohnH
Posts: 85
Joined: Sun Jan 06, 2019 6:57 pm
First Name: John
Last Name: Hunter
Location: Blue Mountains, Australia
Board Member Since: 2002
Contact:

Re: A new DIY electronic coil tester.

Post by JohnH » Tue Jan 21, 2020 3:23 pm

Chris,
That's an interesting question. The magneto puts out something between a sine and triangular wave and the peak voltage would actually be more than 30Vrms. It's important to note that while the magneto puts out a seemingly higher voltage, the coil actually fires well before the voltage has reached its peak. As the voltage ramps up, the coil might fire at say 3 or 4V. So, it's quite different to the step function of 6 or 12V being suddenly presented to the coil. To simulate magneto operation would require the tester produce a ramp voltage which is certainly possible. Given the AC output from the magneto, it's an interesting question too as to whether the firing time remains exactly the same for both polarities. If for example there was some residual magnetism in the coil core, the coil might conceivably fire earlier when the polarity is such that it adds to the magnetism rather than subtracts from it.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Tue Jan 21, 2020 4:59 pm

Chris,

As far as the tester is concerned, with the way it's wired up at present you could simply supply 30V (or whatever) to the input of the switching device and it would record the events normally. Both the BTS7960 and the L298 would handle that ok.

John (and Chris),

You've echoed some earlier comments of mine around the absolute firing voltage and how the ramp of the magneto waveform will interact. And you're right re the waveform itself, Jim (jab35) pointed me to an earlier thread (with images) on this very thing - it's quite 'interesting' isn't it!

There are a couple of things from my perspective. Firstly the timer is still in the circuit when operating on the car itself (the HCCT is different, which was central to the conversation between Jim and me), so there will still be a hard switch on and off at some point. Where the magneto ramp is at that point is determinable as the advance is changed - but it's arbitrary in terms of real-life operation.

Secondly I've found in the limited testing I've done that there is ttf variability between coils at different voltages - IOW they don't all react to voltage change the same.

You would have better knowledge of that than me, but to my mind these two things make the need or desire to generate a triangle or sine wave in order to test coils much more of academic interest than practical. The things are so imprecise anyway that I doubt there would be any advantage in doing this for a coil tester in the field.

That's not to say it's not interesting or worthwhile in that academic setting. Jim and I have had some discussion around this, he's particularly interested in comparing the HCCT system to the electronic methodology utilised such as in this unit and Mike K's.

In terms of making something up to do it I don't see it'd be particularly difficult. I'd probably use a function generator, output that via a suitable cct to generate the requisite AC waveform with sufficient current and use the 'FACT' code, or oscilloscope, to see what went on from there. However there's only so many things one can do...


jab35
Posts: 228
Joined: Sun Jan 06, 2019 12:28 pm
First Name: James
Last Name: Bartsch
Location: Dryden, NY 13053
MTFCA Number: 30615

Re: A new DIY electronic coil tester.

Post by jab35 » Tue Jan 21, 2020 7:26 pm

Luke: As always, I appreciate your efforts and continued sharing of info. IIRC, Voltage and inductance are involved in this process, so you may need to look at both values to better understand the effects of varied excitation voltage and possibly, coil to coil variability. For sure, inductance values may vary considerably from coil to coil, and in the quest for a balanced set of 4 coils, one may need to select for similar inductance and set them for identical dwell time. (And after doing this, I wonder if you would see any difference in the RMS current observed on a HCCT.) All the best, jb

User avatar

MKossor
Posts: 122
Joined: Sun Jan 06, 2019 7:30 pm
First Name: Mike
Last Name: Kossor
Location: Kenilworth, NJ 07033
MTFCI Number: 22706

Re: A new DIY electronic coil tester.

Post by MKossor » Fri Jan 24, 2020 8:16 pm

Great progress on this collaborative effort. Once the coil test algorithm is finalized, I'm looking forward to how the next phase evolves on validating the coil test algorithm. That part was a lot of fun and yielded some interesting and non-intuitive results that helped optimize the ECCT coil test algorithm. Here is how I did it: http://www.modeltecct.com/uploads/TDAS_V4.pdf One thing that this thread has done very well thus far is provide a good sense of the time and effort necessary design and perfect a micro controller based project.

JB, the relationship between coil test voltage (VL), inductance (L), current charge rate (di) and dwell time to fire spark (dt) is: VL = L * di/dt so yes, coil Dwell Time to fire spark is directly proportional to coil inductance. Coils with significant differences in inductance adjusted on the HCCT for the exact same average RMS current Guarantee they have different Dwell times to fire spark. I am Not bashing the HCCT, just pointing out a simple fact based on physics and the limitations inherent to using coil current as an indirect approximation of dwell time to fire spark.
I-Timer + ECCT Adjusted Coils = Best Model T Engine Performance Possible!
www.modeltitimer.com www.modeltecct.com


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Mon Jan 27, 2020 2:43 am

Mike,

Thanks for the link. It looks like you did a thorough job, and I expect it was personally satisfying to have your thesis and work affirmed. It can also be quite interesting just working out how to test such things and carrying it out can't it!

I've been staggered at the variability in inductance of the Ford coils, so far I've yet to find any two within what I'd consider to be a reasonable proximity of another. This may in part be a function of the very few coils I've been able to check (<10), regardless I would not have anticipated quite the range I've found to date. I confess to being a little intrigued, but that's a subject for another day...

Supporting your comments to Jim I note that a few days ago we set four coils at ~2msec ttf (12V) on the 'FACT', then checked them on a HCCT.

Two of the coils showed a current draw of around 1.6A on the HCCT meter, the other two 1.3A, ie. there was ~200-300mA average current difference between them despite their typical ttf being just a few usec apart.

After this no adjustments were made from the HCCT test and when installed in the vehicle it ran well with the 'FACT' set coils. The also owner commented that, having taken it for a reasonable test drive, he felt the four we had set for another vehicle the week prior had made that run better than previously.

While this was clearly a somewhat subjective statement, as opposed to the quantitative testing you did, it was nevertheless pleasing to hear and at least partially vindicated some of the time and effort spent on the project :-)


jab35
Posts: 228
Joined: Sun Jan 06, 2019 12:28 pm
First Name: James
Last Name: Bartsch
Location: Dryden, NY 13053
MTFCA Number: 30615

Re: A new DIY electronic coil tester.

Post by jab35 » Mon Jan 27, 2020 12:25 pm

Luke: Do you have the inductance values and corresponding rms current/HCCT current values for the coils after the coils were all set to fire at the same dwell time? If you do, would you mind sharing the data? Thanks, jb jab35(at)cornell(dot)edu


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Mon Jan 27, 2020 2:59 pm

Jim,

I didn't check their inductance, but with Chris' (owner's) indulgence I may be able do that tomorrow and will let you know.

As a complete aside I'm presently waiting for some parts to arrive before (hopefully) finalising the tester design, at least for me. Unfortunately as we're at the bottom of the world, and as I think they're all on holiday at the other end, it could well take several weeks...

... which might give a little time to tackle the electronic-mechanical speedometer I mentioned a few weeks ago (now morphed into a Model T BECM :roll: )


ModelTMark
Posts: 32
Joined: Sun Jan 27, 2019 9:39 pm
First Name: Mark
Last Name: Williams
Location: Virginia
Board Member Since: 1999

Re: A new DIY electronic coil tester.

Post by ModelTMark » Tue Jan 28, 2020 1:03 am

I'm curious as to why an AC source equivalent to the Mag was not considered for the input voltage of the tester rather then a 12VDC or 6VDC source (other than the added complexity and cost of additional circuity)? The RMS value (the DC component) of the AC magneto at speed is higher than the 12VDC source used by the testers. Properly adjusted coils on an original coil tester seem to clearly perform better on MAG than on a DC source, which I believe is undisputed.

We have designed and built a prototype "magneto eliminator" that converts 6VDC to an AC output that emulates the output of the original Mag at speed. In drive testing, we seem to get significantly more speed on AC than DC (to the tune of about 10 extra MPH) when using coils aligned on an original coil tester (as provided by Ron Patterson). We get similar results on the same car when switching between Mag and battery (6 or 12V).

R/Mark
Williams Vintage Power Systems

User avatar

MKossor
Posts: 122
Joined: Sun Jan 06, 2019 7:30 pm
First Name: Mike
Last Name: Kossor
Location: Kenilworth, NJ 07033
MTFCI Number: 22706

Re: A new DIY electronic coil tester.

Post by MKossor » Tue Jan 28, 2020 6:57 am

Mark, improved performance operating on AC/Magneto versus 12V battery is due to the limitations of using average coil current as an indirect approximation for coil dwell time to fire spark to adjust your coils regardless of how experienced the operator is based on my TDAS test results. A novice using the ECCT to adjust all 4 coils for equal and consistent firing time will provide performance on 12V battery equal to or better (smoother, more power) than magneto operation using coils tuned for the same average current by a highly experienced operator. The limitation is the method of adjustment and not a reflection on the operator's skills. Similar results can also be achieved operating on 6V battery with extended ignition timing advance attained by reducing the initial safety margin on fully retarded timing from 15 degrees after TDC to something much closer to TDC (which I do NOT recommend for safety sake) due to the longer coil dwell time to fire spark operating on 6VDC.

This performance comparison assumes the other ignition timing variables (timer contact condition, timer contact to contact variation, timing cover alignment, spark plug condition and gap) do not contribute any significant cylinder to cylinder ignition timing variation. A original New Day Timer in good condition centered on the CAM shaft works well or preferably an I-Timer used to eliminate all timer variables will help eliminate other sources of ignition timing variables when conducting engine performance testing attributed to ignition coil adjustment.

Find someone in your area with an ECCT to adjust the same set of coils for equal and consistent firing time (0 deg timing error >90% of the time) and repeat the experiment comparing acceleration and top speed on the same course operating on 12V battery, Magneto and your 6VDC to AC Magneto Eliminator and report your findings.
I-Timer + ECCT Adjusted Coils = Best Model T Engine Performance Possible!
www.modeltitimer.com www.modeltecct.com

User avatar

MKossor
Posts: 122
Joined: Sun Jan 06, 2019 7:30 pm
First Name: Mike
Last Name: Kossor
Location: Kenilworth, NJ 07033
MTFCI Number: 22706

Re: A new DIY electronic coil tester.

Post by MKossor » Tue Jan 28, 2020 7:18 am

Luke, It is indeed gratifying to earn positive performance reports using coils adjusted with your tool. The problem I encountered was doubt and criticism of readers skeptical of strictly subjective performance comparisons vulnerable to placebo effect and reluctance to report disappointing results. The latter two did lead me astray during coil tuning algorithm optimization. This was averted when I stopped relying on subjective feedback and based engine performance on TDAS acceleration and velocity data as the performance guide to achieve the results described in my previous post.
I-Timer + ECCT Adjusted Coils = Best Model T Engine Performance Possible!
www.modeltitimer.com www.modeltecct.com


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Tue Jan 28, 2020 3:48 pm

ModelTMark wrote:
Tue Jan 28, 2020 1:03 am
I'm curious as to why an AC source equivalent to the Mag was not considered for the input voltage of the tester rather then a 12VDC or 6VDC source (other than the added complexity and cost of additional circuity)? The RMS value (the DC component) of the AC magneto at speed is higher than the 12VDC source used by the testers. Properly adjusted coils on an original coil tester seem to clearly perform better on MAG than on a DC source, which I believe is undisputed.
Mark,

For me I don't run my T on magneto, so there was no point in considering an AC source to start with. Also, as you've rightly pointed out, there is additional cost and componentry required - for little ultimate benefit I would suggest.

To my mind, as there is still a timer switching the relevant coils there's still hard switch on/off, and although there will be a rising/falling supply from the magneto subsequent to the switch I'm not sure this in itself is enough to make it worthwhile supplying AC for testing purposes - and in fact I think it could make it much harder to get an accurate tff, which is what mattered to me.

That said I will be commenting on something relevant in a further post.

WRT your latter comment I see that Mike has responded regarding the different methodology of testing/setting coils between average current across time (HCCT) and time to fire (ttf) on an electronic tester such as his ECCT or the 'FACT' we've been working on here.

Finally on this matter I would suggest that, if there is a difference between magneto and battery then it may be less to do with the AC waveform per se than with other factors such as voltage and available timing range (bear in mind that voltage will affect the time to fire).

We have designed and built a prototype "magneto eliminator" that converts 6VDC to an AC output that emulates the output of the original Mag at speed. In drive testing, we seem to get significantly more speed on AC than DC (to the tune of about 10 extra MPH) when using coils aligned on an original coil tester (as provided by Ron Patterson). We get similar results on the same car when switching between Mag and battery (6 or 12V).
This is interesting. Are you fully utilising the slightly weird waveform of the T mag, or simple sine (or triangle)?

We've already discussed the coil setting methodologies here and elsewhere so I won't go into that again but again the results you're getting don't tell me that it's solely down to the provision of AC vs DC (well, it could be to some extent, depending upon how your coils are set up, but that's not quite the point).

Recalling (hopefully correctly!) that power required to increase speed is a cube law then to give a 10mph difference means a very significant change in power. You've not given absolutes but I'd like to know what they are?

The reason for this is that I wonder if you started with a poorly performing vehicle and improved it by 10mph, or with an 'average' vehicle (say 42mph max :-) and added 10mph.

Also, have you tested coils using a ttf methodology for setting them vs average current methodology?


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Tue Jan 28, 2020 4:40 pm

Mike,

I fully agree that quantitative data for performance is much preferred and indisputable. It's good you've done that work and can provide some hard detail for those interested enough to look at it.

There is of course the slightly more qualitative 'smoothness' of an engine too that may be a factor some people could notice. I don't know if you've had any feedback on this (?) but I suppose one could attach an accelerometer to the motor and do some comparative measurement (I'd expect closely matched [ttf] coils to result in less vibration). Whether it's worth going down that track I'm not sure.

As it happens I did a project some years ago that could probably test this, but it'd be a bit of work and I'm not sure I want to delve into fourier transforms and suchlike things again when I'm personally happy with the results I'm getting anyway. If I should ever get some spare time (hahah) I may give it a crack...

However there's another thing that arises around the discussion on inductance that's been exercising my (and others) mind over the past little while. I expect you and possibly John H may have better insight and might usefully comment.

The discussion has centred around the difference in current readings on an HCCT from coils set via the ttf method. We accept that the coils will (within reason) fire at a given time at a given voltage but when placed in the HCCT some coils will show quite different average current readings from others.

I have posited that this may be explained through inductive reactance and impedance. Jim and others have suggested that a coil with a lower inductance will give a higher current reading on the HCCT, which is generally supported by the theory (XL = 2*pi*f*L, Z (roughly) = XL+R, Z=E/I and so I = E/Z).

However of course it's not that easy with a Ford coil. The primary is switched in and out (which will affect average current readings), there's a capacitor involved when the points are opened, there's a secondary also connected at one point, and there's the frequency/shape of the AC supply to contend with too...

All that said I am still of the view that this is the most likely explanation, given the whole current lagging voltage thing that underlays it all (and which is obviously in action given the various 'scope waveforms we have of rising current before the coil fires etc).

So that's the first thing of interest, and which your view (and that of anybody else) would be appreciated.


The second thing is that since frequency and voltage will change (on mag in car - and HCCT) then coils of different inductance may fire at different times as this f/V is altered, even if set to be the same ttf at a specific voltage and pulse.

I've yet to get data to specifically support or disprove this, but I have previously noted variability in timing across coils at different voltages. This may be down to inductance, or it may not, I'm less sure of the causation around voltage change than frequency, but nevertheless it does happen.

If this is the case then what it tells me is that in order for good magneto operation on a vehicle then coils should be matched inductively as much as possible, before setting them (either method). I'm reminded now that Tom mentioned earlier he was matching coils on Q etc in order to achieve optimum performance, so there's some prior evidence to support this I think.

100 years ago in the factory I suspect this was less of an issue for the average person because the four coils in a car would most likely have come from the same batch and so be reasonably matched (within the vagaries of the manufacturing process). However today there will be few cars that haven't had a good mix of coils over the years and so unmatched inductance, and therefore variable performance across a range of voltage/frequency, is more likely to be the norm than not.

Should this turn out to be a thing then we could run into issues around how to measure the inductance. I've already tried two different meters with different absolute results; as you will know there are several methodologies of measuring inductance and the two could be using a different method each - but then again the other componentry of the coil could be having an effect, along with any capacitance etc.

It may not matter much if the same method is used to test inductance across all coils - after all it's more a close match between them that's important rather than the absolute value - but I think it's something to consider and maybe trial.

I'd welcome input on this, it's not been my field for many years now so my theory is very rusty and my head hurts - it could all be a work of fiction :-)


Scott_Conger
Posts: 2673
Joined: Sun Jan 06, 2019 11:18 am
First Name: Scott
Last Name: Conger
Location: Clark, WY
Board Member Since: 2005

Re: A new DIY electronic coil tester.

Post by Scott_Conger » Tue Jan 28, 2020 5:26 pm

We accept that the coils will (within reason) fire at a given time at a given voltage but when placed in the HCCT...
You may accept that, but since the coil is a current-operated device, you will find many which will disagree with you. Any given coil is going to fire at the current it is set to on purpose (HCCT) or ends up at with (your setup). The time it takes when set on HCCT is what it is. The time it takes when set on your device is defined, but unsurprisingly, you end up with random current draw from coil to coil.

To follow this to conclusion, elsewhere you, or someone mentioned that coils adjusted perfectly for ttf gave varying readings on a HCCT (from 1.3 to up to 1.6A, as I recall?). I expected that, as lots of papers on this stuff have been published in the past regarding effects of inductance, etc., but I can tell you that I would not want to be hand-cranking my car with coils set to a high amperage. My back is not up to it. The car may run great with coils set perfectly ttf but if amperage is so high I cannot start the car, it is kind of moot. Same thing with varying amperage coils (will it start with THIS pull or THAT pull?).
Scott Conger

Full Flow Float Valves - deliver fuel like Henry intended!


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 29, 2020 1:15 am

Scott,

That comment was poorly worded on my part because what you took from it is not quite what I intended it to mean, sorry :?

However, to centre on your conclusion, and so that I don't misunderstand, are you saying that you consider it will be harder to crank start your car with coils set by ttf, than those set with average current?

And, if so, by harder to start, do you mean you expect to apply more force to the crank, or higher angular velocity? Or is there another issue I've not thought of?


Scott_Conger
Posts: 2673
Joined: Sun Jan 06, 2019 11:18 am
First Name: Scott
Last Name: Conger
Location: Clark, WY
Board Member Since: 2005

Re: A new DIY electronic coil tester.

Post by Scott_Conger » Wed Jan 29, 2020 12:04 pm

Setting ttf is no problem per se...ending up with one or more coils with high current is a problem if you start your car with the magneto. The answer to your question is angular velocity. You're never going to get more than around 3V from hand cranking, particularly with a worn brake drum/clutch assembly. With low/correct amperage, you're going to get a spark on a regular basis. With high amperage, not so much. Notwithstanding the fact that most T's have electric starters (even those which never originally came with them), this was designed as a hand-cranked car that came with no battery, and the coil/magneto design is wrapped around that fact. Everything else that came later is a convenience.

In reality, when new, you needed to little more than lift the engine through to TDC compression and then give it a little whirl...the compression helps to push the crank around and the spark occurs. I own such a car in my '15. The lack of effort or dramatics by the guy on the end of the crank is surprising to most folks. The reality of these things though, is that things wear and usually the owner must overcome that resulting drag with more OOMPH. In any event, to get amperage output needed, it's all about angular velocity when starting on Mag.

A side note: I believe that the engines in Model Ts were "burned in" on test beds so that the engines would be already limber as-new, so that the car could be immediately hand cranked. I used to attribute it to the less precise mfg techniques combined with lower skilled assemblers (and that may still be true), but now owning a non-battery stem-winder, I think it was to ensure a free engine that even the smallest woman could start when new. Today the vast number of freshly rebuilt engines cannot be hand cranked after rebuilding, even with battery spark assistance.
Scott Conger

Full Flow Float Valves - deliver fuel like Henry intended!

User avatar

A Whiteman
Posts: 268
Joined: Sun Jan 06, 2019 3:36 pm
First Name: Adrian
Last Name: Whiteman
Location: South Island, New Zealand

Re: A new DIY electronic coil tester.

Post by A Whiteman » Wed Jan 29, 2020 3:09 pm

Luke kindly had a look at a selection of my coils yesterday. Wonder of wonders, no two were alike :-) (out of 14).

I was bemused to find that of the 4 coils pulled from Albert (I drove him into the garage 6 months ago but not been out since) 3 would not work at all, neither on Luke's tester or Chris' HCCT! How was that! 3/4 failure by just sitting! Has anyone else had such an experience? What possibly could be behind that?

Thanks to all for keeping this thread cordial, it makes it so much more interesting and as a 'non-sparky' I am learning quite a bit. Thanks to all contributors :-)

Cheers
Adrian


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 29, 2020 4:23 pm

Scott,

Regularity of spark at low voltage would be affected largely by points condition and adjustment (all other parameters being equal).

At the risk of going over old ground too often:
  • Setting coils via ttf method is done to ensure that all of the coils in a set of four will fire at the same time, notwithstanding observations I've made earlier around voltage variability.
  • The target ttf has been determined empirically through observing the current rise time in coils from 0 to saturation level.
  • Target ttf is circa 2msec at 12V, 3,5msec at 6V, and would be longer again at 4.7V*
  • There is no point in holding a coil on for any longer than needed (past saturation), you'd simply convert the input energy to heat from thereon in.
  • If you measured a coil in an averaging way (as the HCCT does) then it would show ever increasing current as you increased it's ttf (all other parameters being equal).
Ipso facto setting coil ttf should not affect detrimentally affect current draw.

Taking a more practical approach, and addressing the issue you're concerned about, which (distilled) I take to be that you believe coils set via ttf could require higher angular velocity of cranking; I recently set four coils for Chris, whom I've mentioned before.

After adjustment to 2msec ttf we took the coils from the electronic tester and put them on his HCCT. All of the coils performed fine in the HCCT at 3V displayed on the HCCT meter, Chris making the comment that they'd be good for hand cranking. Of those four coils two showed lower average current which led me to speculate why, and ultimately the theory I presented above. Like all good theories this one is set out in public for others to shoot down, particularly as the writer is old and his grasp on such matters hazy at best, but the thing perhaps to take from the reality is that the 'FACT' set coils happily worked at 3V.

* 4.7V is the peak of 3V from an average reading meter. We've had the discussion around the current meters in an HCCT and understand they're moving iron, displaying RMS current, but I'm not certain on the voltmeters so will go for average until told otherwise.

Finally on this. I crank my T all the time partly because the starter has failed, but also because I like it - it's even more in keeping with what one would have done in the times, and it creates a great spectacle in the supermarket car park etc ;) My battery is also ill, so for a cold start after it's been sitting for a few hours it delivers around 5V to the coils, perilously close to the 4.7V I've mentioned above. I set the coils with the 'FACT' at 6V.

At the risk of encouraging Murphy, so far it's not failed to start. That it can require a few cranks I believe is more down to the worn engine, if it's hot it will free start - or take just one pull on the crank - but it still has the original cast iron pistons and compression is quite low when cold. I could do with some other plugs as well, but that will need to wait.

Adrian,

Your coils were certainly the talk of the party :D Thanks for bringing them along, they've added to the body of knowledge!

In the next week or so we'll be able to have a 'session' to properly sort them out. Some new points and 'proper' caps will make a big difference. In the meantime, looking at the data, A6,R2,4,5,6,7 are your best bet for the moment.

I suspect Albert is making an effective complaint that he's not being exercised enough, but maybe others will have more insight...

User avatar

MKossor
Posts: 122
Joined: Sun Jan 06, 2019 7:30 pm
First Name: Mike
Last Name: Kossor
Location: Kenilworth, NJ 07033
MTFCI Number: 22706

Re: A new DIY electronic coil tester.

Post by MKossor » Wed Jan 29, 2020 5:00 pm

Scott said " the coil is a current-operated device" but later said "You're never going to get more than around 3V from hand cranking" regarding concerns about difficult hand cranking coils adjusted for equal and consistent dwell time to fire spark that test higher average HCCT current. Wait, What? So? Lets see, typical coil primary resistance is ~0.3 Ohms and applying Ohms Law, 3V/0.3 Ohms = 10A primary coil current.... Wow! That should be way more than enough current to make the current operated coil fire spark. What's the problem?

Also consider the Peak current of an ECCT adjusted coil is typically only 6A at the moment of firing (Not average current). That indicates lots of margin and easy hand cranking which is also consistent with ECCT user reports of easier hand crank starting, Hummmm....

Here is yet another data point, coils adjusted by the Expert using an HCCT (1.3A Average current) typically require more than 6A Peak current at the moment of spark firing when tested on the ECCT. Heck, that would imply more difficult hand crank starting, NOT easier....
Perhaps some ECCT users could way in here. So what's the problem with the logic???
I-Timer + ECCT Adjusted Coils = Best Model T Engine Performance Possible!
www.modeltitimer.com www.modeltecct.com


Scott_Conger
Posts: 2673
Joined: Sun Jan 06, 2019 11:18 am
First Name: Scott
Last Name: Conger
Location: Clark, WY
Board Member Since: 2005

Re: A new DIY electronic coil tester.

Post by Scott_Conger » Wed Jan 29, 2020 8:14 pm

Rereading my post, I did in fact type in a wrong value for voltage. Where I typed "3" I meant "2", and I did not state it, but that would be a very good magneto and a very hearty pull on a free engine.

It was stated earlier that ttf coils resulted in a range of average current values. That makes perfect sense. Unlike yourself, (who likely knows these ranges from your research and development of your tools) I do not know the range of those variations and stated that I would not wish to try to crank start a car on Mag if the coils were in fact very far off of the accepted range. If I did not state or imply that accurately earlier, then shame on me. If in fact you are positing that coils set to a high amperage rating (above the typical value) will as easily light off a mag-cranked engine with coils set to a traditional value, then I would disagree with you. Similarly, coils set to an amperage range too far below the generally accepted value will "pop", but the fuel may not due to weak spark.

That said, experience has taught me the value and results of debating you, so I will sit it out from here on. It isn't my sandbox, so I'll let you guys play.
Scott Conger

Full Flow Float Valves - deliver fuel like Henry intended!

User avatar

MKossor
Posts: 122
Joined: Sun Jan 06, 2019 7:30 pm
First Name: Mike
Last Name: Kossor
Location: Kenilworth, NJ 07033
MTFCI Number: 22706

Re: A new DIY electronic coil tester.

Post by MKossor » Wed Jan 29, 2020 11:41 pm

Scott, Your reference 3V magneto output is actually low based on my test data; my Allan HCCT peak voltage output is 5V cranking at 60 RPM (1 revolution per second which I would say is on par with hand crank starting given only 1/4 turn is turned at that rate). I checked my HCCT test data and noted that the coil resistance was a bit higher at 0.83 Ohms; the coil fired at 6A with peak voltage of 5V. I really wish I could share the ECCT/HCCT test comparison data but the phone will start ringing off the hook at the MTFCA with rabid complaint of me violating the vendor rule "advertising" so you don't get to see it.

I have the test data but not a lot of experience hand crank starting a car so I do Not have all the answers. Others have reported to me a noted ease in hand crank starting using ECCT adjusted coils adjusted for equal ttf spark so there seemed to be a discrepancy in the discussion so was trying to walk through the logic and spur thought not alienate. My apology if that is the way it was perceived. I believe the discrepancy comes about due to mixing comparisons between ECCT Peak coil current at the moment of firing spark with the coil starting from rest (i.e. no current flowing in the coil prior to excitation or in other words timer not on contact yet) compared with average coil current measured during continuous excitation (magneto driving the coil under test without the timer function permitting the coil to rest in between firings i.e. HCCT operation). The two measurements do NOT correlate well and I shared my observations. Again, it would be much more instructional if I were permitted to present the test data visuals illustrating the coil voltage and current relationships of the different measurement conditions.
I-Timer + ECCT Adjusted Coils = Best Model T Engine Performance Possible!
www.modeltitimer.com www.modeltecct.com


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Wed Jan 29, 2020 11:46 pm

Scott,

Chris' meter scale is fairly cramped at the lower end, 2V might be difficult to determine, and for various reasons it'll be several weeks before any further opportunity to test so I'm not able to comment on that much further.

However wrt your enquiry on the range of average current draw, and as Adrian has alluded to, we did test a number of coils yesterday.

The coils were initially set on the 'FACT', then tested on the HCCT. When I've time to convert from the old-school pen and paper I was using I'll put the data up here FYI.

As this is an open-source community project, and you've got an interest in performance of coils on magneto at (crank) start, I wonder if you've given any thought to trying any set via 'FACT' or ECCT and comparing to some set via HCCT and sharing your experience? It seems to me that empirical data is lacking a bit at the moment, so it would be helpful if you could...

Otherwise, as Mike has asked, perhaps some users of his machine may be able to comment?


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Coil testing data

Post by Luke » Thu Jan 30, 2020 3:15 pm

As mentioned earlier, on Wednesday we tested a number of coils from several sources. The coils included brass-tops and plastics.

The methodology used was to initially set the points (some were dressed) by feeler gauge, then test the capacitors and set the coil timing in the 'FACT' at 12.1V.

Primary coil inductance was measured with two different meters, known to give 'different' readings. Although not (yet) determined the different readings may be due to the different possible methods of testing inductance, and the associated componentry still connected to, and surrounding, the primary coil.

Following this the coils were then tested in an HCCT and the current reading recorded.

The data is presented in raw form below, and in a graphic for easier reading (if anyone wants the spreadsheet file I'm happy to email it). No interpretation or analysis has been attempted at this time.

The plastic coils do not appear in the data for various reasons. A brief comment on these; they were found to perform better per the HCCT when set to 2.55msec timing in the 'FACT'.

Notes:

Some limitations include the variability in points (ie. for a better test all coils should have had the same set of points, or at least new points, set by the same person), accuracy of meter readings on HCCT, resolution of current readings on 'FACT' (still waiting for improved sensor), some coils would not operate at all or so clearly needed new points that they were only roughly set on the 'FACT'.

Key:

C in uF
L in mH (L1 = meter 1, L2 = meter 2)
TTF in msec
I ('FACT') in Amps
HCCT in Amps (meter sits ~100-200mA at rest)

Coil S & T previously set with ‘FACT’, assume nominal TTF & C

Own = coil owner
int = intermittent
ds = double spark
Blank space = no data

coil_test_data_screenshot.png

Model T Coil Testing 29 Jan 2020.
Own No. TTF I Sdev L1 L2 C HCCT Spark

T 1 2.02 5.24 0.04 7.37 2.29 0.46 1.46
2 2.06 5.17 0.06 7.55 2.31 0.47 1.7
3 2.04 5.39 0.04 7.85 2.16 0.46 1.6
4 2.05 5.03 0.02 7.03 2.48 0.46 1.2 ds
5 2.03 5.24 0.09 9.3 2.27 0.41 1.5
6 2.06 4.95 0.08 7.28 2.2 0.47 1.15
7 2.03 4.95 0.1 7.095 2.36 0.49 1.2 ds

D 1 1.99 4.8 0.1 10.43 2.85 0.49 1.5
2 1.99 4.9 0.04 7.82 2.68 0.49 1.35
3 1.99 5.24 0.03 6.43 2.25 0.49 1.2
4 1.98 5.55 0.03 7.08 2.16 0.49 1.2
5 1.99 4.95 0.03 8.78 2.33 0.49 1.1

A A1 0
A2 0
A3 0.49
A4 10.75 0.2
A5 7.54 0.5
A6 2 5.76 0.08 5.7 1.8
R1 2.16 5.17 0.14 6.12 0.49 1.3 int
R2 1.95 5.55 0.08 0.21 1.85
R3 2.06 5.39 0.05 10.08 0.49 1.45 int
R4 2.03 5.39 0.06 9.35 0.5 1.3
R5 1.83 5.39 0.25 9.95 0.22 1.65
R6 2.14 5.03 0.08 9.33 0.21 1.7
R7 2.17 6.62 0.12 7.05 0.49 1.7
R8 2.1 5.32 0.01 5.03 0.29 1.2 nil

S 1 2 6.21 2.02 0.47 1.55
2 2 6.57 1.99 0.47 1.55
3 2 9.22 2.1 0.47 1.45
4 2 8.05 2.28 0.47 1.45

T 1 2 6.39 1.84 0.47 1.46
2 2 9.46 2.09 0.47 1.4
3 2 10.27 2.11 0.47 1.1
4 2 7.23 2.12 0.47 1.5


Poppie
Posts: 56
Joined: Sun Jan 06, 2019 7:33 pm
First Name: Neil
Last Name: Martin
Location: Sydney Australia

Re: A new DIY electronic coil tester.

Post by Poppie » Thu Jan 30, 2020 5:35 pm

Hi Investigator Team,
Being a historic (aged) < 600 volt electrican and playing with Model T coils during my apprenticeship in the 1954-9 period and still playing, My electronic knowledge starts and finishes with the simple diode dating back to approx. 1960 so I still use my K W Wilson HCCT coil tester and feel that I get perfect results. Plenty of free starts, single and multiple with one time (I cant remember the number) I didn't go on any further.
Our Model T's pull hills like a bull in spring and so does the Model B Reo and 08 IHC all with model T coils
That being said I put a set of previously overhauled (not by me) coils in my HCCT and adjusted them and was a pain to do. I took the 5 coils to a friends ECCT and they all failed.
Capacitors Indicated POOR
TTF indicated 2 led to the right on 4 coils and 3 led right on 1 coil.
The third test indicated poor and I cant remember the reason.
I didn't re adjust them on the ECCT until they were test tied in the Model T.
Question---- What is the FACT system of coil setting. Where do I find it in the current Thread??
Regards--Neil.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Thu Jan 30, 2020 8:21 pm

Neil,

The 'FACT' theory of operation and that of the ECCT are essentially the same.

The essence of it is that a motor doesn't care about 'average current setting' (ala HCCT), rather it simply wants to see consistent spark at the right time, and across all four cylinders. With modern electronics it's much easier to set individual coils to consistent and (relatively!) accurate time to fire than previously, hence Mike K developed the ECCT, and the wider community is developing the 'FACT' here.

I went into further depth on this posting: https://www.mtfca.com/phpBB3/viewtopic. ... 072#p67092

If you've already tested your coils and found the capacitors faulty then obviously they should be replaced before going any further. Please excuse me if I'm teaching you about sucking eggs https://en.wikipedia.org/wiki/Teaching_ ... _suck_eggs but there is much detail available on this forum and elsewhere as to how to do that - shouldn't be a problem to you given your background!

Once replaced and the points cleaned & set, or replaced, then set via your friend's ECCT (or you might like to build a 'FACT'!) it would be of interest if you could test them in your HCCT and tell us what the average current reading is (per my 'data' post above)? If you happened to have an inductance meter the primary coil inductance would also be useful....

As an aside I managed either 9 or 11 free consecutive free starts a few days ago (I recall it being one off ten, just not which way!). I don't necessarily ascribe this to the 'FACT'-set coils I'm running, probably it's more to do with a overly rich mixture, but it was an interesting and spectacular demonstration to a passenger about how a T could do such things :-)

User avatar

MKossor
Posts: 122
Joined: Sun Jan 06, 2019 7:30 pm
First Name: Mike
Last Name: Kossor
Location: Kenilworth, NJ 07033
MTFCI Number: 22706

Re: A new DIY electronic coil tester.

Post by MKossor » Thu Jan 30, 2020 11:19 pm

Poppie wrote:
Thu Jan 30, 2020 5:35 pm
I took the 5 coils to a friends ECCT and they all failed.
Capacitors Indicated POOR


Neil, the most important detail of the ECCT capacitor test is the capacitor Value; it should read between 0.47uF and 0.56uF. If so, the capacitor does Not need replacing. A Poor result with proper value reading means the leakage is higher than typical but will not adversely effect coil operation. Low capacitor value readings (below 0.47uF) or excessively high value reading (above 0.68uF) warrant replacing the capacitor.


Poppie wrote:
Thu Jan 30, 2020 5:35 pm
TTF indicated 2 led to the right on 4 coils and 3 led right on 1 coil.


TTF to the right of the 0 deg (center) Timing Error you described is Very Typical of HCCT adjusted coils which indicates spark fires LATE and requires HIGHER firing current that Scott was concerned about making Hand Cranking Harder.

Did you ever have your friend adjust your coils in his ECCT for equal and consistent firing Time and give them a try in your car? Do NOT judge coil performance by ECCT to HCCT test comparisons, its like comparing apples and oranges! The only real coil performance comparison is how your engine performs with them in your car on the road.
I-Timer + ECCT Adjusted Coils = Best Model T Engine Performance Possible!
www.modeltitimer.com www.modeltecct.com

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Fri Jan 31, 2020 9:19 am

Luke,

I have been running old version FACT without capacitor tester very successfully. Just looking to upgrade it to your latest version but I am having some difficulty understanding the switch wiring arrangement in your diagram. Is the switch a 2 way 3 pole switch you are using? Thanks John.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Fri Jan 31, 2020 6:06 pm

John,

Pleased to hear you've been using the software (where's the thumbs up icon?!), thanks for letting us know :D

Yes it's meant to be a triple pole two-way switch - not my best diagram I'm afraid. It's simply there to switch the coil to either the FET/H-bridge, or the cap test pins on the Arduino. I agonised for some time over the best way to do the switching, by the best way I mean the simplest for others to reproduce, not sure I achieved that, sorry.

If one continued down this track (rather than using electronic switching of some sort) I have a quad-pole triple throw switch that to my mind would be ideal. This would be centre off, one side to cap test, other side to coil test, the fourth pole being simple power on-off to the whole thing. They're less than $2 and keeps the switches on a completed unit down to two - this one and the press switch.


Poppie
Posts: 56
Joined: Sun Jan 06, 2019 7:33 pm
First Name: Neil
Last Name: Martin
Location: Sydney Australia

Re: A new DIY electronic coil tester.

Post by Poppie » Sat Feb 01, 2020 12:16 am

Luke and Mike K, Thanks for your replies.
Luke,
I do not worry about the coil primary current, as long it is in the range of 1.0 and1.75 on the HCCT meter. My main concern is that the H/T spark fires at the exact same time for all 5 coils at all generated voltages (by varying the cranking speed of the handle). I fire on 16 spots on the flywheeI, I learn't that 50 years ago on my 1st home made MCCT coil tester and when I acquired my KW Wilson HCCT I had to modify
the H/T circuit to make the spark readable.

Mike,
These coils are a friend of mine, they came to me to rectify after a failed to proceed 1915 Model T on the HCCA(America) Bathurst rally here in Australia where I diagnose lack of engine oil. Three litres fixed the (fail to proceed) problem and a replacement coil fixed the engine miss, Hence the readjusted coils as mentioned.
As requested I will check my TT coils in Andrews ECCT and see how they preform. He is over your way at present.
Another Question?? Please.
Why is my firing point retarded and the ECCT/FART system at Zero as per your LED's. Zero to what?
Would it be the fact that on FORD MAGNETO (alternator or AC current) of which the coils were originally
designed for could set at MCCT zero and (ECCT/FACT) 6volt/12volt D/C be advanced when set/tested on the ECCT.
This allows the engine combustion ignition to be set by the hand lever.
Some time back say 3or 4months ago a member did an excellent thread on his own home built HCCT and am wondering if he has reported his experience and knowledge of coil adjustment.
Regards.....Neil.


Poppie
Posts: 56
Joined: Sun Jan 06, 2019 7:33 pm
First Name: Neil
Last Name: Martin
Location: Sydney Australia

Re: A new DIY electronic coil tester.

Post by Poppie » Sat Feb 01, 2020 7:18 am

"Oops"
Line 8
Should have read (FACT)
Line 9 '
of which the coils were originally designed for would be set at MCCT zero and the(.......
Line 10
/DC adjusted coil be advanced........N.

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Sat Feb 01, 2020 5:10 pm

I now have the latest FACT version running with the capacitor tester. I have 13 coils to restore here so did FACT / StroboSpark capacitor comparison check. The results are below which are pleasingly comparable except coil 13. The Strobospark has an analogue meter which is not as easy to read as FACT but I did my best to be as accurate as possible. They all agree capacitor pass / fail but I am unsure why the Strobospark did not read any leakage on coil 13 also the capacitance readings for this coil are very different. I measured it on an external capacitance meter and it was 0.68uf, different again, I suspect this is something to do with the leakage. As I restore these coils I will continue doing FACT / StroboSpark comparisons along the way.
fact strobocomp.png


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Sun Feb 02, 2020 3:02 pm

Neil,

I'd hoped that Mike K was going to respond to your question because I've never seen one of his ECCT's, let alone operated one, so I'm not the best person to ask, sorry.

However I think Mike sets a target time to fire, and all coils are measured against this. If a coil takes a longer or shorter time to fire it will appear either side of the target LED (?).

What this means in practice is that the resultant spark on the engine would be retarded or advanced from the 'ideal' target, all other things being equal.

Does that answer your question? Mike, is that correct?

BTW, I wouldn't correct Line 8, I chuckled over it for some time :lol:

John,

Thanks for putting that data up, and good to see the correlation.

The way I've done the cap/leakage test is fairly crude but should be good enough for this purpose. In some instances it could report things a little differently than another tester might, but in terms of pass/fail I'd be reasonably confident of what it says. Certainly that last coil warrants some investigation.

Slightly puzzled re the penultimate coil though - was that a typo or did it really read 0.005uF on the Strobospark, and the 'FACT' 0.05uF ?


sedalia
Posts: 4
Joined: Sat Feb 22, 2020 5:36 pm
First Name: STEVE
Last Name: OWENS
Location: Newton, IA

Re: A new DIY electronic coil tester.

Post by sedalia » Sat Feb 22, 2020 6:02 pm

Could someone please combine version 0.9.1 (Matt), 14 Jan 2020 and version 0.95 (Luke P), 20 Jan 2020. I would like to have the OLED display with the O-scope and the capacitor test function that would work with this display.
I have tried to do this myself, but my programming ability is very limited.
Thanks
Sedalia

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sat Feb 22, 2020 6:23 pm

Steve,
Yes, I have been planning to do it, but I have been busy. I will try to get it to you in the next few days.

Matt

Update: I am still working on it. Steve I sent you a draft. I am not sure if you saw it. In reality I have not got to the new functions so it is basically the same as the earlier version that I posted.


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Tue Mar 03, 2020 5:26 pm

Steve (and others),

I apologise but I'm still waiting for components to arrive before I do much more on this. They're taking a very long time, I assume it's to do with the virus.

As I don't have an OLED screen the same as Matt's I can't test any changes I'd make to the code, hence it's best that he does that at this point.

I'm keen to utilise a different screen for my next version, as the OLED units seem a little small for this task (?) and typically don't offer control input. Although ordered in January I'm still waiting for that as well as other things...

I also wondered about trying an e-ink display out of an old e-book reader, but there's only so much time so perhaps someone else could give it a go?

User avatar

John Housego
Posts: 17
Joined: Wed Jan 16, 2019 4:44 pm
First Name: John
Last Name: Housego
Location: Aylesbury Bucks UK
Board Member Since: 2007

Re: A new DIY electronic coil tester.

Post by John Housego » Thu Mar 05, 2020 5:10 pm

Well I boxed mine up and decided to use a larger 4 line screen, its been working great! I agree with Luke it needs a larger OLED style screen also I would like to see a way of measuring double sparking so a combination of Luke's and Matts software would be ideal on a larger screen.
Attachments
fact.jpg


sedalia
Posts: 4
Joined: Sat Feb 22, 2020 5:36 pm
First Name: STEVE
Last Name: OWENS
Location: Newton, IA

Re: A new DIY electronic coil tester.

Post by sedalia » Thu Mar 05, 2020 6:14 pm

Is anyone else having noise from the coil scrambling the arduino? Sometime the display goes blank. Other times the arduino needs to be reset.
Steve

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Fri Mar 06, 2020 12:33 am

Yes, Steve I am having the same issue with noise. I believe somewhere here Luke mention using ferrite bead on the wiring.

Bravo John! That looks great! Is that An OLED or LCD display?

Luke and everyone,
I did order a larger 1.3 OLED, but it looks like I received the same display:( I took my tester to a Horseless carriage meeting and asked people twice my age about the display side/readability. They all seem satisfied. Yes it is small, but the numbers are readable. If we go larger how large should we go?

Additionally at the meeting someone had a set of professionally rebuilt coils. These did not seen much use. What I can say is the time to fire is not as consistent as I would think we would want to be. This war one of the worst coils.
0B1A6C19-A0C4-4C35-8BF6-C39CCA660639.jpeg
5BFEEA40-6B0C-4576-BC6E-8B87E55AE491.jpeg
I did notice that the cushion spring seemed to have lots of gap.

The bottle neck for me at the moment is changing the hardware to match Luke’s. That and working 12 hour days.

I can share what I have thus far. (It is missing the tests not shown above.

Enjoy,
Matt


Topic author
Luke
Posts: 154
Joined: Fri Dec 13, 2019 1:04 am
First Name: Luke
Last Name: P
Location: New Zealand

Re: A new DIY electronic coil tester.

Post by Luke » Fri Mar 06, 2020 4:52 pm

John,

Good to see it in a box, and with the 4-line screen. That's what I was going to leave mine at, but Matt's idea of showing the ramp etc is a good one.

It may be possible to have both the LCD and OLED screens running if you'd want - as long as the i2c address of each unit is different, and the Arduino has enough residual memory. In this way you could increase the trace size as it wouldn't be necessary to report figures on the OLED screen.

Otherwise I mentioned that I've had a larger screen on order for a while, not sure how it'd go and until it arrives and I have time to interface it I won't be able to report on that, sorry. Like Matt I've got busy after the christmas break and have somewhat less time right now.

Matt,

I've noticed the longer ttf with coils set via the old method. Your current peak looks about right though.

Given some recent experience I wonder if the target ttf shouldn't be increased a bit from 2m/s to say 2.2m/s. My reasoning is that with some coils 2m/s seems to be right on the edge (late rise of the ramp) and they don't fire as well, particularly at low voltage, than if they have a longer ttf set. The ideal IMV would be to set the coils at the start of their plateau (obviously with a consistent ttf across the four in the car).

I think I've commented on this in the past but as by now many coil sets are unlikely to be from the same batch they may be even more disparate than normal in terms of their operating parameters. Given this I believe it would be better to set them all to the minimum ttf required for the worst coil to operate at 6V. IOW three or less of the coils would be set to slightly longer than their optimum ttf (but still the same numerical value across all four), and one or more at their best minimum point. I hope that makes sense.

To me this is one of the advantages of this tester; especially if operated with a variable PSU the characteristics of individual coils may be assessed and the target parameters adjusted to suit either the car or the coil set (or better, both!).

As some cars will operate on 6V battery only, some 12V, some magneto, and others a mix, and as I've reported some coils may alter their ttf differently at differing voltages, this means the coil set may be better tuned to the specific machine they're to operate on...

Steve,

I did have that issue to a small degree, and I found that running the feed cable to the coil through a random toroid core I had fixed it.

Latterly with the BTS driver it's not been any problem, and particularly if you used minimum length cables between modules etc I suspect it'd all but disappear. If necessary some power side decoupling with 0.1uF caps might assist further but it's not been necessary for me.

FWIW my 'final' version will probably return to using a FET switch, more on that when the full compliment of parts arrive.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Fri Mar 13, 2020 12:31 am

Well, well, well! I hope someone finds this entertaining. Things came to a halt on the weekend for me. The EMI burned out my Adruino last weekend. I bought some coils and a handful more boards.
4CC420A1-E5D1-4439-952A-97669D9CE148.jpeg
Matt

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Tue Apr 07, 2020 2:09 am

Update:
After some work I was able to get the FACT electronics in the box.
closed case
closed case
FACTO 1.jpeg (73.01 KiB) Viewed 1599 times
Case open
Case open
FACT0 2.jpeg (72.63 KiB) Viewed 1600 times
D8955E87-35DE-4D57-85D6-9AD1B4F7099C.jpeg
Here is a shot with a single test oscilloscope (one of three time to fire tests).
06AF80E0-67AB-4641-9665-79E98E34D03F.jpeg
Here is a 50 test ensemble and average time to fire and current:
74DA159D-CAF1-4E8C-B478-4D969B88B216.jpeg
Here is a video of me tuning a set of coils for my car:
https://www.youtube.com/channel/UCLs89j ... ytNiB-jlFQ
(Next time I need to have the camera adjusted so that we can see the top of the coils:)

The code is still a work in progress. If you’re interested in it I can send it to you just sent me an email.

Enjoy,
Matt

User avatar

Charlie B in N.J.
Posts: 299
Joined: Mon Jan 07, 2019 7:40 am
First Name: CHARLIE
Last Name: BRANCA
Location: Brick N.J.
MTFCA Number: 28967
Board Member Since: 2010

Re: A new DIY electronic coil tester.

Post by Charlie B in N.J. » Tue Apr 07, 2020 7:08 am

This post is like a gyro. 100% Greek to me but I want one.
Forget everything you thought you knew.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sun Apr 19, 2020 2:49 am

Charlie, you are funny! It is my goal that this would be simple enough for more people to have and use.

I did get the capacitor test working.

Here it is with a good replacement capacitor with the graph:
A2BE3F52-52F2-4DCE-8C35-6A86A2ECA514.jpeg
And now more details:
408582E6-A7CB-485A-B260-E681F9D5405F.jpeg
Here is a bad capacitor:
C8A8642A-0DF0-4C22-87A0-9472B05C24DE.jpeg
I believe it is helpful to have the graphing function to see the issues.
1A2D0C67-969F-4444-AE66-D122A515C3B3.jpeg
I code is now a bit more refined. I plan to post a updated version soon.

Enjoy;)

Matt

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sun Apr 19, 2020 9:04 pm

For those wanting the code, here it is. I will likely make a few mistakes in this post and edit it if there is any mistakes or things are not clear. When you try this code, please post a response about your experience.

Tests
  • Single Spark Test
    9FE6C316-9E61-4263-A0BA-AACFA240F7A2.jpeg
    Enter the "single_test()" subroutine by pressing the button for less than a second. This test will cause the coil to spark once. This will display the waveform, time to fire and peak current.
  • Multi fire test
    3F98A400-E552-420D-AE74-B80B34FBEDC4.jpeg
    Enter the "multi_test()" subroutine by pressing the button for more than a second, but less than two seconds. Speed of the spark can be adjusted by potentiometer connected to A1 (500-2500 rpm). This test will cause the coil to spark 50 times. After test is over it will give average, minimum, maximum and standard divination of time to fire along with the average current.
  • Multi fire Oscilloscope
    7B0CDED9-F92E-4E9D-910D-4EB7DB839ADD.jpeg
    Enter the "live_o_scope()" subroutine by pressing the button for more than two seconds. Speed of the spark can be adjusted by potentiometer connected to A1 (500-2500 rpm). This test will cause the coil to spark and show the live spark overlapping previous waveforms. Additionally, this gives the average time to fire and max current To leave this test press button again. It gives me a real nice feeling about a coil when I can run it from 500 RPM to 2500 RPM and get the same response.
  • Capacitance Test
    B0459AC0-02BF-4AF5-9362-852243928C91.jpeg
    Enter the "cap_test()" subroutine by closing a switch to connect D5 to ground (dc common). This test will graph the showing the RC time response then give calculated vales.


Pin Connections
Arduino device
Ground OLED ground
+5VDC Vcc
A0 Input for data read from current sensor (5 VDC limit)
A1 Input for RPM_Set control potentiometer (0-5 VDC)
A2 Input from where timer connects to coil (note resistor connects to D13)
A3
A4 To OLED/LCD SDA (if no SDA pin)
A5 To OLED/LCD SCL (if not SCL pin)
A6
A7 Input to measure power 6-12 VDC (R1 ~10 Kohm A7 to ground, R2 20-30 Kohm to input power)
D1
D2
D3
D4
D5 Input Cap Test switch (other side connected to GND)
D6
D7 Output to Solid State Switch (MOSFET) to connect where timer connects to coil
D8 Input Run Test Pushbutton (other side connected to GND)
D9
D10
D11
D12
D13 Output Cap Charge Pin (connect to A2 with a resistor 300-500+ Kohms)

The following code was edited the 27th of May, 2020

Code: Select all


/* The Ford Arduino Coil Tester ('FACT'), a prog to test Model T 'buzz coils'

   Released under the GNU General Public Licence (https://www.gnu.org/licenses/gpl-3.0.html)

   -----------------------------------------------------------------------------

   Version 0.7 written by Luke P and Robert R, Christchurch, New Zealand, 17th December 2019.

    (1) turn on Model T coil for [interval] milliseconds (typically 4-5 msec)
    (2) measure the current max value
    (3) measure time from 0 to max val (rise/ramp time)
    (4) measure time from max val to min val (decay time)
    (5) calc and present results via USB serial

   Makes use of fast ADC read (set presecale to 16, giving read times of ~ 24 us)
   Leading on from initial proof of concept to usable code

   -----------------------------------------------------------------------------

   Version 0.8 (Luke P), 28th Dec 2019

   Collect data much as for 0.7, tidy code, sep into functions for:
     (a) Multi-firing of coil as if running in vehicle at specific RPM
         This in order to check consistency between firings and present results
     (b) Single fire as before (and present results)

   Utilise switch press longevity for multi-fire or single-fire tests

   -----------------------------------------------------------------------------

   Version 0.81 (Luke P), 29th Dec 2019

   Bugfix - need to reset results array at start of multi-test otherwise it only outputted every 2nd trial
   Alter calculation of rpmdelay to incorporate interval time at start

   -----------------------------------------------------------------------------

   Version 0.88 (Luke P), 29th Dec 2019

   Calculate some stats on results (incl affect on degrees of rotation) and display
   Bugfix where using rpmdelay to calc degree variation (should be rpm)
   Intro discard variable to discard first few results from multi-fire test that are often higher
   than following results. Prob due to coil 'warming up from rest' these could skew stat calcs

   -----------------------------------------------------------------------------

    Version 0.89 (Luke P), 30th Dec 2019

    Ability to use CT or ACS712 for current reading
    Some changes to stats calcs / display

     -----------------------------------------------------------------------------

    Version 0.89.1 (Luke P), 2 Jan 2020

   Bugfix - multiple 60000/rpm by 2 for rpm delay, not divide!

    -----------------------------------------------------------------------------

   Version 0.9 (Luke P), 2 Jan 2020

   Include LCD setup and output data to LCD
   This uses a lot more memory so begin on some code optimisation to reduce
   Set missfire variable
   RPM to global and std at 900RPM

   -----------------------------------------------------------------------------

   Version 0.9.1 (Luke P), 3 Jan 2020

   Bugfixes incl testnum after multi-fire, memory optimisation contd

   -----------------------------------------------------------------------------

   Version 0.92 (Luke P), 3 Jan 2020

   Include capacitor test and leakage / tracking resistance check
 *  *
   -----------------------------------------------------------------------------

   Version 0.93 (Luke P), 13 Jan 2020

   Shorted turns (ringing) test via 0,47uF, reactance test.

   -----------------------------------------------------------------------------

   Version 0.94 (Luke P), 15 Jan 2020

   ESR test for capacitors (check able to deliver requisite current)

   -----------------------------------------------------------------------------

   Version 0.95 (Luke P), 20 Jan 2020

   Remove short/ESR tests as probably unnecessary and complicated
   Add input voltage reading - eventually use to track & ID correct firing time
   per given input voltage

   Version 0.96 (Matt), 27 May 2020

   Added code for .96" OLED.  This code also is set up for graphing current.  Set numReadings = 150 (170 caused trouble).

  Pin Connections
  Arduino device
  Ground OLED ground
  +5VDC Vcc
  A0 Input for data read from current sensor (5 VDC limit)
  A1 Input for RPM_Set control potentiometer (0-5 VDC)
  A2 Input from where timer connects to coil (note resistor connects to D13)
  A3
  A4 To OLED/LCD SDA (if no SDA pin)
  A5 To OLED/LCD SCL (if not SCL pin)
  A6
  A7 Input to measure power 6-12 VDC (R1 ~10 Kohm A7 to ground, R2 20-30 Kohm to input power)
  D1
  D2
  D3
  D4
  D5 Input Cap Test switch (other side connected to GND)
  D6
  D7 Output to Solid State Switch (MOSFET) to connect where timer connects to coil
  D8 Input Run Test Pushbutton (other side connected to GND)
  D9
  D10
  D11
  D12
  D13 Output Cap Charge Pin (connect to A2 with a resistor 300-500+ Kohms)

   PLEASE NOTE: This code does multiple and single fire test with the oscilloscope.
   The goal is to get a matching set of coils with a time to fire of; 3.5ms at 6V, and 2ms at 12V,

*/

#define ver 0.96

// Include any required libraries

// Uncomment following for LCD *******************************************************************************************
//#include <LiquidCrystal_I2C.h> // presently utilising the library from https://github.com/johnrickman/LiquidCrystal_I2C
// #define LCD=1; //define to correctly select correct code

//Initialise the LCD
//LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2); // set the address, columns and line
// END LCD

// Uncomment following for OLED ******************************************************************************************
#include <Adafruit_SSD1306.h>
#define OLED_RESET    4
#define SCREEN_WIDTH 128 //OLED Width
#define SCREEN_HEIGHT 32 //OLED Height
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// END OLED **************************************************************************************************************

#define cap_swPin 5 // input pin for cap/coil test switch. Low for cap
#define outPin 7 //output pin to ss relay for coil
#define swPin 8 //input pin for switch, normally high
#define cap_chg_pin 13 //for capacitor test

//setup for fast ADC read
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

#define numReadings 120     //max number of values in array, 150 = approx 3ms (112 limit of display)
#define numTests 50         //number of test cycles in multi test
#define interval 4000       // interval at which to turn on (microseconds)
//#define source_volts 1010   // source voltage for cap test (should check this at start)
#define source_volts 1023   // source voltage for cap test (should check this at start)

//setup for switch reading
#define short_in  60
#define meduim_in  600
#define long_in  2000

// voltmeter + resistor divider details
//#define R1 32400.0 // resistor to ground
//#define R2 120000.0 // resistor to input supply
#define R1 10000.0 // resistor to ground
#define R2 20000.0 // resistor to input supply

//setup for switch reading
unsigned long swTimer = 0;
unsigned long RPM_time_new = 0;
unsigned long RPM_time_old = 0;
boolean swPrevState = HIGH;
boolean swPresentState;
boolean cap_swPinState;
int ttf;  // time to fire

// voltmeter + resistor divider details
float input_voltage = 0.0;
float interim_val = 0.0;

// Set global variables etc
unsigned long time_now = 0;  // use long in case micros count gets big
unsigned long time_gone = 0;
//byte testnum = 0; // use byte for mem reduce, assume testnum < 255
float mVolts = 0.0;
float amps = 0.0;
int rpm = 900;  // set desired 'rpm' for multitest - facsimile of single coil running at this speed
int A0_max = 512; // set to zero current

//set variables for collect_data function array
unsigned int analogVals[numReadings][2]; // array name & columns
unsigned int x = 0; // initialise array input

//set variables for multi_test function array
unsigned int resultVals[numTests][2]; // array name
unsigned int y = 0; // initialise array input

/*
  //create the omega symbol to print to LCD
  // ohm sign
  byte omega[8] =
  {
  B00000,
  B01110,
  B10001,
  B10001,
  B10001,
  B01010,
  B11011,
  B00000
  }; // creating the omega (ohms) symbol, thanks to https://www.hackmeister.dk/2010/08/custom-lcd-characters-with-arduino/
*/

//begin setup for program proper

void setup()
{
  pinMode(swPin, INPUT_PULLUP); // set the switch pin as input and apply resistor to +5
  pinMode(outPin, OUTPUT);// define output pin
  pinMode(cap_chg_pin, OUTPUT);// define output pin
  pinMode (cap_swPin, INPUT_PULLUP);
  sbi(ADCSRA, ADPS2); //more stuff for fast ADC read
  cbi(ADCSRA, ADPS1);
  cbi(ADCSRA, ADPS0);
  Serial.begin(115200); // open the serial port
  //Serial.println (F("Setup 15")); //For testing ***************************************************************************************************

  // let's get the input voltage to display
  int a7val = analogRead(A7);
  interim_val = (a7val * 5.0) / 1024.0;
  input_voltage = interim_val / (R1 / (R1 + R2));

  //read potentiometer and set rpm
  rpm = analogRead(A1) / 50 * 100 + 500; // perform a read to clear register (comment out if no Potentiometer) units 100 rpm

  // begin display detail
  /* // The following for OLED comment if not used
    lcd.init(); // setup the LCD for printing
    lcd.backlight(); // turn on LCD backlight
    lcd.print (F("FACT v")); // initial text on lcd display at startup
    lcd.print (ver); // prints version number from define
    lcd.print (F(" LP_20")); // build number
    lcd.setCursor (0, 1);
    lcd.print (F("Test @"));
    lcd.print (input_volts, 1); // print voltage to 1 decimal place
    lcd.print (F(" volts"));
    lcd.blink();
    lcd.createChar(0, omega);
  */

  // The following for OLED comment if not used
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(WHITE, BLACK);        // Draw white text
  display.setCursor(0, 0);            // Start at top-left corner
  display.println(F("Ford Arduino Coil Tst"));
  display.setTextSize(2);             // Draw 2X-scale text
  //display.setTextColor(SSD1306_WHITE, SSD1306_BLACK);
  display.print(F("FACT v")); display.println (ver);
  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.print(F("Vin= ")); display.print (input_voltage); display.println(F(" volts")); // display input voltage

  //display.println(F(".96 OLED OSCILLOSCOPE"));
  display.display();
}

//--- Function to fire coil once and collect data ---//
void single_fire_data()
{
  //int A0_max = 512; // set to zero current
  A0_max = 512; // set to zero current
  int A0_new = 0;
  mVolts = 0.0;
  ttf = 0;
  analogRead(A0); // perform a read to clear register
  digitalWrite(outPin, HIGH); //set outPin high to power coil for time interval
  time_now = micros();

  for (byte i = 0; i < numReadings; i++) // test only for the number in the array
  {
    analogVals[i][0] = analogRead(A0); // read pin 0 volts (which is actually current from CT) and input value to array col 1
    analogVals[i][1] = (micros() - time_now); // time since start of loop (thus sample time), input to array col 2
    if (input_voltage > 9) // for 12 volts (for 9-12 volts)
    {
      analogVals[i][0] = (analogVals[i][0] + analogRead(A0)) / 2; //take a second reading and average the two (this helps fit on OLED screen)
    }
    else // for 6 volts (for less than 9 volts)
    {
      analogVals[i][0] = (analogVals[i][0] + analogRead(A0)); //take a third reading and average the three (this helps fit on OLED screen)
      analogVals[i][0] = (analogVals[i][0] + analogRead(A0)) / 3;
    }
    A0_new = analogVals[i][0];
    if (A0_new > A0_max && (A0_new > 580)) //detect current increasing and write to 'maxval'
    {
      A0_max = A0_new;
      ttf = analogVals[i][1];
    }
  }

  digitalWrite(outPin, LOW); // reset outPin to low and turn off power to coil

  /*
    // uncomment two lines for ACS712
    mVolts = (A0_max / 1024.0) * 5000.0; // raw analog read val to millvolts
    //amps = ((mVolts - 2500.0)/185.0); // millivolts to amps (utilise scale factor for ACS sensor range 5A chip
    amps = ((mVolts - 2500.0) / 100.0); // millivolts to amps (utilise scale factor for ACS sensor range 20A chip
    //amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range 30A chip
  */
}

void single_test()
{
  single_fire_data();
  // uncomment two lines for ACS712
  mVolts = (A0_max / 1024.0) * 5000.0; // raw analog read val to millvolts
  //amps = ((mVolts - 2500.0)/185.0); // millivolts to amps (utilise scale factor for ACS sensor range 5A chip
  amps = ((mVolts - 2500.0) / 100.0); // millivolts to amps (utilise scale factor for ACS sensor range 20A chip
  //amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range 30A chip
  // write results to OLED
  display.clearDisplay();
  for (x = 1; x < numReadings; x++) {
    // digital value of max current in =660; 5= digital values of current range/#lines = 150/32 = 4.68
    display.drawLine(x + 10 , ((660 - analogVals[x - 1][0])) / 4.68, x + 10 , (660 - (analogVals[x][0])) / 4.68, WHITE);
  }
  // draw the axis, lables and tick marks
  for (int y = 0; y < 5; y++) {
    display.drawFastHLine(7, y * (32) / 7 + 9, 3, WHITE);
  }
  for (int x = 0; x < 6; x++) {
    display.drawFastVLine(x * 23 + 10, 29, 3, WHITE);
  }
  display.setTextColor(WHITE, BLACK);
  display.setTextSize(1);
  display.setCursor(0, 24);
  display.println("0");
  display.setCursor(0, 8);
  display.println("5");

  //Yellow text at top
  //display.fillRect(0, 0,  127 , 14, WHITE);
  display.setTextColor(WHITE, BLACK);
  display.drawFastHLine(10, 31,  128 - 10, WHITE);
  display.drawFastVLine(10, 8,  32, WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.print("TTF=");
  display.print(float(ttf) / 1000.00);
  display.print("ms ");
  display.print(F("Imax="));
  display.print(amps);
  display.println(F("A"));
  display.display();

  Serial.println (F(" ***"));
  Serial.print (F("Total cycle time (to fire) = "));
  Serial.print (float(ttf) / 1000.00); // convert to ms
  Serial.println (F("msec"));
  Serial.print (F("Maximum current = "));
  Serial.print (amps);
  Serial.println (F("A"));
  Serial.println();

  /* uncomment for LCD
    // write results to LCD
    lcd.clear();
    lcd.setCursor (0, 0); //set cursor first col, first row
    lcd.print (F("Single test #"));
    lcd.print (test);
    lcd.setCursor (0, 1); //set cursor first col, second row
    lcd.print (F("TTF="));
    lcd.print (float(ttf) / 1000.00); // convert to ms
    lcd.print (F("ms"));
    // DEBUG    Serial.println (maxv);
    // DEBUG    Serial.println (mVolts);
    Serial.print (F("Maximum current = "));
    Serial.print (amps);
    Serial.println (F("A"));
    Serial.println();
    lcd.print(F(" "));
    lcd.print (amps);
    lcd.print(F("A"));
  */
}

//--- Function to do a multi-fire test on a coil as if running in vehicle ---//

void multi_test()
{
  // do some calcs on rpm as needed for delay (four-stroke, so single cyl ign fires every second cycle therefore div 2)
  byte rpmdelay = ((60000 / rpm) * 2) - (interval / 1000); // attempts to roughly account for time in data_collect process ('interval') - byte means not much slower than 500RPM
  float ttf_sum = 0;
  float ttf_std_dev = 0;
  float ttf_msec = 0;
  float ttf_mean = 0;
  float results_var = 0;
  float ttf_max = 0;
  float ttf_min = 10;
  float ttf_max_current = 0;
  byte discard = 2; // first few results from multi-test show higher ttf than normal, discard to give more accurate result
  int miss = 0;

  for (byte i = 0; i < numTests; i++) // Load data into array
  {
    single_fire_data();
    resultVals[i][0] = ttf; //1st col of result array gets ttf
    resultVals[i][1] = A0_max; // 2nd col of result array gets max voltage (to determine current)
    delay(rpmdelay); // sets 'rpm' delay between each test firing,
  }

  for (byte i = discard; i < numTests; i++) // get results from each test and print to serial
  {
    ttf_msec = ((resultVals[i][0]) / 1000.00); // convert to ms
    ttf_sum += ttf_msec;
    ttf_mean = (ttf_sum / (numTests - discard)); //get mean of array results for ttf ***using testnum cost of discard
    if (ttf_msec > ttf_max)
    {
      ttf_max = ttf_msec;
    }
    if (ttf_msec < ttf_min)
    {
      ttf_min = ttf_msec;
    }
    // uncomment two lines for ACS712
    mVolts = ((resultVals[i][1]) / 1024.0) * 5000.0; // raw analog read val to millvolts
    //amps = ((mVolts - 2500.0)/185.0); // millivolts to amps (utilise scale factor for ACS sensor range 5A chip
    amps = ((mVolts - 2500.0) / 100.0); // millivolts to amps (utilise scale factor for ACS sensor range 20A chip
    //amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range 30A chip
    if (amps < 0.2) // if we have a low current it suggests firing issues
    {
      miss = miss + 1; //count number of missfires
    }
    if ( amps > ttf_max_current)
    {
      ttf_max_current = amps;
    }

    /*Serial.print (F("Maximum current = "));
      Serial.print (amps);
      Serial.println (F("A"));
      Serial.print (F("*** Test number "));
      Serial.print (i);
      Serial.println (F(" ***"));
      Serial.print (F("Total cycle time (to fire) = "));
      Serial.print (ttf_msec);
      Serial.println (F("msec"));*/
  }
  for (byte i = discard; i < numTests; i++) // get results from each test and print to serial
  {
    results_var += pow(ttf_mean - ttf_msec, 2); // get variance
    ttf_std_dev = sqrt(results_var / (numTests - discard)); // get std deviation ***using testnum cost of discard instead numTests
  }

  //OLED Print
  display.clearDisplay();
  display.setCursor(0, 0);
  display.print(F("M="));
  display.print(ttf_mean);
  display.print(F("ms  ("));
  display.print(ttf_min);
  display.print(F("-"));
  display.print(ttf_max);
  display.println(F(")"));
  display.setCursor(0, 8);
  display.print(F("SD="));
  display.print(ttf_std_dev);
  display.print(F("; Dwell ="));
  display.print((ttf_max - ttf_min) / (float(60000 / rpm) / 360));
  display.println((char)167); // let's print the degree symbol!
  display.setCursor(0, 16);
  display.print(F("Max Current ="));
  display.print(ttf_max_current);
  display.println(F("amps"));
  display.setCursor(0, 24);
  display.print(rpm);
  display.print(F(" RPM "));
  display.print(miss);
  display.println(F(" MISFIRES   "));
  display.display();// now that the display buffer is built, display it
  /*
    Serial.println ();
    Serial.print (F("Mean time to fire = "));
    Serial.print (ttf_mean);
    Serial.println (F("mSec"));
    Serial.print (F("Standard deviation = "));
    Serial.print (ttf_std_dev);
    Serial.println (F("mSec"));
    Serial.print (F("Results Max = "));
    Serial.print (ttf_max);
    Serial.println (F("mSec"));
    Serial.print (F("Results Min = "));
    Serial.print (ttf_min);
    Serial.print (F("mSec"));
    Serial.print (rpm);
    Serial.print (F(" RPM "));
    if (miss > 0)
    {
      Serial.print (miss);
      Serial.println (F(" MISFIRES!  "));
    }
    else
    {
      Serial.println();
    }
    // DEBUG    Serial.println (maxv);
    // DEBUG    Serial.println (mVolts);
    Serial.print (F("Range = "));
    Serial.print (ttf_max - ttf_min);
    Serial.println (F("mSec"));
    Serial.print (F("Degrees of variation at "));
    Serial.print (rpm);
    Serial.print (F(" RPM = "));
    Serial.print ((ttf_max - ttf_min) / (float(60000 / rpm) / 360));
    Serial.println (F(" degree(s)"));
  */

  /* uncomment to use LCD
    // LCD print
    lcd.clear();
    lcd.setCursor (0, 0); //set cursor first col, first row
    lcd.print (F("M="));
    lcd.print (ttf_mean);
    lcd.print(F("ms"));
    lcd.setCursor (9, 0); //set cursor 9th col, first row
    lcd.print (F("SD="));
    lcd.print (ttf_std_dev);
    lcd.setCursor (0, 1); //set cursor first col, second row
    if (miss>0)
    {
    lcd.print(F("***MISFIRE***"));
    }
    else
    {
    lcd.print(ttf_min);
    lcd.print(F("-"));
    lcd.print(ttf_max);
    lcd.print(F("  "));
    lcd.print ((ttf_max - ttf_min) / (float(60000 / rpm) / 360));
    lcd.print ((char)223); // let's print the degree symbol!
    Serial.print (F("Maximum current = "));
    Serial.print (amps);
    Serial.println (F("A"));
    Serial.println();
    lcd.print(F(" "));
    lcd.print (amps);
    lcd.print(F("A"));
    }
  */


  /*  if (miss>0)
    {
      lcd.print(F("***MISFIRE***"));

    }
    else
    {
      lcd.print(ttf_min);
      lcd.print(F("-"));
      lcd.print(ttf_max);
      lcd.print(F("  "));
      lcd.print ((ttf_max - ttf_min)/(float(60000 / rpm)/360));
      lcd.print ((char)223); // let's print the degree symbol!
      lcd.print(F(" "));
      lcd.print (amps);
      lcd.print(F("A"));
    }
  */
}



//the following function works like a time laps o-scope
void live_o_scope()
{
  int RPM_live = 0;
  float ttf_sum = 0;
  float ttf_std_dev = 0;
  float ttf_msec = 0;
  float ttf_mean = 0;
  float results_var = 0;
  float ttf_max = 0;
  float ttf_min = 10;
  float ttf_max_current = 0;
  float I_sum = 0;
  float I_mean = 0;
  byte discard = 2; // first few results from multi-test show higher ttf than normal, discard to give more accurate result
  int miss = 0;
  mVolts = 0.0;

  display.clearDisplay();
  display.setTextColor(WHITE, BLACK);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println(F("Multifire O-Scope"));

  // draw the axis, lables and tick marks
  for (int y = 0; y < 5; y++) {
    display.drawFastHLine(7, y * (32) / 7 + 9, 3, WHITE);
  }
  for (int x = 0; x < 6; x++) {
    display.drawFastVLine(x * 23 + 10, 29, 3, WHITE);
  }
  display.setTextColor(WHITE, BLACK);
  display.setTextSize(1);
  display.setCursor(0, 24);
  display.println("0");
  display.setCursor(0, 8);
  display.println("5");
  //Yellow text at top
  //display.fillRect(0, 0,  127 , 14, WHITE);
  display.setTextColor(WHITE, BLACK);
  display.drawFastHLine(10, 31,  128 - 10, WHITE);
  display.drawFastVLine(10, 8,  32, WHITE);
  RPM_time_old = micros();
  for (int i = 0; i < 50 ; i++)
  {
    RPM_time_old = RPM_time_new ;
    RPM_time_new = micros();
    RPM_live = 120000000 / (RPM_time_new - RPM_time_old);
    single_fire_data();
    ttf_msec = (ttf / 1000.00); // convert to ms
    ttf_sum += ttf_msec;
    // uncomment two lines for ACS712
    mVolts = (A0_max / 1024.0) * 5000.0; // raw analog read val to millvolts
    //amps = ((mVolts - 2500.0) / 66.0); // millivolts to amps (utilise scale factor for ACS sensor range
    //amps = ((mVolts - 2500.0)/185.0); // millivolts to amps (utilise scale factor for ACS sensor range 5A chip
    amps = ((mVolts - 2500.0) / 100.0); // millivolts to amps (utilise scale factor for ACS sensor range 20A chip
    //amps = ((mVolts - 2500.0)/66.0); // millivolts to amps (utilise scale factor for ACS sensor range 30A chip
    // uncomment for CT
    // amps = (maxv * .0222); // millivolts to amps (utilise scale factor for CT
    I_sum += amps;
    I_mean = (I_sum / i);
    ttf_mean = (ttf_sum / i);

    /* uncomment for serial
      // write results to serial port
      for (x = 1; x <= 127; x++) {
      Serial.println (analogVals[x - 1][0]);
      }
      Serial.print (F("*** live O scope "));
      Serial.println();*/

    // write results to OLED
    display.setCursor(0, 0);
    display.print(F("t="));    display.print(ttf_mean);    display.print(F("ms"));
    display.print(F(" I="));    display.print(I_mean);    display.print(F("A "));
    display.println(RPM_live);  display.setCursor(108, 7);   display.print(F("rpm"));
    for (x = 1; x <= 112; x++)
    {
      // digital value of max current in =660; 5= digital values of current range/#lines = 150/32 = 4.68
      display.drawLine(x + 10 , ((660 - analogVals[x - 1][0])) / 4.68, x + 10 , (660 - (analogVals[x][0])) / 4.68, WHITE);
    }
    display.display();
  }

  /*
    display.setTextSize(1);
    display.setCursor(0, 0);
    display.print("sp test TTF=");
    display.print(float(ttf) / 1000.00);
    display.print("ms ");
    display.print(F("Imax="));
    display.print(amps);
    display.println(F("A"));
  */


}

void cap_test()
//--- Function to check capacitor value and resistance ---//
{
  unsigned long new_time = 0;
  mVolts = 0;
  int cap_time = 0;
  int r_volts = 0;
  //long r_val = 487000; // charge resistor value in ohms
  long r_val = 370000; // charge resistor value in ohms (should be in the few 100kohm range)
  unsigned long sample_time;
  sample_time = r_val * .00000047 * 1000000 / 30; // sample_time = r_val * 47 uF * 1000(to change to microsec) / 30 (location on graph to cross 63%)
  float cap_val = 0.0;
  long leak = 0;
  digitalWrite(cap_chg_pin, LOW);
  //OLED Display comment out
  display.clearDisplay();
  display.setTextColor(WHITE, BLACK);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println(F("Capacitor Test"));
  display.println(F("in progress..."));
  display.display();


  // LCD Print
  /*
    lcd.clear();
    lcd.setCursor (0, 0); //set cursor first col, first row
    lcd.print (F("Capacitor test"));
    lcd.setCursor (0, 1); //set cursor first col, second row
    lcd.print (F("in progress..."));
  */

  // OLED Print *************************Add*****************

  delay (90); //ensure the cap is discharged via charge pin low
  digitalWrite(cap_chg_pin, HIGH); // use digi pin 13 to charge the cap via a resistor
  time_now = millis();
  for (int i = 0; i < 500; i++)
  {
    new_time = micros();
    time_gone = millis() - time_now;
    mVolts = analogRead (A2);  //use analog pin A2 to read volts across unknown cap

    //Serial.print (time_gone);
    //Serial.print (" - ");
    //Serial.println (mVolts);

    if (mVolts <= (source_volts * 0.63212055882))
    {
      cap_time = time_gone; // time at which capacitor charge has reached 63.2% (one time constant)source_volts
    }


    if (i < numReadings)
    {
      analogVals[i][0] = mVolts;
      analogVals[i][1] = 1023 * (1 - exp(-i / 30.0));
      Serial.print (time_gone);
      Serial.print (" - ");
      Serial.println (mVolts);
    }
    while (micros() - new_time < sample_time); //delay time

  }
  display.clearDisplay();
  //display.setCursor(0, 8);
  //display.println("5");
  // draw the axis, lables and tick marks
  //draw 63% line
  for (int y = 0; y < 30; y++) {
    //display.drawFastHLine(7, y * (32) / 7 + 9, 3, WHITE);
    display.drawFastHLine(10 + y * 4, 16,  1, WHITE);
    display.drawFastHLine(10 + y * 6, 8,  2, WHITE);
    display.drawLine(y * 5 + 10 , ((1360 - analogVals[y * 5 - 1][1])) / 43, y * 5 + 10 , (1360 - (analogVals[y * 5][1])) / 43, WHITE);
  }
  for (int x = 0; x < 12; x++) { //draw the upper and lower limits
    display.drawFastVLine(30 + 10, 8 + 2 * x, 1, WHITE); //30 T constant + 10 offset
  }
  display.setTextColor(WHITE, BLACK);
  display.drawFastHLine(10, 31,  128 - 10, WHITE);
  display.drawFastVLine(10, 8,  32, WHITE);

  display.setTextColor(WHITE, BLACK);
  display.setTextSize(1);
  display.setCursor(0, 0);   display.println(F("Capacitor Test"));
  display.setCursor(0, 12);   display.println("63%");
  //display.setCursor(20, 24);  display.println(F(".47uF"));
  display.display();
  delay (1000);
  for (int i = 1; i < numReadings; i++) {
    // digital values of current range 1024 /#lines 24= 43; digital value input range 1024 + 43 * display range 24 * offset 8 = 1360
    display.drawLine(i + 10 , ((1360 - analogVals[i - 1][0])) / 43, i + 10 , (1360 - (analogVals[i][0])) / 43, WHITE);
    //display.drawLine(i + 10 , ((1360 - analogVals[i - 1][1])) / 43, i + 10 , (1360 - (analogVals[i][1])) / 43, WHITE);
    display.display();
  }
  cap_val = ((float)cap_time / r_val) * 1000.0;
  leak = mVolts * r_val / (source_volts - mVolts); // calculate the resistance of the unknown resistance (leakage) in voltage divider cct

  if (leak < 0)
  {
    leak = 20000000; // if we get variable source volts then could go negative - may need to say 're-test!'?
  }

  display.setTextColor(BLACK, WHITE);
  display.setCursor(90, 0);
  if (leak > 10000000 && cap_val > 0.4 && cap_val < 0.6)
  {
    display.println(F(" PASS "));
  }
  else
  {
    display.println(F(" FAIL "));
  }
  if (analogVals[1][0] > 10) {
    display.fillRect(79, 16,  128 , 32, BLACK);
    display.setTextColor(WHITE, BLACK);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   display.setCursor(0, 0);
    display.setCursor(80, 16);
    display.print(cap_val);   display.println(F(" uF"));
    display.setCursor(80, 24);
    display.print(leak / 1000000); display.println(F(" Mohm"));
  }
  else {
    display.setCursor(20, 12);
    display.println("Capacitor Shorted");
    display.setCursor(20, 20);
    display.println("Please open points");
  }
  digitalWrite(cap_chg_pin, LOW);


  display.display();
  delay (6000);


  //OLED Display comment out
  //display.clearDisplay();
  display.fillRect(0, 8,  128 , 28, BLACK);
  display.setTextColor(WHITE, BLACK);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   display.setCursor(0, 0);
  display.println(F("Capacitor Test"));
  display.setCursor(0, 8);
  //display.print(F("C = "));
  display.print(cap_val);    display.println(F("uF Ideal .4-.6 uF"));

  //LCD Printing
  //lcd.clear();

  Serial.print (cap_val);
  if (cap_val > 0.4 && cap_val < 0.6)
  {
    //OLED Display comment out
    display.setCursor(0, 24);
    display.println(F(" PASS uF; "));

    /*  // LCD Print Uncoment to use LCD
      Serial.print (F("uF"));
      Serial.println (F(" **OK** :)"));
      lcd.setCursor (0, 0);
      lcd.print (F("C="));
      lcd.print (cap_val);
      lcd.print (F("uF *OK*"));
    */
  }
  else
  {
    //OLED Display comment out
    display.setCursor(0, 24);
    display.setTextColor(BLACK, WHITE); display.print(F(" FAIL ")); display.setTextColor(WHITE, BLACK); display.println(F("uF; "));
    // LCD Print
    /*
      lcd.setCursor (0, 0);
      lcd.print (F("C="));
      lcd.print (cap_val);
      lcd.print (F("uF *BAD*"));
    */
  }
  display.setCursor(0, 16); display.print(leak / 1000); display.println(F(" Kohm Ideal > 10M"));
  Serial.print (leak);
  display.setCursor(60, 24);
  if (leak > 10000000)  //test if > 10 Mohms
  {
    display.println(F("PASS ohm"));
    Serial.println (F(" **OK** :)"));
    /*  // LCD Print
      lcd.setCursor (0, 1);
      lcd.print (F("R="));
      lcd.print ((leak) / 1000000);
      lcd.print ("M");
      lcd.write (0);
      lcd.print (F(" *OK*"));
    */
  }
  else
  {
    display.setTextColor(BLACK, WHITE); display.print(F(" FAIL ")); display.setTextColor(WHITE, BLACK); display.println(F("ohm"));
    Serial.print (F(" ohms"));
    Serial.println (F(" **BAD** :-("));
    /* //LCD Print
      lcd.setCursor (0, 1);
      lcd.print (F("R="));
      lcd.print ((leak) / 1000000);
      lcd.print ("M");
      lcd.write (0);
      lcd.print (F(" *BAD*"));
    */
  }
  display.setTextColor(BLACK, WHITE);
  display.setCursor(90, 0);
  /*if (leak > 10000000 && cap_val > 0.4 && cap_val < 0.6)
    {
    display.println(F(" PASS "));
    }
    else
    {
    display.println(F(" FAIL "));
    }  */
  display.display();
  digitalWrite(cap_chg_pin, LOW);
}


//--- Main loop, detect short press of switch to call single fire, long press to call multi-fire ---//


void loop()
{
  //read potentiometer and set rpm
  rpm = analogRead(A1) / 50 * 100 + 500; // perform a read to clear register (comment out if no Potentiometer) units 100 rpm
  //display.setCursor(80, 24); display.print(rpm);  display.println(F("rpm ")); display.display();// now that the display buffer is built, display it

  cap_swPinState = digitalRead(cap_swPin);
  if (cap_swPinState == HIGH)
  {
    swPresentState = digitalRead(swPin); // what's the switch doing
    if (swPresentState != swPrevState) // if not same as prev then...
    {
      delay(20); //debounce delay
      swPresentState = digitalRead(swPin); // check again after debounce delay to be sure
      if (swPresentState == LOW) // if switch is still on then it's real
      {
        swTimer = millis(); // set timer from on
      }
      if (swPresentState == HIGH) // sw not on now
      {
        unsigned long currentMillis = millis();
        if ((currentMillis - swTimer >= short_in) && !(currentMillis - swTimer >= meduim_in)) // SHORT PB PRESS
        {
          Serial.println (F("- Single shot test -"));
          //lcd.clear();
          //lcd.print(F("Single shot test")); // use F() macro to reduce memory use
          //testnum = (testnum + 1);
          single_test();
        }

        if ((currentMillis - swTimer >= meduim_in) && !(currentMillis - swTimer >= long_in)) // MEDUIM PB PRESS
        {

          // the meduim long press was detected
          Serial.println ();
          Serial.println (F("- Multi-fire test -"));
          Serial.println ();


          //LCD Print
          /*
            lcd.clear();
            lcd.print(rpm);
            lcd.print(F("RPM multifire"));
            lcd.setCursor (0, 1);
            lcd.print(F("test in progress"));
          */

          //OLED Print
          display.clearDisplay();
          display.setTextColor(WHITE, BLACK);
          display.setTextSize(1);
          display.setCursor(0, 0);
          display.print(rpm);
          display.println(F("RPM multifire"));
          display.setCursor(0, 8);
          display.println(F("test in progress"));
          display.display();// now that the display buffer is built, display it

          multi_test();
        }

        if ((currentMillis - swTimer >= long_in)) // LONG PB PRESS
        {
          // the long press was detected
          Serial.println (F("- Multi-fire test O-scope"));
          Serial.println ();

          //read potentiometer and set rpm
          rpm = analogRead(A1) / 100 * 200 + 500; // perform a read to clear register (comment out if no Potentiometer)

          //OLED Print
          live_o_scope();
        }
      }
      swPrevState = swPresentState; // has state changed?
    }
  }


  if (cap_swPinState == LOW)
  {
    digitalWrite(cap_chg_pin, LOW);
    swPresentState = digitalRead(swPin); // what's the switch doing
    if (swPresentState != swPrevState) // if not same as prev then...
    {
      delay(20); //debounce delay
      swPresentState = digitalRead(swPin); // check again after debounce delay to be sure
      if (swPresentState == LOW) // if switch is still on then it's real
      {
        swTimer = millis(); // set timer from on
      }
      if (swPresentState == HIGH) // sw not on now
      {
        unsigned long currentMillis = millis();
        //if ((currentMillis - swTimer >= 60) && !(currentMillis - swTimer >= 600)) // sw short press
        if ((currentMillis - swTimer >= short_in) && !(currentMillis - swTimer >= meduim_in)) // sw short press
        {
          Serial.println (F("Cap test"));
          cap_test();
        }
      }
      swPrevState = swPresentState; // has state changed?
    }
  }
}
Last edited by Matt in California on Wed May 27, 2020 10:58 pm, edited 2 times in total.


barrym
Posts: 3
Joined: Wed May 27, 2020 6:59 pm
First Name: Barry
Last Name: Moyer
Location: Langdon

Re: A new DIY electronic coil tester.

Post by barrym » Wed May 27, 2020 7:07 pm

Matt & Luke,

Many thanks for all of the work you have put into this project.

I noticed 2 issues with the code that was posted on Apr 19.

Item 1: capturing more samples than what was intended
292: while (micros() < time_now + interval)
293: {
294: for (byte i = 0; i < numReadings; i++) // test only for the number in the array
I think the original intention was to capture 4msec of data using the while loop on line 292.
The for loop on line 294 forces the capture of all 'numReadings' (120) which captures 8msec
of data on my Arduino Nano. I suggest line 292 to 294 become:
int i = 0;
while (i < numReadings && micros() < time_now + interval)
{
and then increment 'i' at the end of the block.
...
i++;
}

Item 2: array index out of bounds
336: for (x = 1; x <= numReadings; x++) {
337: // digital value of max current in =660; 5= digital values of current range/#lines = 150/32 = 4.68
338: display.drawLine(x + 10 , ((660 - analogVals[x - 1][0])) / 4.68, x + 10 , (660 - (analogVals[x][0])) / 4.68, WHITE);
The analogVals has a dimension of 'numReadings' which allows index values from 0..numReadings-1. The loop
on line 336 allows the 'x' to *equal* numReadings which is used as a dimension value on line 338 and is out of range.
The 'x <= numReadings' should be changed to 'x < numReadings' similar to line 803.

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Wed May 27, 2020 10:57 pm

Barry,
I was hoping that someone would take a detailed look at the code that I hobbled together. Your response shows that you paid attention to details and yes I (not Luke) left some things for you to find.

Item 1: capturing more samples than what was intended
Thanks for pointing this out. Each sample represents on pixel of screen on the OLED display. Rather than take the time into account I decided to just delete that. The only risk is that it may look like a double spark, but I think with the auto adjust scaling for different voltages it should be okay.

Item 2: array index out of bounds
You are correct I replaced 'x <= numReadings' should be changed to 'x < numReadings'

Please note I made the changes and edited the post from April 19th. My thought is if I post the code too many times it will get very confusing if it is only minor changes.

Also, JohnH tested the code and told me it seemed like the voltage display (at start up) was off. I just doubled checked and for me it was .3 volts high.

I have really enjoyed this project, but my goals for the summer are to get moving with rebuilding a chassis for my next project. Please keep me posted and I am happy to try to get this code in better shape. If I find time, I would like to make a PCB for the Nano, so that this project would be much easier for the average model T hobbyist to enjoy.

Barry, please feel free to post photos of your tester.

Matt


sedalia
Posts: 4
Joined: Sat Feb 22, 2020 5:36 pm
First Name: STEVE
Last Name: OWENS
Location: Newton, IA

Re: A new DIY electronic coil tester.

Post by sedalia » Sat May 30, 2020 6:56 pm

I finally finished my coil tester today. I’d like to thank everyone that contributed to this project. Now I need to get my spare coils setup.
Steve
20200530_170649.jpg
20200530_170555.jpg
20200530_170451.jpg

User avatar

Matt in California
Posts: 383
Joined: Sun Jan 06, 2019 5:42 pm
First Name: Matt
Last Name: G
Location: California
MTFCA Number: 30697

Re: A new DIY electronic coil tester.

Post by Matt in California » Sat May 30, 2020 9:25 pm

Steve,
It puts a big smile on my face to see your set up! Nicely done!

I like the box that you put it in! I think it was a great idea to use the breakout board with the Aurdino Nano. It was a real hassle for me to try to solder and fit everything in. I didn’t even accomplish the capacitor test in my main unit, I did it separately because I had too many issues with EMI... so I would say that yours is better than mine. What are you using to trigger your coil (i.e. MOSFET)?

I really need to make PCB to avoid the spaghetti wiring. wonder how your graphs look, I get a good amount of noise likely because of the wiring picking up EMI.

Great job!

Matt


sedalia
Posts: 4
Joined: Sat Feb 22, 2020 5:36 pm
First Name: STEVE
Last Name: OWENS
Location: Newton, IA

Re: A new DIY electronic coil tester.

Post by sedalia » Sun May 31, 2020 12:44 pm

I also have noise on my display. I believe it is usable as it is. I’ll try to setup some coils and see how it goes.
I’m driving my coil with a dc solid state relay.
Steve
Attachments
20200531_111844.jpg
20200531_111904.jpg
20200531_112150.jpg
20200531_112343.jpg

Post Reply Previous topicNext topic