Jump to content

Kingbob's Content

There have been 133 items by Kingbob (Search limited from 05-February 94)

By content type

See this member's

Sort by                Order  

#352455 Arduino gun controller mk3

Posted by Kingbob on 27 March 2016 - 12:35 AM in Modifications

Here is a parts list. The ebay links are just examples of the types i used. 


Arduino Nano - $3+
from ebay
1.8" colour tft ST7735S based display - $9
Regulated Power supply - $4
INA219 DC/current monitor - $10
2 UGN3505 Hall effect sensors - $3
PSP1000 joystick - $3.50
Buzzer $1+
220ohm resistor - $0.05
your parts box or local electronics shop
micro lever switch - $1
ebay or your local electronics shop
LM298N H bridge motor driver - $3
Note this is rated to 4A. According to jwasko the 360 size motor in the stampede can draw up to 13A, so will likely die. I'll be replacing it with:
BTS760B 43A H bridge - $11
In hindsight to make assembly easier i'd have used one of these nano expansion boards:
Arduino Nano expansion board - $3+
Along with which i'd have used a bunch of these:
Male servo connectors - $5
Battery, i had a couple of Lipo's so didnt need to buy one. But i'm using a 3S 11.1V 2500mAh pack capable of 20c discharge. I already had a spare connector for it too
Wire, heatshrink, and cable ties
It cost me around $37 in electronics, not including wiring, battery, and parts i blew up!

#352454 Arduino gun controller mk3

Posted by Kingbob on 26 March 2016 - 10:44 PM in Modifications

I actually managed to mount it just above the magazine release switch. That way it can be reached by the trigger finger without having to change grip at all.


And, with that, mechanically and electronically its finished!


The software is 95% done, everything works, but i'm just making some tweaks to the screen layout and getting it all working just how i want it.

#352438 Arduino gun controller mk3

Posted by Kingbob on 26 March 2016 - 02:40 AM in Modifications

Made great progress today, had to do some switching around of what is connected to which arduino pin since i had used all the pwm pins for non-pwm functions.


The firing mechanism and detection is all done. Got the jam door open detection and firing prevention working (decided that was necessary after it tried to eat my finger during testing). Got the single/triple/full auto firing working, and stops at 0 ammo. And buzzes to let you know you're out.


Would you believe my biggest problem now is working out where to mount the joystick???

#352417 Arduino gun controller mk3

Posted by Kingbob on 25 March 2016 - 03:30 AM in Modifications

Good progress on it today! Firing all works now, everything as intended.

Only issue ive discovered is that when the arduino is first turned on, the control pin to the h bridge goes high while it boots. Which means it fires about 5 times when turned on.


Only way i can think of around it so far is to route that signal pin through the safety switch, so wont fire with the safety on. But means i have to remember to turn the safety on every time. 



Edit: occurred to me i might be able to just put a pull down resistor on it, might do the trick.


Edit 2: Yup, pull down resistor does the trick!

#352416 Arduino gun controller mk3

Posted by Kingbob on 24 March 2016 - 11:41 PM in Modifications

Did a bit of research, the H-Bridge i'm using is based on an L298N driver, which will do 4A and seems to be holding up so far, though the max ive run it at is 60% power.


If (or when) it cooks, i'll replace it with one based on the BTS7960B which can handle 43A. Though I'm guessing thats combined both channels, but its still 21.5A per side.


Checked ebay and they can be bought for $10-12US:




#352413 Arduino gun controller mk3

Posted by Kingbob on 24 March 2016 - 11:07 PM in Modifications

Yeah the battery i'm using is rated to 20C continuous, which is why i chose it. I used to competitively race RC cars so know all about batteries, but i didnt know the specs of the motor. The h-bridge i'm using is rated to 4A, and seems to be holding up fine atm.


Will have a look and see if i can find a higher rated one.

#352396 Arduino gun controller mk3

Posted by Kingbob on 24 March 2016 - 08:40 AM in Modifications

