A transformer has a cover and a bobbin. The cover has a cavity and a bottom opening. The cavity is formed inside of the over. The bobbin is mounted inside the cavity in the cover and has two surfaces, multiple pins and multiple coils. The pins are mounted through the bobbin and protrude from the two surfaces of the bobbin. The coils are mounted between the pins and have wires connected to each other. After the coils are connected to pins and tested, the bobbin with the coils can be mounted in the cover so that the process of fabricating the transformer is easier.