i just fix the reset using writing pwm at 100 percent duty cycle.You still haven't answered my question in post #36. Before moving on to the display, is the arduino/PWM part working or does the arduino still constantly reset? If it is working, what did you do to fix it?
When using the Nano with the Arduino IDE, there is no obvious access to setting individual fuses.What frequency are you using on your inductor, if you can hear it, it must be very low. Have you de-activated the divide by 8 fuse on the microcontroller?
1. i did almost hundred percent. since i limit the duty cycle at 157 (160 in full)1) That mosfet controller (IR2106s) relies on a charge pump to boost the Vgs of the top mosfet. I don't believe it will work at 100%. That is, it needs to have some off time for the capacitor to charge.
2) Your schematic has neither a coil nor LCD display in it. Where are they attached?
3) What type of display are yo using? Is the display driver a Hitachi HD44780 or compatible device?
4) What is your interface with the display?
5) Show your code for initialization of the display.
1 - This is not so, the charge pump capacitor charges to 12V when Q4 is on, so will be @ Q5 source voltage +12V when Q4 is off... so that is fine.1) That mosfet controller (IR2106s) relies on a charge pump to boost the Vgs of the top mosfet. I don't believe it will work at 100%. That is, it needs to have some off time for the capacitor to charge.
2) Your schematic has neither a coil nor LCD display in it. Where are they attached?
3) What type of display are yo using? Is the display driver a Hitachi HD44780 or compatible device?
4) What is your interface with the display?
5) Show your code for initialization of the display.
i tried to lift up the coil but same problem. i already clear the gnd plane below the coil as you can see in the pcb layout.1 - This is not so, the charge pump capacitor charges to 12V when Q4 is on, so will be @ Q5 source voltage +12V when Q4 is off... so that is fine.
2 - The coil connections can be inferred from the PCB..
It's only fine until the cap charge has leaked away. The cap needs recharging occasionally, so 100% duty cycle would only work for a limited time.the charge pump capacitor charges to 12V when Q4 is on, so will be @ Q5 source voltage +12V when Q4 is off... so that is fine.
Can you just clarify.. when you say 100% duty cycle do you mean that only 1 of the FETs is on, and on permanently?i just fix the reset using writing pwm at 100 percent duty cycle.
the pwm is working before and after garbage lcd display.
i mean its 98 percent duty cycle. i just assume it 100 percent since it is almost full.Can you just clarify.. when you say 100% duty cycle do you mean that only 1 of the FETs is on, and on permanently?
So 98% on 2% off?i mean its 98 percent duty cycle. i just assume it 100 percent since it is almost full.
yes definitelySo 98% on 2% off?


