Jump to content

Arduino stuff/ programing/so cheap


flyingbrick

Recommended Posts

  • Replies 416
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

You can change TEMP_BAND from 2 to 1 to lower the deadband, and then it will be 'faster'

you can also remove or lower the delay, as it only sends stuff when stuff changes, so wont bombard the serial port as much probably

Link to comment
Share on other sites

or even change the defines to this:

 

#define TEMP_BAND     2
#define TEMP_MINOR    24
#define TEMP_GENERAL  28
#define TEMP_DIRE     32

#define INCR_MINOR    (TEMP_MINOR)
#define INCR_GENERAL  (TEMP_GENERAL)
#define INCR_DIRE     (TEMP_DIRE)

#define DECR_IDLE     (TEMP_MINOR - TEMP_BAND)
#define DECR_MINOR    (TEMP_GENERAL - TEMP_BAND)
#define DECR_GENERAL  (TEMP_DIRE - TEMP_BAND)

and it will fire the error as soon as it happens, but wont 'clear' it until it's gone lower by the deadband

  • Like 1
Link to comment
Share on other sites

I'm after some info for a raspberry pi build I am doing. The code is all written and is working well. Is counting units per minute and displaying the previous minutes production. I'm very lucky my brother is a programmer. I've been learning a bit of python along the way. 

The problem I'm having is the input into the pi is basically a on off switch, I am getting a lot of false triggers or button pushes, I have tried adding debounce time etc. The system worked fine on the bench but as soon as took it out to the machine it must have picked up alot of electronic noise from the machine. I'm picking I need to add some resistors to stabilize the pin. The program is looking for a pull down input.

Anyone got any ideas how I could improve this further? Or make the tiger more stable.

 

Cheers rusty!!

Link to comment
Share on other sites

mechanical switches bounce, thats just the nature of them. Add SW debouncing by checking the signal is valid for 30mS or something, or do hardware debouncing with a 100nF capacitor across the switch and a weak pullup? 10k or bigger maybe? i dont usually do HW debouncing as it costs more than a few lines of code so might pay to google a bit....

  • Like 1
Link to comment
Share on other sites

OK, so i have started to blend 2 codes together and found something odd.
The temp' reading won't update-read a new value unless one of the other input pins is changing state & performing an action based on it.
May i send someone the code for them to see what's going on & tell me what i did wrong?   I suspect it's something to do with needing brackets or a "while run" type thing.  But i really don't know.

Link to comment
Share on other sites

Not a snowballs change in hell of me figuring out how to use google drive.  Google really does need to be dragged outside, beaten & shot.  And the corpse thrown in a volcano while people chant & beat drums.  How they can make something that unintuitive i don't know.  Who thought having buttons that aren't visible & don't have any known function was a good idea?  It's like point & click lucky dip & not every action is repeatable.  Just like things i build in real life....

Ok the thing in the spoiler should be code that worked.

 

#include <max6675.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

int soPin = 12;// SO=Serial Out
int csPin = 13;// CS = chip select CS pin
int sckPin = A1;// SCK = Serial Clock pin

MAX6675 thermoSensor(sckPin, csPin, soPin);

int thermoSensorNewVal, thermoSensorOldVal;  // an attempt to add zoomcats potentometer test to thermosensor

#define TEMP_BAND     2
#define TEMP_MINOR    60
#define TEMP_GENERAL  75
#define TEMP_DIRE     90
#define INCR_MINOR    (TEMP_MINOR + TEMP_BAND)
#define INCR_GENERAL  (TEMP_GENERAL + TEMP_BAND)
#define INCR_DIRE     (TEMP_DIRE + TEMP_BAND)

#define DECR_IDLE     (TEMP_MINOR - TEMP_BAND)
#define DECR_MINOR    (TEMP_GENERAL - TEMP_BAND)
#define DECR_GENERAL  (TEMP_DIRE - TEMP_BAND)

enum warningStates_t {IDLE = 0, WARN_MINOR, WARN_GENERAL, WARN_DIRE};
warningStates_t curState, oldState;

