Jump to content


Photo

Cyberpunk 2077 Kang Tao 3D Printed Nerf Gun

Cyberpunk 2077 Kang Tao 3D Printed

17 replies to this topic

#1 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 13 October 2019 - 03:04 AM

Hey everyone, I am excited to present to you my latest and greatest creation - The 3D Printed Kang Tao functional Nerf gun from the upcoming video game Cyberpunk 2077

 

A screenshot from the gameplay trailer for reference:

j10clvj.png

 

I've always had a passion for building and creating things and sharing with those who have similar interests.

 

A teaser of the build:

jyOuidr.jpg

 

I've made more progress than this so far, but let's start from the beginning.

 

This is going to be a comprehensive build log from planning to finish, so hopefully this gives you some ideas if you ever want to 3D print a scratch-built Nerf Gun of your own.

 

From Arduinos to coding, from Lipo's to Brushless motors, from MOSFETS to Solenoids, from CAD drafting to 3D printing - All will be revealed so stay tuned!

 

Next post will be about the planning stage where I show you CAD drawings, schematics etc.

 

Any questions or suggestions just ask below.

 

Edit: Re-uploaded images.


Edited by Clark3DPR, 14 October 2019 - 06:09 AM.

  • 0

#2 Meaker VI

Meaker VI

    Member

  • Moderators
  • 1,177 posts
  • State:Washington
  • Country:United States
  • u/MeakerVI on Reddit

Posted 13 October 2019 - 10:21 PM

You may be limited to image posts because you're a new user. Linking images from imgur/etc. is acceptable until you do get full permissions.


  • 0

#3 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 14 October 2019 - 04:27 AM

You may be limited to image posts because you're a new user. Linking images from imgur/etc. is acceptable until you do get full permissions.

 

Thanks! It seems to have worked.

 

Onto typing the next post


  • 0

#4 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 16 October 2019 - 04:45 AM

*
POPULAR

PLANNING - Physical CAD Drawings

 

Here I show you over 120 hours worth of CAD drawings used to bring this project to life. Program used: Autodesk Inventor Professional.

Gameplay trailers on Youtube were used for visual reference of the Kang Tao, as well as the official CDPR reference images for Cosplayers.

 

The Kang Tao started as a single line, then evolve into many complex shapes. Everything constrained with dimensions so that every part fits together precisely. Cant just 'eyeball' this stuff.

 

a5WxaIK.png

 

Multiple parts were made with the 3D printing process in mind. Each part was designed to be fastened to one another using M3 screws and threaded inserts.

 

It is designed to be split into two halves similar to a Nerf gun. Both halves have screws, as Nerf guns look a little weird and "toy like" with screws on only one side causing deep holes where the screws are.

 

6fv3JZI.jpg

 

Fun fact: There are over 115 components that make up this project (not including screws, inserts or cables)

 

All of the electronics (except battery) were housed in the right half (similar to nerf guns) for easy access. Battery located in a compartment towards top front. (Electronics tutorial in future post).

 

By far the most challenging aspect was to make the gun functional while also aesthetically accurate to the Kang Tao from the game.

To achieve the correct look, I purchased a 3D printer (Artillery Sidewinder X1) with a massive 300x300x400mm build area. (More details in upcoming 3D printing post)

 

To achieve the functionality similar to the Kang Tao from Cyberpunk 2077, this needed to have full auto fire mode.

For this, a flywheel cage with Brushless Motors was used in conjunction with a solenoid pusher. (More parts list details in a future post).

 

There is a 'window' on the Kang Tao that features a piston moving in a back and forth motion whilst firing. I HAD to simulate that somehow…

So I moved the solenoid towards the rear and added a shaft extension through the window that pushes the Nerf dart out of the mag and into the flywheels. It just...works!

 

1aY65Vt.jpg

 

Check out my video explaining in a bit more detail of how the parts were modelled and how they all fit together etc:

 

Next post will be about the 3D Printing Process.

 

And as always, suggestions and questions just leave a comment below.


Edited by Clark3DPR, 18 October 2019 - 07:05 AM.

  • 1

#5 Meaker VI

Meaker VI

    Member

  • Moderators
  • 1,177 posts
  • State:Washington
  • Country:United States
  • u/MeakerVI on Reddit

