Man that has some VERY cool applications...
Imagine an after game report of how many rounds you had fired etc?
Nice work!
I have been busy..
Why?? Why have I done this
I have had a lot of trigger trouble with my AGM SCAR-L, the cut-off lever was sharp and was nibbling out the trigger block, replacement trigger blocks and cut-off levers didn't work, which meat that 1/2 trigger pulls and in some cases full trigger pulls resulted in the cut-off not working, thus the gun went full-auto. This is totally unacceptable to me (and the law)..
So.. I had to find another way, and my brain went "computer" and "Some sensor" a fair amount of searching and researching on the internet led me to know - I wanted to use an AVR micro-controller, the micro-controller had to come on a small board pre-made and inexpensive with plenty of I/O and the ability to activate the AEG motor via a SW-AB-LONG mosfet.
I also had to find some way of sensing a complete cycle in the gearbox, and it had to be done without any modification of the gearbox shell.
Some of this was motivated by the extreme-fire computerised mosfet called SW-LION which is in development so My other requirement was that my solution should be compatible with this.
Requirements
- AVR Micro-controller on a board with enough I/O & Mosfet Drive
- Sensor or Switch for cycle completion.
- Removal of cut-off lever
- Remove the anti-reversal latch?
- Easy to program micro-controller - inexpensive programmer.
- Change the usual AEG trigger switch with a micro-switch.
What I Found
Much searching, grunting and howling later (oops wrong movie)..
A company in Las Vegas, called Pololu makes hobby robot controllers, and they have a "basic" board called "Baby Orangutan B-328 Robot Controller"
- overall unit dimensions: 1.2" x 0.7"
- input voltage: 5-13.5 V (15 V absolute maximum)
- two bidirectional motor ports can deliver ~1 A continuous (3 A peak) per channel
- programmable 20 MHz Atmel ATmega328P AVR microcontroller (32 KB flash, 2 KB RAM, 1 KB EEPROM)
- 18 user I/O lines, 16 of which can be used for digital I/O and 8 of which can be used as analog input channels
- 1 user LED
- user potentiometer tied to ADC7
- 20 MHz external resonator
They also had a kit that came with a programmer which attaches to USB and all the software / libraries required to program it and it was cheap.. the board is only $20 USD on its own.
Now, they also had a device called a "Reflectance Sensor" and it was fairly small, my mind worked on that for a while, so I ordered a couple of Orangutans, some (sub) micro switches and a couple of the reflectance sensors.
One week later, they arrived and experimentation began..
Experiments
First I tested the reflectance sensor to see how it worked, and how fast, so to test the response time I taped it to the guts of my gearbox and had it sense a white tape patch on the tappet plate, this worked well, the sensor was able to work fast enough to be useful for stopping the AEG controller (this test also showed that I was able to control the SW-AB-Long without blowing up the Orangutan.
Second test, was to see if I could mount the reflectance sensor inside the gearbox, to sense some black marks on my (very shiny) sector gear, and it did work, but i found that position of the sensor had to change with different motor powers (eg between lipo/nimh battery) and it was not what I really wanted, not the best control..
Third test, My gearbox has open holes at the rear by the spring guide, the piston moves past this for every shot - so I put a white patch and mounted the sensor over that hole - and had the software cut the power to the motor when the sensor saw some reflection - perfect, motor stopped every time, piston returned to rest (shoot) and it kept going and going until i slipped and the piston smashed into the sensor and demolished it - not to be put off, I went to the garage and cut up some metal and designed something to hold it to the gearbox.. I now had a sensor mounted in the right position, some basic software making the gun shoot, the gearbox had no cutoff lever and no anti-reversal latch, it will only shoot semi-auto one shot at a time and wont ever lock up..
Here is a video of the test, there is other videos of the prior tests in my boob-tube account (wintersairsoft).
Pictures of the sensor:
Sensor on mount and white spot on the piston - not the piston is opaque and doesn't reflect at all.
Sensor seen from inside the gearbox.
Sensor outside the gearbox with piston in view.
My second desire was to replace the trigger switch that AEG's usually come with with a sub-micro switch, and this was done too..
Result
The result of my work, is that my AEG now no-longer needs the cutoff lever which is the root of all evil in the gearbox design, it will never lock up, the anti-reversal latch is removed as the piston always returns to rest, there is no 1/2 pulled back piston (which is held by the anti-reversal latch)..
Software Features
I am a Software Engineer by trade, so writing the software to run on this was not difficult, I have taken some tips from the software used in the extreme fire computers and currently have come up with the following (basic list).
- Complete Cycle of gearbox everytime.
- Sensor is switched on only when needed.
- Shot counting - stored in eeprom, will count out on a LED.
- Serial Comms - to computer for debugging - eg cycle times, sensor values. (the gun talks to me).
- Fail safe - if motor runs for more than 2* average cycle time it stops and goes into a loop requiring power off.
- Sleep Mode - when not used for 60 seconds, cpu sleeps, instant startup to shoot.
- User Programmable Modes - Motor Speed via PWM, Sniper Delay 1 to 10 seconds. & More
- Mag Switch, (to be mounted) gun will not shoot when mag out.
- Feedback via vibrating motor.
Programming Mode?
The extreme fire controllers have a programming mode, which is entered at power on, the motor vibrates to tell me what menu option it is in, then the trigger is pulled a number of times to alter that option - eg 4 vibrations = motor speed, 1 click = 100%, 2 clicks = 90% e.t.c.. (the gun will not shoot while programming).
Currently I can program.There will be more to come with additional features in the software / hardware.
- Mag Switch on / off - when off gun will shoot when mag is out.
- Motor Speed 100% to 10% - motor is controlled via PWM (Pulse Width Modulation) so it can be slowed down (eg uses less power).
- Sniper Delay - 0 to 10 Seconds, 0 being default normal mode - when 1 or more the gun will not shoot after a shot until that delay is over - pulling the trigger has no effect in that time.
Future
Future features after some experimenting will be.
Switch on the charging handle, for use in the following.
BB Detecting - will stop the gun if BB's are not moving into the hop, requiring the mag to be wound or filled, will need to have the charge handle to be cycled before shooting continues.
Voltage detection - will be able to slow motor or stop gun when voltage drops.
More diagnostics stored in eeprom memory, eg total shots, game shots, average / min / max cycle speed, battery voltage.
Complete?
Not yet, waiting on some small plugs and sockets before I can complete the first stage, currently I have it wired to a breadboard. I also have to do some investigation to see if I can alter the SW-AB-LONG mosfet so that I can control the braking feature separately as it should not be used when doing PWM or vibrations.
Will update this thread when more is done..
Last edited by mat; 07-07-2010 at 11:18 AM. Reason: Image sizes reduced
FN SCAR-L, 1911 M.E.U., M40 Sniper.
I experimented last night with detecting the battery voltage through an analog input, so it will be able to slow the motor when the battery starts to lag (thus use less power) and / or stop the ability to shoot all together.. that way the lipo is protected..
some more bits n pieces I am waiting on from the states have not arrived yet so I dont think I will get it assembled for this weekendmaybe next..
FN SCAR-L, 1911 M.E.U., M40 Sniper.
Hi Mat
Absolutely brilliant work, i can fore see loads of applications for this system.
You are to be congradulated on coming up with the idea and the follow thru to a working system.
However there are a couple of things I would like to know:
1/ In any mode will holding the trigger back cause it to automaticly fire again at the end of the time delay or do you need to release the trigger?
2/ If someone wanted this system fitted can they get it done with some of the features removed? ie: The mag out feature. I for one at the end of the day like to remove my mag and dry fire a couple of times to ensure that my weapon isn't stored with a chambered round, i have also been teaching other people to do the same.
Thats all i have, carry on with the great work.
Almost done, blew up one of the controller boards last night, it was all wired up into the loom that will go inside the gun, and heat shrunk, connected the 11.1v lipo there was a strange noise then a pop and some smelly smoke..
I had a resistor lying across the h-bridge mosfet (larger chip on the picture above) and it must have been exerting some pressure on the mosfet after the heat-shrink and the power of the lipo shorted the h-bridge internally and bang..
Atleast I have some spares, I will be changing the way the baby-o is wired in, maybe on a daughter board so it can be removed.
On the software front, new features are.
storage of preformance data in a round robin table in the eeprom
battery voltage monitoring, with shutdown when voltage hits a level, configurable in programming mode to nimh, 2 cell lipo and 3 cell lipo, with some rude detection between the 11.1 and nimh at startup.
serial port - can now accept commands from an un-developed application, to retreive data, retreive programming mode information, actually program the gun features, run a test, get battery voltages & using a bootloader the serial port can upload new software to the baby-o instead of using the jtag (which is buried in the gun)..
Almost there, need some more time now to re-wire and put it together.. Might get that done tonight, have some more sw-ab-long mosfets arriving soon and they are high priority to assemble and get out the door..
FN SCAR-L, 1911 M.E.U., M40 Sniper.