Introduction: Tap Detection With Intel Curie Chip on Arduino 101

Picture of Tap Detection With Intel Curie Chip on Arduino 101

This is the twelfth module of the Arduino 101 series and is centred around the use of the IMU (Inertial Measurement Unit) inside the Arduino 101.

This is another one of the most unique features of the Arduino 101 (apart from RTC and Bluetooth) and its advantage over the Arduino Uno is that it has an IMU embedded within the micro controller. This allows us to use an IMU sensor without additional wiring or uses of the limited I/O ports. Thus, making the wiring very straightforward for this project.

In this project the IMU sensor will be used to detect taps, while the RGB LED will indicate the responses to the detection of taps though the use of the built-in Curie library by Intel.

Step 1: Tools and Materials

Picture of Tools and Materials
  • Arduino 101
  • Breadboard
  • RGB LED
  • 3 pieces of 100Ω resistor
  • Jumper Wires

Step 2: Circuitry

Picture of Circuitry

The circuitry is the same as the circuitry for driving an RGB LED and this is due to the fact that the IMU sensor is embedded within the Arduino 101, which is one of the unique features and advantages the Arduino 101 have over the Uno.

Connecting the Arduino

  • Only the ground pin of the Arduino is needed since individual digital signals from the digital I/O pins will be driving each individual diode.
  • Connect the GND pin from the Arduino to the black power rail of the breadboard.

Wring the RGB LED.

  • The longest leg is the ground so connect this to the black power rail on the breadboard with a brown jumper wire
  • For the remaining three pins connect the 100Ω resistors to each one of them.
  • Connect the ends of these resistor starting from the one closest to the ground to pins 5, 6, and 9 on the Arduino board, respectively. The order of these pins are relative to the colour LED each of them drive, which are red, green, and blue respectively.

Since the IMU is embedded, there is no additional wiring needed

Step 3: Code

Picture of Code

// incldue the CurieIMU Library

#include "CurieIMU.h"

void setup() {

pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode (9, OUTPUT);

// Initialise the IMU CurieIMU.begin(); CurieIMU.attachInterrupt(eventCallback);

// Increase Accelerometer range to allow detection of stronger taps (< 4g) CurieIMU.setAccelerometerRange(3);

// Reduce threshold to allow detection of weaker taps (>= 750mg) CurieIMU.setDetectionThreshold(CURIE_IMU_TAP, 750); // (750mg)

// Set the time window for 2 taps as a double tap (<= 250 milliseconds) CurieIMU.setDetectionDuration(CURIE_IMU_DOUBLE_TAP, 250);

// Enable Double-Tap detection CurieIMU.interrupts(CURIE_IMU_DOUBLE_TAP); }

void loop() { // nothing happens in the loop because all the action happens // in the callback function. }

static void eventCallback() { // if the Curie IMU detects a double tap if (CurieIMU.getInterruptStatus(CURIE_IMU_DOUBLE_TAP)) { if (CurieIMU.tapDetected(Z_AXIS, NEGATIVE)) { digitalWrite (5, HIGH); digitalWrite (6, LOW); digitalWrite (9, HIGH); } // if the Curie IMU detects a single tap else if (CurieIMU.tapDetected(Z_AXIS, POSITIVE)) { digitalWrite (5, LOW); digitalWrite (6, HIGH); digitalWrite (9, HIGH); } else { // no taps detected so make the light glow white digitalWrite (5, HIGH); digitalWrite (6, HIGH); digitalWrite (9, HIGH); } } }

Step 4: Demo

It's difficult to get the right tap rhythm with the case attached onto the Arduino like shown on the video since it absorbs some of the shock. For the best results tap on the bottom of the Arduino without the plastic casing.

You will see with a single tap cyan lit up will be shown and with a double tap, purple will be lit up.

Comments

Apolo8 (author)2017-07-17

Don't trust anything by intel.

TechMartian (author)Apolo82017-07-25

Right. It's not perfect but at least they tried. It's sad that Intel is actually leaving the maker market

About This Instructable

310views

11favorites

License:

Bio: Aerospace Engineer working in Software Development with a passion for Hardware.
More by TechMartian:Flying Captain America's Shield - RC PlaneWide Angle ShotsLED Ping Pong With Shift Register
Add instructable to: