Skip to content

Final Project

Made your slide: 1920 x 1080 pixels with your name, project name, Fab Lab name, a photo/render/sketch of your project, a brief description of what your project is/does

Water reminder

Drinking water does more than just quench your thirst — it’s essential to keeping your body functioning properly and feeling healthy. Nearly all of your body’s major systems depend on water to function and survive. You’d be surprised about what staying hydrated can do for your body. but sometimes with the people are not regularly drinking the Appropriate in water in the day and i am one of them My innovation is a accessorize device that designed like a belt that can be adjust on any water bottle and randomly light up to reminder you until you drink it and count the number of time that you have been drink in the day

Materials

Qty Description Price Link Notes
1 acrylic sheet 6mm 18.00 $ https://www.amazon.com/Pack-PET-Sheet-Panels-Sheet-Quality/dp/B084MK8D4Z/ref=sr_1_1_sspa?crid=2RSPIHE99KCCH&keywords=acrylic+sheet+6mm&qid=1650407139&sprefix=acrylic+sheet+6m%2Caps%2C446&sr=8-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUExR01UR0c4QkIyMkQ0JmVuY3J5cHRlZElkPUEwOTc2MTk5QTBTRVJORzNTS0FSJmVuY3J5cHRlZEFkSWQ9QTA2NTQzMTIxSDZXVzY3N0w3NjNQJndpZGdldE5hbWU9c3BfYXRmJmFjdGlvbj1jbGlja1JlZGlyZWN0JmRvTm90TG9nQ2xpY2s9dHJ1ZQ== Order many
1 LET’S RESIN Silicone 31.00 $ https://www.amazon.com/LETS-RESIN-Silicone-Translucent-Non-Toxic/dp/B07V5FFPWC/ref=sr_1_2?crid=1NT8JXWBTS1H3&keywords=silicon+mold&qid=1650407339&sprefix=silicone+mol%2Caps%2C389&sr=8-2
1 Adafruit microcontroller $23.46 $ http://amazon.com/test

add led light

2D and 3D Modeling

for the design the design of the the belt is in steps

  • 1 Degital Design

  • 2 mold design (Laser Cutting)

  • 3 fixing the mold

  • 4 casing the mold (silicon)

using AutoCAD to draw the mold in Acrylic sheet thickness is 6 mm and the picture show the series of the layers

speed : 7

power : 80 the holes in the design is for contact them together to prevent for the mold to move in the casting proses by using screws and nests and then make the silicon mold by follow the same steps of the
Moulding and casting assignment

Electronics and Coding

Coding

logic

the microcontroller will be counting intel the (LastDrinkTime)that the person want to be reminded and then will be lighting the rainbow state by the Adafruit_NeoPixelpixle . and then if the person drink the water will be count as 1 and the Adafruit_NeoPixel will be change to white and every drink will be switch to purple color (drink) by using the acceleration and gyro sensor in the microcontroller ( that has been count according to the average calculation of the X and Y axis)

calculate the deference in portioning the microcontroller

the IF statement of count as a (drink)

  if (accel.acceleration.y < 2 && accel.acceleration.y > -6 && accel.acceleration.z < 1 && accel.acceleration.z > -9 )

the library used

#include <Adafruit_LSM6DS33.h>
#include <SPI.h>
#include <Adafruit_NeoPixel.h>

defending

#define LED_PIN  5 (the pin used in the adafrute)

lighting setting RGB

uint32_t white = strip.Color(255, 255, 255);
uint32_t purble = strip.Color(238, 0, 238);

uint32_t off = strip.Color(0, 0, 0);

drink code

    Serial.println("drink");
    LastDrinkTime = millis();
    strip.fill(purble , 0 , drinknumber + 1);
    strip.fill(white , drinknumber + 1 , LED_COUNT );
    strip.show();
    delay(7000);
    drinknumber = drinknumber + 1;    
    Delta = myTime - LastDrinkTime;  
    strip.fill(off , 0 , 10);
    strip.show();
  }
  Delta = myTime - LastDrinkTime;
  Serial.println(Delta);
