Airsoft BB-counter, complete noob and need help

Discussion in 'The Projects Forum' started by JHammer, Dec 8, 2011.

  1. JHammer

    Thread Starter New Member

    Dec 8, 2011
    4
    0
    Hi fellas!!

    Im into Airsoft and one major thing thats missing in the majority of the weapons
    out there is a bolt stop when the mag is out of ammo.

    in an electric fully automatic airsoft-rifle the gearbox has a notch in one of the
    gears that can be used to push a microswitch at every rotation.

    i wanna use that to create a circuit in a small form factor that has 2 functions,
    one function is to count to 50 rotations of that specific gear
    through a microswitch

    and when that circuit has reached 50 it will break another closed circuit so that
    the gun stops firing.

    After that when another microswitch is pressed the counter is zeroed and will start
    counting again the next time i start to fire.

    i know it sounds messy, i have tried searching around but since i have very little
    knowlage of terms and names i have no luck searching.

    im not looking for you guys to give me a complete diagram but could you point
    in the right direction at least?


    the gun atm has a battery, a motor, and mosfet circuit that acts as the on/off-switch,
    from the mosfet circuit i have 2 wires from the trigger pins on the transistor to the weapons
    trigger-microswitch, and that's the circuit i figured i want to break at 50, so there's no
    high voltage or high amp that need to be handeled since it's only the trigger-wires to the
    mosfet..

    take care guys and pardon my english, cant be good at everything lol. :)
     
  2. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230

    I would absolutely recommend a small pin count micro, even for such a trivial task. The reasons being, simplicity, expansion, and your product security.
     
  3. bwack

    Active Member

    Nov 15, 2011
    109
    10
    Sounds like an application for Atmel ATTiny13 or maybe another 8bit 8pin microcontroller.

    You could use a 7bit counter (4024), where the microswitch is interfaced with the clock input to advance the counter, and when it reaches 50, you have decoder logic ( a series of nand gates for example) to deactivate the mosfet and clock input. The reset button would be interfaced with the reset of the 7bit counter. A bit old school but why not :)

    Should the device retain the count when the gun is switched off ?
     
  4. wayneh

    Expert

    Sep 9, 2010
    12,123
    3,048
    If you don't want to learn about microcontrollers, because even a simple one has a daunting learning curve for a noob, you could set up two 4017 counter IC's to count up to 50 (or anything from 1-100).
     
  5. JHammer

    Thread Starter New Member

    Dec 8, 2011
    4
    0
    everybody, thanks a heap for the fast respons!!

    i tried reading up on microcontrollers and even tho i rarely give up easily i noticed that
    this will take forever, as i see it -the ammount of knowlage in the area needed to play around with microcontrollers will most likely put me off if i start in that corner.

    However, a counter IC sounds interesting, i found stuff on both wiki and some sites dedicated to the 4017 but since i havent played anything with these kinda things the names and functions tell me very little about how they work, sucks when i dont have the terminology

    a standard mag for the M4 or M16 is 30 rounds if im not misstaking but the number doesn't matter atm, would i need one or several to reach those numbers or how does it work?
     
  6. wayneh

    Expert

    Sep 9, 2010
    12,123
    3,048
    I'm no expert but I think as long as the total number you need can be factored into two numbers less than 10, then two 4017 counters will give you everything you need. Let's say you want to count to 30. The first counter could be set to count to 5. When it sends its reset pulse, that would be a clock input for the second 4017, set to count to 6. The reset pulse of the second timer would trigger once every 30 clicks at the first timer. You could also use 10 and 3.

    Of course you can configure multiple timers to count to any large number. Never done it myself, so I'd better not speculate much more. I suppose you would AND the outputs; for instance if timer 3 is a "1" and timer 2 is a "3" and timer 1 is a "7", then the output is 137.
     
  7. bwack

    Active Member

    Nov 15, 2011
    109
    10
    For terminology used in digital logic electronics, see:
    http://www.allaboutcircuits.com/vol_4/index.html
    Especially chapter 11 on digital sequential logics is relevant.

    A friend who is more of a mechanical wiz than a electronics wiz got into microcontrollers using the PICAXE. Its basically a Microchip PIC microcontroller with a PICAXE bootstrap program on it. That means it can be reprogrammed with a simple interface and has a BASIC language interpreter so you don't need to learn C or ASM. The Basic programming language was my entrylevel programming language in the 80s, on the Commodore 64.

    But I'd recomend learning basic digital electronics first. Like the idea of using the 4017's. Wayneh explained it well. Then you will know more about the architecture of digital electronics before you dive into more integrated stuff..
     
  8. JHammer

    Thread Starter New Member

    Dec 8, 2011
    4
    0
    I will try my best and read up on as much as possible before i bug you again
    thanks a heap! at least now i know what IC to start with hehe

    i had a long phonecall with my uncle who knows alot about this stuff but it's been a looong time since he tinkered around with it so he had nothing real solid to tell me other than i could use a resistor on the plus from the battery and after that a cap between plus and ground on the ic to get rid of spikes from the motor of the airsoft weapon, that is ifcours if i use the battery that runs the weapon itself =) (11.1V lipo) the 4017 seems to work between 3-15V

    if you have loads of sparetime then ofcours you can draw up some schematics
    of what i need to build this circuit, i will still read up on this so i understand WHY the schematics look the way it does. so feel free to help out if you all want to.

    Thanks again, really great! -fast responding communitys. i like it ;)
     
  9. bwack

    Active Member

    Nov 15, 2011
    109
    10
    I don't know much about the pheriferals, so heres what i'm thinking how the two 4017 could be wired up..

    [​IMG]

    Note how Q5-9 has only one pulse for every 10th clock/shot. I've connected Q5-9 as a clock to the next 4017. See also datasheets for these components, there you will find examples on how they can be used and what signals look like.

    Also you may want to filter the shot/clock pulses so you don't get unwanted counts from noise.. Resistor + cap to the powersupply of these devices is not a bad idea for decoupling.
     
Loading...