iPhone Datalogger with Arduino Using The iOS Bluetooth App BLExAR
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).
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.
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: