The present disclosure generally relates to the field of controllable nebulizers for aerosol generation. The nebulizer comprises an aerosol release mechanism configured to release aerosols based on control signals received from a controller based on yawn sensor measurements of the patient. The aerosol release during deep and full inhalation, as in yawns, improves drug delivery to the lungs and consequently may lead to reduction of drug dosage.