Posted 19 October 2019 - 12:01 PM

Holy smokes that is incredibly detailed
  • 0

#6 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 20 October 2019 - 04:43 AM

Holy smokes that is incredibly detailed

Cheers!

 

I had to replicate the look :D


  • 0

#7 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 20 October 2019 - 06:33 AM

*
POPULAR

PART 2 - 3D PRINTING

 

Now it's time to bring this Kang Tao into reality!

 

Slicer software used was PrusaSlicer

3D Printer used was Artillery Sidewinder X1 - 300x300x400mm build area.

Filament: PLA / Hotend 210°C / Bed 65°C

 

Besides a simple pencil holder, this is actually my first 3D printed project (a bit ambitious i know...)

 

So this 3D printer was purchased because of it's affordable price and rather large print area, making things easier.

Even with a large 300x300mm build area, the Kang Tao had to be split into multiple pieces to print. This was kept in mind during the CAD modelling process.

 

The first part to print is the 'main' part which houses critical components such as flywheel cage, mag, firing chamber and Arduino. This will be the base piece, where consecutive pieces will build onto it.

 

8UfsmpY.jpg

 

This finished part is another main part, which will house the remaining critical components such as the grip, trigger, solenoid and MOSFET.

17 hours later, this finished part looks something like this:

 

HTGOQaS.jpg

 

Fun Fact: Over 52 3D printed parts taking over 160 hours to print

 

Flipping it over, you can see the 'base plate'. This base plate was created so that the print stays stuck to the print bed, otherwise it would peel off mid-print and be ruined!

Also notice how the base plate is made up of multiple sections, so that removal with pliers is easier.

 

Beneath the base plate is a grid of manually designed support material, so that the printer does not print in mid air, and the material above will not collapse on a hollow section.

Auto-generated support material tends to put material everywhere, making it a nightmare to remove without damaging the part, and so support material was painstakingly designed manually.

 

mFG6bMw.jpg

 

Here it is hollowed out with most of the support material removed. You can catch a glimpse of the grid supports that once was.

You don't need to hollow this out if all you want is an inanimate object for cosplay purposes. However, because I want to be difficult and make it a functional Nerf Blaster, I needed somewhere to mount all the electronics.

 

sJePBEU.jpg

 

Flywheel cage was printed in multiple parts, specifically to fit these brushless motors. (More on electronics in future post).

 

bfLJmkG.jpg

 

Here is a video of the 3D Printing time lapse, a further explanation and a teaser of the painted parts:

 

Next post will be...hmmm...further analysis of mechanic operations. How the mag release works, solenoid, flywheel cage etc.

 

Thank for reading, any questions leave a comment :)


  • 1

#8 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 27 October 2019 - 01:02 AM

Part 3 - Mechanical Operations
 
Here I show you how all the moving parts work
 
Battery Cover - This is a simple screw on cover. It has only 2 screws to make it easier to remove. Thumb screws would be useful to make it a tool-less design. Magnets did not hold as well as anticipated. Cable goes out and back in, only for aesthetics to replicate the Kang Tao look from the game.
 
Mag Release - Unlike how most Nerf Blasters have a small slider switch to release the mag, I created a more accessible lever that you push forwards. Here's an image showing the catch, and the cover that holds it in place. The spring was taken from an old Nerf Blaster's mag release I had laying around.
 
5xXvefe.jpg
This catch pin sticking out is only approx. 3mm in diameter. 3D printing has proven to be quite durable.
 
MvGcUgr.jpg
Now the lever is shown attached to the catch pin, and pivots around the screw.
 
This lever pivots around a screw near the top, which pulls back the catch that releases from the slot in the mag. Note that the top 'hole' in the lever is actually a slot, to allow the catch pin to move freely. To make this simple, I made it compatible with any Nerf stick mag. Drum & Banana mags could be compatible if the fore grip was removed or modified.
 
D4Yly0w.jpg
How it looks from the outside of the Kang Tao
 
Trigger - The trigger is 3D printed too, and does not even need a spring! The way it works is the micro-switch behind it has it's own spring action that pushes the trigger forwards once released. The actuation length is only 3mm, which I think feels more responsive, and the micro-switch makes a satisfying clicking sound.
 
bIKVD6q.jpgYou can also see the secondary micro-switch used to spin up the flywheels.
 
Solenoid Pusher Rod - This rod only needed to be this long if you want a window showing it going back and forth. Again, this was to replicate the Kang Tao look. Before this setup, the issue I had was that the pusher rod would rotate and sag. The solution was a guide rail and a slot on the pusher rod that goes over the guide rail. The guide rail and solenoid shaft was lubricated for smoother operation.
 
zUCSq9p.jpg
You can see the metal pin that the slot slides over.
 
Flywheel Cage - The cage has mounting points at the rear for the motors. One problem with flywheels is that the crush could cause the motors to push apart as the dart goes through. This puts strain on the mounting points at the rear. To fix this, the inner diameter of the cage where each motor is mounted into is very close to the outer diameter of the motors themselves. This makes the motors press fit as well as screwed in, so that they do not move apart from the crush of the darts.
 
ZPLwwEz.jpg
Rear View of Flywheel Cage showing motor mounting screws.
 
Flywheels - These were 3D printed too. Aluminium flywheels that can be purchased are typically made for brushed motors, and have an entirely different shape from these brushless outrunner motors. The flywheels have slots in them to allow ventilation to the motors. You could print a built-in fan to the flywheels to further cool the motors, however these motors don't get hot enough to justify it.
 
JW0H3oV.jpgFront View of 3D Printed Flywheel Cage
 
 
Next post will get more technical with how the electronics work
 
Any questions or suggestions just ask, cheers.

Edited by Clark3DPR, 27 October 2019 - 02:54 AM.

  • 0

#9 Meaker VI

Meaker VI

    Member

  • Moderators
  • 1,177 posts
  • State:Washington
  • Country:United States
  • u/MeakerVI on Reddit

Posted 27 October 2019 - 11:21 PM

You went with manual supports?!?

 

First, I'd like to see how you've gone about making them. Second, those grids that are left over look more difficult to remove than some of the auto-generated supports I've used, especially tree supports.

 

This remains an excellent post, I hope you continue to fill it out.


  • 0

#10 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 27 October 2019 - 11:54 PM

*
POPULAR

You went with manual supports?!?

 

First, I'd like to see how you've gone about making them. Second, those grids that are left over look more difficult to remove than some of the auto-generated supports I've used, especially tree supports.

 

This remains an excellent post, I hope you continue to fill it out.

 

Ah yes, manual because i'm crazy like that!

 

Auto supports tends to be dense, I have to saw / cut it off in some instances. Also, some areas are small and fragile, and could easily break off with the support material. Auto is 'dumb' and places supports in some places where it is not needed.

 

Grids are easy enough to remove with needle nose pliers using a twisting motion. It just takes a bit of time. Grid is only 0.5mm thick.

 

The supports were created within the 3D CAD software (I use Autodesk Inventor Professional) before importing to the Slicer software. I might make a video on the topic of manual supports.

 

I haven't tried tree supports yet, I will look into that.

 

Yes, next week there will be a technical explanation of electronics, MOSFET, brushless motors, brushless ESC, Arduino, Solenoid, Microswitches etc. And maybe a video of it firing!

 

Thanks for commenting


Edited by Clark3DPR, 28 October 2019 - 12:00 AM.

  • 1

#11 Daniel Beaver

Daniel Beaver

    HQRSE CQCK

  • Moderators
  • 2,059 posts
  • NerfHaven Subscription Supporter
  • Location:Minneapolis
  • State:Minnesota
  • Country:United States

Posted 30 October 2019 - 09:52 PM

This is some of the best content ever posted on NH, thanks for sharing in detail!

Manual supports is a good approach for a lot of these kind of parts, even if it's a lot of work. In a sense, the major design consideration of design for 3D printing is dealing with overhangs, as they're a necessary part of a lot of parts.

 

I've had mixed feelings about tree supports. They're really great for parts where you need support, but where there isn't clearance all the way to the print bed. When that's not the case, then regular supports often work better.


Edited by Daniel Beaver, 30 October 2019 - 09:54 PM.

  • 0

#12 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 31 October 2019 - 04:17 PM

