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

Up/Down Counter Circuit

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by Mastahh, Nov 20, 2010.

  1. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    Can you expand on the idea of the mechanism which detects coin diameters and weight please??

    Regarding the 4029,

    I was going to makes slots of different sizes so that each coin falls through the first slot it can. [See Attachment]
    On the other side of the holes would be opto-isolators, which would detect and give an output when the IR connection is broken.
    I would feed these outputs into a GENIE PIC, on which i would make a flowchart based on the input of the pin, giving out pulses. For example, if there was an output which from a 2p coin fed into an input of the PIC, i would make the flowchart give two pulses to count up for the 4029. This goes for all the coins.
    Next, the reason i wanted the PTM switches was that if the user takes out some money, he/she can subtract from the total display. This is so it goes down.
    To go up, i would need that in case they subtracted a bit too far.

    That was my model specification of the circuit.

    =]
     

    Attached Files:

  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi Mastahh,
    About the 4029 counter, as the PTM u/d switches are wired as clock pull low when pressed, it is possible wire opto coupler outputs to also pull the u/d clocks low.
    The point you have to consider is how the opto's are configured, for example: the IR emitter in the opto will be lit, so if the opto detector is wired with cathode [ or photo transistor emitter] is connected to 0V, then the output will be low [0v] when there is no coin in the opto slot.
    The opto output will go high when a coin is in the opto slot.

    You dont want this condition as it will disable the PTM down/up clock action. Recall that the unused PTM clock MUST be high for the pushed PTM to work.

    Let me know which type of opto coupler you plan to use and we can suggest a circuit to give opto u/d and wired 'OR' PTM u/d action.

    The problem with using the 4029 counter in its present configuration is loading the number of counts into the 4029's.

    For say all the UK coins 1p,2,5,10,20,50p and £1,£2 thats a range of 1 thru 200 counts in 8 selections..

    As you must use only Genie components for your project its makes for a 'messy' solution.

    Is it possible that you could use two Genie PIC's.?
    The first one would have 8 input pins wired to your 8 opto outputs, then depending upon which input pin was active due a coin, that pin would produce a pulse count output for that type of coin. The second PIC would then count the pulses as you expect.

    The U/D PTM make switches could be connected to two other pins for manual u/d.
     
  3. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    I can use as many GENIE PICs as i wish to.
    You said that "The second PIC would then count the pulses as you expect." What do you mean by this? Is it that the GENIE PICs would give the output to display the numbers on the 7 Segments??

    If that is what you meant, my problem is counting down.

    You said that the opto solution is disadvised, as i need the PTMs to be high when unused.
    My problem is that i need PTMs AND a sort of sensor.
    Can you propose any solution to this problem too please??

    Thanks

    =]
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK

    hi,
    Again,
    Tell me which opto you have...:)
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    With reference to the coin diameters.
    Line up along a straight edge, a 5p,1p,20p,£1,10p,2p,50p and £2 coins and you will see they have increasing diameters
     
  7. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    The coin diameter slots were what i had in mind.

    A GENIE PIC is something you have to programme EVERTHING MANUALLY.
    So it is very difficult to programme an updown count.
    That is why i wanted it to work as a pulse generator.

    Sorry about the opto-isolator comment.
    However, i am unable to identify which one it is.
    If you see the below attachment, it just litterally says what it is.
    Not the component name.
    The only information given is: 'Opto-Isolator (Ideal)'

    Thanks

    =]
     

    Attached Files:

  8. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    No problem..:)
    That opto coupler is a photo transistor detector type, more sensitive than a photo diode detector.

    I will look at a way of making them work with the PTM switches.
     
  9. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Thanks a lot mate!!

    =]
     
  10. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    Hi,
    I have shown only 4 of the possible 8 opto-couplers, they are all connected in the same way.
    The output from the 2N2222 gate is connected to the UP counter section of the 4029 Latch/Gate.

    You can see at the start of the plot, 4 pulses, due to coins interrupting the opto couplers 1 to 4. On the right side of the plot are pulses coming from the PTM switches, this is to show how the two UP clocks are combined OK.

    Having done this, I still cannot see how it is going to help with your Genie coin counting project.. perhaps I am missing something.:)
     

    Attached Files:

  11. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    I think you may be misunderstanding the following...

    What i mean by pulses, is for example, [on my attachment], say the far left opto is for 1p, that works fine as it counts up by 1, sending one pulse.
    However, the next one, say its 2p, should send two output pulses, so that the 7 segments counts up twice.
    The 5p should give five pulses, 10p ten etc.

    Following on from that, i have made the circuit as you have shown me and it only counts up in ones. That is where i have GENIE come into play. By an opto giving an output into a particular pin, for example, the 2p opto, i can programme it to give out 2 pulses.

    So,

    • Start
      Input 1 = High?? [2p opto]
      Output 1 = High [feeds into S1]
      Wait 0.1 seconds
      Output 1 = Low
      Wait 0.1 seconds
      Output 1 = High [feeds into S1]
      Wait 0.1 seconds
      Output 1 = Low
      Wait 0.1 seconds
      End

    Does that make sense??

    Thanks

    =]


    EDIT:
    The push-to-break switches above the optos are only to simulate a coin breaking the connection. They have no proper purpose in the final circuit.
     

    Attached Files:

    Last edited: Nov 28, 2010
  12. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    Thats a little clearer, thanks.
    I guess you can now move forward on your project, let me know if you need any more help.
     
  13. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    I just got one more question, if thats alright, and then i will be done.

    Do you remember i asked you if it is possible to have 4 PTMs.

    Two will count up, one in pounds and the other in pence, and other two will do the same but count down.

    Is this possible, along with the optos??

    Thanks

    =]
     
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK

    hi,
    You can add a PTM switch across the opto coupler input emitter.
    When you push the switch you would connect the junction of the 270R and opto emitter Anode to 0V, this will stop the opto emitter from driving the opto coupler transistor, its the same as putting a coin in the opto slot.
    Do you follow OK.?
     

    Attached Files:

    Last edited: Nov 28, 2010
  15. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    So you are saying that this will work in the same method as well.
    I just have to add the pulse and it the PTMs would simulate the output, instead of a coin?
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,

    Showing only one opto circuit, but it applies to all the optos.

    the ptm is your finger press and the in2 is due to a coin.

    EDIT:
    in the plot I have mislabelled PTM as PMT.! believe me that is something quite different!...:rolleyes:
     

    Attached Files:

    Last edited: Nov 28, 2010
  17. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    Thanks For All Your Help So Far.

    Im just wondering if the following can be done...

    If you see my attachment, i have connected the 1st three optos directly to the 'units' column.
    The first three optos represent 1p, 2p, 5p [the circuit is without the pulse]

    Is there a way to connect the next 3 optos, the 10p, 20p, 50p optos directly to the 'tens' column? [the highlighted ones]
    And the £1 and £2 optos to the next section? [the ones to the right of the highlighted ones]

    I am asking because writing a hundred pulses in a PIC would take too long, and take up a lot of PIC memory.

    Thanks

    =]

    EDIT: The PTMs are not connected to anything, my mistake, but i have in my circuit and they work alright.
     

    Attached Files:

    Last edited: Nov 29, 2010
  18. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK

    hi,
    I can hardly read that circuit diagram.:)

    When you say 'tens' column do you mean the second 4029.??

    Perhaps on your diagram you could draw in the connections you would like to have.??


    EDIT:
    on that diagram there is a only 1 resistor required for that diode gate.
     

    Attached Files:

    Last edited: Nov 29, 2010
  19. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Hey,

    Yeah, by tens, i mean the second 4029. Sorry if that didn't come out too clear.

    The reason i have all the diodes connected to separate resistors is because each diode will become a separate input into the PIC. This way, i can create specific pulses for specific optos.

    Do you think you can help me with this?

    Thanks

    =]

    EDIT: Also, along with the 'tens', i may need one for the third 4029, as this is where the pound figures shall be displayed.
     
    Last edited: Nov 29, 2010
  20. Mastahh

    Mastahh New Member

    Joined:
    Nov 19, 2010
    Messages:
    61
    Likes:
    0
    Circuit attached.

    Don't know if this one is better or not.

    It is too big to fit onto one page of the program clearly, so i had to crop out two halves on MS Word
     

    Attached Files:

    Last edited: Nov 29, 2010
  21. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,238
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    If its only for counting a 'ten' UP it could done, to count a 'ten' down as well would be difficult., I will look it over.
     

Share This Page