Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
hobooeconomicus
Published © GPL3+

EMDR Psychotherapy Light Bar

Building a therapy device for my psychotherapist wife was a nice mix of programming, electronics and woodworking.

BeginnerFull instructions provided519
EMDR Psychotherapy Light Bar

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
10mm Warm White LED
×14
10mm LED Clip Holder
×14
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×2
Resistor 330 ohm
Resistor 330 ohm
×1
Breadboard (generic)
Breadboard (generic)
×1

Story

Read more

Schematics

Schematic

Code

sfr_EMDR_v03.ino

Arduino
Pins 0-13 are connected to LEDs. The code "moves" a light from one LED to the next. Potentiometers connected to steer brightness and speed of movement.
// EMDR Therapy Tool
// v01 - Light is "moving" from LED to LED, speed can be adjusted with poti
// v02 - Brightness can also be adjusted with poti
// v03 - Using Poti as a hardware adjustable resistor instead of analogWrite for Brightness adjustment



// Light variables

int activeLED = 0;
int duration = 500;
int updown = 0;     // 0 = Aufwrts laufen, 1 = abwrts
int minLED = 1;    
unsigned long counterStart = millis();
int brightness = 255;

// Poti variables

int potiSpeed= A5; 
int potiSpeedValue = 0; 


void setup() {
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(0, OUTPUT);

  // Serial.begin(9600);   // For debugging, can be deactivated, observation: Calling Serial will enable TX/RX on PIN 0 and 1
}


void loop() {

  // Read Speed Poti 
  potiSpeedValue = analogRead(potiSpeed);  
  duration = map(potiSpeedValue,0,1023,5,200); // So that the speed does not start at unreasonably low, and does not go up to 0 (=permanent)
  // Serial.println(potiSpeedValue);  // For debugging, can be deactivated
  
  digitalWrite(activeLED, HIGH ); // Turn active LED on
  
  counterStart = millis();
  
  while (millis()-counterStart < duration) {
  }

  digitalWrite (activeLED, LOW); // Turn active LED off

  if ((activeLED <=12) && (updown == 0)) {
    activeLED++;
  
  }
  
  else if ((activeLED >= minLED) && (updown == 1))  { 
    activeLED--;
  }
  
  else if ((activeLED < minLED) && (updown == 1)) {
    activeLED = minLED;
    updown = 0;
  }
  
  else {
    activeLED=12;
    updown = 1;
  } 

}

Credits

hobooeconomicus
1 project • 0 followers

Comments