Serial.println(myTime);
Serial.println(LastDrinkTime);
if ( Delta > 20000 )
{
  ```
if ( Delta > 20000 )
is the Time between the each drink ( Reminder)

} void rainbow(int wait) { for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) { for (int i = 0; i < strip.numPixels(); i++) { int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels()); strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue))); Delta = myTime - LastDrinkTime; }

    The Rainbow Code

<iframe width="560" height="315" src="https://www.youtube.com/embed/8xKnWHswZRg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

```c++

    #include <Adafruit_NeoPixel.h>

    #define LED_COUNT 10
    #define LED_PIN  5
    Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

    void setup() {
      strip.begin();
      strip.show();
      strip.setBrightness(50);
    }


    void loop() {
      rainbow(10);
    }

    void rainbow(int wait) {
      for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
        for(int i=0; i<strip.numPixels(); i++) {
          int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
          strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
        }
        strip.show();
        delay(wait);
      }
    }


The final code

// Basic demo for accelerometer/gyro readings from Adafruit LSM6DS33

#include <Adafruit_LSM6DS33.h>
#include <SPI.h>
#include <Adafruit_NeoPixel.h>

#define LED_COUNT 10
#define LED_PIN  5

Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

int drinknumber = 0;
unsigned long myTime;
unsigned long LastDrinkTime;
unsigned long Delta;
uint32_t white = strip.Color(255, 255, 255);
uint32_t purble = strip.Color(238, 0, 238);
uint32_t rem = strip.Color(255, 255, 0);
uint32_t off = strip.Color(0, 0, 0);

// For SPI mode, we need a CS pin
#define LSM_CS 10
// For software-SPI mode we need SCK/MOSI/MISO pins
#define LSM_SCK 13
#define LSM_MISO 12
#define LSM_MOSI 11

Adafruit_LSM6DS33 lsm6ds33;
void setup(void) {

  strip.begin();
  strip.show();
  strip.setBrightness(100);
  Serial.begin(115200);
  while (!Serial)
    delay(10); // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("Adafruit LSM6DS33 test!");

  if (!lsm6ds33.begin_I2C()) {
    // if (!lsm6ds33.begin_SPI(LSM_CS)) {
    // if (!lsm6ds33.begin_SPI(LSM_CS, LSM_SCK, LSM_MISO, LSM_MOSI)) {
    Serial.println("Failed to find LSM6DS33 chip");
    while (1) {
      delay(10);
    }
  }

  Serial.println("LSM6DS33 Found!");

  // lsm6ds33.setAccelRange(LSM6DS_ACCEL_RANGE_2_G);
  Serial.print("Accelerometer range set to: ");
  switch (lsm6ds33.getAccelRange()) {
    case LSM6DS_ACCEL_RANGE_2_G:
      Serial.println("+-2G");
      break;
    case LSM6DS_ACCEL_RANGE_4_G:
      Serial.println("+-4G");
      break;
    case LSM6DS_ACCEL_RANGE_8_G:
      Serial.println("+-8G");
      break;
    case LSM6DS_ACCEL_RANGE_16_G:
      Serial.println("+-16G");
      break;
  }

  // lsm6ds33.setGyroRange(LSM6DS_GYRO_RANGE_250_DPS);
  Serial.print("Gyro range set to: ");
  switch (lsm6ds33.getGyroRange()) {
    case LSM6DS_GYRO_RANGE_125_DPS:
      Serial.println("125 degrees/s");
      break;
    case LSM6DS_GYRO_RANGE_250_DPS:
      Serial.println("250 degrees/s");
      break;
    case LSM6DS_GYRO_RANGE_500_DPS:
      Serial.println("500 degrees/s");
      break;
    case LSM6DS_GYRO_RANGE_1000_DPS:
      Serial.println("1000 degrees/s");
      break;
    case LSM6DS_GYRO_RANGE_2000_DPS:
      Serial.println("2000 degrees/s");
      break;
    case ISM330DHCX_GYRO_RANGE_4000_DPS:
      break; // unsupported range for the DS33
  }

  // lsm6ds33.setAccelDataRate(LSM6DS_RATE_12_5_HZ);
  Serial.print("Accelerometer data rate set to: ");
  switch (lsm6ds33.getAccelDataRate()) {
    case LSM6DS_RATE_SHUTDOWN:
      Serial.println("0 Hz");
      break;
    case LSM6DS_RATE_12_5_HZ:
      Serial.println("12.5 Hz");
      break;
    case LSM6DS_RATE_26_HZ:
      Serial.println("26 Hz");
      break;
    case LSM6DS_RATE_52_HZ:
      Serial.println("52 Hz");
      break;
    case LSM6DS_RATE_104_HZ:
      Serial.println("104 Hz");
      break;
    case LSM6DS_RATE_208_HZ:
      Serial.println("208 Hz");
      break;
    case LSM6DS_RATE_416_HZ:
      Serial.println("416 Hz");
      break;
    case LSM6DS_RATE_833_HZ:
      Serial.println("833 Hz");
      break;
    case LSM6DS_RATE_1_66K_HZ:
      Serial.println("1.66 KHz");
      break;
    case LSM6DS_RATE_3_33K_HZ:
      Serial.println("3.33 KHz");
      break;
    case LSM6DS_RATE_6_66K_HZ:
      Serial.println("6.66 KHz");
      break;
  }

  // lsm6ds33.setGyroDataRate(LSM6DS_RATE_12_5_HZ);
  Serial.print("Gyro data rate set to: ");
  switch (lsm6ds33.getGyroDataRate()) {
    case LSM6DS_RATE_SHUTDOWN:
      Serial.println("0 Hz");
      break;
    case LSM6DS_RATE_12_5_HZ:
      Serial.println("12.5 Hz");
      break;
    case LSM6DS_RATE_26_HZ:
      Serial.println("26 Hz");
      break;
    case LSM6DS_RATE_52_HZ:
      Serial.println("52 Hz");
      break;
    case LSM6DS_RATE_104_HZ:
      Serial.println("104 Hz");
      break;
    case LSM6DS_RATE_208_HZ:
      Serial.println("208 Hz");
      break;
    case LSM6DS_RATE_416_HZ:
      Serial.println("416 Hz");
      break;
    case LSM6DS_RATE_833_HZ:
      Serial.println("833 Hz");
      break;
    case LSM6DS_RATE_1_66K_HZ:
      Serial.println("1.66 KHz");
      break;
    case LSM6DS_RATE_3_33K_HZ:
      Serial.println("3.33 KHz");
      break;
    case LSM6DS_RATE_6_66K_HZ:
      Serial.println("6.66 KHz");
      break;
  }

  lsm6ds33.configInt1(false, false, true); // accelerometer DRDY on INT1
  lsm6ds33.configInt2(false, true, false); // gyro DRDY on INT2
}

