Maker Portal

View Original

Arduino Sensor Data Logging and Visualization on iPhone

“As an Amazon Associates Program member, clicking on links may result in Maker Portal receiving a small commission that helps support future projects.”

See this content in the original post

See this content in the original post

The MakerBLE board is the centerpiece to this entire tutorial series, which is why we are exploring the board’s capabilities through a series of projects involving sensors, motors, peripherals, and power constraints. Because the MakerBLE has Nordic’s nRF52840 BLE chip at its core, we are also connecting many projects to a smartphone using the BLExAR iOS app. In this entry, we are testing the MakerBLE’s ability to read a common environmental sensor (BMP280) through its Inter-Integrated Circuit (I2C) port and transmit that data over Bluetooth. The parts list to follow along with this project is given below for reference:

  • 1x MakerBLE Arduino Board - $22.00 [Our Store]

  • 1x BMP280 Temperature and Pressure Sensor - $9.00 [Our Store]

  • 1x Mini Breadboard - $3.00 [Our Store]

  • 4x Male-to-Male Jumper Wires - $0.60 [Our Store], $9.99 (560pcs) [Amazon]

See this product in the original post

For the MakerBLE getting started guide (installing Arduino board package, pinout diagrams, etc.), please see the link below:

Getting Started Tutorial for MakerBLE Board

See this content in the original post

In the next section, the reading and testing of the sensor connection will be explored and explained.

See this content in the original post

See this content in the original post

The BMP280 is an absolute barometric pressure sensor designed for mobile phones, smart watches, and GPS modules. It also contains a high-resolution temperature sensor that makes the sensor ideal for environmental monitoring. The BMP280 can also be used to estimate changes in altitude, which can be useful for applications in navigation. The BMP280 has been used in a variety of maker projects ranging from indoor/outdoor position tracking to ambient condition monitoring for scientific experiments. The BMP280 is the perfect sensor for testing Arduino boards because it has widely used libraries and communicates via the I2C port, so it will allow us to test a few features of the MakerBLE while also giving us sanity checks based on our local environment.

A GitHub repository can be found for the MakerBLE board and contains many of the Arduino scripts used here and in other tutorials:

The GitHub repository for the MakerBLE will be periodically updated as projects develop and incubate. If a feature, sensor interaction or is desired, please use our contact page to notify us of your request.

We will be using Adafruit’s BMP280 library to read sensor data with the MakerBLE, so make sure to install it via the Arduino IDE’s Library Manager:

To test the Adafruit library and the wiring between the MakerBLE and BMP280 sensor, upload one of the sample sketches. Below, the “bmp280test.ino” example is given as a sample (with the alternate I2C address called and some minor edits):

See this content in the original post

Opening the serial monitor should result in the temperature, pressure, and approximate altitude being outputted. Below is an example screenshot of the MakerBLE reading the BMP280 sensor:

In the next section, the temperature, pressure, and altitude data will be sent to an iOS device and plotted in real time.


See this content in the original post

In this section, we will be using the BLExAR iOS app as a data collection tool. BLExAR is an integrated app that uses Bluetooth Low Energy to convert Arduino boards into iOS or Android-compatible devices. BLExAR permits smartphone users to control pins, record data from sensors, and send and receive general commands — all in one app. The BLExAR app is intended for makers, students, and engineers. It also includes the ability to plot data in real time, which is the focus of this section of the tutorial.

Below is a code snippet which carries out the following on the MakerBLE Arduino board:

  1. Creates a BLE service that connects with the BLExAR app

  2. Adds a characteristic that writes and notifies BLExAR of data transmission

  3. Starts the BLE service

  4. Starts the BMP280 sensor

  5. Begins advertising the MakerBLE as a BLE device

  6. Enters the loop that begins sending temperature, pressure, altitude (any or all via command-separated values) every 500 ms

See this content in the original post

After the code above is uploaded to the MakerBLE board, the BLExAR app can be opened and the user can search for the MakerBLE board via the search table:

After connecting to the MakerBLE Arduino board, users should navigate to the “Data” tab of the BLExAR app. Assuming everything up to this point has been successful, data should be plotting in real-time similar to the GIF below:

Now we have a working Arduino + iOS data logger! The data can also be saved in real time via the “Acquire Data” button. When the user is finished collecting their data, they can press “Stop Acquisition” to start an email that sends the data to their own email account. This will provide users with a comma-separated value (CSV) file containing their gathered data for later analyses.

See this content in the original post

See this content in the original post

This is the second entry into the tutorial series centered around the MakerBLE Arduino board. Using the BLExAR iOS app again, we were able to monitor the incoming data from the MakerBLE board, plot the values, and save them to a comma-separated value (CSV) file. The data being sent was read from a BMP280 sensor over the I2C port by the MakerBLE board. Temperature, atmospheric pressure, and approximate altitude were all sent over the BLE connection with an iPhone.

With an nRF52840 BLE SoC at its core, the MakerBLE allows users to receive and send messages, collect data, control GPIO pins, and read from sensors. The intention of this tutorial series is to explore remote control of motors, data collection from I2C, SPI, UART, I2S sensor peripherals, message and string text analyses, BLE peripheral/central communication protocols, and general electronics testing with the MakerBLE. The aim is to reduce average component size for maker projects to improve scalability of wearables and portables in the DIY electronics space. Stay tuned for the next entry into the series!

See this content in the original post