Abstract
Smoking is the biggest avoidable health risk, causing millions of deaths per year worldwide. Persuasive applications are those designed to change a person’s behavior, usually in a specific way. Several mobile phone applications and messaging systems have been used to promote smoking cessation. However, most interventions use participants’ self-reports to track cigarette consumption and avoidance, which may not be accurate or objective. Previous proposals have used sensors to track hand movements and other contextual data to detect smoking or have used devices to detect smoke or breath carbon monoxide. This article proposes a low-cost wearable device that may be worn in a front shirt pocket or clipped to clothing to detect smoke and secondhand smoke. Furthermore, the device is integrated into a persuasive application to promote smoking cessation. The device was evaluated through an experiment to detect whether it may detect direct, passive, and no smoking conditions. The results are promising and may help improve tracking of cigarettes in persuasive applications.
Introduction
In the United States, approximately 15.5% of adults are smokers. 1 Smoking is the biggest avoidable health risk, 2 and it is related to a number of diseases, for example, cancer, cardiovascular diseases, and pulmonary diseases, with serious deleterious effects, and it is estimated that worldwide, direct smoking and secondhand smoking caused over seven million deaths in 2016 3 and are responsible for billions of dollars in healthcare costs every year. 4 In some countries such as Chile, more than 33% of adults are smokers, 5 and although some public health policies have been introduced (e.g. a ban on smoking in enclosed public spaces, 6 graphic warnings on cigarette packages), 7 there is a level of complacency that has hindered efforts to reduce smoking in children and adults in Chile. 7
Even though no amount of cigarette smoking is considered to be safe, lowering consumption decreases cardiovascular disease risk. 8 There is a wealth of research about smoking cessation programs and initiatives: for example, picture warnings, ad bans, and increased taxes have been shown to reduce tobacco use. 9 However, smokers tend to overestimate how likely they are to quit smoking. 10 Studies have reported that 68% of current smokers intend to stop smoking—however, only a third of those who try to stop smoking use evidence-based cessation methods and less than 10% of smokers are actually successful. 11
Persuasive applications are those designed to change a person’s behavior, usually in a specific way. 12 Persuasive technologies may impact health care and can be thought of in terms of the involved technologies, persuasive strategies, and healthcare subdomains—for example, weight loss, nutrition, physical activity, addiction, aging, risky behaviors, and smoking cessation. 13
Mobile phone applications and messaging have been used to promote smoking cessation, finding long-term benefits in using these interventions, although the existing studies have been conducted in high-income countries with tobacco control policies, and may therefore not be applicable in other contexts. 14 A review of available applications in app stores found that, although some applications based on scientific evidence currently exist, they are difficult to find for consumers 15 and that most applications focus on ease of use rather than implementing evidence-based behavior change techniques. 16 Another review of smoking cessation applications found that existing applications do not sufficiently stimulate autonomous motivation. 17
Several interventions for smoking cessation currently use self-report through questionnaires, which may be distributed in person or via post, telephone, or the Internet 18 to track smoking. Some proposals to automatically detect smoking have been proposed, with some tracking hand movements 19 along with other data (e.g. heart rate sensors, 20 lighter sensors) 21 to improve detection accuracy. These proposals are discussed in the next section.
This article aims to answer the following research question: is a low-cost smoke sensor able to differentiate between no smoking, secondhand smoking, and direct smoking? To answer this question, we developed an Arduino-based low-cost smoke sensor that is paired with a persuasive application to automatically track how many cigarettes a person has smoked.
This article is organized as follows. First, we discuss related work in persuasive smoking detection applications and automated smoking detection. Then, we present Evitapp, the persuasive application with which the device is paired. The next section introduces SAS4P (smoking automated sensor for persuasive applications), our sensor-based approach to smoking detection. We evaluate the effectiveness of the sensor by differentiating direct and secondhand smoking. Then, we present a discussion of our results and our conclusions.
Related work
Persuasive smoking cessation applications
Computer-based interventions are an effective alternative to in-person interventions for drug misuse; 22 they provide features such as self-monitoring, progress tracking, and daily reminders. 15
Google Play store (as of August 2019) displays hundreds of applications when searched by the keywords “quit smoking,” for example, Flamy, Quit Tracker, Stop Smoking, QuitNow!, myQuitTime, etc. A 2017 review found a few evidence-based applications in both the Google Play and Apple application stores, 15 which are still available as of 2019: Craving To Quit!, 2Morrow’s Tobacco Cessation program, also known as SmartQuit (https://www.2morrowinc.com/smoking-cessation), and SF28, or SmokeFree28) (http://www.sf28.co.uk/). SmartQuit aims to provide users with techniques that help them not act on the urge to smoke, by recording urges and completing daily exercises. 23 SmartQuit has been found to have promising rates of quitting, 24 also finding in a small study that smoking was reduced in the short term and in the medium term for a few participants. 23 SF28 is an application that encourages users to become smoke-free for 28 days, providing users with evidence-based behavior change techniques. Abstinence rates from 28 days of use of SF28 suggest that it may be helpful for some smokers. 25
Many smoking cessation applications send reminders to users in the form of messages—for example, SMS and MMS.26,27 Users would like text messaging smoking cessation programs to allow them to feel involved with the program, communicate their feelings, and visualize their progress. 28 Anti-smoking messages stressing gains (over losses) and short-term (over long term) consequences have been found to have more effect on smoker attitudes. 29
Several other applications have been proposed and studied in academic research. A smoking cessation application called Quit Smoking, based on persuasive design theory, highlighted how much users had saved by not smoking (in terms of money and life regained). To report cigarette consumption, the application allowed users to choose whether they had resisted or submitted to their cravings to smoke. 30 A similar approach for an application called SmokefreeNZ asked for users to track each cigarette they smoked or resisted. 31 Most assessments currently use self-report to track smoking. 19 Even though self-tracking offers the possibility of tracking both the effective number of cigarettes smoked and the number of times a user wanted to smoke and did not, it depends on the user’s consistent, thorough, and honest use of the reporting tool. The next section describes approaches to automatically detecting when a user smokes.
Automatic smoking detection
Smoking produces unique and repetitive hand movements that are particular to this habit. To leverage this, a few commercial solutions have been proposed, for example, SmokeBeat, which uses smartband accelerometer and gyroscopes to detect and monitor this motion, 32 and CigFree, a similar smartband that is under development. 33 Reseachers have proposed similar solutions, for example, a smartband was used to detect hand gesture activities, using deep learning to classify activities and finding an accuracy of 94.07% and a recall of 91.38%. 34 A similar study used an Android smartwatch (without the need for any additional devices) to detect hand movements related to smoking, finding it to be adequate for applications that do not require a high level of performance. 35 Another study used MYO armbands on each arm to distinguish smoking motions from other similar motions such as answering the phone and drinking coffee, with high accuracy. 19 Researchers have also used a heart rate sensor, along with a wrist-worn 6-axis inertial sensor, to detect hand movement patterns and heart rate changes. 20 Another approach used a chest module (to monitor breathing, heart rate, chest movement, hand-to-mouth proximity, and user location) and an instrumented lighter (to track press and release), along with a hand module, to detect smoking in naturalistic settings. 21
Another approach that has been used to detect smoking is to measure smoke or breath carbon monoxide (CO). One such proposal developed a portable CO breath detector that may be attached to a smartphone, as well as an application to calibrate the sensor and capture and display data, finding the measures to be reliable and valid enough to detect smoking or abstinence from smoking. 36 A final approach, more similar to ours, is CRegrette, an ambient device to track no smoking, passive smoking, and active smoking (and which displays an LED with three possible colors, corresponding to each situation). 37 This article presents a similar device that detects smoke through a single device and serves as input for a persuasive mobile application.
Evitapp: a persuasive application for smoking cessation
Evitapp is a persuasive application, developed for Android 4.4., which has two versions with a high software reuse between both: one for smoking cessation and one for physical activity promotion. 38 Naturally, this article focuses mostly on the smoking cessation application, but both applications share a common metaphor and a large number of core services. To develop these applications, we started by defining the persuasive strategies, based on literature concerning persuasive technology for health and wellness, 39 physical activity,40–42 and smoking cessation,25,43,44 as well as a review of existing applications in the app stores. Following this review, it was decided to incorporate five persuasive strategies 45 (1) tracking and monitoring; (2) social support, sharing, and comparison; (3) persuasive messages, reminders, and alerts; (4) goals and objective; and (5) emoticons and persuasive images.
The design of the application centers around a metaphor of a tree in a field to visualize goals and objectives and provide persuasive images. This image changes proportionally with the user’s progress, adding landscape elements, making it more cheerful and abundant in terms of the number of items.
The application for physical activity promotion in its initial version automatically detected physical activity (specifically walking, jogging, and cycling), while for users of the smoking cessation version, it required users to input the number of cigarettes they smoke daily as well as to report each cigarette they smoked, which was used to calculate the user’s progress.
The application sends notifications to users using a non-diverse strategy 46 to avoid overwhelming users. The notifications are shown at random times, with a daily limit of possible notifications.
The Evitapp application stores all information related to cigarettes smoked and physical activity done by the user in an internal database based on Realm. Once a day, and if an Internet connection is available, all information stored in the internal database is exported and saved in an external database based on MySQL (see Figure 1). In particular, we developed a Cardiovascular Risk Application Programming Interface (API) that encapsulates the services that transmit and synchronize the information between the internal and the external database.

Evitapp general diagram.
SAS4P: a sensor-based approach to automatic smoking detection
SAS4P: design rationale
SAS4P was designed to be a wearable device that users can choose to wear, for example, in a front shirt pocket or clipped to their clothes. The device is low cost and based on Arduino components and parts that can be easily acquired.
SAS4P: implementation
Hardware components
The device was built using an Arduino Nano V3 main card, connected to an HC-05 Bluetooth module and a MQ-2 smoke sensor, encased in the case of a power bank and connected to a Phillips 2600-mA h power bank (see Figures 2 and 3).

SAS4P device components.

SAS4P device (top: open, showing components; bottom: final version).
The MQ-2 smoke sensor outputs a raw analog-to-digital converter (ADC) value, which is between 0 and 1023. This value can then be converted to voltage values between 0 and 5 V. This value represents conductivity—as there is lower conductivity in clean air, when conductivity rises, this represents the presence of smoke or other gases. The sensor cannot detect specific gases—rather, it can be used to detect change in gas in a known setting. As the raw ADC value is proportional to voltage, which is also proportional to smoke particles per million (PPM), this article uses the raw ADC value to present results.
Communication protocols
The MQ-2 smoke sensor detects smoke once every 3 s approximately. These readings are received by the Arduino Nano to which the sensor is connected, which transfers them through Bluetooth to a paired smartphone. Once the smartphone receives the data, it uses the Evitapp API to send the data to a database and store it.
Smoke detection
The development of the device for smoking detection had three phases. The first phase consisted in placing the components on a breadboard in order to more easily test the connections and possible distribution of the device components, as well as the connection between the Bluetooth module and an ad hoc Android application built for this purpose. The second phase was to incorporate the MQ-2 sensor into the breadboard. To test the component, we generated a smoke source and verified that the air quality readings were sent correctly to the smartphone. Finally, in the third phase, we proceeded to build the portable version of the prototype, in which we incorporated a mobile power bank (lithium battery) to power the device and a case for the components. The components were distributed in such a way that they used as little space as possible and the device had a shape that would allow a user to manipulate and carry it comfortably.
As previously mentioned, the sensor samples the air every 3 s, then sending the captured data through the Bluetooth module to a paired smartphone.
Integration with Evitapp application
To integrate the smoke sensor with Evitapp, we implemented a background service (extending from android.app.Service) that starts when the smartphone’s Bluetooth is activated. The smoking sensor sends a special character each time it detects a cigarette has been smoked, which in turn increases the number of automatically detected cigarettes in Evitapp.
Evitapp stores two separate counters for the number of cigarettes that have been smoked: (1) those cigarettes that have been detected automatically by the sensor and (2) cigarettes that are manually input by the user (e.g. when he or she has not been wearing the device). Both numbers are stored in the internal database and replicated in the remote database later.
Evitapp+SAS4P software architecture
Figure 4 shows a simple architectural view of the Evitapp application coupled with the SAS4P device.

Architecture diagram.
The architecture is presented as a layered view (module style), 47 and it has three layers: interaction, services, and data. The lower layer (data) is in charge of storing temporal (internal database) and persistent (external database) data. A synchronization module is required to maintain consistency between the databases.
The second level is the services level. We decided to separate the functionalities into two modules: one for encapsulating the five persuasive strategies defined for this application and another for the rest of functionalities, for example, login, user registration, and manual input of tracking data. This separation of concerns will allow us to add, delete, or modify persuasive strategies independently from other functionalities in the future.
The third level consists of the user interface elements needed to interact with the application. Furthermore, all sensors are considered in a separate module. The first version of Evitapp only had the smartphone-integrated sensors, for example, accelerometer and GPS. This separation allowed us to incorporate the smoke sensor and will allow us to add other types of sensors to Evitapp in the future, enhancing the user experience.
Evitapp+SAS4P user interface
When integrating the sensor data to the Evitapp interface, we decided to provide the user with information both from the manual and automatic detection of cigarettes separately. These data can be seen in Figure 5, which reads “Manual: 1” (one cigarette was input manually, through the “+” and “−” buttons provided by the interface) and “Auto: 2” (two cigarettes were automatically detected by the sensor). The automatic value cannot be manipulated or changed by the user, and it is independent from the number input manually by the user (so the user should only manually input cigarettes when not using the SAS4P device to avoid duplication).

Evitapp screenshot with manual tracking and automatic reporting.
Materials and methods
Smoking machine
We built an artificial rudimentary smoking machine based on a simple experiment 48 to show the effects of smoking.
The materials used in the construction of the smoking machine were the following: an empty 600-ml plastic bottle, clear plastic tubing (about 30 cm in length), two 20-cm balloons, and a 24-cm balloon. As tools, we used an electric hot glue gun with its corresponding glue sticks, duct tape, scissors, and a box cutter. Figure 6 shows the materials we used to build the artificial smoking machine.

Materials for building artificial smoking machine.
The process to build the smoking machine followed the following steps:
Cut the bottle base with the box cutter and remove it.
Make a hole in the bottle cap with the same diameter as the plastic tubing.
Cut a piece of tubing with the same length as the bottle (approximately 15 cm) and two 5-cm tubes.
Cut one end of the long tube in a “V”-shape and the ends of both shorter tubes diagonally, and join all the three tubes using the hot glue gun.
Place the short tubes inside the small balloons, sealing any openings with duct tape.
Insert the balloons and tubes through the base of the bottle, passing one end of the long tube through the hole in the bottle cap. Seal any openings using the hot glue gun.
Cut a piece of the big balloon to fit on the base of the bottle, and affix it to the bottom of the bottle using duct tape.
The final machine is shown in Figure 7. The machine was able to “inhale” and “exhale” by pulling on the balloon at the bottom of the bottle, simulating a person smoking without the need of recruiting real persons to smoke a high number of cigarettes.

Artificial smoking machine.
First, we tested our setup by having the smoking machine smoke 40 cigarettes at varying distances, finding that, for example, if cigarettes were setup at a distance of 1 m or more from the smoking machine, the sensor did not detect any smoke (the sensor readings were below 54, same as when there was no smoke at all). This initial experiment allowed us to select appropriate distances and times for the final experiment. During these tests, we also verified whether any deformation occurred in the bottle, balloons, or tubes or whether these components got too hot due to cigarette smoke, since those issues could eventually affect our measurements. There was no apparent deformation or extreme warming during these tests.
On another day, after this initial calibration, we tested the smoking sensor by carrying out a two-part experiment, which is described below. All the experiment was conducted on 1 day (in which wind speed was 2 knots or 4 km/h), outdoors to prevent smoke from accumulating. On the day the measurements were taken, first, we reviewed the measurements the sensor was taking without lighting any cigarettes, finding that it oscillated between 44 and 54.
Next, we describe the methods used for both parts of the experiment.
Part 1: Can SAS4P detect no smoking, secondhand smoking, and direct smoking?
The sensor was placed in front of the smoking machine at a 15-cm distance. The researcher noted the measurements captured by the sensor without lighting the cigarette. The cigarette was lit, and one researcher activated the machine so that it would smoke the cigarette, simulating a real smoker. When the cigarette was over, it was put out and the researcher waited until the smoke levels reached the initial measurements before lighting the next cigarette. This was repeated at a 50-cm distance, and four cigarettes were used for each distance.
Part 2: Can SAS4P detect no smoking when a cigarette has just been put out?
The sensor was placed in front of the smoking machine at a 15-cm distance. One cigarette was lit, and one researcher activated the machine so that it would smoke the cigarette. When it was put out, the researcher waited 12 s until lighting the next cigarette. This was repeated four times, and then, the experiment was repeated with a waiting time between cigarettes of 24 and 36 s (each with four cigarettes).
Results
Part 1: Can SAS4P detect no smoking, secondhand smoking, and direct smoking?
Figures 8 and 9 show the values detected by the sensor over time for the cigarettes at 15 and 50 cm, respectively (data shown are from when cigarette was lit to when it was put out). The four cigarettes smoked at a 15-cm distance from the sensor (Figure 8) have an average value of 77.3, while the cigarettes smoked at a 50-cm distance (Figure 9) have an average value of 55.19. Moreover, the cigarettes smoked at 15 cm show a high variability (with a standard deviation of 25.4), with high peaks reaching 211, 163, 135, and 156 for each of the four cigarettes, while at 50 cm, the highest values were 67, 67, 74, and 72, respectively (and standard deviation was 5.61). Minimum values were comparable (between 46 and 50 for all cigarettes), showing that at these points, the sensor did not detect any smoke.

Part 1: Four cigarettes at 15 cm.

Part 1: Four cigarettes at 50 cm.
Figure 10 shows at each point in time, the average smoke values for the cigarettes smoked at 15 and 50 cm. We also added, for visualization purposes, a line of random points between 44 and 54, to simulate non-smoking conditions.

Average of all cigarettes at 15 cm (orange) and 50 cm (gray). Blue dots simulate non-smoking conditions.
Part 2: Can SAS4P detect no smoking when a cigarette has just been put out?
Figure 11 displays the values measured for the three different conditions (12, 24, and 36 s). Data colored in blue represents the times when a cigarette was being smoked, while red dots represent rest periods between cigarettes. As the rest period increased, there is a tendency toward having a clearer downward slope. However, the high variability in data even while a cigarette is being smoked does not make it easy to distinguish smoking and non-smoking periods.

Part 2: Four cigarettes smoked with rest period of 12, 24, and 36 s.
Discussion
SAS4P is a device suitable for tracking cigarette consumption, which allows for objective registration of smoking cessation progress, without requiring users to self-report.19,30,31 It is also easily removable, allowing users to easily and voluntarily switch between automatic detection and not using the device, which grants them a degree of privacy that may not be available, for example, in chest-worn devices 21 or other devices that may be difficult to remove. SAS4P is built with low-cost Arduino components and other easily available parts, so it may be potentially adapted to different contexts and needs, especially considering the lack of research conducted on how to successfully promote smoking cessation in developing countries. 14 Furthermore, SAS4P is built into a software architecture that allows it to serve as input for a persuasive application for smoking cessation. The architecture we designed for this application also allows additional sensors to be coupled with the application with little additional work.
The experiment results show that the sensor may differentiate between smoking and secondhand (or passive) smoking, as it detected three different ranges of values: one for no smoking, one for smoking at a distance of 50 cm (which could be interpreted as secondhand smoking), and higher values for smoking at a distance of 15 cm (which could be interpreted as direct smoking). At 15 cm, the detected values had a high variance, which may be due to variability in smoking machine periodicity (which was manually activated) and wind. As the experiment was conducted outdoors, smoke does not tend to accumulate, rather dispersing constantly.
There is an important limitation related to the sensitivity of the sensor to measure smoke at a distance greater than 50 cm. As previously stated, when the sensor was used to measure smoke at distances around 1 m, the sensor values were below 54, same as when there was no smoke at all. From these data, it is not possible to reliably determine the maximum distance at which the MQ-2 sensor measures the smoke. Another relevant limitation is that the smoking machine we used is rudimentary and made of plastic and rubber balloons. Although we did not detect any changes to this machine over the course of the experiment, we may not rule out that the materials became heated or slightly changed their shape, which might have affected the results of the experiment as it progressed.
Regarding detecting no smoking periods when cigarettes are smoked in quick succession (e.g. less than 30 s between cigarettes), the experiment did not show that it is possible to detect these short no smoking periods. However, the longer time periods between cigarettes did display a longer chain of decreasing values, which suggests that when there is a reasonable period of time between cigarettes, it will be possible to differentiate between them. Furthermore, this decision at a software level may be complemented with data on how long a person takes to smoke a cigarette. For example, all the cigarettes smoked in the first phase of the experiment lasted on average 161.25 (max: 177, min 141) s, with a standard deviation of 11.87, showing that it would be possible to infer that any cigarette that lasts over, for example, 300 s should be considered to be two cigarettes.
The results from the experiment allow us to begin working toward detecting when a cigarette is started and finished. Further testing under different conditions needs to be undertaken to define appropriate values for two parameters: the sensor value when someone is smoking (v) and the number of seconds it takes for a particular user to smoke a cigarette (s). Then, the application could consider a user to be smoking when it detects several (e.g. four) values over v in a short defined period of time (e.g. 30 s). Then, it would assume that the cigarette is on for s seconds. As previously stated, further work is necessary to define the parameters and test whether cigarettes are detected correctly under different conditions.
Conclusion
We developed a low-cost wearable device, able to detect cigarette smoke and differentiate between no smoking, secondhand smoking, and direct smoking. The device was integrated into a persuasive application, allowing cigarette consumption to be monitored automatically. The implementation of a low-cost wearable in a developing country with high tobacco consumption is an important step toward studying how to improve smoking control in an understudied context.
As future work, further experimentation would be necessary, especially in indoor spaces to review the effects of smoke accumulating in the environment. Furthermore, it may be useful to make additional measurements (e.g. 60, 70, 80, and 90 cm) to determine the exact distance between the sensor and the cigarette at which smoke is no longer detected and use another more sensitive smoke sensor than the one used in this work. Also, we will study the most appropriate placement of the sensor on the body and conduct research on the use of the device by actual smokers. Finally, we will work on the automatic detection of each smoked cigarette and study the effects of automatic detection of cigarettes on smoking cessation effectiveness.
Footnotes
Handling Editor: Joseph Rafferty
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was funded by grant DINREG 05/2017 from the Dirección de Investigación of the Universidad Católica de la Santísima Concepción (Chile) and by CONICYT/FONDECYT 1181162 (Chile).
