This is just a simple toy made to try and use my my components and material, and for me to play around in and scratch my itch of having to make something.
Being meant as a toy, I did not make it to look realisti, and made it just to have the general shape and fell of the gun.
Since I made this will a lot of extra space left in the barrel, you could add more features, like an ultrasound distance sensor, or PIR sensor, or maybe try to make a coilgun (probably not that easy) if you want. However, I did not really have these (or I broke or couldn't figure how they worked if I had), and just stuffed cables inside. You could potentially try to expand this into a laser tag system if you wanted, but due to a lack of resources and time (and being just a clearance project), I just made it simple.
Step 1: Electronics
- Micro bit
- Micro bit edge connector (to connect to gpio)
- Micro roller switch (for trigger)
- Speaker (for sound)
- Bright white LED (to act as flashlight, I had it as scrap)
I just comnected the compinents to the micro bit. However for the bright LED, you have to connect straight to the GPIO of the switch, such that enough power will be supplied to it to turn on.
You could add any other electronic components in the barrel, for example, I tried adding an ultrasound distance sensor (though it broke), or a PIR sensor (More on that later).
Step 2: Software
In short, the software was for the micro bit to make a sound whenever the roller switxh was pressed, and that you could change the pitch of the sound make using the potentialmeter.
Step 3: Case
The case was built in scrap wood for the handle, and acrylic for the barrel.
The wood handle is basically a long wooden box with an exposed top and bottom, all hot glued together. The bottom was left exposed for the power bank to slide in. Moreover, the back of the handle would have a hole drilled (or for me, cut out a piece before gluing back a smaller piece, leaving a hole in the middle) for the knob.
The acrylic barrel is a piece of black acrylic bent (crappily with a soldering iron) to form a long U shape, leaving the bottom exposed
Step 4: Putting It All Together
I used velcro to put everything in place, including the roller switch, micro bit, led flashllight and speaker.
The led was stuck to the tip of the barrel, while the roller sitch was stuck at the handle where the trigger would be. The microbit and speaker would be stuck at the sides of the toy so that they would not get in the way of the user.
Meanwhile, the USB connector was hot glued inside the handle as a docking connector for the power bank. The power bank would be able to slide in the hollow handle and dock to power the device.
The potentialmeter would be mounted throught the hole on the handle facing the user.
Step 5: PIR Sensor
I added an additional PIR Sensor at the tip of the Barrel. Take note, to have the PIR function properly, you need to bypass the regular to power it straight from 3.3V. This is a good tutorial on how to do so.
After that, I just wired ground to ground, 3.3V to 3.3V, and the output to GPIO 15.