Project tutorial

Simple Lap Counter for Swimming Maniac (Waterproof) © GPL3+

It is a rechargeable waterproof lap counter that does not use a water proof bag separately.

  • 747 views
  • 4 comments
  • 7 respects

Components and supplies

Apps and online services

About this project

Ideation

Now the weather here is very hot because it is summer. I went to the pool with my primary school son to avoid the heat, and I saw people swimming several times on the swimming track. How many laps did they turn? When you learn to swim, count how many turns you have made to measure your momentum. But most people forget the count. There is a wrist watch or a finger counter, but it is a little uncomfortable when swimming. When swimming, it is better not to do anything. I made an intuitively waterproof lap-counter. Simply press it to go up once. I would like to implement many functions, but step by step.

Materials

There are some great conditions. The first is battery use, the second is waterproof, and the third is convenience. The battery should be rechargeable. Because you do not have to open the case when it's completely discharged. So I found connectors and switches that are waterproof. The case recycled the phone accessary case. I think that it was good to recycle when I finished.

Assembling the Case

The lap-counter has a waterproof toggle switch and a waterproof Magconn connector. I bought the Lithium-Polymer battery and Lithium-rechargeable PCBA that I had inexpensively. The back side of the Samsung mobile phone case was machined to match the Magconn connector, and the magnet was attached and closed with epoxy. I added four more because I think one magnet is not enough. The connector is closed with epoxy and glue.

Build Circuit

I built a circuit on the breadboard and implemented the behavior. The counter is fine. The four corners of the switch are for height adjustment. After confirming that it works well, I put it in the case and finished it with silicon. When using glue gun, be careful because case may melt at high temperature.

Waterproofing should be good. It was made better than I thought. I was worried about the phone case, but the recycle case became the key point.

Waterproof Test

I tried the waterproof test in the water of the pool. There is a magnet on the back of the case, and if there is an iron plate on the outside, it attaches unconditionally. When there is no iron plate, a sucker plate can be used.

The lap counter is very useful when you swim. Of course, children also like it.

Schematics

Schematics
Schematic dowtg5nte3

Code

Lap counterArduino
const byte numeral[10] = {
  //ABCDEFG dp//
  B11111100,  //0
  B01100000,  //1
  B11011010,  //2
  B11110010,  //3
  B01100110,  //4
  B10110110,  //5
  B00111110,  //6
  B11100000,  //7
  B11111110,  //8
  B11100110,  //9
};

// dp, G, F, E, D, C, B, A
const int segmentPins[8] = { 9,8,7,6,5,4,3,2 };
const int nbrDigits = 2;
const int digitPins[nbrDigits] = { 12,13 };
const int buttonPin = 11;
int buttonState;             // the current reading from the input pin
int lastButtonState = HIGH;   // the previous reading from the input pin
unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled
unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers
int value = -1;



void setup() 
{
  for(int i=0; i<8; i++)
  {
    pinMode(segmentPins[i], OUTPUT);    
  }
  for(int i=0; i<nbrDigits; i++)
  {
    pinMode(digitPins[i], OUTPUT);  
    digitalWrite(digitPins[i], 1);   
  }
  pinMode(buttonPin, INPUT);
  digitalWrite(buttonPin, HIGH);   //   
}



void loop() 
{
  int reading = digitalRead(buttonPin);
  if (reading != lastButtonState) { // reset the debouncing timer
    lastDebounceTime = millis();
  }
  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (reading != buttonState) {
      buttonState = reading;

      if (buttonState == HIGH) {
        value = value + 1;
      }
    }
  }
  lastButtonState = reading;  
  showNumber(value);
}



void showNumber(int number)
{
  if(number == 0)
    showDigit(0, nbrDigits-1);
    else
    {
      for(int digit = nbrDigits-1; digit>=0; digit--)
      {
        if (number>0)
        {
          showDigit(number%10, digit);
          number = number/10;
        }
      }
    }
}



void  showDigit(int number, int digit)
{
  //boolean   isBitSet;  
  digitalWrite(digitPins[digit],0);  //1
  for (int segment = 1; segment <8 ; segment++) //segment A ~ dp  
  {
    boolean isBitSet = bitRead(numeral[number], segment);   //byte numeral[number] segment  
    digitalWrite(segmentPins[segment], isBitSet);
    }
    //isBitSet = !isBitSet
    delay(5);
    digitalWrite(digitPins[digit], 1);
  }
  

Comments

Similar projects you might like

Arduino MKR GSM 1400 and DTMF

by Arduino_Genuino

  • 2,750 views
  • 0 comments
  • 7 respects

Magic Lamp

by Nekhil ravi

  • 605 views
  • 2 comments
  • 8 respects

Love You Pillow

Project tutorial by Arduino

  • 1,231 views
  • 0 comments
  • 4 respects

Infrared Replicator

Project tutorial by Gustavo Gonnet

  • 3,335 views
  • 6 comments
  • 24 respects

Rural Hack Kit

by Officine Innesto

  • 3,235 views
  • 0 comments
  • 4 respects

A Model Lighthouse Using an Adafruit NeoPixel Ring

Project tutorial by Jeremy Lindsay

  • 196 views
  • 0 comments
  • 4 respects
Add projectSign up / Login