Motors control and protection