Project tutorial
arduBand - Save your eyes!

arduBand - Save your eyes! © CC BY-NC

Every 10 minutes it checks my position and if it detects that I am sitting for thirty minutes, it activates an alarm.

  • 24 views
  • 0 comments
  • 2 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project


Video


Hi, in the current situation many people work at home, which is why we spend much more time in front of computers or smartphones. Sometimes we can sit before the display for several hours, destroying our eyes and curving our backs. We could use a device reminding us of taking a short break to move and give a moment of respite to our eyes. This is how arduBand works, and now I will show you how to build it.

Okay, at the beginning a few assumptions. I would like my device to be as small as possible, to notify me from time to time about taking a break from the computer with a visual, sound and vibrating signal. That's all. Using the accelerometer, the band will check my current position, using the buzzer it will generate an acoustic signal, the vibration motor will generate vibrations, and the RGB led will provide a visual signal. The whole will be controlled by a microcontroller programmed by RS232 USB converter and of course powered by a battery.

I already have selected components, so it's time to create a layout diagram in the Eagle. I found most of the items I needed in the built-in libraries, and the rest of them using the library loader. I divided the scheme into several blocks to make it more readable and when it was finished I started designing the board. I set the dimensions of the board in such a way that it was a little larger than the battery and placed microcontroller, diode, motor, buzzer and several other components on the top side of the board, and the battery and some other elements on the bottom of the board. Of course, I remembered about creating holes to fix the board to the housing. When everything was ready I generated Gerber files and saved them in.zip format.

The board is ready, the parts are ready, so it is time for soldering. I started by sorting all the elements for the previously marked compartments so that they do not get mixed up. In the beginning, I soldered the parts responsible for the work of the microcontroller, which I desoldered from the Arduino Nano, i.e. two 20pf capacitors, one 100nF, 16MHz quartz resonator, Atmega328 and elements responsible for the working of the programmer, i.e. a 10k resistor and two 100n capacitors. I connected the programmer and uploaded the sample code to make sure that the communication was going correctly. The next step was to solder the charging module, i.e. the tp4056 chip and several other elements. If the red LED flashes gently, everything works fine. When you connect the battery, the blue LED will turn off, indicating that the battery is charging, and when it is only blue, the battery is charged, which can be read in the catalog note. I disconnected the battery and soldered the ws2128 diode, uploaded the code from the Ardafruit Neopixel library making sure that the diode works and then soldered in and tested the next blocks marked in the diagram, thus eliminating the possibility of any errors. The whole process took about two hours. I uploaded the final program and moved on to the next stage.

Then in the Fusion 360, which is free for students, I created housing for my band and exported it to the.stl format, to later upload this file to the Creality Slicer. This program is responsible for translating our project into a language understood by the printer. I saved the file to the sd card and started printing. I found an old, unused watch with which I removed the strap and attached it to my case when it was finished. I put electronics in it and screwed the housing cover. This was the last step.

This is the ready arduBand. Every 10 minutes it checks my position and if it detects that I am sitting for thirty minutes, it activates an alarm that I can deactivate by standing for a minute. At that time, I take my eyes off the computer and look out the window, giving my eyes and back a break. Thanks to this, I don't hurt them when I work for a long time on my projects. I think this project useful for everyone, but above all for those who sit at the desk for a long time, whether reading books or working in front of a computer.

Thanks for your attention and I invite you to check my previous projects!

My Youtube: YouTube

My Facebook: Facebook

My Instagram: Instagram

Code

acc_test.inoC/C++
#include <FastLED.h>

#include <Wire.h>
int ADXL345 = 0x53;
float X_out, Y_out, Z_out;
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

#define DELAYVAL 500

#define PIN 10
#define NUMPIXELS 1
const byte motor = 11;
const byte piezo = 9;
unsigned long minutes;
unsigned long prevMinutes;
int myTime;
int myTime2;
int myPos;

int minMotorVal = 0;
int maxMotorVal = 50;

int a;
int i;

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

