My Remote Controlled Coil Gun uses electro magnets to accelerate a ferromagnetic projectile. Additionally, it is controlled remotely using an iPhone app to aim and fire the rail gun.
iOS app development ~
Swift UI front end
API network requests
Swift concurrency
UI State indicators to express device/app connectivity.
API Development ~
Hosted a flask API on a raspberry pi.
Transmitted live feed video capture from camera, through pi with OpenCV, to API endpoint
Received signals from API endpoint, and used those to control signals on a circuit.
Multithreaded Realtime Embedded Systems ~
Background thread used to control mutate 4 global state variables that control the pan and tilt servos.
low‑latency loops,
debouncing,
deterministic state machines.
Power Management & Circuit Design
Used step down buck converters to apply proper power distribution to different parts of the system with different power requirements.
Controlled Servos using PWMs & External Power Supply
Controlled solenoid valve using Binary Signal, and External Power Supply
Designed a Solenoid Driver Circuit
Electromagnetic Acceleration
Uses electromagnets to accelerate a ferromagnet.
The app used to control the Coil Gun is written in Swift and SwiftUI. It uses swift concurrency to make network calls to a Flask API hosted by a raspberry pi. The pi feeds live video from a camera, through an api endpoint to the iOS app. The pi also takes in commands from each api endpoint, and uses those commands to output signals on certain GPIO pins using the pigpio library. The circuit uses those signals to control the pan and tilt servos used to aim the device, and the solenoid used to push the projectile into the chamber. Once in the chamber with initial velocity v_0 the projectile is accelerated by each coil until it is launched with V_out.
The iOS app separates each UI component into its own view. The Fire Button and D-Pad each interact with the weapon service which passes its signals asynchronously to the API as individual events. The fire button passes no arguments. The DPad passes an argument representing the direction command (up, down, left, right, stop). The Video Feed view interacts directly with the video feed endpoint from the API.
The coil drivers use IR transmitters and receivers to determing when the projectile is at the entrance of the coil. When the signal is cut, the coil turns on, thus applying a magnetic pull to the projectile. As soon as the projectile enters the coil, the IR sensor begins receiving the signal again and thus turns the coil off allowing the projectile to continue moving down the chamber with out getting stuck in the coil. The drawings below illustrate this 3 step process.
The projectile approaches a coil. The driver leaves the coils off.
The projectile cuts the signal between the transmitter and receiver. In response the driver activates the coils, applying a magnetic force to the projectile moving it towards the center of the coil.
The IR signal reconnects once the projectile is inside the coils so that the magnetic force is no longer active and allows the projectile to continue moving with v_f.
The resulting velocity versus time graph for the projectile looks roughly like this:
A solenoid is used as the triggering mechanism as it allows me to initiate the motion of projectile with a simple electronic signal. I designed the solenoid driver shown to the left to control the solenoid from a GPIO Pin and power it using an external power supply while accounting for GPIO pin floating states with the pull down resistor (R2), protecting the pi from inrush current with the gate resistor (R2), and protecting the MOSFET from voltage spikes that may occur when the solenoid turns off using a flyback diode (1N5819 diode connected to the solenoid in reverse bias).
Developing the Remote Controlled Coil Gun taught me a ton about electromagnetism, circuit design, power mangement, networking, API design, and app designed. It was the first large scale system I designed that involved creating 2 way communication between an iOS app and some physical system. There were many challenges I encountered and overcame along the way such as jittery servos, over heating parts, and software bugs. But in the end I ended up with a functional system that aligned with mostly what I set out to accomplish. It is fully functional, but the projectile does not exit with very much velocity. In fact, if the device is angled up too much, the force of gravity outweighs the force of the electromagnets on the projectile leading to the projectile getting stuck in the chamber and falling back down. The 3 key factors I could target to fix this include using larger coils, pushing more current through the coils, and using lighter projectiles.