====== LamaPLC: CJMCU-6701: Biosensor for measuring Galvanic Skin Response (GSR) with SPI communication ====== {{ :sensor:cjmcu_6701_1.png?180|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 sensor**s, this module measures skin conductance to infer emotional or physiological arousal, such as stress or excitement. **Key Features** * **Dual Interface:** Supports both Analog (direct voltage output) and [[com:basic_spi|SPI communication]] for versatile integration. * **Built-in ADC:** Features a precise 12-bit Analog-to-Digital Converter for digital processing. * **Voltage Support:** Compatible with both 3.3V and 5V power supplies. * **Form Factor:** Compact design often including a 3.5mm headphone jack or pads for connecting skin electrodes. ==== Skin electrodes for modul ==== {{ :sensor:cjmcu_6701_3.png?180|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** * **Velcro Finger Straps (Most Common):** Reusable straps with metal or conductive fabric contact pads. They are typically worn on the index and middle fingers. * **Ag/AgCl (Silver-Silver Chloride) Electrodes:** Used for high-precision or research-grade measurements. These can be disposable snap-on pads or reusable cup electrodes that provide a very stable electrical interface. * **Conductive Dry Pads:** Simple metal plates often found in DIY kits. These are durable but more sensitive to movement noise than gelled or velcro options. **Electrode Placement & Maintenance** * **Optimal Sites:** The fingertips or palms are the most responsive areas because they have the highest density of eccrine sweat glands. * **Skin Prep:** For best results, the skin should be clean but not scrubbed with alcohol, as overly dry skin can lower the baseline conductance. * **Contact Pressure:** Velcro straps should be snug but not tight. Too much pressure can restrict blood flow, while too little causes erratic "spikes" in your data. ==== Pinout ==== {{ :sensor:cjmcu_6701_2.png?180|CJMCU-6701: Biosensor for measuring Galvanic Skin Response (GSR) with SPI communication}} ^Pin^Function^Connection Type| ^+5V|Power Supply|(**3.3V/5V**) Power Input| ^GND|Ground|Common Ground| ^OUT|Analog Output|Analog Pin (e.g., A0)| ^CS|Chip Select|SPI Interface| ^MIS|Master In Slave Out|SPI Interface| ^SCK|Serial Clock|SPI Interface| **Backside Port Functions** * **3.5mm Audio Jack (Standard):** The primary port for connecting the GSR electrode cable. It allows for a secure, plug-and-play connection to the finger electrodes. * **Solder Pads (Alternative):** Some versions of the board feature labeled pads on the back (**GSR**) for users who want to bypass the headphone jack and solder electrode wires directly to the PCB for a more permanent or compact installation. * **Potentiometer Access:** While the adjustment screw is on the front, the solder points for the Sensitivity Calibration Potentiometer are visible on the back. This component adjusts the baseline output voltage to accommodate different skin types. ==== Option 1: Arduino Analog Wiring (Recommended for simplicity) ==== This is the easiest way to get started. You only need three wires for data/power and the electrode cable plugged into the back. |< 90% 30% 30% 30% >| ^CJMCU-6701 Pin^Arduino Pin^Note| ^VCC|5V|Power supply| ^GND|GND|Common ground| ^OUT|A0|Analog Input 0| ^//Back Jack//|Electrodes|Plug 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. |< 90% 30% 30% 30% >| ^CJMCU-6701 Pin^Arduino UNO Pin^Arduino Mega Pin| ^VCC|5V|5V| ^GND|GND|GND| ^CS|D10|D53| ^SCK|D13|D52| ^MIS|D12|D50| ^//Back Jack//|Electrodes|Plug 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 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 ===== {{topic>spi}} \\ {{tag>CJMCU CJMCU-6701 ACS758 ACS-758 Galvanic_Skin_Response GSR Electrodermal_Activity EDA SPI communication Arduino code sensor healthcare}} This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}