This paper introduces a dual layered particle swarm optimization algorithm (DLPSO), an evolutionary algorithm proposed to design an artificial neural network (ANN). The algorithm evolves the architecture of the ANN and trains its weights simultaneously. Different from the other techniques previously used, the proposed algorithm evolves the architecture along with the weights in two different layers. Tested on a non-linear system, typically a boost converter, the DLPSO evolves an optimal ANN controller to produce more efficient and robust results than the conventional control techniques used. The performance of the DLPSO based ANN controller is compared to that of a conventional PI controller at different operating points of the non-linear system. The tests show that the evolved controller performs equal to or better than the conventional techniques in terms of overshoot voltages and settling times for small and large signal input transients. Also, a comparison between the applicability of a PSO and a real-valued genetic algorithm for the training of weights is presented which shows that the PSO is faster and more efficient as a learning algorithm. Moreover, the proposed approach fully automates the neural network generation process, thus removing the need for time consuming manual design.