Toy Dart Shooter (App-controlled)
by frodyyyyyyyyyy in Workshop > 3D Printing
31 Views, 0 Favorites, 0 Comments
Toy Dart Shooter (App-controlled)
This project combines multiple disciplines I learned in my free time: Arduino programming, CAD design, mechanics, FDM printing, mechatronics, and app development.
Two servo motors control the left/right and up/down aiming. Another servo motor tensions the rubber bands using a gear connected to a gear rack. This connection can be disengaged by a fourth servo, which instantly releases the tension and launches the dart up to 4 meters.
The app was developed using MIT App Inventor and communicates with the Arduino via a Bluetooth module.
Downloads
Mechanism
The dart itself gets pushed through a barrel printed in two parts (for assembly and smoothness reasons). There is a pushing part gliding in there, that is connected with rubber bands to the front of the barrel and to a gear rack in the back. The servo charging the mechanism is connected by a living hinge, so that it can be bend away from the gear rack. Small rubber bands ensure a stable connection between gear and rack until the release servo turns an excentric circle, pushing the gear out of contact and ultimatly releasing the tension. It took a few iterations to find a suitable gear and tooth size to get an instant release. Also i had to experiment with the rubber bands a little to avoid slipping.
Downloads
Mechatronics
The actual electronics are relatively simple. The Bluetooth module is connected like in the provided example. It needs the RX/TX pins for communication, power and a pin for the connection state. I used three positional servos to aim and for the release mechanism, since its quite important to have consistant angles. For turning the gear on the other hand I needed multiple revolutions, so i used a continuous rotation servo.
App
For the app programming I used the MIT-App-Inventor. It consists of 3 sliders, a shoot button and the connection selection. The sliders are used to controll left/right, up/down and the charging duration. Every time one of these gets draged, the app sends a list of two intigers to the Arduino via Bluetooth. These lists are used to tell which value changed (0&1 aiming, 2 loading time, 3 shoot), and what the new value is (e.g. 140°).
Arduino Code
This is where everything comes together, so i tried to keep it simple. In the beginning I defined some variables and imported the servo library. In the setup part the servo pins and the BT-connection pin get defined. The main part happens in the loop. Every time the BT-Module is connected and sends something via serial communication, this imput gets stored in a 2 Byte buffer. This should be the 2 intiger list and is therfore entered in a switch case stucture, using the first byte to tell which servo to change, and the second to which value to change to. I quickly noticed that sometimes a byte got lost, meaning the value comes first and the identifyer for the next command second. I solved this by dumping one byte everytime the first bit was none of the expected ones. This automaticly solved the issue unless the value happened to be 0,1,2 or 3.