Two series of amorphous carbon alloys were deposited by reactive sputtering using a graphite target and argon as a sputtering gas. The effect of hydrogen or nitrogen on the structure of amorphous carbon was investigated using photothermal deflection spectroscopy (PDS), UV–Vis–near infrared spectroscopy, Fourier Transform Infrared (FT-IR), Raman and Photoluminescence (PL) techniques. The change in the structure of hydrogenated amorphous carbon (a-C:H) is due to the fact that H incorporation favours the formation of sp 3 sites. In fact, the hydrogen incorporation relaxes the structure enough to improve electronic properties by increasing the number of terminal bonds. In the amorphous carbon nitride (a-CN) films, the lone pairs belonging to the nitrogen atoms are important in determining the optical properties of the films. The nitrogen alters the structure of carbon and creates cavities to be responsible for hydroxyl (OH) inclusions.