Pulse Counter

Discussion in 'Programmer's Corner' started by DAK, Mar 27, 2011.

  1. DAK

    Thread Starter New Member

    Nov 25, 2009
    I recently built a circuit that would count a predetermined amount of pulses then send a high to an alarm. It is used on a pitching machine. It counts the amount of balls (each time the arm would go around it would trigger the limit switch) and activate an alarm after 8 pitches. Below hopefully gives you an idea of how it is currently set up.

    1. Neg. Pulse from Limit Switch
    2. Into 556 Timer to debounce the signal
    3. The 556 then sent a pos pulse to a 4017 Counter/Divider
    4. After 8 pulses or high signals the corresponding pin would go high
    5. Then into the other half of the 556 timer (used for the on time of alarm)
    6. Then into a Transistor which powered the Alarm. This would signal the batter that he was done.
    7. A Reset Switch was place by the batter if for some reason he had to start over.
    8. Also the on/off switch to the pitching machine controlled power to the circuit. This would also reset the counter / divider in the event that the machine was turned off.

    Because of my limited experience, the board took forever to put together to actually work. I need another circuit for another pitching machine, but don’t want to smoke any more components and spend months on doing so. By the way this board was working for 2 seasons, but recently can only count the correct pulses when it receives them quickly. The arm takes awhile to complete its revolution which in-turn sets the alarm off at different intervals. I changed out all three chips, but now luck. Oh well, maybe I can take care of all of this using a microcontroller like the picaxe 08M. This may be a good time to get my feet wet and look into this possibility.

    Now the question is, with my limited knowledge of programming what would it take as far as code to do this? I’m using this microcontroller (PIC12F683) and already have the PICAXE, hardware and programming system which runs on Basic. I have written a few lines of code to turn on LED’s and some other things, but need help writing something that would work to operate the above project. I am stupid ok a little slow, and would need a step by step code and maybe a schematic to accomplish this. How many components would I still need? I know I’m asking a lot, but would appreciate any help I can get.

    1 = V+
    2 = Serial In
    3 = ADC4/ Out 4/ In 4
    4 = Infrain /In 3
    5 = In 2 / Out 2 /ADC 2 / pwm 2 / tune
    6 = In 1 / Out 1/ ADC 1
    7 = Out 0 /Serial Out / Infraout
    8 = 0V

    Thank You for Your Time
  2. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    08M...Good choice!

    Whats the voltage/current for the alarm?

    If over 5v:

    1 5v voltage regulator
    2 capacitors for the regulator
    1 capacitor for the PICAXE
    1 toggle switch for on/off
    1 pushbutton switch for reset
    2 resistors for reset and count switch pull-up or pull-down
    1 transistor to drive the alarm
    1 resistor for alarm drive transistor

    I can do the schematic for you.

    Also, the PICAXE forum is a great place for help with the programming. http://www.picaxeforum.co.uk/