If your Arduino is resetting when you use PWM, you're using too much current. That's what PWM is for- controlling current. Change your duty cycle or reengineer your circuit.hi
i am trying to build an mppt charger using arduino nano and right now i am having a problem with my mppt.
i already test all the components and working fine. the current sensor is okay and also the voltage sensor is okay.
but when the mppt start pwm then the arduino keeps resetting every seconds.
Code:#include <LiquidCrystal_PCF8574.h> #include <Wire.h> LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display int show = -1; uint16_t PWM_MIN = 96; uint16_t PWM_MAX = 150; uint16_t PWM_DUTY = 120; #define PWM_INC 1 //the value the increment to the pwm value for the ppt algorithm #define AVG_NUM 20 #define SOL_AMPS_PIN A0 #define SOL_VOLTS_PIN A3 #define BAT_AMPS_PIN A1 #define BAT_VOLTS_PIN A2 #define SENSOR_SCALE 0.05 // 50mv per amper double VOLTAGE_DIVIDER = 0.04912836767; //(r2/(r1+r2)) double VOLTAGE_REFERENCE = 4.096; //external Vref double SOL_AMPS = 0.0; double SOL_VOLTS = 0.0; double BAT_AMPS = 0.0; double BAT_VOLTS = 0.0; double SOL_WATTS = 0.0; double OLD_SOL_WATTS = 0.0; double OLD_SOL_VOLT = 0.0; double OFFSET_SOLAR = 0.0; double OFFSET_BATTERY = 0.0; void setup() { // put your setup code here, to run once: TCCR1A = 0xB2; TCCR1B = 0x11; ICR1 = 160; DDRB = 0x06; OCR1A = 0; // pin 9 OCR1B = 0; // pin 10 int error; analogReference(EXTERNAL); analogRead(A0); analogRead(A1); analogRead(A2); analogRead(A3); Serial.begin(115200); Serial.println("Dose: check for LCD"); Wire.begin(); Wire.beginTransmission(0x27); error = Wire.endTransmission(); Serial.print("Error: "); Serial.print(error); if (error == 0) { Serial.println(": LCD found."); show = 0; lcd.begin(16, 2); // initialize the lcd } else { Serial.println(": LCD not found."); } lcd.setBacklight(255); OFFSET_SOLAR = read_adc(SOL_AMPS_PIN); OFFSET_BATTERY = read_adc(BAT_VOLTS_PIN); } void loop() { read_data(); if (SOL_WATTS > OLD_SOL_WATTS) { if (SOL_VOLTS > OLD_SOL_VOLT) { PWM_DUTY += PWM_INC; } else { PWM_DUTY -= PWM_INC; } } else { if (SOL_VOLTS > OLD_SOL_VOLT) { PWM_DUTY -= PWM_INC; } else { PWM_DUTY += PWM_INC; } } if (PWM_DUTY < PWM_MIN) { PWM_DUTY = 96; } if (PWM_DUTY > PWM_MAX) { PWM_DUTY = 150; } OLD_SOL_VOLT = SOL_VOLTS; OLD_SOL_WATTS = SOL_WATTS; // load old_watts with current watts value for next time OCR1A = PWM_DUTY - 10; OCR1B = PWM_DUTY; delay(100); lcd.setCursor(0, 0); lcd.print(SOL_WATTS); lcd.setCursor(8, 0); lcd.print(SOL_VOLTS); lcd.setCursor(0, 1); lcd.print(BAT_VOLTS); lcd.setCursor(8, 1); lcd.print(SOL_AMPS); } void read_data(void) { int temp_sol_amps = read_adc(SOL_AMPS_PIN); int temp_sol_offset = temp_sol_amps - OFFSET_SOLAR; if (temp_sol_offset < 0) { temp_sol_offset = 0; } int temp_bat_amps = read_adc(BAT_AMPS_PIN); int temp_bat_offset = temp_bat_amps - OFFSET_BATTERY; if (temp_bat_offset < 0) { temp_bat_offset = 0; } SOL_AMPS = (temp_sol_offset * (VOLTAGE_REFERENCE / 1023.0)) / 0.05; //input of solar amps //SOL_AMPS = read_adc(SOL_AMPS_PIN); //input of solar amps SOL_VOLTS = (read_adc(SOL_VOLTS_PIN) * (VOLTAGE_REFERENCE / 1023.0)) / VOLTAGE_DIVIDER; //input of solar volts BAT_AMPS = (temp_bat_offset * (VOLTAGE_REFERENCE / 1023.0)) / 0.05; //output of battery amps //BAT_AMPS = read_adc(BAT_AMPS_PIN); //output of battery amps BAT_VOLTS = (read_adc(BAT_VOLTS_PIN) * (VOLTAGE_REFERENCE / 1023.0)) / VOLTAGE_DIVIDER; //calculations of solar watts SOL_WATTS = SOL_AMPS * SOL_VOLTS; } int read_adc(int channel) { int sum = 0; int temp; int i; for (i = 0; i < AVG_NUM; i++) { // loop through reading raw adc values AVG_NUM number of times temp = analogRead(channel); // read the input pin sum += temp; // store sum for averaging delayMicroseconds(100); // pauses for 50 microseconds } return (sum / AVG_NUM); // divide sum by AVG_NUM to get average and return it }
View attachment 194029
hi, i already found the problem resetting of arduino.. i just adjust the dead time of two pwm. now the problem is that the battery wont take much current and as can you see the link image is that the battery voltage goes up to 18v. i don't know if the battery is already broke. or may be other problems that i don't know yet. cant test for new battery since i don't have new battery for now.If your Arduino is resetting when you use PWM, you're using too much current. That's what PWM is for- controlling current. Change your duty cycle or reengineer your circuit.