The present disclosure generally relates to thefield of controllable nebulizers for aerosol generation. Thenebulizer comprises an aerosol release mechanism configuredto release aerosols based on control signals received from acontroller based on yawn sensor measurements of the patient.The aerosol release during deep and full inhalation, as inyawns, improves drug delivery to the lungs and consequentlymay lead to reduction of drug dosage.