Return to site

Complete Guide for Curie/Genuino 101

Here we want to show you how to insert AI to almost everything :)

· tutorial,curie,air drum kit

CurieNeurons Kit is an easy-to-use tool for makers of all levels who want to have a shot at building neural networks, machine learning or artificial intelligence related projects. It helps users to build smart hardware capable of pattern learning and object recognition.

In this article, we will show you step by step how to grasp the power CurieNeurons Kit and insert intelligence into almost everything! :)

Now let's begin!

Driver Installation of Arduino IDE and Genuino 101

1. First, prepare Genuino 101 and USB cable:

2. Connect your Genuino 101 to computer:

3. Download and install Arduino IDE

The download link is https://www.Arduino.cc/en/Main/Software

Open the link in a browser and download the installation package according to your computer system (MacOS).

When you click the link, the page will switch to a donation page.

At this page, you can select a certain amount of donation or click “JUST DOWNLOAD” to download the installation package directly.

After downloading, run the installation program refer to the instructions.

4. Install Genuino 101 development board’s support in “development board supervisor”

Open Arduino IDE

Successively click “tool→ development board→ development supervisor” on Menu bar

Input “intel” in the input box and then find “Intel Curie Boards by Intel”, click it to install.

and than we choose Arduino/Genuino 101 Board.

choose Poart "Arduino/Genuino 101".

Part 1 Wireless Transmission

You may want to make some equipment which needs wireless communication. And the Bluetooth 4.1 module onboard Genuino 101’s master controller makes Genuino 101 communicate with other Bluetooth equipments (includes computer, mobile phone and other Bluetooth accessories) possible. In this chapter, we will build the Bluetooth connection between Genuino 101 and computer through the serial port on Bluetooth adapter (USB BLE-link) and receive and dispatch data between Genuino 101 and USB BLE-link through serial port monitor.

Material List

Softwares

Suggested computer: MacOS

Suggested development environment: Arduino IDE 1.6.12

Suggested support library for development board: Intel Curie Boards by Intel 1.0.7

Required library file: BLESerial (it can be downloaded below, please don’t download it in library supervisor)

Installation of library file:

After downloading BLESerial library, click “project->load library-> add a .ZIP library…”under Arduino IDE menu bar and then select the downloaded “BLESerial.zip” file. The library file installation will then be done automatically. If you are using MacOS computer system, after download, the BLESerial library may be unzipped automatically. We can select the library folder directly in the selection window “add a .ZIP library”.

Sample code

First, we will download below codes to Arduino

#include "BLESerial.h"
#include "CurieIMU.h"

void setup() {
pinMode(13, OUTPUT);
//Serial.begin(115200);
  
//Serial.print("Initialize CurieIMU... ");
CurieIMU.begin();
// Set the accelerometer range to 2G
CurieIMU.setAccelerometerRange(2);
// Set the gyro range to 250 degrees/second
CurieIMU.setGyroRange(250);
//Serial.println("Done!");

//Serial.print("Initialize Bluetooth Service... ");
BLESerial.setName("Curie");
BLESerial.begin(); // Initialize BLESerial communication
//Serial.println("Done!");
  
//Serial.println("Waiting for connections...");
while(!BLESerial); // Waiting for USB BLE-link connected
//Serial.println("Connected!");
}

void loop() {
//scaled accelerometer values
float ax, ay, az;
//scaled Gyro values
float gx, gy, gz;
  
// read accelerometer measurements from device, scaled to the configured range
CurieIMU.readAccelerometerScaled(ax, ay, az);
// read gyro measurements from device, scaled to the configured range
CurieIMU.readGyroScaled(gx, gy, gz);
  
if(BLESerial.operator bool()) {
digitalWrite(13, HIGH);
// display tab-separated accelerometer x/y/z values
BLESerial.print(ax);
BLESerial.print("\t");
BLESerial.print(ay);
BLESerial.print("\t");
BLESerial.print(az);
BLESerial.print("\t");
// display tab-separated gyro x/y/z values
BLESerial.print(gx);
BLESerial.print("\t");
BLESerial.print(gy);
BLESerial.print("\t");
BLESerial.print(gz);
BLESerial.println();
}
digitalWrite(13, LOW);
}

