This paper presents an implementation of a microcontroller based boost converter to maintain constant speed of a DC motor. The optimised values namely kp,ki,kd of the Boost Converter are taken from firefly algorithm[10] and implemented using microcontroller. Pulse width modulation (PWM) is a procedure to generate changeable pulse width with different duty cycle. The PWM signal reduces the switching losses. This paper presents a DC motor speed controller where PID Controller is used where the optimized values of kp,ki,kd are taken from firefly algorithm[10]. The PWM pulse width will alter the speed of the motor. The motor voltage and revolutions per seconds (RPS) obtained at different duty cycle rates. With increase in duty cycle, further voltage is applied to the motor. This gives stronger magnetic flux in the armature windings and to enhance revolutions per seconds. The characteristics and concert of the DC motor speed control system was discussed. In this paper, a PIC microcontroller is designed with a DC-DC boost converter for the motor speed controller system. Finally to improve the graphical result we design the hardware in loop method using matlab.