The above board has 4 different sensors outlined here.
The arduino is controlled by an arduino sketch. Arduino can be downloaded here: https://www.arduino.cc/en/Main/Software.
Once you have downloaded and installed arduino you will need to select the board you are using. In this case we are using a Mega. Tools>Board Manager/
You will also need to make sure you have the right port selected: Tools>Port
The below arduino sketch accepts data from the 4 sensors and sends it to processing.
#include "Adafruit_Si7021.h" Adafruit_Si7021 sensor = Adafruit_Si7021(); int accelXpin = A0; int accelYpin = A1; int accelZpin = A2; float accelX; float accelY; float accelZ; int press1pin = A8; int press2pin = A9; int press3pin = A10; int bendpin = A7; float press1; float press2; float press3; float bend; float temp; float humidity; int startTime; void setup() { Serial.begin(9600); sensor.begin(); startTime = millis(); } void loop() { Read(); Transfer(); } void Read() { accelX = analogRead(accelXpin); accelY = analogRead(accelYpin); accelZ = analogRead(accelZpin); press1 = analogRead(press1pin); press2 = analogRead(press2pin); press3 = analogRead(press3pin); bend = analogRead(bendpin); if (millis() - startTime > 1000) { startTime = millis(); humidity = sensor.readHumidity(); temp = sensor.readTemperature(); } } void Transfer() { Serial.print(accelX); Serial.print(","); Serial.print(accelY); Serial.print(","); Serial.print(accelZ); Serial.print(","); Serial.print(press1); Serial.print(","); Serial.print(press2); Serial.print(","); Serial.print(press3); Serial.print(","); Serial.print(bend); Serial.print(","); Serial.print(humidity); Serial.print(","); Serial.print(temp); Serial.println(); }
The processing sketch below receives data from the arduino and displays it through simple bars.
import processing.serial.*; Serial myPort; float inX; float inY; float inZ; float inBend; float inR; float inG; float inB; float inT; float inH; float bX; float bY; float bZ; int check = 0; float sensors[]; int ch = 0; String myString; void setup() { size(800,500); String portName = Serial.list()[2]; myPort = new Serial(this, portName, 9600); myPort.bufferUntil('\n'); } void draw() { background(0); noStroke(); ///background for graphs fill(80); rect(100,40,400,20); rect(100,80,400,20); rect(100,120,400,20); rect(100,160,200,20); rect(100,200,200,20); rect(100,240,200,20); rect(100,280,200,20); rect(100,320,200,20); rect(100,360,200,20); textSize(12); fill(255); textAlign(RIGHT); text("X AXIS",90,55); text("Y AXIS",90,95); text("Z AXIS",90,135); text("FLEX",90,175); text("PRESSURE 1",90,215); text("PRESSURE 2",90,255); text("PRESSURE 3",90,295); text("TEMPERATURE",90,335); text("HEAT",90,375); /// 3 axis of the accelorometer fill(0,255,255); rect(290 + (bX-inX)/2,40,inX-bX,20); rect(290 + (bY-inY)/2,80,inY-bY,20); rect(290 + (bZ-inZ)/2,120,inZ-bZ,20); rect(100,160,inBend*.8,20); rect(100,200,inR/5,20); rect(100,240,inG/5,20); rect(100,280,inB/5,20); rect(100,320,inT,20); rect(100,360,inH,20); if(inX > 0 && check == 0){ bX = inX; bY = inY; bZ = inZ; check = 1; } if (myString != null) { myString = trim(myString); float sensors[] = float(split(myString, ',')); inX=sensors[0]; inY=sensors[1]; inZ=sensors[2]; inBend=sensors[6]; inR=sensors[3]; inG=sensors[4]; inB=sensors[5]; inT=sensors[7]; inH=sensors[8]; } } void serialEvent(Serial myPort) { // read the serial buffer: myString = myPort.readStringUntil('\n'); }