Above codes are used to initialize Genuino 101 Bluetooth and CurieIMU’s related functions, and launch the “search nearby Bluetooth device” status (i.e., USB BLE - link). After completion of Bluetooth connection, D13 pin’s statue LED light will light up at the same time it will also transmit real-time motion data of the 6-axis accelerometer and gyroscope. After Bluetooth disconnecting, D13 pin’s statue LED light will light out, at the same time, it will stop sending motion data.

Effect Test

•   Bluetooth Pairing through Close Distance

After the success of code unloading, close all other Bluetooth devices around and then insert a Bluetooth adapter in computer USB port. Put Genuine 101 Bluetooth antenna near the Bluetooth adapter (less than 20 mm), wait until the Bluetooth LED indicators light on both of the two devices (the blue LED lights on adapter can be found in the vicinity of a pinhole).When the two lights light up and keep lit at the same time, it represents the Bluetooth is connected. After pairing is completed, the Genunio 101 can be removed, Bluetooth will keep pairing state.

•   Check the Motion Data transmitted by Bluetooth

After pairing is completed, select USB BLE-link located port in “tool” menu on Arduino IDE menu bar (after port No. it will goes as “Arduino / Genuino Uno”).

On menu bar, select “tool ->serial port supervisor” and after open serial port supervisor, you can check the real-time motion data.

• Check the Line Chart of the Motion Data

Similarly, after you can check the real-time motion data, you also can check the line chart of the motion data.

On menu bar, select “tools -> serial port plotter” and after open serial port plotter, you can check the real-time line chart of the motion data.

Code Analysis

• BLESerial Library

We use BLESerial library to realize Bluetooth data transmission. We can use following functions to initialize Bluetooth connection.
BLESerial.begin()
Initialize BLESerial function。
BLESerial
Check BLESerial is initialized or not, after initialization return value 1。
BLESerial.operatorbool()
Check 101 development board is matched with adapter or not, if matched, return value is 1 otherwise return value is 0.

• CurielMU Library

We use CurielMU library to call the data of 6-aix accelerometer and gyroscope of IMU from Curie.
We can use following functions to initialize CurielMU’s function.
CurieIMU.begin();
Initialize CurieIMU function。
CurieIMU.setAccelerometerRange(2);
Set the read range of the accelerometer as 2 G 。
CurieIMU.setGyroRange(250);
Set the read range of gyroscope as 250 degrees/second。
CurieIMU.readAccelerometerScaled(ax, ay, az);
Read speed accelerometer’s x/y/z data。Based on previous setting, the data range read here is -2.00 ~ 2.00
CurieIMU.readGyroScaled(gx, gy, gz);
Read speed gyroscope’s x/y/z data。Based on previous setting, the data range read here is -250.00 ~ 250.00

Save and Read Motion Data

Material List

Real products’ picture is as following:

Hardware Connection

• 1. Connection cable for hardware: insert expansion board into Arduino 101 and then insert module MicroSD Module V1.0 into expansion board. As shown in below picture, insert SD card into MicroSD Module and then use USB cable connect Arduino101 with computer.

Picture is as following:

Note: After our test, the direction of the power and the download line’s power supply terminal is the acceleration direction of ax. In the same way, in the same plane, the one vertical to ax direction is ay direction. The one vertical to control panel is az direction. Please see the below picture for reference. After several times of test], we find that we should keep the consistency of the movement when we collect data and after finishing the whole action, let equipment still for a second to make it convenient to the marking and data processing followed by.

Software Preparation

Recommended system: MacOS

Recommended development environment: Arduino IDE 1.6.12

