13. Skin Electronics¶
Inspiration¶
A new, electronic skin microsystem tracks heart rate, respiration, muscle movement and other health data, and wirelessly transmits it to a smartphone. The electronic skin could be used in a variety of applications, including continuous health monitoring and disease treatment. Professor Jang states "Combining big data and artificial intelligence technologies, the wireless biosensors can be developed into an entire medical system which allows portable access to collection, storage, and analysis of health signals and information."
Process and Workflow¶
We start the week practicing different arduino codes and different microcontrollers. Next I show how I have worked with the Matrix code and the steps to follow to make the analog sensor.
Analog Sensor¶
These are the steps we have followed to make the analog sensor link.
Materials:
-
Paper
-
Velostat
-
Copper Tape
And here Emma's Code
//Emma Pareschi- Dec 2020
//Modify example from Pressure Sensor Matrix Code
//parsing through a pressure sensor matrix grid by switching individual
//rows/columns to be HIGH, LOW or INPUT (high impedance) to detect
//location and pressure.
//>> https://www.kobakant.at/DIY/?p=7443
#define numRows 5
#define numCols 5
#define sensorPoints numRows*numCols
int rows[] = {A0, A1, A2};
int cols[] = {5,6,7};
int incomingValues[sensorPoints] = {};
void setup() {
// set all rows and columns to INPUT (high impedance):
for (int i = 0; i < numRows; i++) {
pinMode(rows[i], INPUT_PULLUP);
}
for (int i = 0; i < numCols; i++) {
pinMode(cols[i], INPUT);
}
Serial.begin(9600);
}
void loop() {
for (int colCount = 0; colCount < numCols; colCount++) {
pinMode(cols[colCount], OUTPUT); // set as OUTPUT
digitalWrite(cols[colCount], LOW); // set LOW
for (int rowCount = 0; rowCount < numRows; rowCount++) {
incomingValues[colCount * numRows + rowCount] = analogRead(rows[rowCount]); // read INPUT
}// end rowCount
pinMode(cols[colCount], INPUT); // set back to INPUT!
}// end colCount
// Print the incoming values of the grid:
for (int i = 0; i < sensorPoints; i++) {
Serial.print(incomingValues[i]);
if (i < (sensorPoints-1)) {
Serial.print("\t");}
// Serial.println("");}
}
Serial.println();
delay(10);
}
Final Result¶
This week Paula and I have worked together and we decide to create something to improve our posture with electronics. Counting on the tools we have, we opted for the playground board which has many possibilities to work, its advantages are that it has introduced different actuators like an accelerometer. temperature sensor, motion, speaker and lighting.
Step by step¶
-
First of all it is important to define the pryect and search on internet for ideas that already exist
-
The posture correctors that I have found on the internet are a kind of mesh that what it does is make you pressure between the shoulder blades and so you can be more aware of your posture, but is it really feasible? In my case I wanted to give a chance but I did not see that it solved the problem.
-
Taking advantage of this week of electronics I wanted to improve this idea and introduce alarms to alert an incorrect posture
-
As I see at last weeks, is very important how you search de questions on internet to resolve dubs with electronics, so the first thing was to know our controler and how it works.
1)We will use the accelerometer on the Circuit Playground to measure the slouch angle.
video taken by Adafruit Circuit Playground
Check here to see all the caracteristics of this microcontroler Adafruit Circuit Playground
Some of the Internally Used Pins:
-
D4 - Left Button A
-
D5 - Right Button B
-
D7 - Slide Switch
-
D8 - Built-in 10 NeoPixels
-
D13 - Red LED
-
D27 - Accelerometer interrupt
-
D25 - IR Transmitter
-
D26 - IR Receiver
-
A0 - Speaker analog output
-
A8 - Light Sensor
-
A9 - Temperature Sensor
-
A10 - IR Proximity Sensor
We use the Data Flow wire to program to the computer
2) I use the next code for Slouch Detector Angle Demo to see how it works
// Circuit Playground Slouch Detector Angle Demo
//
// Compute current angle using accelerometer.
// Compare asin() to atan2().
//
// Author: Carter Nelson
// MIT License (https://opensource.org/licenses/MIT)
#include <Adafruit_CircuitPlayground.h>
#define GRAVITY 9.80665 // standard gravity (m/s^s)
#define RAD2DEG 52.29578 // convert radians to degrees
float currentAngle1;
float currentAngle2;
///////////////////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
// Initialize Circuit Playground
CircuitPlayground.begin();
}
///////////////////////////////////////////////////////////////////////////////
void loop() {
// Compute current angle
currentAngle1 = RAD2DEG * asin(-CircuitPlayground.motionZ() / GRAVITY);
currentAngle2 = RAD2DEG * atan2(-CircuitPlayground.motionZ() ,
CircuitPlayground.motionX() );
// Print current angle
Serial.println(currentAngle1);
Serial.print(",");
Serial.println(currentAngle2);
// But not too fast
delay(100);
}
3) Then open the serial plotter: Tools -> Serial Plotter
4) If the current angle sensed by the Circuit Playground (currentAngle) exceeds a preset value (SLOUCH_ANGLE), then we are slouching and should sound an alarm
// Circuit Playground Slouch Detector Angle Demo
//
// Compute current angle using accelerometer.
// Compare asin() to atan2().
//
// Author: Carter Nelson
// MIT License (https://opensource.org/licenses/MIT)
#include <Adafruit_CircuitPlayground.h>
#define SLOUCH_ANGLEMAX 10
#define SLOUCH_ANGLEMIN -30
#define GRAVITY 9.80665 // standard gravity (m/s^s)
#define RAD2DEG 52.29578 // convert radians to degrees
int currentAngle;
//int currentAngle1;
//int currentAngle2;
///////////////////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
// Initialize Circuit Playground
CircuitPlayground.begin();
}
///////////////////////////////////////////////////////////////////////////////
void loop() {
// Compute current angle
//currentAngle1 = RAD2DEG * asin(-CircuitPlayground.motionZ() / GRAVITY);
//currentAngle2 = RAD2DEG * atan2(-CircuitPlayground.motionZ() ,
// Compute current angle
currentAngle = RAD2DEG * asin(-CircuitPlayground.motionZ() / GRAVITY);
// Check if slouching
if (currentAngle > SLOUCH_ANGLEMAX || currentAngle <SLOUCH_ANGLEMIN ) {
// Sound alarm
CircuitPlayground.playTone(800, 500);
}
// Print current angle
Serial.println(currentAngle);
// real movement
delay(50);
}
5) With the previous sketch loaded and running in the Circuit Playground, you should hear the alarm sound if the tilt angle (hunched over) is greater than 10 degrees.
6) Next step is to introduce a red light to alert the curvature. For that I start programing a small Red LED in the protoboard to see if the code works.
7) Include NeoPixel.h librari
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
//
//Seccion de declaracion de parametros fijos.
#define ALARM 10
#define NUMPIXELS 1 //
Adafruit_NeoPixel pixels(NUMPIXELS, ALARM, NEO_GRB + NEO_KHZ800);
// Declaracion de variableds
Posture Corrector¶
Material Table¶
TOP | NEOPRENE | ELASTIC TAPE AND CONDUCTIVE THREADS | BED TEMPERATURE | SPEED RETRACTION | RETRACTON DISTANCE |
---|---|---|---|---|---|
Reuse a sports top so that it is well attached to the body and mobility is real | Neoprene fabric for sewing electronics components | The conductive threads are sewn into the elastic fabric so that movement does not break them. The three threads run to the small neopixel on the chest | 40mm/seg | 35mm/seg | 0,8mm/seg |