Since all the parts are in and working, its basically just software now. Should be finished by the end of the weekend!

#352338 Arduino gun controller mk3

Posted by Kingbob on 21 March 2016 - 07:06 AM in Modifications

Nah i wasnt happy with having the tray going in and out with all the parts in a decent way. So ended up removing the rear of the tray from the main part and just used the bay instead.


Yes that is a switch, just a dpst, but only using one side.


That wire on the spring isnt fully fitted yet, was just laid on top for sizing by length. It will go underneath the spring and be glued down out of the way.

#352300 Arduino gun controller mk3

Posted by Kingbob on 20 March 2016 - 07:55 AM in Modifications

Updated version of the schematic.



#352296 Arduino gun controller mk3

Posted by Kingbob on 20 March 2016 - 06:36 AM in Modifications

Found a h=bridge locally!


Current state:


#352269 Arduino gun controller mk3

Posted by Kingbob on 19 March 2016 - 10:02 AM in Modifications

Its lucky i had a bunch of nano's in my parts box. Down to just 4 spares now! Though theres no reason i couldnt use a pro mini, a Uno or even a Mega would fit in the battery compartment of the Stampede.


A H bridge basically is a regulator. Just takes the pwm signal and outputs the proportional voltage to match. The stampede runs on 6x D cells so the motor should run on ~9V anyway, so 11.1V shouldnt be a stretch. I'm guessing the motor controller i was using was designed for an analog signal input instead of a PWM input. Basically fried the FET's input.

#352265 Arduino gun controller mk3

Posted by Kingbob on 19 March 2016 - 04:20 AM in Modifications

Right, so i got another nano wired in, tested and the screen wouldnt work. Swapped wires around and all sorts, just refused. Tested the screen on a MEGA, worked fine. Can only conclude one of the pins it uses on the nano wasnt working. So scratch that nano.


Grabbed the next one out of my parts box, decide i'll test the screen on it before hooking it up. Plugged it in to usb to load the sketch, wouldnt even power on. Dead as a door nail.


Grabbed ANOTHER nano from the box, plug it to test, and hurrah! powered on! Hooked up the screen, and works! yay! So thats 3 nanos down (those 2 plus the one i blew up). 


Hooked it all up, and all the switches, sensors, screen, and all that work! yay! Next step, hook up the motor and driver. As soon as i turned it on it went to full power. Did some testing and its looked like the FET had failed closed, so just sent the whole battery voltage straight to the motor. Went and got a replacement (luckily only $7 locally), tested it and seemed ok. Wired it in, and slowly started to power it up, and all of a sudden, it went straight to full power as well! Checked the FET and it was red hot! Tested and lo and behold, failed closed again. Its rated to 5A 24V, and i'm only using a 1500mAh 11.1V battery yet it cooked.


I'm going to order a couple of decent H bridges to use instead, so until they arrive the actual motor drive is on hold.


The wiring and software are there for it though, so until they get here, i'll concentrate on getting all the rest of it put together, functional, and tweaking the software to how i want it. Then just have to add the bridge when it arrives.

#352193 Arduino gun controller mk3

Posted by Kingbob on 14 March 2016 - 06:28 AM in Modifications

Assuming theres space to fit one. Wouldnt want to try and fit one in a Stryfe or a Rayven.

#352190 Arduino gun controller mk3

Posted by Kingbob on 14 March 2016 - 03:35 AM in Modifications

These look interesting for a nano. The size is about the same as a Uno, but the good part is that where each pin is broken out to the headers, they also have a +V and GND for each pin.


Handy when you want to connect multiple extras.



#352187 Arduino gun controller mk3

Posted by Kingbob on 13 March 2016 - 08:40 PM in Modifications

Yeah i have a solder sucker and de-soldering braid as well, but of course i have to rip all the wiring off to get to it.


I've ended up just separating the boards out, makes working on it easier. I did accidentally fire it up briefly while testing the battery connection. I think it fed full voltage to the motor, must have been firing at at least 4 rounds/s. Scared the crap out of the dog!