Recommended support library for development board: Intel Curie Boards by Intel 1.0.7

SD card’s read-write development library:

(After the downloading of SD.zip library, select file “SD.zip” by clicking “tool -> loading library ->add a .ZIP library…” on Arduino IDE menu bar and then the library file will be loaded automatically. Under macOS system, the zip document may be unzipped automatically after downloading. Then we can select the library folder in the selection window “add a .ZIP library”.)

Sample Code

Sample of writing SD card codes:                        

#include <SPI.h>
#include <SD.h>
#include <CurieIMU.h>
#define SAMPLING_INTERVAL 10//ms

File myFile;
float ax, ay, az;

uint64_t timer;

void setup() {

timer = 0;

Serial.begin(9600);

CurieIMU.begin();

CurieIMU.autoCalibrateXAccelOffset(0);

CurieIMU.autoCalibrateYAccelOffset(0);

CurieIMU.autoCalibrateZAccelOffset(1);

CurieIMU.setAccelOffsetEnabled(true);

CurieIMU.setAccelerometerRange(4);

if(!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
}
void loop() {

timer =millis();
CurieIMU.readAccelerometerScaled(ax, ay, az);
myFile =SD.open("data.csv", FILE_WRITE);
if(myFile)
{
myFile.print(ax);
myFile.print(",");
myFile.print(ay);
myFile.print(",");
myFile.print(az);
myFile.print("\n");
}
myFile.close();
while((millis() - timer) < SAMPLING_INTERVAL);
}
 

Code Analysis

if(!SD.begin(4)) {
//if communicate with SD card through CS port, 4 means CS connecting line’s pin port
myFile =SD.open("data.csv", FILE_WRITE);
To write permission to open data.csv,if file data.csv is not exist,create data.csv file。
myFile.print(ax);
X axis’s value in the file。
myFile.close();
Close file。
CurieIMU.autoCalibrateXAccelOffset(0);
CurieIMU.autoCalibrateYAccelOffset(0);
CurieIMU.autoCalibrateZAccelOffset(1);
CurieIMU.setAccelOffsetEnabled(true);

Initialize acceleration sensor。

CurieIMU.setAccelerometerRange(4);

Set the output value range of the acceleration sensor as -4g~4g。

Effect Test

After programming routine, we can repeat a group of movement for about 20 times. And then power off, take out tf card, use tf card adapter to insert tf card into computer, double-click to open file “DATA.csv” inside.

Shown as below:

Now what we can see is the 3 axis data inside.

Notice

If the plugged Dupont line is not firm enough, it will cause bad connection and influence the collected data.

Read & Write Data in SD Card

The installation of SD.zip development library comes with a sample about file reading & writing and the file path is file –>sample-> SD-> ReadWrite.
Check the file which needs to be read & written is available or not. If it is available, print the file through serial port.
 
#include <SPI.h>
#include <SD.h>

File myFile;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial.print("Initializing SD card...");

if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");

// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
myFile = SD.open("test.txt", FILE_WRITE);

// if the file opened okay, write to it:
if (myFile) {
Serial.print("Writing to test.txt...");
myFile.println("testing 1, 2, 3.");
// close the file:
myFile.close();
Serial.println("done.");
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}

// re-open the file for reading:
myFile = SD.open("test.txt");
if (myFile) {
Serial.println("test.txt:");

// read from the file until there's nothing else in it:
while (myFile.available()) {
Serial.write(myFile.read());
}
// close the file:
myFile.close();
} else {
// if the file didn't open, print an error:
Serial.println("error opening test.txt");
}
}

void loop() {
// nothing happens after setup
}

Part 2 Intelligent Color Recognizer

How to make colors sing? With CurieNeurons Kit of course!

Let's make an intelligent color recognizer that can play music according to colors.

Here is a complete guide:

Material Preparation

Hardware Connection

Connect hardware as following picture:

White, red and blue buttons connect with 7, 8, 9 pin port respectively. SDA, SCL, GND, VCC of color sensor connect with SDA, SCL, GND and VCC respectively. VCC, GND, SCL, SD of LCD connect with VCC, GND, simulation port 5 and simulation port 4 respectively.

Below is the picture which shows color sensor’s connector:

Real products’ picture is as following:

USB connected with computer. It should be pay attention that the 5v and 3.3v jumper on the expansion board need switch to 5v。

Red, blue and white scraps of paper

Software

Recommended system: MacOS

Recommended development environment: Arduino IDE 1.6.12

Recommended support library for development board: Intel Curie Boards by Intel 1.0.7

Download the library of LCD screen:

The installation of library file:

After the download of LiquidCrystal_I2C.zip library, select file “LiquidCrystal_I2C.zip” by clicking “tool -> loading library ->add a .ZIP library…” on Arduino IDE menu bar and then the library file will be loaded automatically. Under macOS system, the zip document may be unzipped automatically after downloading. Then we can select the library folder in the selection window “add a .ZIP library”.

Download the development library of DFrobot color sensor:

Install the library in the same way above.

Sample Codes:

#include <CurieTimerOne.h>
#include <CurieNeuronsPro.h>
#include <Wire.h>
#include "DFRobot_TCS34725.h"
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20,16,2); //set the LCD address to 0x20 for a 16 chars and 2 line display
DFRobot_TCS34725 tcs = DFRobot_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);

