Voltage Leaking back to controller.

LesJones

Joined Jan 8, 2017
3,570
Hi sghioto, Although you managed to get MN107 to confirm that the 12 volt input on the coaxial power connector to the Arduino drops to zero when the ignition switch is off I suspect that something is holding the +5 volt rail up when the ignition is off. The long time it seems to take before applying power to the Arduino makes it startup correctly seems to rule out the possibility of it being caused capacitors on the Arduino board. Before the mosfet driver was used the the PWM signal would have held the 5 volt rail up when the ignition switch was off but with the mosfet driver that should not be possible. I have asked twice for the 5 volt rail to be checked after the ignition switch was set to off but have not yet had an answer.

Les.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
Hi sghioto, Although you managed to get MN107 to confirm that the 12 volt input on the coaxial power connector to the Arduino drops to zero when the ignition switch is off I suspect that something is holding the +5 volt rail up when the ignition is off. The long time it seems to take before applying power to the Arduino makes it startup correctly seems to rule out the possibility of it being caused capacitors on the Arduino board. Before the mosfet driver was used the the PWM signal would have held the 5 volt rail up when the ignition switch was off but with the mosfet driver that should not be possible. I have asked twice for the 5 volt rail to be checked after the ignition switch was set to off but have not yet had an answer.

Les.
Arduino will not reset even if its completely disconnected from the power supply and all wires removed from the bread board. Funny thing is the more I screw with this the better it gets. Time to reset is getting less and less since I first started. It also gets worse the more I mess with it. First thing in the AM I was able to start it 3 times without issue. Then I had to use the reset button which works very well. Progressive use of the system will increase the time it takes to reset by itself.

I'm starting to think this board may be damaged from lots of miss wiring and shorting things out. I will probably be ordering a new one just to rule that out.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
Can you program a RESET when the board is first powered back on?
I have been playing around with programing a reset but no luck so far. It appears that when doesn't run, it doesent run any code at all. Consequently It wont run code to reset it. The good news is, I at least have a way resetting it with a mechanical relay on start up. I could use the reset pin if need be. Bad news is I would have to make an external 5V power supply. Not too difficult but more to go wrong.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
Why? You have 5 volts available on the Arduino. You can try this simple circuit using a mosfet to reset the micro.
View attachment 247867
I was thinking a circuit could be made to do that. But those circuits are well beyond me. So I did verify that even with the board not reset I do have 5V output available to do something like this. I will have to get a 100K resister and the 1uf cap so it will take me a couple of days. But can you tell me how this circuit works. My understanding of the reset pin is that is has to be brought down to 0 for a min of 2 msec. Some of the examples Ive seen initialise the reset in code which I cant do.
 

sghioto

Joined Dec 31, 2017
2,416
I will have to get a 100K resister and the 1uf cap so it will take me a couple of days. But can you tell me how this circuit works.
When power is first applied C1 is essentially a short circuit which turns on Q3 pulling the reset pin to ground until C1 has charged sufficiently, then Q3 turns OFF. When power is disconnected C1 discharges through R2 and R1 so it's ready for the next power ON sequence.
 

djsfantasi

Joined Apr 11, 2010
7,913
Arduino will not reset even if its completely disconnected from the power supply and all wires removed from the bread board. Funny thing is the more I screw with this the better it gets. Time to reset is getting less and less since I first started. It also gets worse the more I mess with it. First thing in the AM I was able to start it 3 times without issue. Then I had to use the reset button which works very well. Progressive use of the system will increase the time it takes to reset by itself.
I’m having a hard time understanding how an Arduino won’t reset when all power is removed? How is that even possible?

Please explain what you mean by reset?
 

Thread Starter

MB107

Joined Jul 24, 2016
154
I’m having a hard time understanding how an Arduino won’t reset when all power is removed? How is that even possible?

Please explain what you mean by reset?
I wish I could tell you. From what I read in some of the other forums, one person described pressing the reset button as the same as pulling the cable out of the board. I pulled the cable and all the other wires going to the fan and it still wouldn't reset. But who knows, I have been very abusive to this board. Maybe the board has a 0.1uf cap built into it that I shorted out. Lets see what happens when I get the new board.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
How do you know that it hasn’t reset?
This particular fan has a fail safe mode. If it doesent see a PWM signal it will just ramp up to full speed. That's what was happening and by pressing the reset button on the board I was able to get control of the fan. But I cant press a reset button every time I start the car. So getting it to reset by itself is what the cap does. You can also tell bu the LED's on the board.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
Hi sghioto, Although you managed to get MN107 to confirm that the 12 volt input on the coaxial power connector to the Arduino drops to zero when the ignition switch is off I suspect that something is holding the +5 volt rail up when the ignition is off. The long time it seems to take before applying power to the Arduino makes it startup correctly seems to rule out the possibility of it being caused capacitors on the Arduino board. Before the mosfet driver was used the the PWM signal would have held the 5 volt rail up when the ignition switch was off but with the mosfet driver that should not be possible. I have asked twice for the 5 volt rail to be checked after the ignition switch was set to off but have not yet had an answer.