Got sick of soldering/wiring though so put that aside and did some physical work cutting a hole in the shell to mount the screen etc. 

#352150 Arduino gun controller mk3

Posted by Kingbob on 12 March 2016 - 09:13 AM in Modifications

Except I'd soldered the Nano onto it.

#352145 Arduino gun controller mk3

Posted by Kingbob on 12 March 2016 - 02:11 AM in Modifications



I zapped the arduino accidentally while hooking things up. Fried it :(


Rebuild time.

#352105 Arduino gun controller mk3

Posted by Kingbob on 09 March 2016 - 11:15 PM in Modifications

I've decided to wire in an extra switch, using the one that was the safety for the jam door.


Figured since the arduino will be controlling the firing, it will be possible for it to shoot 3 rounds, or full auto, with that access open. Could be hazardous to fingers, so going to add it back in as a safety, and add a box to the lcd display saying "Jam Door" or similar.

#352067 Arduino gun controller mk3

Posted by Kingbob on 08 March 2016 - 09:18 PM in Modifications

Pulse Width Modulation. Basically a digital square wave signal with a variable frequency. Feed that to a motor via a FET and lets you control the speed by controlling the voltage through the FET.

#352056 Arduino gun controller mk3

Posted by Kingbob on 08 March 2016 - 07:27 AM in Modifications

The little red one is the FET motor driver. Uses the PWM signal from the arduino to drive the motor directly from the battery.

#352051 Arduino gun controller mk3

Posted by Kingbob on 07 March 2016 - 09:59 PM in Modifications

My local electronics store happens to have quite a few arduino bits they get from china.


Its identical to this:


#352043 Arduino gun controller mk3

Posted by Kingbob on 07 March 2016 - 04:19 AM in Modifications

Have also decided for practical wiring reasons to put the screen on the right, mounted internally but flush with the side of the mag slot.

#352042 Arduino gun controller mk3

Posted by Kingbob on 07 March 2016 - 04:13 AM in Modifications

Actually no, the nano can accept 7-12V because of its onboard regulator.


But its not recommended to draw more than 20mA per pin from the arduino, and after i had that IR problem in my Rayven i worked out the actual draw of the bits and pieces that I had connected to the +5V output. The hall effect sensors draw ~10mA each, the IR LED draws about 20mA, the IR transistor about 5mA, 5mA for the buzzer, and up to 10mA for the i2c current/voltage board. Thats 60mA already, then have to add in the 1.8" LCD. I couldn't find the exact specs for the lcd i'm using, but found one similar and it has a 150mA regulator onboard. So max could be looking at 210mA draw. 


Goes way over the per pin rating, and its recommended the whole arduino not exceed 200mA total!


So the regulated power supply runs all the bits and pieces so they don't draw through the arduino, but still get a nice stable 5V.


I was just going to use a 7805 5V regulator, which is $2 locally, plus a couple of $0.50 capacitors for smoothing, and a $2 small bread board to put it on. But when i went to the electronics shop, i saw that little pre made unit for $6. Only $1 more and saved me the hassle of building it, so figured why not?

#352036 Arduino gun controller mk3

Posted by Kingbob on 06 March 2016 - 08:25 AM in Modifications

On the left is the regulated power supply for the arduino etc. Takes the 11.1V from the battery and provides a nice 5V for everything.

The blue board at the top is an i2c voltmeter and ammeter.

The black board at the bottom is a buzzer, for indicating when out of ammo etc.

The nano is obvious.

Then theres a double row of headers on the right that will connect to the various switches, display etc etc in the gun.



#352032 Arduino gun controller mk3

Posted by Kingbob on 06 March 2016 - 07:49 AM in Modifications

Board built, and installed in the battery tray with an 11.1V LiPo.








New wiring in to the relevant switches, screen, and other bits and pieces.



Need to trim the wiring to length and put the proper connectors on instead of the temporary ones i used while testing.


#352010 Arduino gun controller mk3

Posted by Kingbob on 05 March 2016 - 09:53 AM in Modifications

Detachable and swappable between sides? Hmmm

#352005 Arduino gun controller mk3

Posted by Kingbob on 05 March 2016 - 12:00 AM in Modifications

So im trying to decide where to mount the screen. It will be on the side of the magazine slot since thats a nice big flat area, but i cant decide whether to put it on the left or right.

Nor can i decide whether to mount it internally, or externally and make a plastic case for it. 

Or to go whole hog and make it fold out.




Atm i'm leaning towards internally on the left.

#351989 Arduino gun controller mk3

Posted by Kingbob on 04 March 2016 - 06:39 AM in Modifications

Well, ive started!


Ripped out the existing wiring from the Stampede, removed a few bits of un-needed plastic, and soldered in new wires for the motor, trigger switch, safety switch, and magazine sensor switch. Just waiting for my 11.1V LiPo to charge so i can do some testing on the motor.


Decided to use the existing motor mechanism for now, wired in a h-bridge so the Arduino can control it. Need to do some testing to make sure i can properly control single/triple/full auto shooting.


If i blow it up, or cant get the timing right, then i'll look at using a stepper or servo instead.

#351879 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 10:38 PM in Modifications

I couldnt see any particular reason for it to be there other than being part of all the various safety mechanisms. Most of which i'll be ripping out or disconnecting.

#351874 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 09:37 PM in Modifications

Yeah i was planning to remove the various bits of plastic in the tray and drop it all in there. I could even fit a MEGA in there if i need to, but i have spare UNO's and Leonardos. Once theres a wiring loom taking the various switches, sensors etc back to the tray will just make it easier to work on.


I've had a look at where to put the IR sensor for firing, i'll probably remove that little door flap where the dart inserts, and use the existing opening with just a hole for the LED.


Once this Stampede is done i'll probably re-visit my rapidstrike and add in a stepper or servo to control the pusher.

#351868 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 08:26 PM in Modifications

Dont need to use a full size servo, a little micro servo will work fine as a pusher.


I've got a load of lipo's i can use. 11.1V 2600mAh, 7.4V 4000mAh, and 2x 7.4V 2500mAh. Plenty of room in the battery tray without 6 D cells!

#351854 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 09:04 AM in Modifications

This particular design doesnt actually interact with flywheel motors. But, since brushless speed controllers work like a servo with a PWM signal, then yes it would be relatively simple to add in. Would still need a brushless speed controller though.

#351852 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 08:42 AM in Modifications

Nothing major. I'll be using the servo/stepper to push/pull the loading/firing mechanism on the Stampede.

In a Rapidstrike, id use the servo in the pusher instead.

#351850 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 04:30 AM in Modifications

So far the design looks roughly like this.

Note that this is from memory, probably not the same as whats on my breadboard at the moment so might have errors. I'll update and correct it as I go.


I'm using a MEGA2560 Arduino at the moment simply because it has more flash and ram than the nano's i normally use. That way i dont have to worry about sketch size until its ready to go. Dont yet know what arduino i'll actually use. Whatever I use will be mounted in the battery tray so theres no shortage of space.


The servo may also get swapped for a stepper motor and controller.


#351846 My Nerf shot counter V2

Posted by Kingbob on 28 February 2016 - 01:50 AM in Modifications

This is the circuit (i think), hall sensors for magazine size detection, one switch for magazine insertion detection, and other switch for trigger.


The IR LED/transistor for RPM counting are still connected in the Stryfe, and the code is still there, but i'm not displaying it on the screen until i can get a hold of an oscilloscope to work out why it drops out.


The OLED screen also needs a 3.3V source, and fortunately the nano has a regulated 3.3V output.




#351845 Arduino gun controller mk3

Posted by Kingbob on 27 February 2016 - 11:34 PM in Modifications

Edit: Parts list: http://nerfhaven.com...e-3#entry352455

Edit: Circuit: http://nerfhaven.com...e-3#entry352456

Edit: Arduino code: http://nerfhaven.com...e-3#entry352474


So my first arduino in a nerf was a 7 segment based counter with magazine size detection for a Stryfe and Rapidstrike:



The mk2 added an OLED screen, and voltage monitoring in a Rayven:



Now comes the mk3 for a Stampede.


This one still has all the things from the others like round counting and magazine size detection etc, but adds a full colour 1.8" LCD screen, battery voltage and current draw display, safety switch, a joystick to select single shot, 3 shot burst, and full auto firing mode selection, and a buzzer to indicate when its out of ammo.


The mk1 and 2 were in flywheel blasters so the motor control wasn't done by the arduino. But the Stampede isn't flywheel, and will have its motor controlled by the arduino which lets me select the firing mode (1/3/auto).


At the moment its breadboarded while i code it, but will probably open up the stampede and start looking at installation this week.






More to come!

#351732 My Nerf shot counter V2

Posted by Kingbob on 23 February 2016 - 10:24 PM in Modifications

I hate to admit it, but the RPM counter has me beat.


It works fine but only when the arduino is connected to USB.

Tried running it all off a higher Ah capacity battery, upped tthe voltage, added in a 5V regulator, ran everything off that. Tried applying power via the usb port, even tried running it off a usb battery. 


Gonna have to live with it until i can get an oscilloscope to see whats going on. Might mock another one up on breadboard and test different types of arduinos too.

#351584 My Nerf shot counter V2

Posted by Kingbob on 17 February 2016 - 07:14 AM in Modifications

Just about there, I cant be bothered swapping the IR sensor, so just gotta write some code so it says MAX instead of dropping to zero.


On the plus side, these just arrived:



Works great. Havent used the SD card to load an image yet, but hooked it up for testing and its all good. Does need some extra double sided tape between the LCD and PCB though.

#351509 My Nerf shot counter V2

Posted by Kingbob on 14 February 2016 - 08:51 PM in Modifications

I suspect its the IR receiver, i did some testing with a spare one, and if the signal it gets is constant, its output stops. So yeah i figure its detecting so frequently that as far as its concerned its a constantly ON signal.


I do have a couple of other IR receiver/transistors to try, see if they're more capable. 


I'm half inclined to just tweak the software to say "MAX" instead of the RPM if it exceeds the RPM its capable of reading

#351494 My Nerf shot counter V2

Posted by Kingbob on 14 February 2016 - 02:34 AM in Modifications

Spoke too soon. Whilst i did solve my power issues, i've found another.

The rpm counter is using a standard IR LED/receiver pair mounted on each side of a flywheel. Theres a hole in the flywheel allowing the IT receiver to get a signal once per revolution. All pretty standard.


The code im using counts the number of signals received every 250ms, and multiplies it out to give an rpm count. The reason i do it every 250ms is so the display updates at that rate. Whilst its more accurate if I count for say 1 second, it also means the display would only update every second which is very slow.


The way the arduino counts the signals is by using one of its interrupt pins, so whenever the IR receiver gets a signal, it interrupts the arduino and forces it to count, before going back to what it was doing. Thats what the interrupt pins are designed for, and work well. 

BUT, what ive found in practice, is that when the motors are at max RPM, (somewhere around 25,000rpm) the counting fails.


It could be the IR sensor not being able to output fast enough, its rated to 37,000hz, which seems coincidentally close to the 25000 count as the max i've seen.


OR, the interrupt pin cant interrupt and execute fast enough to count the signal its getting.


I'm inclined to think its the IR sensor since the interrupt pin would count as much as it could so i'd still get a high count. Instead at high RPM the count simply drops off to almost zero, implying the sensor cant get a clean "sense" of the LED. 

I'm going to look for an IR sensor with a higher frequency, see if that helps.


I also have a new arduino on its way that runs at 48Mhz instead of the 16Mhz of the nano. Possible it may be able to keep up with the interrupt counting if thats the issue.