CurieNeurons hNN;

#define LEN 7

byte pattern[LEN];
int dist, cat, nid, res;

#define white_button 7
#define red_button 8
#define blue_button 9

//const of color
#define RED 1
#define BLUE 3

int white_button_value = 0;
int red_button_value = 0;
int blue_button_value = 0;

void printClassifyResult()
{
if (res == 8 || res == 4)
{
if (res == 8)
Serial.println("Recognition is certain.");
else if (res == 4)
Serial.println("Recognition is uncertain.");
//Serial.print("dist:");
//Serial.println(dist, DEC);
Serial.print("color is: ");
if (cat == RED)
{
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("RED");
Serial.println("RED\n");
}
else if (cat == BLUE)
{
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("BLUE");
Serial.println("BLUE\n");
}
}
else
Serial.println("Recognition failed.\n");
}

void setup()
{
Serial.begin(115200);
Serial.println("Color View Test!");

if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1); // halt!
}
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.home();
  
Serial.begin(9600);
while (!Serial);
pinMode(white_button, INPUT);
pinMode(red_button, INPUT);
pinMode(blue_button, INPUT);
  
hNN.begin();
hNN.forget(50);
}

void loop()
{
uint16_t clear, red, green, blue;
while (1)
{
delay(100);
red_button_value = digitalRead(red_button);
blue_button_value = digitalRead(blue_button);
white_button_value= digitalRead(white_button);
    
tcs.getRGBC(&red, &green, &blue, &clear);
tcs.lock(); // turn off LED
    
pattern[0] = (byte)(red/10);
pattern[1] = (byte)(green/10);
pattern[2] = (byte)(blue/10);
                    
// Serial.print("R = ");
// Serial.print(pattern[0]);
// Serial.print(", G = ");
// Serial.print(pattern[1]);
// Serial.print(", B = ");
// Serial.println(pattern[2]);
if(red_button_value ==1 ){
hNN.learn(pattern, LEN, RED);
Serial.println("Learned an example of RED.\n");
delay(200);
red_button_value= 0;
}
if(blue_button_value ==1 ){
hNN.learn(pattern, LEN, BLUE);
Serial.println("Learned an example of BLUE.\n");
delay(200);
blue_button_value = 0;

}
if(white_button_value ==1 ){
res = hNN.classify(pattern, LEN, &dist, &cat, &nid);
printClassifyResult();
delay(200);
white_button_value=0;
}
}
}

Code Analysis

