1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Need working circuit for this "arduino based 7 segment counter || Finger Click speed || Race"

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by pradoartz, May 13, 2017.

  1. pradoartz

    pradoartz Member

    Joined:
    Oct 17, 2016
    Messages:
    35
    Likes:
    0
    Location:
    Chennai, India
    Hello Friends,
    Please have a look in the video below. I am working in a project like this. This guy presents his code and circuit in his video description, code is perfectly compiling but the circuit is not good. Please help me in designing a good circuit for this project with all buttons and resistors in place. Thanks



    Things i have in my hand:
    4 x single digit 7 seg display - Common Cathode
    1 x Arduino Uno
    5 x Push buttons
     
  2. tomizett

    tomizett Active Member

    Joined:
    Aug 11, 2013
    Messages:
    551
    Likes:
    58
    Location:
    UK
    Could you start by showing us that circuit you have already tired that's not working? Perhaps someone can tell you what's wrong with it.
     
  3. pradoartz

    pradoartz Member

    Joined:
    Oct 17, 2016
    Messages:
    35
    Likes:
    0
    Location:
    Chennai, India
    finally got the schematic.... Thanks
    skematik.png
     
  4. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  5. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,677
    Likes:
    121
    Location:
    Michigan, USA
    That schematic you posted depicts common anode displays with PNP "source" drivers. The program 'sketch' appears to be for common cathode displays with NPN "sinking" digit drivers.

    To use your common cathode displays with that program 'sketch' the schematic should probably look something like that shown below, though I'm not sure if the BC547 would be a suitable NPN transistor.

    Cheerful regards, Mike

    CC Mods.png
     
    Last edited: May 15, 2017
  6. dr pepper

    dr pepper Well-Known Member Most Helpful Member

    Joined:
    Oct 6, 2008
    Messages:
    5,077
    Likes:
    301
    Location:
    North west UK
    And if the code is written for common anode you'll need to invert the outputs, either by replacing the lookup table for the 7 seg, or by inverting the bits just before you write them using the ! operator.
     
  7. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,677
    Likes:
    121
    Location:
    Michigan, USA
    As I mentioned in post #4, the program appears to be written for common cathode displays with NPN "sinking" drivers;

    Code (C):
    byte seven_seg_digits[10][7] = {
            { 1,1,1,1,1,1,0 },  // = 0
            { 0,1,1,0,0,0,0 },  // = 1
            { 1,1,0,1,1,0,1 },  // = 2
            { 1,1,1,1,0,0,1 },  // = 3
            { 0,1,1,0,0,1,1 },  // = 4
            { 1,0,1,1,0,1,1 },  // = 5
            { 1,0,1,1,1,1,1 },  // = 6
            { 1,1,1,0,0,0,0 },  // = 7
            { 1,1,1,1,1,1,1 },  // = 8
            { 1,1,1,0,0,1,1 }   // = 9
    };
    const int one_u = A0;
    const int one_d = A1;
    const int one_ahlah = 10;
    const int one_baga = 9;
    int one_us=0;
    int one_ds=0;
    int one_ufront = 0;
    int one_dfront = 0;
    int one_count = 0;
    //up2 a2-up, a3-down, 12-ahlah,11-baga
    //a4 - reset
    const int two_u = A2;
    const int two_d = A3;
    const int two_ahlah = 12;
    const int two_baga = 11;
    int two_us=0;
    int two_ds=0;
    int two_ufront = 0;
    int two_dfront = 0;
    int two_count = 0;

    const int reset = A4;
    int reset_s = 0;
    int res = 0;

    void setup() {            
      pinMode(2, OUTPUT);       // segment A
      pinMode(3, OUTPUT);       // segment B
      pinMode(4, OUTPUT);       // segment C
      pinMode(5, OUTPUT);       // segment D
      pinMode(6, OUTPUT);       // segment E
      pinMode(7, OUTPUT);       // segment F
      pinMode(8, OUTPUT);       // segment G
      pinMode(9, OUTPUT);       // ones left
      pinMode(10, OUTPUT);      // tens left
      pinMode(11, OUTPUT);      // ones right
      pinMode(12, OUTPUT);      // tens right
      pinMode(one_u, INPUT);
      pinMode(one_d, INPUT);
      pinMode(two_u, INPUT);
      pinMode(two_d, INPUT);
      pinMode(reset, INPUT);
    }
    void sevenSegWrite(byte digit) {
      byte pin = 2;
      for (byte segCount = 0; segCount < 7; ++segCount) {
        digitalWrite(pin, seven_seg_digits[digit][segCount]);
        ++pin;
      }
    }

    void loop() {
      res = digitalRead(reset);
      if(res==HIGH && reset_s==0){ reset_s =1; }
      if(res==LOW && reset_s ==1){ reset_s =0; one_count = 0; two_count = 0;}
      one_us = digitalRead(one_u);
      if(one_us==HIGH && one_ufront ==0){one_ufront =1;}
      if(one_us==LOW && one_ufront ==1) {one_ufront =0; one_count++;}
      one_ds = digitalRead(one_d);
      if(one_ds==HIGH && one_dfront ==0){one_dfront =1; }
      if(one_ds==LOW && one_dfront ==1) {one_dfront =0; one_count--;}
     
      if(one_count>99){one_count = 99;}
      if(one_count<0){one_count = 0;}  
       ////////////////////////////////////
       two_us = digitalRead(two_u);
      if(two_us==HIGH && two_ufront ==0){ two_ufront =1; }
      if(two_us==LOW && two_ufront ==1) { two_ufront =0;  two_count++; }
      two_ds = digitalRead(two_d);
      if(two_ds==HIGH && two_dfront ==0){ two_dfront =1; }
      if(two_ds==LOW && two_dfront ==1) { two_dfront =0;  two_count--; }
     
      if(two_count>99){two_count = 99;}
      if(two_count<0){two_count = 0;}

     
        digitalWrite(one_ahlah,1);      // left "tens" digit
        digitalWrite(one_baga,0);
        digitalWrite(two_ahlah,0);
        digitalWrite(two_baga,0);
        sevenSegWrite(one_count/10);
        delay(2);
        digitalWrite(one_ahlah,0);      // left "ones" digit
        digitalWrite(one_baga,1);
        digitalWrite(two_ahlah,0);
        digitalWrite(two_baga,0);
        sevenSegWrite(one_count%10);
        delay(2);    
        digitalWrite(one_ahlah,0);      // right "tens" digit
        digitalWrite(one_baga,0);
        digitalWrite(two_ahlah,1);
        digitalWrite(two_baga,0);
        sevenSegWrite(two_count/10);
        delay(2);
        digitalWrite(one_ahlah,0);      // right "ones" digit
        digitalWrite(one_baga,0);
        digitalWrite(two_ahlah,0);
        digitalWrite(two_baga,1);
        sevenSegWrite(two_count%10);
        delay(2);
     
    }

    //up2 a2-up, a3-down, 12-ahlah,11-baga
    //a4 - reset
     
     
    • Like Like x 1
  8. dave miyares

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    2
    Likes:
    -10


     
  9. dr pepper

    dr pepper Well-Known Member Most Helpful Member

    Joined:
    Oct 6, 2008
    Messages:
    5,077
    Likes:
    301
    Location:
    North west UK
    Yes if the chip drives the segments directly.
     
  10. madrigalwebs

    madrigalwebs New Member

    Joined:
    Mar 1, 2018
    Messages:
    1
    Likes:
    0
    do you have proteus simulation for this?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice