Table of Contents

LamaPLC: CJMCU-6701: Biosensor for measuring Galvanic Skin Response (GSR) with SPI communication

CJMCU-6701: Biosensor for measuring Galvanic Skin Response (GSR) with SPI communication The CJMCU-6701 is a specialized biosensor module used for measuring Galvanic Skin Response (GSR), also known as Electrodermal Activity (EDA). Unlike the ACS758 current sensors, this module measures skin conductance to infer emotional or physiological arousal, such as stress or excitement.

Key Features

Skin electrodes for modul

CJMCU-6701: Biosensor for measuring Galvanic Skin Response (GSR) with SPI communication The CJMCU-6701 GSR module typically pairs with finger-strap electrodes that connect via a 3.5mm jack on the backside of the board. These electrodes measure the ion flow from sweat gland activity on the skin surface.

Types of Compatible Electrodes

Electrode Placement & Maintenance

Pinout

CJMCU-6701: Biosensor for measuring Galvanic Skin Response (GSR) with SPI communication

PinFunctionConnection Type
+5VPower Supply(3.3V/5V) Power Input
GNDGroundCommon Ground
OUTAnalog OutputAnalog Pin (e.g., A0)
CSChip SelectSPI Interface
MISMaster In Slave OutSPI Interface
SCKSerial ClockSPI Interface

Backside Port Functions

This is the easiest way to get started. You only need three wires for data/power and the electrode cable plugged into the back.

CJMCU-6701 PinArduino PinNote
VCC5VPower supply
GNDGNDCommon ground
OUTA0Analog Input 0
Back JackElectrodesPlug in electrode cable

This code reads the raw sensor value and performs basic averaging to filter out noise common in biosignals.

const int gsrPin = A0;   // Sensor OUT connected to A0
int sensorValue = 0;
int gsrAverage = 0;
 
void setup() {
  Serial.begin(9600);    // Initialize Serial Monitor
}
 
void loop() {
  long sum = 0;
 
  // Take 10 samples and average them to reduce noise
  for(int i = 0; i < 10; i++) {
    sensorValue = analogRead(gsrPin);
    sum += sensorValue;
    delay(5);
  }
 
  gsrAverage = sum / 10;
 
  // Print the raw average value (0-1023)
  Serial.print("GSR Raw Value: ");
  Serial.println(gsrAverage);
 
  // Optional: Convert to Voltage
  float voltage = gsrAverage * (5.0 / 1023.0);
  Serial.print("Voltage: ");
  Serial.println(voltage, 2);
 
  delay(100); 
}

Option 2: Arduino SPI Wiring (For better noise immunity/precision)

Using SPI uses four data lines but provides a direct digital reading, bypassing the Arduino's built-in ADC for potentially cleaner data.

CJMCU-6701 PinArduino UNO PinArduino Mega Pin
VCC5V5V
GNDGNDGND
CSD10D53
SCKD13D52
MISD12D50
Back JackElectrodesPlug in electrode cable

In this CJMCU-6701, there is no MOSI pin because the onboard ADC (often a Microchip MCP3201) is read-only. It doesn't need instructions from the Arduino; it simply “spits out” data when clocked.

This sketch uses the standard Arduino SPI Library to read the 12-bit digital value.

#include <SPI.h>
 
const int csPin = 10; // Chip Select pin
 
void setup() {
  Serial.begin(9600);
  pinMode(csPin, OUTPUT);
  digitalWrite(csPin, HIGH); // Ensure sensor is disabled initially
 
  // Initialize SPI: Speed 1MHz, MSB first, SPI Mode 0
  SPI.begin();
}
 
void loop() {
  // Start SPI transaction
  SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
  digitalWrite(csPin, LOW); // Select the sensor
 
  // Read 2 bytes (16 bits total) from the sensor
  // Since it's read-only, we send 0x00 to provide clock pulses
  byte highByte = SPI.transfer(0x00);
  byte lowByte = SPI.transfer(0x00);
 
  digitalWrite(csPin, HIGH); // Deselect the sensor
  SPI.endTransaction();
 
  // Combine bytes and extract 12-bit value
  // MCP3201 format: 2 leading zero bits, 1 null bit, then 12 data bits, 1 extra bit
  int rawValue = ((highByte & 0x1F) << 7) | (lowByte >> 1);
 
  Serial.print("GSR Digital Value: ");
  Serial.println(rawValue);
 
  delay(200); // Sample rate adjustment
}

SPI topics on lamaPLC


This page has been accessed for: Today: 2, Until now: 3