Tech Age Kids
Published © GPL3+

Make Your Own Toothbrush Timer with Circuit Playground

We've made a toothbrush timer using an Adafruit Circuit Playground board to help kids to understand how long to brush their teeth for.

IntermediateFull instructions provided2 hours816
Make Your Own Toothbrush Timer with Circuit Playground

Things used in this project

Hardware components

Adafruit Circuit Playground
×1

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

3D printed lips

A kids toothbrush timer using an Adafruit Circuit Playground Arduino board with 3D printed lips to turn it into a mouth. This is a fun and useful project to make with kids.

Code

Main Code for Timer

Arduino
I hid the trickier code in some helper functions so that the kids can understand the main loop code. The Circuit Playground is upside down so we start with pixels 6 and 7 to indicate brushing the top left part of the mouth.
#include <Adafruit_CircuitPlayground.h>
#include <Wire.h>
#include <SPI.h>

void setup() {
  CircuitPlayground.begin();   
  CircuitPlayground.setBrightness(10); // Make sure the LEDs aren't too dazzling
}

void loop() {

  if (CircuitPlayground.leftButton()) {

    CircuitPlayground.playTone(440, 100); 

    segment(6, 7); 
    segment(4, 5);
    segment(2, 3);
    segment(1, 2);
    segment(9, 10);
    segment(7, 8);

    setColor(0, 9, 0, 255, 0);
    CircuitPlayground.playTone(440, 100);
    delay(200);
    CircuitPlayground.playTone(780, 100);
    delay(200);
    CircuitPlayground.playTone(440, 100);

    delay(5000);

    setColor(0, 9, 0, 0, 0);
  }

}

void segment(int start, int end) {

    flash(start, end, 0, 0, 255);
    setColor(start, end, 0, 255, 0);
    CircuitPlayground.playTone(440, 100);
}

Helper Functions

Arduino
void setColor(int start, int end, int r, int g, int b) {
  for (uint16_t i = start; i < end + 1; i++) {
    CircuitPlayground.setPixelColor(i % 10, r, g, b);
  }
}

void flash(int start, int end, int r, int g, int b) {

  for (int s = 0; s < 40; s++)
  {
    for (uint16_t i = start; i < end + 1; i++) {
      CircuitPlayground.setPixelColor(i % 10, r, g, b);
    }

    delay(250);

    for (uint16_t i = start; i < end + 1; i++) {
      CircuitPlayground.setPixelColor(i % 10, 0, 0, 0);
    }

    delay(250);
  }

}

Credits

Tech Age Kids

Tech Age Kids

1 project • 0 followers
Helping parents bring up tech age kids who know how to make stuff with technology.

Comments