Deck of Cards Habit Tracker

by prerna7 in Circuits > Arduino

1569 Views, 11 Favorites, 0 Comments

Deck of Cards Habit Tracker

Screen Shot 2022-12-20 at 11.25.11 PM.png
Deck of Cards Habit Tracker

Ever thought of a deck of cards as a calendar?

It takes approximately 2 months to form a habit. Taking the deck of cards as our guide (52 cards= 52 days), I created this visual calendar using Arduino to track new healthy habits I am trying to implement in my life.

Supplies

Deck of cards

Acrylic sheet (18x24" and 3/16" thick)

Wood for frame

Perma Proto Breadboard

Standalone Momentary Capacitative Touch Sensor Breakout

Stranded Wire

Soldering Iron

Solder

Wire Cutter

Screws

Led Strip (https://www.amazon.com/dp/B07BKNS7DJ?ref=ppx_yo2ov_dt_b_product_details&th=1)

Design Your Deck of Cards

suits-01.png

For this project I wanted to design my deck from scratch so I made my own illustrations to make my deck of cards. These illustrations will be laser cut and engraved to make the visual element of the habit tracker.

The size of each tile is 2.5 x 3" when laser cut. The size of the tiles is determined by the type of LED strip. In this case the size was based off of my led strip which was 30 pixels/m.

Laser Cut and Engrave

Screen Shot 2022-12-20 at 10.55.09 PM.png

Engrave all illustrations and laser cut borders to fit exact measurements. (2.5 x 3")

Construct Frame

Screen Shot 2022-12-20 at 10.58.20 PM.png

Build frame according to measurements of LED strip.

In my case it was 2 pixels per tile, 13 tiles a row, i.e 26 pixels a row.

4 rows


My woodshop did not have a working dado blade in good condition so I had to improvise and use a regular tablesaw blade to build my frame.

I had to make my rails by gradually incrementing the cuts/rips millimeter by millimeter to make it fit the led strip snugly.

Each rail had a channel on the top and bottom to hold the tiles in.

Solder Solder Solder

Screen Shot 2022-12-20 at 10.58.28 PM.png

Solder the LED strips together making sure that you have enough wire to wrap around the rails and reach the other side.

Cable management is key.

Code


#include <Adafruit_NeoPixel.h>


// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN 6
// How many NeoPixels are attached to the Arduino?
#define LED_COUNT 200
// this constant won't change:
const int buttonPin = 2; // the pin that the pushbutton is attached to

// Variables will change:
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button


// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)

void setup () {
Serial.begin(57600);
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
// initialize the button pin as a input:
pinMode(buttonPin, INPUT);


#ifndef ESP8266
while (!Serial); // wait for serial port to connect. Needed for native USB
#endif

}

void loop () {

// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);

// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH ) {
// if the current state is HIGH then the button went from off to on:

Serial.println("on");
Serial.print("number of button pushes: ");
Serial.println("count"+buttonPushCounter);

strip.setPixelColor(buttonPushCounter, strip.Color(255, 0, 203));
strip.setPixelColor(buttonPushCounter+1, strip.Color(255, 0, 203)); // Set pixel's color (in RAM)
//strip.setPixelColor(buttonPushCounter+1, strip.Color(255, 255, 0)); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
buttonPushCounter=buttonPushCounter+2;
Serial.println(buttonPushCounter);
lastButtonState++;
Serial.println(lastButtonState);
} else {
// if the current state is LOW then the button went from on to off:
//Serial.println("off");
}
// Delay a little bit to avoid bouncing
delay(50);
}
lastButtonState = buttonState;
delay(150);
}

Assemble

Screen Shot 2022-12-20 at 11.25.21 PM.png

After ensuring that your code and parts all work together it's time to assemble it all.

I used V nails and wood glue for the frame corners.

Drilled pilot holes for attaching the rails to the frame using screws.

Each tile had a slim wood separator to ensure each piece stayed in its place and the light diffused correctly.

Track Away!

Plug your habit tracker in and use to cultivate good habits, right in time for the new year.

Don't just leave it up to chance.