Neopixel 60 clock mod for the color blind

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
hellbent
 
Posts: 22
Joined: Wed Jul 09, 2014 9:15 pm

Neopixel 60 clock mod for the color blind

Post by hellbent »

hey all,

wanted to share the small modification i made the the NeoPixel 60 clock project. I'm red/green colorblind and the color combining of the original project was extremely difficult for me to discern even if i stared at the clock. so I figured i'd do something about it. i did this in two ways:
1) add on a separate 12 pixel ring to display only the hours in red, this has data in on pin 5 of the boarduino.
2) modify the code so that instead of combining the blue and green of seconds and minutes for the relevant pixels, i'd make it so that the smaller value of either seconds or minutes would be treated like the lighter 'layer' of time being displayed on the 60 ring. this way, if the seconds value is smaller than the minutes value, the seconds will appear as solid blue and the minutes will appear as solid green. when the two values match or pass one another, the pixels swap color so that the smaller value is still 'on top' of the other, making things much easier to read.

you can see the working clock here if you like: https://www.youtube.com/watch?v=RLbNUEjkebs

here's the modified code:

Code: Select all

/**************************************************************************
 *                                                                     	*  	 
 *   NeoPixel Ring Clock                                               	*
 *   Copyright (C) 2014  Andy Doro ([email protected])                 	*
 *                                                                     	*
 ***************************************************************************
 *                                                                     	*
 * This program is free software; you can redistribute it and/or modify	*
 * it under the terms of the GNU General Public License as published by	*
 * the Free Software Foundation; either version 2 of the License, or   	*
 * (at your option) any later version.                                 	*
 *                                                                     	*
 * This program is distributed in the hope that it will be useful,     	*
 * but WITHOUT ANY WARRANTY; without even the implied warranty of      	*
 * MERCHANTABILITY or F*TNESS FOR A PARTICULAR PURPOSE.  See the       	*
 * GNU General Public License for more details.                        	*
 *                                                                     	*
 * You should have received a copy of the GNU General Public License   	*
 * along with this program; if not, write to the Free Software         	*
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,               	*
 * MA  02111-1307  USA                                                 	*
 *                                                                     	*
 ***************************************************************************
 *
 *
 * Revision History
 *
 * Date 	 By    What
 * 20140320 	AFD 	First draft
 * 20140722     BMP     Separated Hours onto second 12 pixel ring, changed to color overlap mode instead of color combining so colorblind people have an easier time
 */

// include the library code:
#include <Wire.h>
#include <RTClib.h>
#include <Adafruit_NeoPixel.h>

// define pins
#define NEOPIN 6
#define HOURPIN 5

#define BRIGHTNESS_BIG 16 // set max brightness
#define BRIGHTNESS_SMALL 8

RTC_DS1307 RTC; // Establish clock object
DateTime Clock; // Holds current clock time

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, NEOPIN, NEO_GRB + NEO_KHZ800); // strip object
Adafruit_NeoPixel hourstrip = Adafruit_NeoPixel(12, HOURPIN, NEO_GRB + NEO_KHZ800);

byte hourval, minuteval, secondval; // holds the time

byte pixelColorRed, pixelColorGreen, pixelColorBlue; // holds color values

void setup () {
  Wire.begin();  // Begin I2C
  RTC.begin();   // begin clock

  //Serial.begin(9600);
  // set pinmodes
  pinMode(NEOPIN, OUTPUT);

  RTC.adjust(DateTime(__DATE__, __TIME__));
  //RTC.adjust(DateTime(2014, 1, 22, 5, 59, 40));

  //strip.show(); // Initialize all pixels to 'off'
  strip.begin();
  hourstrip.begin();

  strip.setBrightness(BRIGHTNESS_BIG); // set brightness
  hourstrip.setBrightness(BRIGHTNESS_SMALL);

  // startup sequence
  delay(500);
  colorWipe(strip.Color(255, 0, 0), 20); // Red
  colorWipe(strip.Color(0, 255, 0), 20); // Green
  colorWipe(strip.Color(0, 0, 255), 20); // Blue
  delay(500);
}


void loop () {

  char* colon = ":"; // static characters save a bit
  char* slash = "/"; // of memory

  // get time
  Clock = RTC.now(); // get the RTC time
 
  secondval = Clock.second();  // get seconds
  minuteval = Clock.minute();  // get minutes
  hourval = Clock.hour();  	// get hours
  if(hourval > 11) hourval -= 12; // This clock is 12 hour, if 13-23, convert to 0-11
  
    // arc mode
  for(uint8_t i=0; i<strip.numPixels(); i++) {
    
    //original code for minute/second color combining, not good for coloblind people   
    /*  
    if (i <= secondval) {
      pixelColorBlue = 255;
    }
    else {
      pixelColorBlue = 0;
    }
    
    if (i <= minuteval) {
      pixelColorGreen = 255;
    }
    else {
      pixelColorGreen = 0;
    }
   */
        
    //new overlaping colors mode, much better for color blind folks
    if (minuteval < secondval) {
      if (i <= minuteval) {
        pixelColorGreen = 255; pixelColorBlue = 0; } 
      else {
        if (i <= secondval) { 
          pixelColorGreen = 0; pixelColorBlue = 255; } 
        else {
          pixelColorGreen = 0; pixelColorBlue = 0; }
      }
    }
    
    if (minuteval >= secondval) {
      if (i <= secondval) { 
        pixelColorGreen = 0; pixelColorBlue = 255; } 
      else {
        if (i <= minuteval) { 
          pixelColorGreen = 255; pixelColorBlue = 0; } 
        else {
          pixelColorGreen = 0; pixelColorBlue = 0; }
      }
    }
            
    strip.setPixelColor(i, strip.Color(0, pixelColorGreen, pixelColorBlue));
  }
 
  //separate loop for hours that has been separated onto a second neopixel ring (12)
  for (uint8_t i=0; i < hourstrip.numPixels(); i++) {
    if (i <= hourval) {
      pixelColorRed=255;
    }
    else {
      pixelColorRed=0;
    }
    hourstrip.setPixelColor(i, hourstrip.Color(pixelColorRed,0,0));
  }
    
  //display
  strip.show();
  hourstrip.show();
 
  // wait
  delay(100);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
	strip.setPixelColor(i, c);
        hourstrip.setPixelColor((i/5),c);
	strip.show();
        hourstrip.show();
	delay(wait);
  }
}

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Neopixel 60 clock mod for the color blind

Post by adafruit_support_rick »

Cool! Thanks for posting!

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”