SparkFun gator:particle Hookup Guide
Introduction
Do you have an experiment involving biometrics or particle detection?
The gator:particle is an amazing tool that uses a high-sensitivity pulse oximeter and heart-rate sensor, the MAX30102. Similar to the SparkFun Particle Sensor, with the MAX30105 high-sensitivity optical sensor, the gator:particle can also be used for particle detection. The primary difference between these boards is that the SparkFun Particle Sensor also uses a green LED that requires more power than the micro:bit can provide. This tutorial will show you how to get started using the gator:particle sensor with the gator:bit (v2) in the micro:bit development environment.
Required Materials
To get started, you'll need a micro:bit to control everything. Each of the products below includes a micro:bit, but the kit and bundle also include some additional accessories that you may want as well.
To easily use the gator board ecosystem, a gator:bit (v2) will help breakout the necessary pins and you will also need alligator and/or banana cables to connect the gator:bit to the gator:particle.
(*These banana cables have a special diameter on the attachment points designed specifically for use with the micro:bit ecosystem. They may or may not be compatible with the banana cables used on your test equipment.)
You may already have some of these materials, so feel free to modify your cart as necessary.
Suggested Reading
The gator:particle sensor is pretty straight forward to use in application. However, you may find the following concepts useful along the way.
Light
MAX30105 Particle and Pulse Ox Sensor Hookup Guide
If you aren't familiar with the micro:bit, we recommend reading here for an overview.
We would also recommend taking a look at the following tutorials if you aren't familiar with them.
Getting Started with the micro:bit
Getting Started with MicroPython and the SparkFun Inventor's Kit for micro:bit
How to Load MicroPython on a Microcontroller Board
SparkFun gator:bit v2 Hookup Guide
Hardware Overview
The gator:particle consists of 4 pads for power and data.
Contacts | Direction | Description |
---|---|---|
GND | N/A | Ground: Reference voltage and ground loop. |
3.3V | In | Power: Provides 3.3V to board. |
SDA | Bi-directional | Data: Data and commands are transmitted between the sensor and microcontroller. |
SCL | In | Clock: The microcontroller provides the timing needed to communicate on the data line. |
Power
The specified operating voltage for the MAX30102 is between 1.7V - 2V. For use with the gator:bit (v2) and micro:bit, you should provide 3.3V through the 3V3 and GND pads to keep the logic levels consistent; the 3.3V input is then regulated to 1.8V for the MAX30102.
MAX30102
The MAX30102 is a high-sensitivity pulse oximeter and heart-rate sensor that communicates over an I2C bus. The MAX30102 uses both red and IR LEDs along with a very sensitive photodetector for pulse oximetry (SpO2), heart-rate (HR) monitoring, and particle (PM) detection. For the most part, users will only need to know I2C addresses to prevent address conflicts with other devices or sensors.
Here are some of the characteristics of the MAX30102 sensor from the datasheet:
Characteristic | Range |
---|---|
Operating Voltage | 1.8V to 2V |
Supply Current |
Heart Rate and SpO2 Mode: 600 to 1200 µA IR Only Mode: 600 to 1200 µA |
Operating Temperature | -40°C to 85°C |
(ΣΔ) ADC |
Resolution: 15 to 18-bits (programmable) Sampling Rate: 50 - 3200 sps (programmable) |
IR LED |
LED Wavelength: 870 to 900 nm (avg. 880 nm) Forward Voltage: 1.4V Radiant Power: 6.5 mW LED Driver Current: 0 to 50 mA (programmable) |
Red LED |
LED Wavelength: 650 to 670 nm (avg. 660 nm) Forward Voltage: 2.1V Radiant Power: 9.8 mW LED Driver Current: 0 to 50 mA (programmable) |
Photodetector |
Spectral Range of Sensitivity: 600 to 900 nm Radiant Sensitive Area: 1.36 mm2 |
I2C Address |
0xAE - Write Address 0xAF - Read Address |
What are Heart-Rate and Oxygen Saturation?
Heart-rate is the speed at which your heart pumps blood through your body. Pulse oximetry is a noninvasive method of determining saturation of oxygen in your blood. However, this is a peripheral measurement is not always a direct reflection of the arterial oxygen saturation (SaO2), but two are correlated enough for clinical purposes. There are a multitude of applications for these measurements; especially, in the medical field.
Here are some examples of studies using HR monitoring and pulse oximetry:
- Accuracy of pulse oximeters in estimating heart rate at rest and during exercise
- Pulse oximetry: Understanding its basic principles facilitates appreciation of its limitations PDF Download
- Experiment: Exercise, Blood Pressure, and Oxygen Saturation Levels
Here are additional resources on how the MAX30102 functions for HR detection and pulse oximetry:
- AN6410: Signal to Noise Ratio (PDF)
- AN6433: Depth Penetration for Biosensors (PDF)
- Maxim: Open Source Heart Rate Algorithm (Arduino)
What are Particulates?
Particulate matter is the accumulation of matter (solid or liquid) in Earth's atmosphere. These particles vary in size, composition, and distribution. Their effects range from individual health on a microscopic scale to regional climate on a macroscopic scale. Particulate matter is also used in the food industry. Apiarist traditionally use bee smokers when harvesting honey. Smoking is also a method of flavoring and preserving meats and other products.
Here is a link to some experiments involving PM:
For more information on particulate matter and their detection, check out some of these resources:
- Particulate Matter (PM) Basics
- Optical Monitoring of Particulate Matter
- Maxim: Using Optical Sensors to Detect Particles
- Optical Particle Counters
- Smoke Detectors
I2C Connection
I2C is a communication protocol used to transfer data between controller and peripheral devices. It is a 2-wire connection consisting of SDA (data) and SCL (clock). The protocol is pretty well defined so it can be shared with multiple devices. This is beneficial for daisy chaining multiple devices together on a single bus. The primary thing users will need to watch out for is address conflicts (you can't have devices with the same address).
Hardware Assembly
Connecting your gator:particle to the gator:bit (v2) is simple. The board can also be daisy-chained with other I2C boards. This can easily be done with alligator cables or these special banana cables.
Gator:UV | GND | 3V3 | SDA | SCL |
---|---|---|---|---|
Gator:Bit | GND | 3.3V OUT | P20 (SDA) | P19 (SCL) |
Adding the MakeCode Extension
- If you have not previously used MakeCode, please check out the Quick Start Guide fro micro:bit.
- If this is your first time using a micro:bit, please review our Getting Started with the micro:bit guide.
- If this is your first time using the gato:bit (v2), please review our SparkFun gator:bit v2 Hookup Guide.
The easiest way to get started using the gator:particle is to use Microsoft MakeCode, a web-based block editor. This tutorial assumes you are familiar with the with MakeCode, the gato:bit (v2), and the micro:bit development board. If this is your first time check out this guides linked in the suggested reading section (above).
Installing Extensions
To get started with using MakeCode with the miccro:bit, head over to the MakeCode for micro:bit website by Microsoft. Then, click the New Project button to start a new project and open the Editor. (*Yes, all you only need to get start coding is a computer with internet access, an up-to-date web browser, and an available USB port!)
Once you have the editor up, click on the the Advanced
block in the block library to reveal the drop down menu.
Finally, click on the Extensions
block. This should bring up the extensions page. (*Alternatively, you could also click on the extensions link from the settings menu.)
There are two methods for finding the gator:particle extension:
- Search for the name used on the extension3.
- Use the link to the GitHub repository for the pxt-package as the search term.
Search for the PXT-Package
Search for the gator:particle extension using the GitHub repository link to the pxt-package:
https://github.com/sparkfun/pxt-gator-particle
Then, click on the box for the extension to add it to the block library. The gator:particle extension should now appear in the block library.
To verify that you have added the extension, click on the gator:particle
block to make sure that your drop down menu options match the image below.
MakeCode Example
Now that you have added the gator:particle extension to the Editor, lets start with some example code. Plug the micro:bit into your computer using an USB micro-B cable after you have assembled your hardware with the instructions from the previous section. The micro:bit should appear on your computer as a removable storage device.
To upload new code, this is where you will be copying the downloaded .hex
file to later.
Block Functions
initialize gator:particle sensor
This block should be pretty self explanatory, it sets the sensor up to be used. You should use this within the on start
block.
get _____ value
This is a value block as indicated by the block's shape. The output is an integer value from 0
to 262,143
for the sensor's detection of the specified wavelength. There is a drop down menu with selectable options for the sensor reading for the block. Below is a description of the available menu options:
red
- An 18-bit integer value for sensor detection in the IR wavelength (0
and262,143
).infrared
- An 18-bit integer value for sensor detection in the IR wavelength (0
and262,143
).- With the default LED intensity, I was only able to see a maximum of approximately 120,000. To get higher values, the LED intensity needs to be turned up.
detect heartbeat in _____
This is a value block as indicated by the block's shape.
There is a drop down menu with selectable options for the output value of the block. Below is a description of the available menu options:
BPM
- Outputs a single heart-rate measurement in beats per minute (BPM).AVG
- Outputs the average of the last four heart-rate readings in BPM.
Set LED mode to read _____
This block should allows users to designate the LED modes. There are only two opions:
red
- Only the red LED is used or on.red & infrared
- Both the red and IR LEDs are on.- There is no option to use only the IR LED.
Change strength of _____ to _____
This block should allows users to control the brightness or intensity of the LEDs.
- LED- Users designate which LED to control.
red
infrared
- Strength- Users specify the intensity of the LED. Enter an integer.
0
to255
Basic Read
Below, is a simple example of how to take simple measurements from the sensor. To use this example, there are multiple options for accessing the .hex
file:
- Replicate the block functions from the display below to copy the example project. Then download the
.hex
file. - Expand the display widow to pull up the example project. Then download the
.hex
file. - Use this link to pull up the example project. Then download the
.hex
file. Download the
.hex
file from the button below or the link on the bottom of the display.
The output is redirected over the serial port to avoid conflicts on pins P0
and P1
, which are also used for serial communication. To read the sensor values, pull up your favorite serial terminal emulator. Then, connect to the serial port that the micro:bit is on; the default baud rate is 115200 bps. Below, is an example of the sensor output for the example code.
Troubleshooting the Extension
This product's extension has a dependency on Microsoft's build process. If the usual method of installing the MakeCode extension gives an error, you will need to manually install the MakeCode extension. We have provided a local build of this extension that can be uploaded to MakeCode:
To manually install this extension in makecode, go to the "Extensions" tab on the left side of the makecode site:
In the location you'd normally search for an extension, you'll notice an upload button on the right:
Click on this, and you'll get a window allowing you to upload your own built extension. Navigate to where you saved the above extension hex, and upload it to your project.
You should be able to see the extension and its functions now. In addition, you'll be able to build and download your project to your variant of micro:bit.
Other Troubleshooting Tips
Here are a few tips for troubleshooting this device.
Heart-Rate and SpO2
Make sure that you are making good contact and have constant pressure on the sensor. For the best results, use your finger tip. A special open-source algorithm is used to determine the Heart-Rate and SpO2 measurements. The algorithm is relatively accurate, but is primarily meant for demonstration purposes and should not be used in critical applications for monitoring a person's health.
If you still have questions or issues with this product, please create a post on our forum under the Gator Products topic.
Additionally, if you are an educator and you have class or application based questions, please create a post on our forum under the Educational Products topic.
Resources and Going Further
For more product information, check out the resources below:
- Schematic (PDF)
- Eagle Files (ZIP)
- MAX30102 Datasheet (PDF)
- gator:particle PXT Package
- GitHub Product Repo
- micro:bit Landing Page
- SFE Product Showcase
Interested in the micro:bit? Check out some of these other micro:bit products:
Need some inspiration for your next project? Check out some of these other micro:bit product tutorials: