Maker Portal

View Original

iPhone Datalogger with Arduino Using The iOS Bluetooth App BLExAR

See this content in the original post
See this content in the original post

Figure 1: BLExAR app for iOS and Arduino Bluetooth interaction


See this content in the original post

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.

Figure 2: DHT22 Temperature Sensor and HM-10 Bluetooth Module for


See this content in the original post

See this content in the original post

Figure 3: Wiring diagram for Arduino Bluetooth communication between an iOS BLExAR device and the Arduino DHT-22 temperature sensor. Notice the 10k resistor acting as a pull-up resistor. This configuration will allow the Arduino to send a temperature (or humidity) data point roughly every 2 seconds.


See this content in the original post

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.

See this content in the original post

See this content in the original post

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.

Figure 4: BLExAR Bluetooth scan with discoverable devices. In this particular case, a BLExAR device has been discovered and needs to be selected in order to connect and continue with the tutorial.

Figure 5: BLExAR app showing the data window and demonstrating the visualization of real-time data as it is logged into the iOS device via Bluetooth communication. This is a real temperature readout from the DHT22 temperature sensor and the BLExAR app.

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:

See this content in the original post

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.


See this content in the original post

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:

See this gallery in the original post