int buttonPause = 3;
int buttonVolPlus = 2;
int buttonVolMinus = 4;

# define ACTIVATED LOW

boolean isPlaying = false;

void setup() {
  Serial.begin(9600);  
  Serial.println("Robojax MAX6675");

# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]

# define ACTIVATED LOW

boolean isPlaying = false;


  pinMode(buttonPause, INPUT);
  digitalWrite(buttonPause,HIGH);
  // initialize the button pin as a input:
  pinMode(buttonVolPlus, INPUT);
  digitalWrite(buttonVolPlus,HIGH);
  // initialize the button pin as a input:
  pinMode(buttonVolMinus, INPUT);
  digitalWrite(buttonVolMinus,HIGH);
  // initialize the button pin as a input:
 

  mySerial.begin (9600);
  delay(1000);
  execute_CMD(0x06, 0, 0x12);   // Set the volume between 0-30 (0x00~0x30)//
  execute_CMD(0x03, 0, 0x0002);    //file to play at system start-up//
  isPlaying = true;

 

}


void loop()
{
  thermoSensorNewVal = thermoSensor.readCelsius();

  if (thermoSensorNewVal != thermoSensorOldVal) {
    Serial.print(" C = ");
    Serial.print(thermoSensorNewVal);

    thermoSensorOldVal = thermoSensorNewVal;
  }

  switch (curState) {
    default:            curState = IDLE;  /* should never happen, but good practice to have a default */
    case IDLE:          if (thermoSensorNewVal >= INCR_MINOR)   curState = WARN_MINOR;    break;

    case WARN_MINOR:    if (thermoSensorNewVal <= DECR_IDLE)    curState = IDLE;
      if (thermoSensorNewVal >= INCR_GENERAL) curState = WARN_GENERAL;  break;

    case WARN_GENERAL:   if (thermoSensorNewVal <= DECR_MINOR)   curState = WARN_MINOR;
      if (thermoSensorNewVal >= INCR_DIRE)    curState = WARN_DIRE;     break;

    case WARN_DIRE:     if (thermoSensorNewVal <= DECR_GENERAL) curState = WARN_GENERAL;  break;
  }

  if (curState > oldState) {
    // Increased temp warnings
    switch (curState) {
      case WARN_MINOR:    playThermalExceed();   break;
      case WARN_GENERAL:  playHeatLevelCrit(); break;
      case WARN_DIRE:     playMeltdownImminent();    break;
      default:            break;  /* should never happen, but good practice to have a default */
    }
  }

  if (curState < oldState) {
    // Decreased temp warnings
    switch (curState) {
      case IDLE:          playHeatNominal();/* Could do an 'all clear' message here */    break;
      case WARN_MINOR:       break;
      case WARN_GENERAL:  playHeatModerate(); break;
      default:            break;  /* should never happen, but good practice to have a default */
        }
  }

  oldState = curState;
  delay(200);

 if (digitalRead(buttonPause) == ACTIVATED)
  {
    if(isPlaying)
    {
      pause();
      isPlaying = false;
    }
    else
    {
      isPlaying = true;
      play();
    }
  }
 
 if (digitalRead(buttonVolPlus) == ACTIVATED)
  {
    if(isPlaying)
    {
      setVolumeUp();
    }
  }

  if (digitalRead(buttonVolMinus) == ACTIVATED)
  {
    if(isPlaying)
    {
      setVolumeDown();
    }
  }
} // end of loop?

