Software apps and online services
Windows 10 IoT Core was created to build powerful solutions on low-powered devices with the potential to bridge the physical world into the nearly endless power of the cloud. It offers a world of synergistic opportunity within the Microsoft ecosystem, which includes technologies such as Visual Studio, .NET, and Microsoft Azure. All of this is available on a variety of devices including the ever popular Raspberry Pi 2, a $35 computer with 1 GB RAM, quad-core processor, 4-port USB hub, and HDMI out. And get this, all of this comes packed on a machine about the size of a credit card at a little over 1.5 inches thick. This little computer also boasts a GPIO hub or General Purpose Input / Output. This GPIO hub can allow you to take readings from the physical world and even perform operations on physical devices that create actions in the real-world.
Okay, you get the picture, big opportunity, small package, can perceive and effect the physical world… How can this change your life or the world for that matter?
That all depends, what is the problem that you wish to solve?
In this case, I decided to pay attention to a problem that is encountered very often, especially in college campuses and in the realm of night-life entertainment. Have you ever known someone to have too much to drink to where it might pose a problem for yourself or others? We have kiosks which will display arcade games and such, but that really just passes the time. What if we had an internet connected device that could track your alcohol consumption? We could identify those who are at risk, or even on their way to becoming a risk to themselves and/or others and intervene.
In this project, we will look at creating an internet connected breathalyzer with cloud-based reporting and logging. From a technical perspective, this project will introduce us to using an analog sensor for detecting alcohol and a standalone LCD screen for prompting a user with instructions. We will tie information gathered from the sensor up to an external interface that logs results and displays them locally while also storing into an Azure Mobile Service.
You may have heard that Windows 10 IoT Core runs Universal Windows Platform apps, meaning that our code should potentially run across any device that supports the Windows 10 Core APIs including Windows Mobile, Xbox One, Windows 10 desktop and potentially Hololens. As such, this implies that it should be able to support UWP controls offered by third parties. We are going to include a charting package from SyncFusion to prove that this is in fact possible.
Note: *Accuracy of this device is not guaranteed. Any replication of this device should be considered as a novelty and not a substitute for more scientifically accurate or legally acceptable methods of measurement
◾Visual Studio (Community Edition or Above)
◾A Raspberry Pi configured for Windows IoT Core
◾A Microsoft Azure account
◾Syncfusion Essential Studio for UWP (Now FREE as part of recently announced Community Licensing)
◾MCP3208 Analog to Digital Converter Chip
◾SainSmart 1.8 TFT Color Display Module (Optional)
Connecting the ADC:
By design, the GPIO pins on the RPi2 are digital only, but we can read from analog sensors using the MCP3208 Analog to Digital Converter chip. We need to connect the following pins (left side is MCP3208 , right side is Raspberry Pi):
◾DGND -> GND
◾CS/SHDN -> SPI1 CS0
◾DIN -> SPI1 MOSI
◾DOUT -> SPI1 MISO
◾CLK -> SPI1 SCLK
◾AGND -> GND
◾VDD -> 5V
Connecting the MQ2 sensor to the ADC:
With the ADC wired up, we can now connect our Analog Sensor to one of the channels on the ADC for converting it’s Analog signal to a Digital signal that can be rad from the RPi2
◾Signal (A0) -> CH0 (ADC)
◾– -> GND (Pi)
◾+ -> 5V (Pi)
Connecting the 1.8″ TFT Color Display Module:
This piece is optional and the code will work regardless of whether this device is connected. We need to connect the following pins (left side is 1.8″ TFT Color Display Module, right side is Raspberry Pi):
◾VCC -> 5V
◾GND -> GND
◾SCL -> SPI0 SCLK
◾SDA -> SPI0 MOSI
◾RS/DC -> GPIO 12
◾RES -> GPIO 16
◾CS -> SPI0 CS0
As mentioned, this project is intended for novelty purposes only as it simply measure alcohol concentration in the air sampled by the MQ2 sensor. This does not equate to the popular Blood Alcohol Content measurement. For more information on how to implement that measure, take a look at this research from nootropicdesign.
Modifying this project to support completely different scenarios:
Technically, this project could be modified to report any analog reading over some predefined ambient threshold. By simply swapping out the MQ2 sensor with say a light sensor or soil saturation sensor, you could monitor sunlight and saturation in a garden. An audio sensor would allow you to determine if city ordinance audio levels are being violated in a controlled area. You could even put in a pressure sensor and build a Strongman game like you see at carnivals.