The goal for this project was to be able to control the garage door to my home remotely with a mobile device in an easy manner, so that I would not have to carry the home key or main garage remote around with me when leaving the house. I decided to do this by using an ESP32 microcontroller on a prototyping board to interface with the garage door motor controller. The ESP32 connects to my home internet and creates a simple web server that anyone who is connected to my router can access with the fixed IP address. Upon accessing the sever through a web browser, the client is presented with a simple web page that displays a button to trigger the garage door, that upon pressing, sends an HTTP POST request to the server, which controls the microcontroller to close a relay to actuate the garage door.
Currently, the ESP32 prototyping board is in a custom enclosure mounted near the garage door motor, and although it works, I would like to use the prototyping board for other things. The next step for this project would be to make a custom smaller PCB with just the bare ESP32 SoC and minimum components needed to fulfill its goal.
In this project, I wanted to make a device to accurately measure the velocity of a projectile. The approach I took was to use two pairs of infrared LEDs and phototransistors, with each pair facing each other, spaced a fixed distance apart, along with a microcontroller (Teensy 3.2), to determine the time it takes for a projectile to travel from one of the sensor pairs to the other. Whenever a projectile travels in front of the LED and phototransistor pair, the beam through the tube holding the sensors is temporarily broken, and with a pull-up resistor, a pin on the Teensy is given a high digital signal. This happens again 4 inches from the first sensor, and the Teensy records the difference in time from one sensor to the other. From this, a fairly accurate measurement of the speed of a projectile is calculated and returned to a plugged-in computer via USB serial.
Last semester, for the Fall of 2022, I started to investigate ways to learn more about electronics and design, so I decided to build a coilgun. A coilgun uses several stages of sequentially activated coils to launch ferromagnetic projectiles in a particular direction. Specifically, it generates a gradient in the magnetic field strength along the projectile’s path such that it applies a force to propel the projectile. A target final velocity for when the projectile leaves the last coil was chosen to be around 100 feet per second, compared to the muzzle velocity of an average Nerf Gun of 70 feet per second.
Initial Design Hardware
The first design uses four stages, each of which provides an extra boost sequentially to the projectile as it moves along a polycarbonate barrel. Each stage consists of the coil being powered along the barrel, a diode to block inductive kickback, a MOSFET to power the coil, an IR beam/sensor to detect the projectile and activate the coil at the appropriate time, and a circuit to amplify the signal from the sensor and use a push-pull amplifier to drive the MOSFETs quickly. The coils are all powered by a supercapacitor bank consisting of 18 2.7V-350F supercapacitors, organized in 3 parallel columns of 6 in series. A 3S Lipo is used to power the MOSFET driving circuit and sensors and to charge the supercapacitor bank when away from a power supply.
Trials with this configuration ended up working with magnets and ferromagnetic projectiles. The exit speeds were in a very safe range, launching the projectiles across rooms with a small but noticeable arc.
Figure 1: The completed first iteration of the coilgun, including everything but the power supplies, which is out of frame to the right.
Initial Circuit
The most complex part of designing a coilgun is the timing circuit and the circuit to power the inductive coils that propel the projectiles. So, we will focus on that part here.
Figure 2: The driving circuit with the MOSFET on.
Each stage of the coilgun consists of a circuit controlling the individual coil. The circuit consists of 4 main parts: 1) The infrared beam detection, 2) an amplifier and inverter, 3) a push-pull MOSFET driver, and 4) the MOSFET and load. The first part of the circuit, the infrared beam detection, uses a constantly powered infrared LED pointed through the barrel to an infrared phototransistor. In the idle state, the phototransistor allows some current to flow to the gate of the amplifier transistor, setting the voltage on the push-pull driver to a low state. In the on state, as shown above (with green depicting higher voltages), the beam is blocked (simulated by an off LED), resulting in the amplifier receiving low signal and the driver gate being pulled up, activating the MOSFET. This allows for a simple and faster way to control the coils than using a microcontroller.
In addition, a status led is added connected to the gate of the driver to provide a real-time status of the coil being activated which helps with troubleshooting.
Figure 3: A schematic in Altium depicting the components placed on a PCB for a single stage.
Conclusion
The first iteration of the coilgun project was a very worthwhile proof-of-concept, but there are many improvements and optimizations that can be made. I plan to explore the different varieties of relays to see if there is one best suited for fast switching and high peak (and non-constant) current and test it to see if it is viable. In the meantime, to explore PCB design, I plan to finalize the first design by placing the switching logic and amplification components on a printed PCB (a significant upgrade from a breadboard).
As far as optimizations go, one thing to consider is that I believe the force could be dramatically increased by increasing the number of wire loops per coil while still keeping the inductance relatively low. In addition, pairing the infrared phototransistors with an oscilloscope and/or sufficiently fast microcontroller can be helpful to log data from the sensors to get an estimate of the speed of the projectile.
I built this quick experiment in my senior year of high school to test Ampere’s force law. It was inspired by a diagram in the physics textbook I used. Powered by a lithium-polymer battery, the circuit involves running current through a resistor (pencil lead) and safety fuse and then through the two U loops of magnet wire via contact with aluminum foil (See Figure 1). Because the two loops are carrying charges moving in opposite directions, the loops will produce magnetic fields that will cause them to repel. Hanging from the aluminum foil contacts, the loops are pushed apart at the bottom as the current flows through them (See Figure 2).
Figure 1: Experiment circuit with items labeled, currently off.
Lithophanes are very cool physical images made by varying thicknesses in a mostly opaque material and shining light through it. I made some simply by using a 3D printer and ItsLitho.com, a site that converts any image into a 3D stl file to print. I also added a custom light switch to some to illuminate the lithophanes internally. They make great gifts!
A 3D picture without the backlight.
The same 3D picture with background light, as well as a color printed paper to add color!
The system I developed to provide the backlight. I used foil to be a reflective element for maximizing the light coverage and put a switch to be able to turn on/off the light.
I am here in the process of assembling the parts!!
One of my coolest projects was fabricating a 3D-printed Nerf blaster with some metal components I bought online. This design is the Caliburn-U, designed by CaptainSlug. I did all the 3D printing and attached it to the metal parts. It is very powerful and the darts average 220 feet per second muzzle velocity. It is my secret weapon in any Nerf blaster battle!!