void playThermalExceed()
{
  Serial.println(" Thermal Exceeded Triggered Once ");
  execute_CMD(0x03, 0, 0x000c);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playHeatLevelCrit()
{
  Serial.println(" Heat Critical Triggered Once ");
  execute_CMD(0x03, 0, 0x000a);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playMeltdownImminent()
{
  Serial.println(" Meltdown Triggered Once ");
  execute_CMD(0x03, 0, 0x000b);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playHeatModerate()
{
  Serial.println(" HeatModerate Once ");
  execute_CMD(0x03, 0, 0x000d);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playHeatNominal()
{
  Serial.println(" HeatNominal Triggered Once ");
  execute_CMD(0x03, 0, 0x000e);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void pause()
{
  execute_CMD(0x0E,0,0);
  delay(500);
}

void play()
{
  execute_CMD(0x0D,0,1);
  delay(500);
}

void playNext()
{
  execute_CMD(0x01,0,1);
  delay(50);
}

void playPrevious()
{
  execute_CMD(0x02,0,1);
  delay(50);
}

void setVolumeUp()
{
  execute_CMD(0x04, 0, 1); // Set the volume (0x00~0x30)
  delay(50);
}

void setVolumeDown()
{
  execute_CMD(0x05, 0, 1); // Set the volume (0x00~0x30)
  delay(50);
}

void setVolume(int volume) //Specify volume using code. Not applicable to the normal button interface.
{
  execute_CMD(0x06, 0, volume); // Set the volume (0x00~0x30)
  delay(2000);
}

void execute_CMD(byte CMD, byte Par1, byte Par2)
// Excecute the command and parameters
{
  // Calculate the checksum (2 bytes)
  word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
  // Build the command line
  byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
                            Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte
                          };
  //Send the command line to the module
  for (byte k = 0; k < 10; k++)
  {
    mySerial.write( Command_line[k]);
  }
}

Link to comment
Share on other sites

And now for combining it with something that doesn't work well when i added that code Ned helped with.

 

#include <max6675.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

int soPin = 12;// SO=Serial Out
int csPin = 13;// CS = chip select CS pin
int sckPin = A1;// SCK = Serial Clock pin

MAX6675 thermoSensor(sckPin, csPin, soPin);

int thermoSensorNewVal, thermoSensorOldVal;  // an attempt to add zoomcats potentometer test to thermosensor

#define TEMP_BAND     2
#define TEMP_MINOR    60
#define TEMP_GENERAL  75
#define TEMP_DIRE     90
#define INCR_MINOR    (TEMP_MINOR + TEMP_BAND)
#define INCR_GENERAL  (TEMP_GENERAL + TEMP_BAND)
#define INCR_DIRE     (TEMP_DIRE + TEMP_BAND)

#define DECR_IDLE     (TEMP_MINOR - TEMP_BAND)
#define DECR_MINOR    (TEMP_GENERAL - TEMP_BAND)
#define DECR_GENERAL  (TEMP_DIRE - TEMP_BAND)

enum warningStates_t {IDLE = 0, WARN_MINOR, WARN_GENERAL, WARN_DIRE};
warningStates_t curState, oldState;

int buttonPause = 3;
int buttonVolPlus = 2;
int buttonVolMinus = 4;

# define ACTIVATED LOW

boolean isPlaying = false;

const int  buttonPin = 6;    // the pin that the pushbutton is attached to
const int  buttonPin2 = 7;    // the pin that the pushbutton is attached to
const int  buttonPin3 = 8;    // the pin that the pushbutton is attached to
const int  buttonPin4 = 9;    // the pin that the pushbutton is attached to
const int  buttonPin5 = 5;
// the pin that the pushbutton is attached to
// Variables will change:
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button
int buttonPushCounter2 = 0;   // counter for the number of button presses
int buttonState2 = 0;         // current state of the button
int lastButtonState2 = 0;     // previous state of the button
int buttonPushCounter3 = 0;   // counter for the number of button presses
int buttonState3 = 0;         // current state of the button
int lastButtonState3 = 0;     // previous state of the button
int buttonPushCounter4 = 0;   // counter for the number of button presses
int buttonState4 = 0;         // current state of the button
int lastButtonState4 = 0;     // previous state of the button
int buttonPushCounter5 = 0;   // counter for the number of button presses
int buttonState5 = 0;         // current state of the button
int lastButtonState5 = 0;     // previous state of the button


void setup() {
  Serial.begin(9600);  
  Serial.println("Robojax MAX6675");

# define Start_Byte 0x7E
# define Version_Byte 0xFF
# define Command_Length 0x06
# define End_Byte 0xEF
# define Acknowledge 0x00 //Returns info with command 0x41 [0x01: info, 0x00: no info]

# define ACTIVATED LOW

boolean isPlaying = false;


pinMode(buttonPause, INPUT);
digitalWrite(buttonPause,HIGH);
// initialize the button pin as a input:
pinMode(buttonVolPlus, INPUT);
digitalWrite(buttonVolPlus,HIGH);
// initialize the button pin as a input:
pinMode(buttonVolMinus, INPUT);
digitalWrite(buttonVolMinus,HIGH);
// initialize the button pin as a input:
 
pinMode(buttonPin, INPUT);
// initialize the button pin as a input:
pinMode(buttonPin2, INPUT);
// initialize the button pin as a input:
pinMode(buttonPin3, INPUT);
// initialize the button pin as a input:
pinMode(buttonPin4, INPUT);
// initialize the button pin as a input:
pinMode(buttonPin5, INPUT);
// initialize the button pin as a input:

  mySerial.begin (9600);
  delay(1000);
  execute_CMD(0x06, 0, 0x12);   // Set the volume between 0-30 (0x00~0x30)//
  execute_CMD(0x03, 0, 0x0002);    //file to play at system start-up//
  isPlaying = true;

 

}


void loop()
{
  thermoSensorNewVal = thermoSensor.readCelsius();

  if (thermoSensorNewVal != thermoSensorOldVal) {
    Serial.print(" C = ");
    Serial.print(thermoSensorNewVal);

    thermoSensorOldVal = thermoSensorNewVal;
  }

  switch (curState) {
    default:            curState = IDLE;  /* should never happen, but good practice to have a default */
    case IDLE:          if (thermoSensorNewVal >= INCR_MINOR)   curState = WARN_MINOR;    break;

    case WARN_MINOR:    if (thermoSensorNewVal <= DECR_IDLE)    curState = IDLE;
      if (thermoSensorNewVal >= INCR_GENERAL) curState = WARN_GENERAL;  break;

    case WARN_GENERAL:   if (thermoSensorNewVal <= DECR_MINOR)   curState = WARN_MINOR;
      if (thermoSensorNewVal >= INCR_DIRE)    curState = WARN_DIRE;     break;

    case WARN_DIRE:     if (thermoSensorNewVal <= DECR_GENERAL) curState = WARN_GENERAL;  break;
  }

  if (curState > oldState) {
    // Increased temp warnings
    switch (curState) {
      case WARN_MINOR:    playThermalExceed();   break;
      case WARN_GENERAL:  playHeatLevelCrit(); break;
      case WARN_DIRE:     playMeltdownImminent();    break;
      default:            break;  /* should never happen, but good practice to have a default */
    }
  }

  if (curState < oldState) {
    // Decreased temp warnings
    switch (curState) {
      case IDLE:          /* Could do an 'all clear' message here */    break;
      case WARN_MINOR:    playThermalExceed();   break;
      case WARN_GENERAL:  playHeatLevelCrit(); break;
      default:            break;  /* should never happen, but good practice to have a default */
        }
  }

  oldState = curState;

  // read the pushbutton input pin:
  buttonState = digitalRead(buttonPin);

  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter++;
      playEngineEnabled();
    } else {
      // if the current state is LOW then the button went from on to off:
      playShuttingDown();
    }
    // Delay a little bit to avoid bouncing
    delay(20);
  }
  // save the current state as the last state, for next time through the loop
  lastButtonState = buttonState;

  // read the pushbutton input pin:
  buttonState2 = digitalRead(buttonPin2);

  // compare the buttonState to its previous state
  if (buttonState2 != lastButtonState2) {
    // if the state has changed, increment the counter
    if (buttonState2 == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter2++;
      playLightAmpEngaged();
    } else {
      // if the current state is LOW then the button went from on to off:
      playButtonOff();
    }
    // Delay a little bit to avoid bouncing
    delay(20);
  }
  // save the current state as the last state, for next time through the loop
  lastButtonState2 = buttonState2;

  buttonState3 = digitalRead(buttonPin3);
  // compare the buttonState to its previous state
  if (buttonState3 != lastButtonState3) {
    // if the state has changed, increment the counter
    if (buttonState3 == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter++;
      playLightAmp2Engaged();
    } else {
      // if the current state is LOW then the button went from on to off:
      playButtonOff();
    }
    // Delay a little bit to avoid bouncing
    delay(20);
  }
  // save the current state as the last state, for next time through the loop
  lastButtonState3 = buttonState3;

  // read the pushbutton input pin:
  buttonState4 = digitalRead(buttonPin4);

  // compare the buttonState to its previous state
  if (buttonState4 != lastButtonState4) {
    // if the state has changed, increment the counter
    if (buttonState4 == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter4++;
      playEXcamEngaged();
    } else {
      // if the current state is LOW then the button went from on to off:
      playButtonOff();
    }
    // Delay a little bit to avoid bouncing
    delay(20);
  }
  // save the current state as the last state, for next time through the loop
  lastButtonState4 = buttonState4;

    // read the pushbutton input pin:
  buttonState5 = digitalRead(buttonPin5);

  // compare the buttonState to its previous state
  if (buttonState5 != lastButtonState5) {
    // if the state has changed, increment the counter
    if (buttonState5 == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter5++;
      playPhoneChargePort();
    } else {
      // if the current state is LOW then the button went from on to off:
      playButtonOff();
    }
    // Delay a little bit to avoid bouncing
    delay(20);
  }
  // save the current state as the last state, for next time through the loop
  lastButtonState5 = buttonState5;

 if (digitalRead(buttonPause) == ACTIVATED)
  {
    if(isPlaying)
    {
      pause();
      isPlaying = false;
    }else
    {
      isPlaying = true;
      play();
    }
  }

 if (digitalRead(buttonVolPlus) == ACTIVATED)
  {
    if(isPlaying)
    {
      setVolumeUp();
    }
  }

  if (digitalRead(buttonVolMinus) == ACTIVATED)
  {
    if(isPlaying)
    {
      setVolumeDown();
    }
  }
} // end of loop?

void playThermalExceed()
{
  Serial.println(" Thermal Exceeded Triggered Once ");
  execute_CMD(0x03, 0, 0x000c);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playHeatLevelCrit()
{
  Serial.println(" Heat Critical Triggered Once ");
  execute_CMD(0x03, 0, 0x000a);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playMeltdownImminent()
{
  Serial.println(" Meltdown Triggered Once ");
  execute_CMD(0x03, 0, 0x000b);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playHeatModerate()
{
  Serial.println(" HeatModerate Once ");
  execute_CMD(0x03, 0, 0x000d);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void playHeatNominal()
{
  Serial.println(" HeatNominal Triggered Once ");
  execute_CMD(0x03, 0, 0x000e);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(500);
}

void pause()
{
  execute_CMD(0x0E,0,0);
  delay(500);
}

void play()
{
  execute_CMD(0x0D,0,1);
  delay(500);
}

void playNext()
{
  execute_CMD(0x01,0,1);
  delay(50);
}

void playPrevious()
{
  execute_CMD(0x02,0,1);
  delay(50);
}

void setVolumeUp()
{
  execute_CMD(0x04, 0, 1); // Set the volume (0x00~0x30)
  delay(50);
}

void setVolumeDown()
{
  execute_CMD(0x05, 0, 1); // Set the volume (0x00~0x30)
  delay(50);
}

void setVolume(int volume) //Specify volume using code. Not applicable to the normal button interface.
{
  execute_CMD(0x06, 0, volume); // Set the volume (0x00~0x30)
  delay(2000);
}

void playEngineEnabled()
{
  execute_CMD(0x03, 0, 0x0006);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(1500);
}

void playLightAmpEngaged()
{
  execute_CMD(0x03, 0, 0x0004);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(2200);
}

void playLightAmp2Engaged()
{
  execute_CMD(0x03, 0, 0x0005);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(2500);
}

void playEXcamEngaged()
{
  execute_CMD(0x03, 0, 0x0007);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(2500);
}

void playShuttingDown()
{
  execute_CMD(0x03, 0, 0x0003);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(600);
}

void playPhoneChargePort()
{
  execute_CMD(0x03, 0, 0x0009);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(1500);
}

void playButtonOff()
{
  execute_CMD(0x03, 0, 0x0008);    //file between 0-2999 in main folder. Doesn't love folders.//
  delay(400);
}

void execute_CMD(byte CMD, byte Par1, byte Par2)
// Excecute the command and parameters
{
  // Calculate the checksum (2 bytes)
  word checksum = -(Version_Byte + Command_Length + CMD + Acknowledge + Par1 + Par2);
  // Build the command line
  byte Command_line[10] = { Start_Byte, Version_Byte, Command_Length, CMD, Acknowledge,
                            Par1, Par2, highByte(checksum), lowByte(checksum), End_Byte
                          };
  //Send the command line to the module
  for (byte k = 0; k < 10; k++)
  {
    mySerial.write( Command_line[k]);
  }
}

Link to comment
Share on other sites

Also.  Is the reason this works with a pair of double A batteries but the arduino fires all the coils at once something to do with ground float?  And how would i fix it?957193043_circuitcoilinsulatedgate.jpg.72e9c91edade88e833e7b14c09e91fbf.jpg

Forgot to say the arduino has 'fast shitty diodes' on the output pins.

Think i toyed with a heavy resistor from the arduino ground to main ground in the past but it wasn't happy?  can't remember.

Link to comment
Share on other sites

59 minutes ago, IvyMike said:

Random guess: try prefixing " int thermoSensorNewVal, thermoSensorOldVal;" with "volatile".

Also, does the arduino share a common ground with the 12V boost converter?

Shares earth via 330ohm resistor.  Much less it doeens't function right.

Link to comment
Share on other sites

On your schematic it connects to the boost converter + via a 330 Ohm resistor, states grounds are separate. Is that what you meant? Grounds should never be coupled using resistors and all elements of a circuit should be tied to a common ground. 

Also, I'm a bit dubious about you tying the output of each FET/IGBT to ground behind a diode, I'd get rid of them.

I'm pretty certain most ECUs run low side drivers i.e. place the IGBT after the coil so it grounds the coil. I think right now, without the use of a bootstrap circuit (something to ensure that Vg is always higher than Vs) you've got some funky stuff going on as the inductive kickback will overwhelm in the input signal. Somehow you've managed to get it to latch up each gate using those resistors but it definitely doesn't stand a chance doing what you want it to with the IGBTs signal input being tied to ground via diodes.

Fuck it, this is roughly how it should look:

Untitled.png.fb6764e7b62344a6c24bb76f4e04b3ff.png

This will invert the signal but you can just negate that in software (Coil fires from high to low). Might be worth protecting Vcc with a diode on the IGBT side.

EDIT: Also, I forgot to add a resistor between the driver FET and Vcc. Right now it'll just short and explode.

  • Thanks 1
Link to comment
Share on other sites

Swapping 'int' to 'int volatile' would compile but did the same refusal to read & print temp unless something else in the system changed.

As for the coils getting pos+ feed in that last diagram.  That's a legacy of when i tried coil on plug igniter things (which worked) but for some reason when i swapped those out for soemthing else, it wouldn't spark if the igbt were on the low side.  Not enough volts to trip them maybe?

Seems i fixed the thermal reading code by added a random "Serial.print ( C = ) at the end of the loop for the resetting thermal value & add a 0.5 second delay (i hate that, it seems noobsh but then i am new...).

Link to comment
Share on other sites

Good to hear. Might be better off flushing the buffer if that's the issue.

The only reasons I can think of that would stop the coil from firing are, as you said, not enough volts or you placed some form of resistance after the IGBT. Typically the gate needs to be at least 4V higher than the emitter with an IGBT.

Link to comment
Share on other sites

  • 2 weeks later...

why are you still dicking around with this? just buy a speeduino board, and start writing code... those ignition drivers all work etc as well as give you lots of other inputs you're going to need...

or you doing it purely as an exercise on how to drive coils/learn something? I dont understand why you are using a fet to drive an IGBT to drive a coil, when you can just use a fet to drive the coil

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...