Flowers Holiday Hack

A group of hackers got together to hack on the Flowers Bluetooth brooches and co-author this project via LIVE streaming.

IntermediateWork in progress2 hours737
Flowers Holiday Hack

Things used in this project

Hardware components

DFRobot Option 1: Adafruit Kitty's Flowers - Pair of Bluetooth Wearable Brooches
×1
Option 2: Art by Physicist Flowers Bluetooth brooches
×1
Adafruit Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

USB-C programming cable (generic)

Story

Read more

Code

touch_vibrate_sample.ino

Arduino
This is a modified script combining the vibration motor and the touch sensor based on the sample code from DFRobot wiki: https://wiki.dfrobot.com/SKU_DFR0748_Kitty_Flower
#define TOUCHPIN   6

#define VMPIN      5     //Vibration motor pin

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(115200);
  // make the pushbutton's pin an input:
  pinMode(TOUCHPIN, INPUT);
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(VMPIN, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input pin:
  int touchState = digitalRead(TOUCHPIN);
  // print out the state of the button:
  Serial.println(touchState);
  delay(10);        // delay in between reads for stability
  
  if (touchState == 1){
  digitalWrite(VMPIN, HIGH);   // turn the Motor on (HIGH is the voltage level)
  delay(1000); // wait for a second
  }
  else{
  digitalWrite(VMPIN, LOW);    // turn the Motor off by making the voltage LOW
  delay(1000);                       // wait for a second
  }

}

basic_fall_detection.ino

Arduino
#include <Wire.h>
#include <DFRobot_LIS2DH12.h>

DFRobot_LIS2DH12 LIS; //Accelerometer

int16_t x2, y2, z2;

void setup() {
  Wire.begin();
  Serial.begin(115200);
  while (!Serial);
  delay(100);

  // Set measurement range
  // Ga: LIS2DH12_RANGE_2GA
  // Ga: LIS2DH12_RANGE_4GA
  // Ga: LIS2DH12_RANGE_8GA
  // Ga: LIS2DH12_RANGE_16GA
  while (LIS.init(LIS2DH12_RANGE_16GA) == -1) { //Equipment connection exception or I2C address error
    Serial.println("No I2C devices found");
    delay(1000);
  }
}

void loop() {
  int16_t x, y, z;
  delay(100);
  LIS.readXYZ(x, y, z);
  LIS.mgScale(x, y, z);
  int16_t at = sqrt(x*x2 + y*y2 + z*z2);
  x2 = x;
  y2 = y;
  z2 = z;
//  Serial.println(at);
  
  if(at >= 170) {
    Serial.println("A fall!");
    delay(2000);
  }

}

pixel_counter

Arduino
Touch the centre of the flower to move the outer pixel up a scale. Resets to the start of the scale once it has been round once.
// you need the Adafruit Neopixel library
// Made to run on the kitty yeung flower brooch
// code conceived and bodged together by Tanya Fish during hackster holiday hack

// I have no clue if it needs the avr bit or not so I left it in
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// the cap touch is on pin 6
#define TOUCHPIN   6

// the vibration motor is on pin 5 - later I may add a bit to use this too so have left it in
#define VMPIN      5     //Vibration motor pin

// sets the number of presses to zero at the start
int presses =0;
int prestate =0;

// the pixels are on pin 9
#define PIXELPIN        9 

// there are 7 pixels on the flower brooch
#define NUMPIXELS 7

// all the settings the neopixel library needs to hear
Adafruit_NeoPixel pixels(NUMPIXELS, PIXELPIN, NEO_GRB + NEO_KHZ800);


void setup() {

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
   // initialize serial communication at 9600 bits per second:
  Serial.begin(115200);
  // make the touch pin an input
  pinMode(TOUCHPIN, INPUT);
  // initialize digital pin for the vibration motor as an output
  pinMode(VMPIN, OUTPUT);
 
}

void loop() {

  // read the input pin:
  int touchState = digitalRead(TOUCHPIN);
  // print out the state of the button:
  Serial.println(touchState);
  delay(10);        // delay in between reads for stability
  
  pixels.clear(); // Set all pixel colors to 'off'
  pixels.show();

// check if the flower centre is pressed. If it is, then the touchState is HIGH:
  if (touchState == HIGH && prestate == 0) {
    presses++;
    Serial.println(presses);
    
    prestate = 1;
  } else if(touchState == LOW) {
    prestate = 0;
  
  }
  
    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // this is set to magenta because I like magenta - change it if you like
    for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
    pixels.setPixelColor(presses, pixels.Color(100, 0, 100));

    pixels.show();   // show the updated pixel position
   
  }

  // if the light has gone round the scale once, go back to the beginning
  if (presses == 8) {
    presses=0;
    Serial.println(presses);
    prestate = 1;
  }

}

CoolBloom: 4-7-8 deep breathing guide

Arduino
Practice mindful breathing to relax, slow your heartbeat, and reduce stress by Alex Glow
https://www.hackster.io/glowascii/coolbloom-4-7-8-deep-breathing-guide-6aec10

Spoon counter

Arduino
A simple touch-to-move indicator light to show anything you like on a scale of 1-7, this one counts spoons left for tasks!
See project by Tanya Fish: https://www.hackster.io/tanyafish/spoon-counter-60a6f6

Credits

Kitty Yeung

Kitty Yeung

19 projects • 184 followers
Physicist/Artist/Musician/Fashion Designer/Engineer www.kittyyeung.com
Alex Glow

Alex Glow

147 projects • 1581 followers
The Hackster team's resident Hardware Nerd. I love robots, music, EEG, wearables, and languages. FIRST Robotics kid.
Amie DD

Amie DD

8 projects • 75 followers
Maker of Things
tanya

tanya

2 projects • 10 followers
Permanently working on something - ex hardware, technical documentation, now academic. Read my tutorials on Make, Hackspace, pimoroni.com.
Moheeb Zara

Moheeb Zara

39 projects • 136 followers
Developer Advocate at EMQ Technologies - . Co-founder - South West Maker Festival. Hardware hacker, artist, robots, HeatSync Labs
Jazz DiMauro

Jazz DiMauro

1 project • 9 followers
Designer/maker and creator of magical experiences and artifacts
Ish Ot Jr.

Ish Ot Jr.

21 projects • 175 followers
Helen Leigh ⚡

Helen Leigh ⚡

1 project • 11 followers
Hardware hacking & musical oddities. I write columns for @Make and books about music tech & crafty electronics. Head of Community @Crowd_Supply 🏴󠁧󠁢󠁷󠁬󠁳󠁿
barbmakesthings

barbmakesthings

1 project • 9 followers
Jinger Zeng

Jinger Zeng

2 projects • 14 followers
Jinger Zeng

Jinger Zeng

33 projects • 237 followers
Contest Manager @Hackster. I 😘 🤖🦄 🎭 🩰 🌎 😜 🎸🌼🌈 🧮

Comments