Les.
Sorry Les two people ased the same question and it was answered in post 11. It's under 1 in less than 1 sec. down to .1mv in about 10 seconds.
 

djsfantasi

Joined Apr 11, 2010
7,913
This particular fan has a fail safe mode. If it doesent see a PWM signal it will just ramp up to full speed. That's what was happening and by pressing the reset button on the board I was able to get control of the fan. But I cant press a reset button every time I start the car. So getting it to reset by itself is what the cap does. You can also tell bu the LED's on the board.
Sorry, but this description seems to indicate that reset is working as designed. What appears to be happening is that the sketch isn’t functioning properly and either gets stuck sending s 100% PWM signal (thus appearing as if the sketch has lost control) or there is a logic error in the sketch whereby it hangs and never sends a PWM signal.

In either case, have you considered a software problem and looked at the code? Can you post the code here so we can look at it.
 

LesJones

Joined Jan 8, 2017
3,570
Re post #34 In post #11 you answered the question about the 12 volt input to the Arduino on the coaxial power connector.
I asked (Twice.) about the +5 volt output from the Arduino board (Which supplies Vcc to the Atmega328p.) This 5 volt output is available on the row of connectors marked V in the bottom right corner of the board. Here is some information on your Arduino that shows all the connections and also a schematic of the board.

Les.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
Re post #34 In post #11 you answered the question about the 12 volt input to the Arduino on the coaxial power connector.
I asked (Twice.) about the +5 volt output from the Arduino board (Which supplies Vcc to the Atmega328p.) This 5 volt output is available on the row of connectors marked V in the bottom right corner of the board. Here is some information on your Arduino that shows all the connections and also a schematic of the board.

Les.
In post 11 the 5V output was measured on the row of connectors marked V. I actually never measured it at the coaxial connector. At the coaxial connector it should be ~13.8V but I never measured it there. My power supply is set to 13.8V. I see you asked about the 5V buss and sghioto asked about the coax voltage. I though you were both asking the same thing but the actual voltage was measured on the 5V rail. So I never really answered sghioto's question. I answered yours. Sorry about the confusion.
 

LesJones

Joined Jan 8, 2017
3,570
That information eliminates my theory that something was holding the +5 volts at some intermediate voltage between 0 and 5 volts when the ignition switch was off. I was suspecting that you were using some other I/O pins on the Arduino connected to something else and that may have been feeding power power back into the Arduino. I now think that maybe the ignition switch is not providing a clean switch on and sghioto's solution of holding the reset low with a capacitor until the +5 volt rail is stable is overcoming the problem.

Les.
 

Thread Starter

MB107

Joined Jul 24, 2016
154
Sorry, but this description seems to indicate that reset is working as designed. What appears to be happening is that the sketch isn’t functioning properly and either gets stuck sending s 100% PWM signal (thus appearing as if the sketch has lost control) or there is a logic error in the sketch whereby it hangs and never sends a PWM signal.

In either case, have you considered a software problem and looked at the code? Can you post the code here so we can look at it.
Have I considered a software problem, absolutely. The problem is when it doesn't reset it will not even get into the code.

C-like:
#include <PWM.h>

// Note for low frequency < 31Hz,the high resolution pwmWriteHR() must be used with 16 bit PWM Value

//For the RoboRed only pins 9 and 10 can be used with 16 bit resolution


int sensorPin = A0;

int FAN = 9;

int LED = 13;

int sensorVal;

int16_t PWMVal;

int32_t frequency = 10;


void setup() {

  // put your setup code here, to run once:

  pinMode(sensorPin, INPUT);

  Serial.begin(9600);

  InitTimersSafe();


  //sets the frequency for the specified pin

  bool success = SetPinFrequencySafe(FAN, frequency);

 

  //if the pin frequency was set successfully, pin 13 turn on. Pin 13 can be used to light an LED etc.

  if(success) {

    pinMode(LED, OUTPUT);

    digitalWrite(LED, HIGH);   

  }


}


void loop() {

  // put your main code here, to run repeatedly:

  //this code prints sensor value to the console

  //Serial.println(sensorVal);

  //delay(1000);


  //read sensor value and set upper limit cap

  sensorVal = analogRead(sensorPin);

  if(sensorVal >1000){

    sensorVal = 1000;

  }


  //map and assign pwm values to the fan output 0 to 65535 corresponds to 0 to 100%

  PWMVal = map(sensorVal, 550, 1000, 6000, 65535);


  //set 550 as out cutout or cut in limit where the fan switches from off to the lower PWM limit

  if(sensorVal <550){

    PWMVal = 0;

  }


  //write the PWM value to the pwm output pin

  pwmWriteHR(FAN, PWMVal);


  //Serial.println(sensorVal);

  //Serial.println(PWMVal);

  //delay(1000);
}
 
Last edited by a moderator:

LesJones

Joined Jan 8, 2017
3,570
I an VERY poor at C programming so someone else will be better to comment on the software. (I would have written it in assembler and used an Attiny13A.)

Les.
 
Top