Since the successful demonstration of a blue light-emitting diode (LED), potential materials for making short-wavelength LEDs and diode lasers have been attracting increasing interest as the demands for display, illumination and information storage grow. Zinc oxide has substantial advantages including large exciton binding energy, as demonstrated by efficient excitonic lasing on optical excitation. Several groups have postulated the use of p-type ZnO doped with nitrogen, arsenic or phosphorus, and even p–n junctions. However, the choice of dopant and growth technique remains controversial and the reliability of p-type ZnO is still under debate. If ZnO is ever to produce long-lasting and robust devices, the quality of epitaxial layers has to be improved as has been the protocol in other compound semiconductors. Here we report high-quality undoped fi lms with electron mobility exceeding that in the bulk. We have used a new technique to fabricate p-type ZnO reproducibly. Violet electroluminescence from homostructural p–i–n junctions is demonstrated at room-temperature.