LiquidCrystal_I2C lcd(0x20,16,2);
Set LCD’s place as 0x22,16 bytes,show in 2 rows。
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("RED");
lcd.clear(); clear the displayed word in lcd
lcd.setCursor(0,1); the position of cursor is in column 0,row 1;
lcd.print("RED");display word “RED” on the screen;
tcs.getRGBC(&red, &green, &blue, &clear);
This function reads RGB’s data and assigns value to variable red, green and blue. Clear seems represents the distance between sensor and color scrap.
pattern[0] = (byte)(red/10);
pattern[1] = (byte)(green/10);
pattern[2] = (byte)(blue/10);
Here the value of red, green and blue are all divided by 10 because the value they read from sensor are all very big but the maximum pattern of type of byte is 256, it can be saved in pattern data set only after being divided by 10.
 
hNN.learn(pattern, LEN, BLUE);
Neuron learning function, parameter is , pattern refers to the input data need to be learned, LEN means the length of input data, BLUE means the customized category of input data.
res = hNN.classify(pattern, LEN, &dist, &cat, &nid);
Neuron recognizing function, pattern refers to the data need to be recognized, LEN refers to the length of pattern, cat refers to the recognized category.

Effect Test

Test steps:

1.     After power on, open software’s serial port:

2. Put color on the red scrap of paper and press red button several time. The picture below shows the button is pressed 2 times which means it learns red color’s RGB value twice.

Pay attention here that keep the distance between color sensor and scrap as around 10mm. As shown in the picture, I use screw to fix the distance between senor and color scrap.

3. Put the color sensor above blue color and press blue button several times to do learning. The step is similar as step 2.

4. Recognition – we can find some scraps or stuff in red or blue color to do the recognition. Of course we can use these color scraps of paper also. Put the color sensor on the surface of red staff and then press white button to do recognition. Below picture shows the recognition result of red color.

Advanced test: theoretically it can learn almost hundred of colors. Let us find another more color scrap or stuff to learn different color. So that it can learn more color.

Notice

1. Pay attention to the jumper of expansion board, in order to avoid jumper, please connect with 5V port shown in following picture:

If using 3V port, the usage of REG color sensor will have a problem.

Part 3 "Air" Drum Kit

Loved this Freedrum project! We made a DIY version - Air Drum Kit - using CurieNeurons Kit by ourselves. Now that you can drum it whenever and wherever you like!

Below is a complete tutorial of how we made it:

Material Preparation

Hardware Connection

• Install Genuino 101 on the pedestal.

• Install IO expansion board on Genuino 101.

• Install SD card to the SD card port on expansion board orderly.

• Use magic ribbon to tie and fix 101, expansion board and SD card together. Leave a certain length (long enough to go around hand one time)of the magic ribbon for future use.

• Connect 9V power line with battery for future use.

Software Preparation

Recommended system: MacOS (pre-install Excel or Numbers )

Recommended development environment: Arduino IDE 1.6.12

Recommended support library for development board: Intel Curie Boards by Intel 1.0.7

iOS equipment (iPhone or iPad, either one of them is OK), pre-install GarageBand App.

Data Collection

First program data-collection.ino into arduono101

The codes are as following:

#include <SPI.h>
#include <SD.h>
#include <CurieIMU.h>
#define SAMPLING_INTERVAL 10//ms

File myFile;
float ax, ay, az;
uint64_t timer;