void loop() {
  //  /* Get a new normalized sensor event */
  sensors_event_t accel;
  sensors_event_t gyro;
  sensors_event_t temp;
  lsm6ds33.getEvent(&accel, &gyro, &temp);
  Serial.print("Time: ");
  myTime = millis();

  Serial.println(myTime); // prints time since program started

  /* Display the results (acceleration is measured in m/s^2) */
  Serial.print("\t\tAccel X: ");
  Serial.print(accel.acceleration.x);
  Serial.print(" \tY: ");
  Serial.print(accel.acceleration.y);
  Serial.print(" \tZ: ");
  Serial.print(accel.acceleration.z);
  Serial.println(" m/s^2 ");
  if (accel.acceleration.y < 2 && accel.acceleration.y > -6 && accel.acceleration.z < 1 && accel.acceleration.z > -9 )
    //if(accel.acceleration.y < 2 )
  {
    Serial.println("drink");
    LastDrinkTime = millis();
    strip.fill(purble , 0 , drinknumber + 1);
    strip.fill(white , drinknumber + 1 , LED_COUNT );
    strip.show();
    delay(7000); //Delay between counting the Drink
    drinknumber = drinknumber + 1;    
    Delta = myTime - LastDrinkTime;  
    strip.fill(off , 0 , 10);
    strip.show();
  }
  Delta = myTime - LastDrinkTime;

  Serial.println(Delta);
  Serial.println(myTime);
  Serial.println(LastDrinkTime);
  if ( Delta > 20000 )

  {
   rainbow(10);

  }

}
void rainbow(int wait) {
  for (long firstPixelHue = 0; firstPixelHue < 5 * 65536; firstPixelHue += 256) {
    for (int i = 0; i < strip.numPixels(); i++) {
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
        Delta = myTime - LastDrinkTime;
    }
    strip.show();
    delay(wait);
    sensors_event_t accel;
    sensors_event_t gyro;
    sensors_event_t temp;
    lsm6ds33.getEvent(&accel, &gyro, &temp);
     if (accel.acceleration.y < 2 && accel.acceleration.y > -6 && accel.acceleration.z < 1 && accel.acceleration.z > -9 )
    {
      break;
    }
   }
  Delta = myTime - LastDrinkTime;
}

Circuit

the rainbow code and contacting result


Last update: May 22, 2022