void setup() {
  Serial.begin(9600);
  pinMode(piezo, OUTPUT);
  pinMode(motor, OUTPUT);
  Wire.begin();
  Wire.beginTransmission(ADXL345);
  Wire.write(0x2D);
  Wire.write(8);
  Wire.endTransmission();
  delay(10);
  pixels.begin();
  pixels.clear();
}
void loop() {
  pixels.clear();
  minutes = millis();
  if (minutes - prevMinutes >= 1000)
  {
    prevMinutes = minutes;
    myTime++;
  }

  if (myTime == 600)
  {
    checkValues();
    checkPosition();
    notification();

    for (int i = 0; i <= 20; i++)
    {
      pixels.setPixelColor(0, pixels.Color(0, 0, i));
      pixels.show();
      delay(10);
    }

    for (int i = 20; i >= 0; i--)
    {
      pixels.setPixelColor(0, pixels.Color(0, 0, i));
      pixels.show();
      delay(10);
    }
  }

  if (myTime == 1200)
  {
    checkValues();
    checkPosition();
    notification();

    for (int i = 0; i <= 20; i++)
    {
      pixels.setPixelColor(0, pixels.Color(0, 0, i));
      pixels.show();
      delay(10);
    }

    for (int i = 20; i >= 0; i--)
    {
      pixels.setPixelColor(0, pixels.Color(0, 0, i));
      pixels.show();
      delay(10);
    }
  }

  if (myTime >= 1800)
  {
    checkValues();
    myPos++;
    notification();
    timeout();
  }

  Serial.print("myTime :");
  Serial.println(myTime);
  Serial.print("myTime2 :");
  Serial.println(myTime2);
  Serial.print("myPos :");
  Serial.println(myPos);
  delay(1000);
}

void checkValues()
{
  Wire.beginTransmission(ADXL345);
  Wire.write(0x32);
  Wire.endTransmission(false);
  Wire.requestFrom(ADXL345, 6, true);
  X_out = ( Wire.read() | Wire.read() << 8);
  X_out = X_out / 256;
  Y_out = ( Wire.read() | Wire.read() << 8);
  Y_out = Y_out / 256;
  Z_out = ( Wire.read() | Wire.read() << 8);
  Z_out = Z_out / 256;
}

void checkPosition()
{
  if (Y_out <= 0.5)
  {
    myPos++;
  }

  if (Y_out > 0.5)
  {
    myPos = 0;
    myTime = 0;
  }
}

void notification()
{
  if (myPos >= 3)
  {
    analogWrite(motor, maxMotorVal);
    delay(500);
    analogWrite(motor, minMotorVal);
    delay(500);
    analogWrite(motor, maxMotorVal);
    delay(500);
    analogWrite(motor, minMotorVal);

    for (int i = 0; i <= 20; i++)
    {
      pixels.setPixelColor(0, pixels.Color(i, 0, 0));
      pixels.show();
      delay(10);
    }

    for (int i = 20; i >= 0; i--)
    {
      pixels.setPixelColor(0, pixels.Color(i, 0, 0));
      pixels.show();
      delay(10);
    }
  }
}

void timeout()
{

  if (Y_out < 0.5)
  {
    myTime2 = myTime;
  }
  if (Y_out >= 0.5)
  {
myPos = 1;
    if ((myTime2 + 60) == myTime)
    {
      tone(piezo, 1000);
      delay(300);
      tone(piezo, 1000);
      delay(300);
      tone(piezo, 2000);
      delay(300);
      noTone(piezo);
      myPos = 0;
      myTime = 0;
      a = 0;
      for (int i = 0; i <= 20; i++)
      {
        pixels.setPixelColor(0, pixels.Color(0, i, 0));
        pixels.show();
        delay(10);
      }

      for (int i = 20; i >= 0; i--)
      {
        pixels.setPixelColor(0, pixels.Color(0, i, 0));
        pixels.show();
        delay(10);
      }
    }
  }
}

Custom parts and enclosures

Housing
Stl file

Schematics

Schematic
Eagle file
band_wrm5RAZEd3.sch
Eagle file
band_7TyGj0zxpr.brd

Comments

Similar projects you might like

Arduino-Powered Water Bottle

Project tutorial by Md. Khairul Alam

  • 10,666 views
  • 5 comments
  • 36 respects

Pill Me Please - The Automated Pill Packaging Machine!

Project tutorial by KevinZhangHK

  • 5,001 views
  • 0 comments
  • 24 respects

Scorbot ER-V+ Controller & Simulator Design

Project tutorial by Amit Nandi (BigWiz)

  • 1,698 views
  • 3 comments
  • 6 respects

WW2 Tank Laser Tag Sherman & Panther

Project tutorial by Arduino “having11” Guy

  • 19,847 views
  • 1 comment
  • 60 respects

Microcontrollers Lab

Project tutorial by raul

  • 12,368 views
  • 8 comments
  • 61 respects

Third Eye for The Blind

Project tutorial by Muhammed Azhar

  • 103,116 views
  • 52 comments
  • 180 respects
Add projectSign up / Login