The master's thesis represents a practical use of the knowledge acquired in the course of study of mechatronics and laser techniques. The paper deals with a control of an open - loop unstable magnetic levitation system and the design of a digital controller for the system under consideration. The mathematical model of magnetic levitation was made based on two differential equations. The first describe the mechanical part of the system, and the second equation for its electrical part. The model is then linearized at its operating point, and a PID controller is developed. The stability analysis was performed using the root locus method and the simulation of the nonlinear and linearized model of magnetic levitation were also performed. The Matlab software environment, which includes a set of tools for the design and analysis of control systems was used. In the synthesis of the magnetic levitation model, the greatest challenge was the evaluation of the magnetic force. The force was first determined by the experimental path, and then by the numerical finite element methods with the EMWorks software tool. By comparing the results, it was found that, with minor deviations, the magnetic force in both cases was similar. In the practical part of the master's thesis the device had to be made and its operation tested. Program code was written in C language, and a digital PID control algorithm was implemented in the code. In the practical part of the task, the biggest challenge was evaluation of the distance of the permanent magnet based on its magnetic field in the presence of the magnetic field of the coil. We found the solution in the implementation of two Hall sensors, the output signals of which are subtracted on the differential amplifier. At the end, a comparison of the operation of the device and its theoretical model was made. Based on the step responses, it was concluded that it is possible to predict the operation of the actual device based on its theoretical model with sufficient certainty.