This is some of the best content ever posted on NH, thanks for sharing in detail!

Manual supports is a good approach for a lot of these kind of parts, even if it's a lot of work. In a sense, the major design consideration of design for 3D printing is dealing with overhangs, as they're a necessary part of a lot of parts.

 

I've had mixed feelings about tree supports. They're really great for parts where you need support, but where there isn't clearance all the way to the print bed. When that's not the case, then regular supports often work better.

 

Thank you!

 

I haven't looked into tree supports yet. The reason I don't think tree supports is useful for this project is that there are a lot of larger, flat horizontal surfaces to support. Tree supports I thought were good for small overhang features, which is rare in this project, surprisingly. I do a lot of bridging instead.

 

When creating manual supports you may notice in the above pictures there is a gap intentionally left around the supports so that removal does not result in damaging the part. Any auto-supports is not smart enough to know this.


  • 0

#13 Daniel Beaver

Daniel Beaver

    HQRSE CQCK

  • Moderators
  • 2,059 posts
  • NerfHaven Subscription Supporter
  • Location:Minneapolis
  • State:Minnesota
  • Country:United States

Posted 02 November 2019 - 07:19 PM

 

 

The reason I don't think tree supports is useful for this project is that there are a lot of larger, flat horizontal surfaces to support. Tree supports I thought were good for small overhang features, which is rare in this project, surprisingly. I do a lot of bridging instead.

 

Your intuition is correct - tree supports do not leave a very good underside surface, worse than standard supports. Designing with a reliance on bridging instead of supports will give you a nicer, more consistent underside surface.


  • 0

#14 Meaker VI

Meaker VI

    Member

  • Moderators
  • 1,177 posts
  • State:Washington
  • Country:United States
  • u/MeakerVI on Reddit

Posted 03 November 2019 - 10:43 PM

 

Thank you!

 

I haven't looked into tree supports yet. The reason I don't think tree supports is useful for this project is that there are a lot of larger, flat horizontal surfaces to support. Tree supports I thought were good for small overhang features, which is rare in this project, surprisingly. I do a lot of bridging instead.

 

When creating manual supports you may notice in the above pictures there is a gap intentionally left around the supports so that removal does not result in damaging the part. Any auto-supports is not smart enough to know this.

 

 

 

Your intuition is correct - tree supports do not leave a very good underside surface, worse than standard supports. Designing with a reliance on bridging instead of supports will give you a nicer, more consistent underside surface.

 

I think this is a case of differing settings - I've had tree supports that came off a horizontal supported surface so cleanly that I couldn't tell what surface was supported. I've also heard of guys using auto standard supports getting similar results, but have never had much success with them myself.

 

I find trees tend to come off more readily in one piece, but they can lap funnily into areas they don't belong.

 

I feel like it'd be possible to design the supports in as maybe boxes that pop off somewhat cleanly but don't wreck the surface. I may try that since I have some extra filament and printing time...

 

Oh also, I've had great success using coarse thread screws like wood, sheet metal, plastite, etc. Inserts are nice, but IMO overkill for 99% of parts - you don't really need to open and close these things so much that a coarse thread will strip the plastic out except in the case of an access hatch or battery bay. A machine thread could certainly strip though, those are too fine for the plastic to hold long.


Edited by Meaker VI, 03 November 2019 - 10:48 PM.

  • 0

#15 Daniel Beaver

Daniel Beaver

    HQRSE CQCK

  • Moderators
  • 2,059 posts
  • NerfHaven Subscription Supporter
  • Location:Minneapolis
  • State:Minnesota
  • Country:United States

Posted 03 November 2019 - 10:57 PM

 

Oh also, I've had great success using coarse thread screws like wood, sheet metal, plastite, etc. Inserts are nice, but IMO overkill for 99% of parts - you don't really need to open and close these things so much that a coarse thread will strip the plastic out except in the case of an access hatch or battery bay. A machine thread could certainly strip though, those are too fine for the plastic to hold long.

 

One thing I saw was that often the surrounding plastic fails before threads, whether they be 3D printed or when using brass inserts:

https://www.youtube....h?v=iR6OBlSzp7I


  • 0

#16 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 04 November 2019 - 04:32 AM

*
POPULAR

