Boost converter switching using IRF540N and arduino Uno

im trying to design an mppt based solar charge controller and i need to step up 5v from pv panel to charge 12volt battery....the problem is when i try to connect pwm pin to mosfet gate terminal,it doesnt work....im using the LED blink code as my sketch...i dont have a logic level mosfet or gate driver ckt......any suggestions on how to get the job done???? a little help on mppt coding would also be nice......

You can get commercially available ones for about 1$ each: http://www.ebay.com/itm/5PCS-DC-DC-Adjustable-Step-up-boost-Power-Converter-Module-XL6009-Replace-LM2577-/200949189145?hash=item2ec9814a19

You really need a logic level mosfet and it needs a clean on/of so it is not held in a half conducting state for too long in the duty cycle.

Include a picture of your circuit including the values of your components. The capacitors should be low ESR types.

I’m currently doing an experiment with a boost converter (but up to 250 volts). You might find the code useful that I’ve developed to select the frequency and the duty cycle

/*

  Boost converter experiment.
  Use enters Frequency in integer KHz & Duty Cycle in integer % in example format
  for 15KHz and 55% duty cycle
  15;55;

  fast PWM out on pin 9
  Potential divider on A0 to measure voltage.

*/



const char versionNr[] = "nixie-ps-v0.12 29.03.2017" ;

const byte mcOut =  9 ;  // mosfet control

const byte vr1 = A0 ;

int preScaler = 1 ;
float vcc = 5.0 ;



void serialEvent( ) {
  //
  // warning: sets timer variables directly
  //
  // called from main().
  // based on http://forum.arduino.cc/index.php?topic=396450 (Robin2)
  // collect input characters in form:
  //   frequency(kHz);dutycycle(%);
  // on new line parse input string and reset globals:
  //   ICR1
  //   OCR1A
  // validate and print confirm/fail message

  static char buff[32] ;
  static byte buffIdx = 0 ;
  static byte errorFlag = false ;
  char * buffPtr ;  // for strtok

  while (Serial.available() > 0 ) {
    char rc = Serial.read() ;
    if ( rc == '\n') {
      // we have a line end so process buffer and clean up
      if ( errorFlag == false ) {
        buffPtr = strtok( buff , ";" ) ;
        int rawFrequency = atoi( buffPtr ) ;
        buffPtr = strtok( NULL , ";" ) ;
        int rawDutyCycle = atoi( buffPtr ) ;
        if ( rawFrequency >= 7 && rawFrequency <= 3200 && rawDutyCycle >= 5 && rawDutyCycle <= 95 ) {

          // update globals
          // sets timer variables

          ICR1 = ( 16000.0 / preScaler ) / rawFrequency ;
          OCR1A = ICR1 * ( rawDutyCycle / 100.0 ) ;

          Serial.println( "Updating frequency(kHz) / duty cycle(%): " ) ;
          Serial.println( rawFrequency ) ;
          Serial.println( rawDutyCycle ) ;

          Serial.println( "ICR1 / OCR1A : " ) ;
          Serial.println( ICR1 ) ;
          Serial.println( OCR1A ) ;


        }
        else {
          Serial.println( "Rejecting frequency(kHz) / duty cycle(%) update. Values out of range. Frequency 7-3200, Duty Cycle 5-95: " ) ;
          Serial.println( rawFrequency ) ;
          Serial.println( rawDutyCycle ) ;
        }

      }
      // reset
      errorFlag = false ;
      buffIdx = false ;
    }
    else if ( errorFlag == true ) {
      // no action until next line end
    }
    else {
      // add character to buffer
      if ( buffIdx < 32 ) {
        buff[buffIdx] = rc ;
        buffIdx ++ ;
      }
      else {
        errorFlag = true;
        Serial.println("buffer overflow. Reenter max. 32 characters") ;
      }
    }
  }
}






void setup() {
  Serial.begin( 9600 ) ;
  pinMode( mcOut, OUTPUT ) ;

  // OC1A = 9
  // OC1B = 10

  //set timer1 toggle at xHz
  TCCR1A = 0;// set entire TCCR1A register to 0
  TCCR1B = 0;// same for TCCR1B
  TCNT1  = 0;//initialize counter value to 0

  ICR1 = 500 ;   // warning - also set in serialEvent !!
  OCR1A = 125 ;  // warning - also set in serialEvent !!

  TCCR1A |= ( 1 << COM1A1 ) | (1 << WGM11) ;

  // wg mode 14
  TCCR1B |= (1 << WGM12) | (1 << WGM13);
  // prescaler 1024
  TCCR1B |= (1 << CS10) | (0 << CS12) ;

}

void loop() {
  static unsigned long lastCycleAtMs = 0 ;
  if ( millis() - lastCycleAtMs > 2000 ) {
    lastCycleAtMs = millis() ;
    float hiVoltage = analogRead( A0 ) * (vcc / ( 1023 * 0.0167 ) ) ;
    Serial.print("hiVoltage= " ) ;
    Serial.print ( hiVoltage ) ;
    Serial.print( "; ICR1= " ) ;
    Serial.print( ICR1 ) ;
    Serial.print( "; OCR1A= " ) ;
    Serial.println( OCR1A ) ;
  }
}

here is the circuit diagram…ive used 980hz switching frequency(pin 3 on uno)…the simulation works perfectly in multisim…Im still confused how its not working in the hardware model…

Maybe the 1.7 microamps that multisim says the circuit will produce is not enough to drive your measuring instrument (voltmeter etc.). It is really very little.

Here is a guide from Adafruit for designing a boost converter. The Calculator | DIY DC/DC Boost Calculator | Adafruit Learning System.

The diode should be a fast recovery type e.g. UF4004 and the capacitors should be of low esr (equivalent series resistance)

Ansuman1994:
here is the circuit diagram....ive used 980hz switching frequency(pin 3 on uno)....the simulation works perfectly in multisim.....Im still confused how its not working in the hardware model..

With that coil value you will need to run the circuit at many many Khz not 980 Hz.