Patent 9955244 was granted and assigned to Apple (company) on April, 2018 by the United States Patent and Trademark Office.
An electronic device may have a speaker for presenting audio to a user. The speaker may have a speaker diaphragm mounted in a speaker enclosure and driven using a speaker driver. A sensor such as a gas sensor, particulate sensor, or other environmental sensor may be mounted within the speaker enclosure. Control circuitry in the electronic device may move the speaker diaphragm to draw fresh air into the speaker enclosure or to capture a sample of liquid while using the environmental sensor to make sensor measurements. The control circuitry may use a display, other visual output devices, audio output devices, and/or vibrating output components to present alerts to the user based on environmental data from the environmental sensor.