iPhone Datalogger with Arduino Using The iOS Bluetooth App BLExAR
In this tutorial, the BLExAR app will be used in conjunction with a CC2541 Bluetooth module and an Arduino (ATmega328) board to create a simple data acquisition system. A DHT-22 sensor will provide temperature and humidity data to the Arduino which will be recorded by an iOS device via the BLExAR app. BLExAR allows users to visualize and save data in real-time. The wiring, programming, and general functionality needed to create a Bluetooth data acquisition system with an iPhone or iPad is demonstrated here to simplify the app. This experiment is a real-world example of an Arduino application showing temperature data acquisition from a real sensor. This tutorial will allow users to solve their own engineering problems using the modern Arduino platform and wireless communication through the BLExAr app, which will ultimately expand the reach and compatibility of technology in the classical sciences through exploration and experimentation.
Parts List and Wiring for Tutorial
The DHT-22 temperature sensor will function as the data component for this tutorial, along with a CC2541 BLE module and an Arduino board. Below is a list of components used in this tutorial (along with an iOS device, of course). A resistor is also needed as a pullup to function correctly with the DHT-22 sensor. I additionally include a breadboard so that the DHT sensor doesn’t need to be soldered (unless a breakout version is purchased, then no breadboard is needed). The wiring is fairly straight forward for this tutorial, and the software is handled by libraries that read the signal from the data pin.
I will be using Adafruit’s DHT Sensor Library to handle and control the temperature and humidity data from the DHT sensor. Before uploading the sketch to an Arduino board, be sure to first download the library from the library manager in the Arduino IDE (shown below).
DHT Sensor Library from Adafruit
The Unified Sensor Library from Adafruit must also be downloaded to ensure that the DHT library functions correctly.
Below is the final DHT-22 data send code from Arduino -> BLExAR. BLExAR knows how to decode the data (sent as UTF-8) and log it into the data acquisition window along with a timestamp. This means that users can access the data and timestamp after data acquisition has completed.
BLExAR App and Data Window
Once the BLExAR app is downloaded and opened, a window will appear that shows multiple peripherals (assuming Bluetooth is enabled on the iOS device). The scan window should look something like the image in Figure 4.
Once the BLExAR device is selected and the iOS device has connected with the peripheral, the tab bar window will appear with an image of an Arduino Uno board. For this tutorial, we will select the “Data” tab on the bottom of the screen. Data should already be arriving in real-time once the Data window is selected. You should start seeing a plot similar to that in Figure 5.
From here, there are multiple options. The user can elect to “Start Acquisition” which will collect data as it comes in. Then, when the user wants to stop acquiring the data, select “Stop Acquiring” and a window will appear with instructions to email the data to an email address. This allows the user to access the data with a timestamp in a .csv format from an email address of their choosing.
I went through the process of heating a DHT-22 temperature sensor and then letting it cool via forced convection, which can be seen in the plot below:
It’s easy to see the heating and cooling of the sensor, as well as the timestamp with accurate (up to about 1 microseconds) readouts of the time at which the data was received.
In this tutorial, I demonstrated the power of the BLExAR app once again by using its data window to acquire data from an Arduino Uno board measuring temperature from a DHT-22 sensor. The BLExAR app has the ability to communicate via Bluetooth with an Arduino ATmega328 board and CC2541 BLE module. The app permits users to acquire and visualize data in real-time, with the ability to save a data period as a .csv file for future processing. This features further proves the versatility of the BLExAR app and its integration with iOS devices to further the young engineer’s education into building and experimenting in the physical world.
See More in BLExAR and Arduino: