Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
cstram
Published © GPL3+

Cool Timer with Voice synthesizer

This is a timer that can be setup without watching the device using just a push button. It can be useful for blind.

BeginnerFull instructions provided396
Cool Timer with Voice synthesizer

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Push Button
×1
4 Digit Display
×1
DFRobot DF Robot Gravity Speech Synthesis Module SKU DFR0760
×1

Hand tools and fabrication machines

Drill / Driver, Cordless
Drill / Driver, Cordless

Story

Read more

Schematics

Smart Timer

Code

Smart Timer

Arduino
/*
 * Carlo Stramaglia
 * https://www.youtube.com/c/CarloStramaglia
 * This is a Smart Timer that
 * once you set it up, will remind you every quarter to check the food in the pan
 * June 1st 2021
 */

#include "DFRobot_SpeechSynthesis.h"
#include <TM1637.h>
#include "OneButton.h"

int minutes=00;
int seconds=0;
char tmp[5];

DFRobot_SpeechSynthesis_I2C ss;

// Display Pins configurations
// Pin 3 - > DIO
// Pin 2 - > CLK
TM1637 tm1637(2, 3);

// Push Button PIN definition
#define PIN_INPUT A2

OneButton button(PIN_INPUT, true);

void setup() {
  Serial.begin(115200);
  Serial.println("Smart Timer sketch. Carlo Stramaglia https://www.youtube.com/c/CarloStramaglia");
  //Init speech synthesis sensor
  ss.begin();
  //Set voice volume to 7
  ss.setVolume(7);
  //Set playback speed to 5
  ss.setSpeed(5);
  //Set speaker to female 
  ss.setSoundType(ss.MALE1);
  //Set tone to 5
  ss.setTone(5);
  ss.setSpeechStyle(ss.SMOOTH);
  ss.setEnglishPron(ss.WORD);
  ss.setDigitalPron(ss.AUTOJUDGED);
  ss.setLanguage(ss.ENGLISHL);
  tm1637.init();
  tm1637.setBrightness(5);
  button.attachClick(singleClick);
  button.attachDoubleClick(doubleClick);
  button.attachLongPressStart(longPressStart);
  tm1637.clearScreen();
  tm1637.colonOn();
  tm1637.display("0000");
  tm1637.colonOn();
  delay(100);
  

}

void loop() {
  button.tick();
  delay (10);
}

void singleClick()
{
  Serial.println("x1");
  minutes++;
  Serial.println(minutes);
  sprintf(tmp, "%d", minutes);
  ss.speak((tmp));
  delay (100);
  ss.speak(F("minutes set"));
  if (minutes < 10)
      tm1637.display(minutes,1,0,1);
  else
      tm1637.display(minutes);
  Serial.println(tmp);
  delay(100);
} // singleClick


void doubleClick()
{
  Serial.println("x2");
  if (minutes == 0) return;
  ss.speak(F("Starting countdown"));
  minutes--;
  for (minutes ; minutes >= 0; minutes--) {
        for (int seconds = 59; seconds >= 0; seconds--) {
            if (minutes < 10 && minutes >0)
              tm1637.display(seconds + minutes*100,1,0,1);
            else if (minutes == 0 && seconds >=10)
              tm1637.display(seconds + minutes*100,1,0,2);
            else if (minutes == 0 && seconds < 10)
              tm1637.display(seconds + minutes*100,1,0,3);
            else               
              tm1637.display(seconds + minutes*100); 
            tm1637.switchColon(); 
            if (seconds == 0)
            {
              sprintf(tmp,"%d", minutes);
              ss.speak(tmp);
              delay(100);
              ss.speak(F("minutes left"));
            }
            delay(1000);
        }
    }
  ss.speak(F("Time finished"));
  delay (1000);
  ss.speak(F("you can setup a new timer now"));
  tm1637.colonOn();
  tm1637.display("0000");
  minutes = 0;
  tm1637.colonOn();
  delay(100);  

} // doubleClick

void longPressStart()
{
  Serial.println("long Press");
  minutes = 0;
  ss.speak(F("Counter reset"));
  tm1637.colonOn();
  tm1637.display("0000");
  tm1637.colonOn();
  delay(100);  
} // longPressStart

Credits

cstram

cstram

16 projects • 21 followers
Passionate about IT, Electronics and DIY. Strong believer in Raspberry and Arduino devices. Experience in digital television and security.

Comments