Part 4 - Electronics
 
Alright, so here is where it gets technical.
 
Schematic
 
GD9GSTL.jpg
 
Drawn to illustrate how everything is connected. An Arduino Nano is used because of it's small size. This should work with a Uno and others too.
 
Refer to this schematic for the below terminologies MS1, C2 etc.
 
Arduino Code will be provided in the next post, as well as an explanation on how to use it, which values you can change in it etc.
 
How it all works
 
W0IZPpW.jpg
 
The way it works, is that when MS2 (secondary microswitch trigger) is held, the brushless motors rev up.
 
When MS1 (primary microswitch trigger) is pressed or held, a signal is sent to the MOSFET gate to fire the Solenoid (S) repeatedly. The solenoid pushes the Nerf dart out of the mag and into the flywheels (M1 & M2) which then accelerate the dart out of the barrel.
 
However, MS1 only activates while MS2 is held. This helps prevent jams in case a dart gets pushed into non-spinning flywheels. This is done in the code.
 
Power supplied to the brushless motors and solenoid do not travel through the microswitches. This means you do not need high current rated microswitches.
 
Brushless Motors
I'm not going to explain how brushless differs from brushed motors here, you can search for some great explanations.
 
There are inrunner and outrunner brushless motors. You want an outrunner motor since they are flatter in shape so you don't have ugly cans sticking out the side of your Nerf blaster. Outrunner motors also have a portion of the external can rotate with the shaft. This makes it easy to 3D print flywheels to go over the motor.
 
Get a motor with rear mounting holes.
 
Voltages of motors should handle at least 12.6V (3s lipo).
 
Current of motor should not exceed Brushless ESC current rating.
 
Power of motors should be >60W. This project uses 12.6V supply voltage x measured 7A motor draw = ~80W each.
 
RPM of brushless motors should be ~25k and are determined by kV rating x Voltage. This project uses 2600kV motors @ 12.6V. Therefore 2600 x 12.6 = ~32,760RPM. I only run the motors at half throttle and darts fly 25m / 82ft!
 
Brushless ESC's
These basically control the power of the brushless motors.
 
Brushless motors don't work with brushed ESC's , get brushless.
 
You need one ESC per motor. Otherwise the back EMF from two motors connected to one ESC will mess up the ESC timing and damage said ESC and / or motors.
 
Current rating of ESC needs to be higher than current draw of motor. Motor in this case was measured at 7A each. Recommend ESC is 20A or higher.
 
Voltage rating of ESC needs to be at least 12.6V (3s Lipo).
 
ESC does not need a built-in BEC. You can use 'OPTO' ESC's. If you have an ESC with BEC, connect the ground and signal cables to Arduino as shown in the schematic. Do NOT connect the ESC 5V Red cable to anything. (Unless you have a specific purpose for it and know what you're doing).
 
Battery
 
u6b55z9.jpg
 
A single battery to power everything. I recommend using a XT60 connector.
 
Voltage is 12.6V 3S Lipo Battery.
 
Capacity is 1300mAH minimum recommended.
 
Current Discharge Rating of battery should be enough for the power draw of all loads. In this project, load current is ~25A.
 
Max discharge rate of battery is calculated by Discharge Rate (25C) x Capacity in Ah (1,300mAh = 1.3Ah).
 
Therefore 25 x 1.3 = 32A max discharge rate for the battery. You should be able to find these numbers in the battery specs.
 
MOSFET
 
LzHzMgs.jpg
 
Powering a 12V / 8A Solenoid straight from an Arduino will cause magic smoke (Arduino dies). Solution? MOSFET.
 
The power MOSFET is used as an on / off switch for the Solenoid. It basically interrupts the ground that powers the Solenoid. This is known as a N-Channel MOSFET. Make sure you get a N-Channel.
 
The MOSFET knows when to turn on and off because of a signal sent to the MOSFET gate pin from an Arduino output pin (D4 in this case). Arduino's put out 5V, and the gate should be fully on at 5V. For this to work it needs to be a Logic Level MOSFET.
 
Current draw from Solenoid is rated at 8A. Make sure the MOSFET has a higher max current rating. This project uses a 30A max rated MOSFET.
 
Voltage though the MOSFET is 12.6V to power the solenoid. This MOSFET is rated at 60V max which is plenty of headroom.
 
Temperature of the MOSFET is less than 35°C in this case. This is achieved because the MOSFET is rated for 30A, though there is only ~8A of load being pulled through it. The other reason is the load (Solenoid) is only powered on momentarily before switching off, instead of powered on constantly. A heat sink is not necessary in this case.
 
Solenoid
 
6nPuf5f.jpg
 
This pushes the dart into the flywheels. All you want is a 12V rated Solenoid with 35mm stroke length. Shorter strokes will not push the full length type Nerf darts far enough.
 
The spring on the solenoid is upgraded to a stiffer spring. 0.9mm wire diameter, 14mmOD and 40mm length. This prevents pusher rod from getting stuck on darts and also increases fire rate!
 
Because the Solenoid is powered on momentarily as opposed to continuously, it should only get mildly warm ~40°C and therefore not require cooling.
 
These solenoids are relatively cheap and generic. They can be found on Ebay, Aliexpress etc.
 
Safety Switch
SW safety switch is simply a 2 position slider switch. It has 3 contacts, though only 2 are used. Powers off Arduino when safety is on, preventing flywheels & solenoid from activating.
 
Protection Circuitry
This section explains how to prevent frying your electronics!
 
C1 33μF is all I had (100μF recommended) & C2 100nF (0.1µF) reduces voltage sag and spikes to the Arduino power input.
 
Caution: C1 is polarity sensitive, striped side is negative, else it goes bang!
 
D1 prevents reverse voltage to Arduino VIN. Take note of it's polarity.
 
D2 is a fly-back / freewheeling diode. It prevents the solenoid (or other inductors) from creating back EMF. This back EMF could otherwise damage the MOSFET. Take note of it's polarity.
 
R1 & R2 are 4.7kΩ pull-up resistors for MS1 & MS2. This prevents floating voltage at the microswitches.
 
R3 is a 10kΩ pull-down resistor to prevent floating voltage at the gate of the MOSFET.
 
R4 is a 150kΩ for the optional LED's. My LED's are 2 in series at 2.4V / 50mA each. Your resistor value may vary. These LED's flash on and off in sync with the solenoid to replicate muzzle flash!
 
 
That sums up this guide. Arduino Code will be provided in the next post, as well as an explanation on how to use it, which values you can change in it etc.
 
Any questions leave a comment below :)

  • 2

#17 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 04 November 2019 - 05:03 PM

 

 

 

I think this is a case of differing settings - I've had tree supports that came off a horizontal supported surface so cleanly that I couldn't tell what surface was supported. I've also heard of guys using auto standard supports getting similar results, but have never had much success with them myself.

 

I find trees tend to come off more readily in one piece, but they can lap funnily into areas they don't belong.

 

I feel like it'd be possible to design the supports in as maybe boxes that pop off somewhat cleanly but don't wreck the surface. I may try that since I have some extra filament and printing time...

 

Oh also, I've had great success using coarse thread screws like wood, sheet metal, plastite, etc. Inserts are nice, but IMO overkill for 99% of parts - you don't really need to open and close these things so much that a coarse thread will strip the plastic out except in the case of an access hatch or battery bay. A machine thread could certainly strip though, those are too fine for the plastic to hold long.

 

Interesting, I will test that 3D printed thread, though I use small m3 sizes. Also, printing a threaded hole sideways (sometimes I have to) the hole is sometimes not perfectly circular.

 

I will test tree supports on my next project.


  • 0

#18 Clark3DPR

Clark3DPR

    Member

  • Members
  • 11 posts
  • Location:Melbourne, Victoria
  • State:Victoria
  • Country:Australia

Posted 09 November 2019 - 09:14 PM

*
POPULAR

Part 5 - Arduino Code

 

Use the following code with the schematic in the last post to give you a better idea of what does what.

There was much research, trial and error to get the code working, but here it is:

const int buttonPinF = 2;      // Flywheel Rev microswitch pin number
const int buttonPinS = 5;      // Solenoid microswitch pin number
int buttonStateF = 0;             // Variable for reading the Flywheel Rev microswitch status
int buttonStateS = 0;             // Variable for reading the Solenoid microswitch status
int solenoidPin = 4;              // Solenoid MOSFET Gate pin number

#include <Servo.h>

Servo throttle;

int pos = 0;
int pin = 3;                            // ESC signal pin

void setup() {
  
   pinMode(buttonPinF, INPUT); 	       // Initialize the Flywheel microswitch pin as an input
   pinMode(buttonPinS, INPUT); 	       // Initialize the Solenoid microswitch pin as an input
   throttle.attach(pin);
   pinMode(solenoidPin, OUTPUT);         // Sets Solenoid MOSFET Gate pin as an output
    
 // ESC Arming Sequence
   for (pos = 90; pos <= 91; pos += 1) { 
      throttle.write(pos);             
      delay(3700);                                         // Wait for ESC to arm / Exit safety mode

// Increase this 3700 value depending on how long it takes for your ESC to arm

   }
}

void loop() {
  
    buttonStateF = digitalRead(buttonPinF);  // Read state of Flywheel microswitch value
 
    if (buttonStateF == HIGH) {  // Check microswitch pressed, if so Flywheel buttonState is HIGH
    throttle.write(92);                 // <(92) = Motor off / (92) = Idle speed
  } else {
    throttle.write(97);                // Motor on (92) = Idle speed / ~(115) = Max speed
  }

buttonStateS = digitalRead(buttonPinS);    // Read state of Solenoid microswitch value

  if (buttonStateF == LOW && buttonStateS == LOW) {
  digitalWrite(solenoidPin, HIGH);           // Switch Solenoid ON
  delay(90);                                                // ON duration
  digitalWrite(solenoidPin, LOW);           // Switch Solenoid OFF
  delay(100);                                             // OFF duration
   } else {
      digitalWrite(solenoidPin, LOW);      // Switch Solenoid OFF
  }
}
 
Uploading the Code
 
Caution: Do not power the Arduino with battery while USB is connected! This could damage the Arduino and/or your laptop/PC. Unplug Lipo Battery before plugging Arduino into PC via USB cable. Unplug USB cable before reconnecting the Lipo Battery. Earth yourself before touching Arduino to avoid static damage to Arduino.
 
Requires a PC / Laptop and the Arduino IDE Software. Copy this code, paste code in software, then upload to Arduino via USB cable.
 
LH5k3oW.jpg
There was a hole cut out of the bottom part and the Arduino's USB port sticking through it. This allows easy access without having to open up everything.
 
How to adjust the code
 
1. When Arduino is powered on via the safety switch, it runs the arming sequence for the brushless ESC's. My ESC's take 3.7secs, 'delay(3700)' in the code. You may have to increase this value up to 10000 (10secs) depending on your own ESC to get it to exit safe mode.
 
2. Hold secondary microswitch to rev flywheels, then press or hold primary microswitch to fire. The '&&' in 'if (buttonStateF == LOW && buttonStateS == LOW)' line of code tells the primary trigger to fire only while the secondary trigger is also held. This helps prevent jams.
 
3. Change 'throttle.write(92)' to increase/decrease motor idling speed or turn them off. By default motors will spin at low speed to decrease rev up time. (Value depends on your motor / ESC but should be around 92)
Change 'throttle.write(97)' to change motor top speed and dart velocity. (Value depends on your motor / ESC, but should be around 115)
 
4. Press or hold primary microswitch to fire solenoid.
 
5. Change 'delay(90)' and 'delay(100)' to increase/decrease fire rate of solenoid.
 
6. When Microswitches are released, ESC PWM signal for flywheels returns to idle rev speed (92) and signal to MOSFET gate for solenoid stops activating.
 
7. When ESC's lose signal from Arduino (when safety switch is on and Arduino powered off), the ESC's revert to safe mode and turn off motors.
 
You can create your own code or modify this code to add functionality such as select fire (full auto, burst & single fire), or a knob (potentiometer) to adjust the speed of the flywheels.
 
 
Hope this helps, and ask questions or suggestions below etc (I'm no expert with coding though), happy to help.

Edited by Clark3DPR, 15 November 2019 - 05:18 AM.

  • 1



Also tagged with one or more of these keywords: Cyberpunk 2077, Kang Tao, 3D Printed

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users