void setup() {
timer = 0;
// Open serial communications and wait for port to open:
Serial.begin(9600);
CurieIMU.begin();
CurieIMU.autoCalibrateXAccelOffset(0);
CurieIMU.autoCalibrateYAccelOffset(0);
CurieIMU.autoCalibrateZAccelOffset(1);
CurieIMU.setAccelOffsetEnabled(true);
CurieIMU.setAccelerometerRange(4);
  
if(!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
}

void loop() {
timer = millis();
CurieIMU.readAccelerometerScaled(ax, ay, az);
myFile = SD.open("data.csv", FILE_WRITE);
if(myFile) {
myFile.print(ax);
myFile.print(",");
myFile.print(ay);
myFile.print(",");
myFile.print(az);
myFile.print("\n");
}
myFile.close();
while((millis() - timer) < SAMPLING_INTERVAL);
}

1. After programming, pull out USB cable.

2. Tie equipment on the back of hand.

3. Connect battery with Arduino 101 for power on and then start to do knock down movement, repeat the movement for about 20 times. Pay attention to the movement range and keep the speed at each tap as consistent as possible, so that it will be convenient to observe action’s waveform later.

4. Remove the battery, take out the SD card and insert it into the PC. Open the DATA.CSV file in the SD card and select the date in column ABC3 - > click insert - > insert line chart, the diagram is as below:

We see above each waveform is a percussion, our work following is to shear off the clutter.

Data Processing

Here what we need to do is get rid of clutter before and after the each group of movement, the way to remove the clutter is to delete data correspondingly. For instance we need to cut off the clutter at beginning and end of below chart.

By moving the mouse pointer on the broken line, we can see the location.

For example, this is the place where the clutter ends at the head and we just need to delete the data before the point.

The deletion of clutter at the end is the same.

And then we use the same method to collect the second movement that swing hand towards the right.

The two processed data are saved separately as file “1.csv” and “2.csv” and they will be put into “train_data” under folder “pipeline-curie”. And then we modify file “config.csv” as following:

And then run “CurieDP”. The procedure will do further processing automatically.

Till here, the data processing is end.

Data Learning and Recognition

The processed data will be saved under the same catalogue as the one of “Cruie-DP” and its file name is “neurons.csv”.

then save it into SD card.

And now, we program “curie-classify-blemidi.ino” into Genuino 101. Then Curie can learn and recognize data automatically.

Effect Test

First we open GarageBand App in iPhone or iPad. Then we select “drum” as musical instrument. Click “primary sound”.

Click the spanner icon at the top right corner.

Select “advanced”

Select “Bluetooth MIDI equipment”

Select “Curie” to connect.

When this place indicates “connected”, you can start waving "Genuino 101" on your hand for fun~

Part 4 Smart Boxing Glove

Do you like boxing? Imagine a pair of boxing gloves combined with artificial intelligence that can recognize your motions, making practising more fun!

Here is a tutorial of how to make your own smart boxing glove!

Material List

Physical picture of material shown as following:

Hardware Connection:

Physical picture of material shown as following: connect 9V battery with Arduino 101 development board with battery connecting cable and insert BLE-link into USB port.

Pass magic ribbon through the gap between pedestal and expansion board and tie magic ribbon on hand. Hold the battery as shown in below picture:

Software

Recommended system: MacOS

Recommended development environment: Arduino IDE 1.6.12

Recommended support library for development board: Intel Curie Boards by Intel 1.0.7

Data collection routine (program it on Arduino to use)

Download link:

Software for data processing (used on pc): CurieDP,

Download link:

Data learning and recognition (program it on Arduino to use)

Download link:

Operation procedure: to make Curie mater a motion need three steps :

data collection, data processing, data learning and recognition.

Curie has 128 never cell so its data processing capacity is limited. So when facing with complex motion with big data, it is required to cut and optimize the collected original 3 axis data and then  do down-sampling to decrease the data quantity. And then Curie learns these characteristic data. Detailed steps are as following:

Step 1: data collection:

First, program “data-collection.ino” onto arduono101

Codes as following:

#include <SPI.h>
#include <SD.h>
#include <CurieIMU.h>
#define SAMPLING_INTERVAL 10//ms

File myFile;
float ax, ay, az;
uint64_t timer;

void setup() {
timer = 0;
// Open serial communications and wait for port to open:
Serial.begin(9600);
CurieIMU.begin();
CurieIMU.autoCalibrateXAccelOffset(0);
CurieIMU.autoCalibrateYAccelOffset(0);
CurieIMU.autoCalibrateZAccelOffset(1);
CurieIMU.setAccelOffsetEnabled(true);
CurieIMU.setAccelerometerRange(4);
  
if(!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
}

void loop() {
timer = millis();
CurieIMU.readAccelerometerScaled(ax, ay, az);
myFile = SD.open("data.csv", FILE_WRITE);
if(myFile) {
myFile.print(ax);
myFile.print(",");
myFile.print(ay);
myFile.print(",");
myFile.print(az);
myFile.print("\n");
}
myFile.close();
while((millis() - timer) < SAMPLING_INTERVAL);
}

1. After programming, pull out USB programming cable.

2. Tie the equipment on the back of hand as shown in below picture:

3. Connect battery with Arduino 101 for power on. Start to do boxing. Repeat straight punching and pay attention that after each punching pause 1 second to make it convenient to check motion waveform in the future.4. Pull out battery cable and take out SD card, using adapter to insert it into pc. Open file “DATA.CSV” in SD card, details shown in below:

5. Display line chart: select the data in A, B and C columns -> click “insert” -> insert line chart, details shown in below picture:

Above we can see each waveform represents a punching. Our work now is cut out each waveform and cut out the clutter.

Step 2: Date Processing:

1 .We need to cut out the clutter between each straight punching and the way to cut it out is deleting the corresponding data. For example we need to cut out the clutter pointed with arrow in first section in below picture. We can see on the picture the clutter is from row 0 to row 253 then we delete the table cell from 0 to 253.

Waveform of the first section after cutting out the clutter is as following:

Use the same way to cut out other clutters. Below picture shows the waveform after cutting out clutter.

It looks much neat now, right? This is just the data interception of the straight punching. We rename the document as “straight. csv”.

We use the same way to collect and process the file of hooks and swings. Rename these two documents respectively as “uppercut.csv” and “swing.csv”.

2. Down-sampling. Then we will use the pre-write routine to extract data characteristic from these three files to reduce data. Unzip “ CurieDP.zip” and then open file “CurieDP/train_data”. Copy the three files generated in first step to this place, and then modify the configuration file “config. csv” as following:

Find the data processor Curie-DP:

Double-click “execution” and it will automatically process the data of the three movements. The results are as follows:

Results show that the recognition rates of the three movements respectively are 56.5217%, 100% and 77.7778% respectively;

After the execution, two new files will be generated: “neurons. csv”.

We only use file “neurons. csv”. This file will be used by Arduino101.

Step 3: Data Learning and Recognition

1. Copy “neurons.csv” into SD card . insert the SD card back into Arduino 101.

2. Unzip file “curie-classfiy-ble.zip”.

Enter into folder “curie-classfiy-ble” as following:

Double-click to open file “curie-classfiy-ble.ino” through Arduino IDE to compiling and download procedure to Arduino 101.

3. Plug BLE-link in the USB port on computer and open ArduinoIDE (Please notice that BLE-link itself is a ArduinoUNO chip). Click to open tool ->port -> select BLE-link’s port COM4 and then open virtual serial port.

The way to open virtual serial port is as following:

4. Close Arduino 101’s Bluetooth antenna to BLE-link (try to keep as close as possible for several seconds). Arduino101 will match with BLE-link automatically. After automatic pair, the blue light on BLE-link will light on.

After the success of the matching, it looks like following:

After the success of the matching, Arduino101 will automatically learn the data of file “neurons. csv”: below picture shows the it is learning and reading data:

After data reading for about few seconds,

We can do whatever movement we want for recognition,

For instance, we do a straight punching:

Below picture shows the recognition result:

Notice:

1. When Arduino101 read the file in SD card, the file name can be too long. If the file name is too long, Arduino101 will fail to read the data. So it is suggested to keep the length of file name within 8 bytes.

2. It is possible that Arduino101 fail to match with BLE-link. When come up against this problem plug in and out of Arduino101 and BLE-link for more try.

All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly