Skip to content

12. Skin Electronics

**First Test with thread

#include <Adafruit_NeoPixel.h>

#define PIN        0  // Pin de datos al que está conectado el NeoPixel
#define NUMPIXELS 1  // Número de NeoPixels (en este caso 1)
#define SENSOR_PIN A0  // Pin analógico para leer el sensor ARD 366
#define THRESHOLD 600  // Umbral de detección del latido (ajústalo según tu sensor)

Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int lastSensorValue = 0;  // Valor anterior del sensor
bool isPulsing = false;  // Estado de si estamos detectando el pulso (rojo parpadeando)
unsigned long lastPulseTime = 0;  // Momento del último cambio de pulso
unsigned long pulseInterval = 500;  // Intervalo de parpadeo en milisegundos
bool ledState = false;  // Estado del LED (encendido/apagado)

void setup() {
  Serial.begin(115200);  // Inicia la comunicación serial

  // Inicializa el NeoPixel
  strip.begin();
  strip.show();  // Asegura que el NeoPixel esté apagado al inicio

  pinMode(SENSOR_PIN, INPUT);  // Configura el pin del sensor como entrada

  // Al iniciar, el NeoPixel será azul
  strip.setPixelColor(0, strip.Color(0, 0, 255));  // Azul
  strip.show();
}

void loop() {
  int sensorValue = analogRead(SENSOR_PIN);  // Lee el valor analógico del sensor
  Serial.print("Valor del sensor: ");
  Serial.println(sensorValue);  // Muestra el valor del sensor en el monitor serial

  // Si el valor del sensor supera el umbral y ha pasado suficiente tiempo desde el último latido, detectamos un latido.
  if (sensorValue > THRESHOLD && lastSensorValue <= THRESHOLD) {
    isPulsing = true;  // Indica que estamos detectando el pulso

    // Cambia el color a rojo y empieza a parpadear
    strip.setPixelColor(0, strip.Color(255, 0, 0));  // Rojo
    strip.show();
  }

  // Si no se detecta el latido (cuando el valor del sensor baja del umbral)
  if (sensorValue < THRESHOLD && lastSensorValue >= THRESHOLD) {
    isPulsing = false;  // Deja de detectar el pulso
    strip.setPixelColor(0, strip.Color(0, 0, 255));  // Azul
    strip.show();
  }

  // Si estamos detectando el pulso, el NeoPixel debe parpadear
  if (isPulsing) {
    unsigned long currentMillis = millis();

    // Parpadeo al ritmo del pulso (cada medio segundo)
    if (currentMillis - lastPulseTime >= pulseInterval) {
      lastPulseTime = currentMillis;

      // Cambia el estado del LED entre encendido y apagado
      ledState = !ledState;
      if (ledState) {
        strip.setPixelColor(0, strip.Color(255, 0, 0));  // Rojo cuando se enciende
      } else {
        strip.setPixelColor(0, strip.Color(0, 0, 0));  // Apagar el NeoPixel
      }
      strip.show();  // Actualiza el NeoPixel
    }
  }

  // Actualiza el valor anterior del sensor para la próxima comparación
  lastSensorValue = sensorValue;

  delay(10);  // Pequeña espera para evitar lecturas demasiado rápidas
}

Research

describe what you see in this image

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

weekly assignment

Check out the weekly assignment here or login to your NuEval progress and evaluation page.

about your images..delete the tip!!
  1. Remember to credit/reference all your images to their authors. Open source helps us create change faster together, but we all deserve recognition for what we make, design, think, develop.

  2. remember to resize and optimize all your images. You will run out of space and the more data, the more servers, the more cooling systems and energy wasted :) make a choice at every image :)

This image is optimised in size with resolution 72 and passed through tinypng for final optimisation. Remove tips when you don't need them anymore!

get inspired!

Check out and research alumni pages to betetr understand how to document and get inspired

References & Inspiration

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

  • Two images side-by-side

describe what you see in this image describe what you see in this image


Tools

Process and workflow

My sketches are ...

This schematic 1 was obtained by..

This tutorial 2 was created using..

footnote fabrication files

Fabrication files are a necessary element for evaluation. You can add the fabrication files at the bottom of the page and simply link them as a footnote. This was your work stays organised and files will be all together at the bottom of the page. Footnotes are created using [ ^ 1 ] (without spaces, and referenced as you see at the last chapter of this page) You can reference the fabrication files to multiple places on your page as you see for footnote nr. 2 also present in the Gallery.

Code Example

Use the three backticks to separate code.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Results

Video

From Vimeo

Sound Waves from George Gally (Radarboy) on Vimeo.

From Youtube

---

---

Fabrication files

Qty Description Price Link Notes
1 Material one 22.00 $ http://amazon.com/test order now
1 Material two 22.00 $ http://amazon.com/test find alternative
1 Material three 22.00 $ http://amazon.com/test

  1. File: xxx 

  2. File: xxx