Get Started with Altium Upverter, Sign Up Now.
In my Guide to Starting a New Project, I mentioned working on some projects for a friend, and for this continuation article, I think it’s worth mentioning that we’re both Airsoft players. It’s a great way to spend a day out in the forest with some friends and get some exercise, and what better project is there for us to work on together than a tracer unit for night games. A tracer unit is a mock suppressor for a replica gun that shines UV light on a glow-in-the-dark BB as it exits the barrel. This is the perfect time to make one because there’s a large Airsoft event spanning multiple days coming up, which he is going to. I’d love to join him, but instead, I’ll be going to AltiumLive.
During the day, it’s very easy to see a white BB fly through the air toward your target, while at night, it’s more of a challenge to see what you’re hitting. Tracer units are surprisingly expensive and typically have under a single watt of LED power. For a similar price, we can build our own tracer unit and purchase about 140 watts of high power SMT LEDs. I’m a fan of the phrase “if it’s worth doing, it’s worth overdoing”, and 140 watts seems like plenty of overdoing, so that’s the plan. The challenge will be packaging this many LEDs and powering them!
Unlike many project articles you may encounter, this will be a series to take you through my full project design process as it happens. I’m writing this article as I’m planning and designing, and it will cover the project design process to the point of circuit board layout, and will be submitted before breadboard prototyping or schematic capture and PCB layout begins. This way, you will be able to see the full project design process, including changes that are driven by the schematic or PCB layout, rather than the cooking show’s typical ‘here’s one I prepared earlier’ approach. This is my first Upverter™ project. I’ve been an Altium Designer® user for over a decade, so I’m excited to see what the more modern Upverter has to offer in design experience.
If you’re new to designing your own electronics, this article will guide you through the process of an experienced engineer and maker as they tackle a project. As mentioned in the Guide to Starting a New Project, whether you are building a basic device, such as this tracer unit, or a complex project, the project design process all boils down to the same set of steps.
My specifications document is fairly simple: Turn the LEDs on when a BB enters the tracer unit, and turn the LEDs off when the BB exits the unit.
I was planning to build this purely with logic devices, however, the number of ICs was rapidly growing and the board space/packaging was going to be an issue. Instead, I’m going to use a microcontroller to detect the BB’s passage and control the LEDs. Not to mention, as a fun added bonus of using a microcontroller, I can also use the tracer unit as a chronograph, to measure every BB’s velocity as it passes through.
To detect the BB, I’m going to use an infrared LED and detector, as the BB travels past it will break the beam telling the microcontroller to turn the lights on. The light gate will be at the exit of the tracer unit, and used to turn the lights off. I’ll also want to add some code to the firmware to automatically turn the LEDs off after a period of time if an exit event was not detected. If there is strong infrared light, such as daylight, shining into the tracer unit, it may not detect the exit event, and with such a huge power draw for the LEDs, I want them switched off as quickly as possible to conserve battery life and prevent the whole unit from overheating. There will be very little cooling for these LEDs, so I’m relying on the very short duty cycle to prevent overheating.
Before even looking at a schematic or a PCB layout, I need to figure out which critical components the design will utilize. For this design it will be the battery, LEDs, LED driver, microcontroller and photogate. Since this is a tracer unit, it’s going to have a lot of LEDs, which means beyond the basics of merely detecting the BB travelling through the tracer unit, the power requirements for the LEDs will be driving many decisions.
For the battery, I am going to select a Turnigy 700mAh 3 cell LiPo battery with a 60C discharge rating, as it’s the most compact battery I can find that meets my discharge requirements. I’ve been using HobbyKing for many years, and their batteries are high quality yet inexpensive, and they have absolutely no circuit protection as you’d find on batteries targeted at consumer devices, which is great for stuff like this! Don’t think of the lack of protection as a bad thing, because in the radio controlled hobby industry, the electronics which the batteries plug into provide the necessary protection, leaving the batteries able to discharge staggering amounts of power. I will need to build a low voltage detection circuit into the design to stop the LEDs from running if the battery starts to be too depleted.
Now that the battery has been defined, I could use its dimensions to set the minimum length of the tracer unit to about 80mm. The minimum length of the tracer unit will also affect the layout of components and the amount of space available on circuit boards within the unit. Knowing the battery size is critical to being able to design the most compact unit possible, which not only is better for real world usage, but also will determine the PCB manufacturing cost.
Because I’m trying to light up a phosphorescent material, I first need to figure out the optimal wavelength of light to use. Phosphorescent materials work by absorbing a lower wavelength of light and re-emitting it as a higher wavelength. I can be fairly sure that typical Airsoft tracer BBs are using SrAl2O4, strontium aluminate, for the phosphorescent material as the cheaper ZnS probably wouldn’t get lit brightly enough to satisfy players. Wikipedia tells us that “excitation wavelengths for strontium aluminate range from 200 to 450 nm”, so the shorter UVB or UVC wavelengths are probably going to be the best options, if suitable LEDs can be found.
For the UV LEDs, I headed to Digi-Key to start filtering down the Infrared, UV, Visible Emitters category. Initially I’m looking for Active, In Stock, Ultraviolet ones that are on Cut Tape to see what options come up. Sorting by price at a quantity of 100 units, I can see there are a lot of low-power options there which just won’t give the energy density this project requires, so I’ll further filter by forward current for anything over 500mA. Now I have lots of 1A Forward DC Current (If(Max)) options, which is fantastic. The cheapest options have a 120°-130° viewing angle, which I suspect is going to be too wide, so I’ll head to Fusion360 to mock up the design to see what might work. I want the LEDs to shine on the BB for as long as possible, so perhaps a wide angle LED will work well, but if I can cram a lot of LEDS in a row, I could possibly get a higher energy density by using a tight beam.
Wide angle LEDs have to be placed close to the ball to achieve high energy density.
The box at the top is a 3.5mm wide LED, and the circle at the bottom is a 6mm BB. With a 120° viewing angle, I feel there will be good coverage of the LED as it comes past, but the peak energy on the LED perhaps isn’t going to be as high as it could be. To get the phosphorescent material glowing as brightly as possible in the shortest amount of time, I need to give it a lot of energy. My gut feeling is that travelling past more tightly focused LEDs will ‘charge’ the phosphorescent material better than more time in the emissions of a wide angle LED.
Narrow angle LEDs offer high energy density while maintaining distance from the BB.
If you look at the same drawing with a 50 degree viewing angle LED, you will notice that I can bring the viewing angle lines down to be tangent with the BB and still maintain good clearance (4.1mm) from the path the BB will travel. This should reduce turbulence in the tracer unit, allowing for a more accurate shot.
I now have a short list of possible UV LEDs, with the Everlight ELUA3535OG5-P0010U23240500-VD1M being the cheapest. It is a 405nm LED which isn’t perhaps as optimal as a 385nm or shorter wavelength, but the price is 37% lower than the same LED in a mildly shorter wavelength. I feel as though 37% more LEDs of the marginally longer wavelength is going to provide more brightness than we could get with fewer LEDs of the shorter wavelength. However, I do not have actual data to back this up. Inolux have several LED options that are just a little more expensive, but the Everlight datasheet is more comprehensive and has much clearer land pattern and pin details, which are very important to me designing the board. So we’ll go with the cheapest option, as not only are they the cheapest per unit, they are also the cheapest per watt. As this part is only available from Digi-Key, I made a quick check for UV LEDs on Mouser and European suppliers, but didn’t find a cheaper option that would suit my requirements.
The chosen LED’s datasheet has a nice voltage/current graph. Using the 405nm option, it looks as though 3.55v to 3.6v will give about 900mA to1000mA of forward current. This lines up very nicely with our battery, as a LiPo battery offers a nominal voltage of 3.7v per cell. However, a fully charged battery will be at 4.2v, making it clear that we’re going to need a constant current driver of some sort so as not to burn the LEDs out.
Higher wavelengths allow for larger forward current for a given forward voltage.
There are two possible approaches to take here: either use an op amp on a current sense resistor to enable/disable the gate of a MOSFET to limit the peak current, or go with a full blown LED driver IC that can boost the voltage and allow more LEDs to be run in series.
Being a lazy engineer, I’m off to Texas Instruments Web Bench tool to design up a constant current LED supply. I just input my requirements, and it came up with a design based on the TI TPS92691 multi-topology LED driver with a rail-to-rail current sense amplifier. It sure sounds fancy! Okay, I’m kidding somewhat, I wanted to use a constant current boost driver because I’m going to be doing another UV LED project for post-curing parts that have been 3D printed from resin. Knowing I’m going to be having similar LEDs and power requirements for that project allows me to design a power supply for this one, and use the same schematic for the other project as well, which makes it both easier to order parts, and reduces the total design time for both projects.
I have chosen to go with 4 ‘rails’ of LEDs inside the tracer unit, and based on a series of decisions which are now mostly irrelevant since deciding to use an LED driver, I decided to use 12 LEDs per rail. I was planning to run the LEDs directly from the battery using a MOSFET and an op amp for current limiting, which led to groups of 3 LEDs. A constant current LED driver, however, will supply a consistent brightness as the battery is discharged and is a more elegant solution. The driver will run two sets of 6 series LEDs in parallel, which requires a 21.6v, 2A supply. This ends up being about 173W for the whole unit, which is definitely overkill and a bit of scope creep, but I’m okay with that.
Web Bench takes care of pretty much everything, however, it does make some odd choices for capacitors and inductors. Given that I need this to be a relatively compact design, I used the integrated bill of materials editor to swap out parts for smaller, more efficient options. I’m not overly concerned with saving every last cent, as I will only be making a couple of these units, so a difference of a dollar or two in the BOM to get a more efficient, more compact design is worth it.
TI Web Bench allows you to design power supply systems with complete ease.
My main concern with using a driver like this is that I can’t afford to have a soft startup or really any startup delay. As starting up the LED driver takes more time than simply switching the LEDs on and off, I’m going to have to put a N-Channel MOSFET on the LEDs. This is going to make the driver think the LEDs are broken or something’s gone wrong; the datasheet specifically mentions this.
The TPS92691/-Q1 supports continuous LED status check through the current monitor (IMON) output. This allows for LED short circuit or open circuit detection and protection.
The IMON pin is an analogue output, and the driver mentions cycle by cycle protection and sensing, so I’m hoping if the load goes away, it will give me full current on the next cycle if required. I don’t normally like technical risks such as this in a design, however, I’m curious enough to try it, and the project timeline isn’t critical, so I could afford to spend time experimenting. When I get the circuit boards I’ll find out if I need to do a redesign!
Simulated driver startup shows that LEDs reach peak current after a delay.
Next up, we’re onto the microcontroller. To keep things easy, I’m going to go with an NXP microcontroller with USB bootloading and MBED compatibility. The NXP LPC11U12FHN33/201 fits the bill nicely. It’s cheap, has enough resources for this project, and shows up as a USB mass storage device when bootloading. What more could you ask for? If the board layout gets tight, I will switch to the LPC11U35FHI33/501 at almost twice the price, but in a 5x5mm footprint rather than a 7x7mm one. I could use a microcontroller that fits in a WLCSP package (36 pins in a 2.4×2.5mm area) if I needed to go really tiny, but those are starting to reach beyond the limits of my ability to hand populate a board reliably.
There are multiple ways to implement a photo switch/photogate sensor, however, due to the short duration of the dark period as the BB travels across the sensor, I need an implementation that is capable of low latency response. Because of this requirement, I’ve decided to use an infrared photodiode connected to a transimpedance amplifier, which in turn will drive an S-R latch that is connected to a microcontroller pin. I may not need the S-R latch, but I haven’t decided how I want to implement the code at this point (either as a loop or using interrupts and with or without MBED). I really need to ensure the BB’s transit across the sensor is not missed, so by using a latch I can ensure the event is caught, and held, until the microcontroller has dealt with it.
In the UK, an automatic airsoft gun is limited to 1 joule, which, with a common 0.2 gram BB gives around 340 feet per second (104 m/s). A single shot airsoft gun, such as a sniper rifle, is limited to 2.3 joules which would give a 0.2g BB a 500 feet per second (152 m/s) velocity. However, snipers typically use much heavier BBs to reduce deflection by wind and increase range, so the projectile’s velocity could be around 340-400 feet per second. At 340 feet per second, the BB will block a 3mm sensor area for about 29 microseconds, a relatively long time in the world of microcontrollers, but still possible to miss if for example the code is saving chrono data to an EEPROM.
When selecting the photodiode, it’s important to look at the spectral response graphs. Many of the available options list an infrared wavelength, but will also detect some UV and a considerable amount of visible light upon closer inspection. As the tracer unit will contain 170 watts of UV LEDs, and just a basic IR LED, light leakage from the UV LEDs could cause a missed detection on the exit sensor as could bright sunlight. The tracer unit will have 3D printed light baffles/shields around the IR gates. However, with orders of magnitude more light coming from the UV LEDs, the chance of some light getting past the baffles is quite high.
Optimizing the part selection for the infrared spectrum only, and the highest possible current when exposed to light, I chose the Everlight PD15-22B/TR8 Silicon PIN photodiode. This photodiode has a peak sensitivity wavelength of 940nm, which is important to know prior to selecting an IR LED, so it can be chosen to match this wavelength.
Heading back to the emitters category on Digi-Key, I’m now looking for an Active, In Stock, 940-950nm surface mount IR LED with a 10-20 degree viewing angle. I’m also trying to avoid gull wing and similar packages in general on this project, as they don’t handle shock and vibration as well as something directly mounted to a circuit board. When setting up the BOM for the LED driver in Web Bench, I switched from aluminium SMT capacitors to multilayer ceramic ones for the same reason. Whilst airsoft guns do not have anywhere near the same recoil as a real gun, they do have some vibration and shock as they are used. Sorting by radiant intensity, my top pick is an OSRAM SFH 4641-Z LED that should work quite nicely. It’s perhaps a little too power hungry, and 950nm rather than 940nm, but it nevertheless seems to be the best tradeoff given the options available.
Analog Devices have a nice tool to calculate the values for a transimpedance amplifier for a photodiode. It even has the properties for the photodiode I have selected in it’s database, which is nice. Using this tool, I was able to design a two stage amplifier, which has significantly lower noise than a single stage amplifier, using SOT-23-5 sized op amps to save space. The tool very much preferred auto selecting dual and quad op amps, but those were just too big. My end design with the tool uses an Analog Devices AD8615U1 for the first stage, and an AD8061U2 second stage. The resistor values will still need some tuning once I see what the actual current the photodiode generates within the device is, however, the tool does provide a very good starting point.
Two stage amplifier designed with the help of the photodiode tool from Analog Devices.
When searching for a surface mount S-R latch, there aren’t a lot of options available. In the smallest pin pitch/package, it comes down to the Texas Instruments CD4043BPWR or the same device in a NAND configuration. That’s all Digi-Key has for me, so that’s what I will go with. Luckily, it has 4 independent latches built in, so I only need one of these real-estate hungry devices.
The High Level BOM
Now that the high level components for the design have been selected, I have the following parts:
- 48x Everlight ELUA3535OG5-P0010U23240500-VD1M UV LEDs.
- 4x Texas Instruments TPS92691 LED drivers.
- 1x NXP LPC11U12FHN33/201 microcontroller.
- 2x Everlight PD15-22B/TR8 photodiode.
- 2x OSRAM SFH 4641-Z IR LEDs.
- 1x Texas Instruments CD4043BPWR quad S-R latch.
- 2x Analog Devices AD8615U1.
- 2x Analog Devices AD8061U2.
The process of selecting parts to meet requirements is critical to a project’s success. Even on a very simple project such as this, there are many engineering decisions to be made before even starting on a schematic. If this was a project I was taking to a client or management, I could provide them with a very broad idea of costs at this point, knowing that I’d have some miscellaneous IC’s such as low current linear voltage regulators, perhaps a clock crystal for the microcontroller, connectors for the battery and USB, as well as all the passives, and ESD and EMI filtering components. From past experience, I have a ballpark figure for how much those extras are going to cost me, and specifically for this design at the low quantity I will be producing, it’s probably going to be $5-$7 and a set of PCBs from asia will be about $30-$40 delivered. The main cost in this project is the stupid, over-the-top number of high wattage UV LEDs, but thats half the fun of maker/hobby projects!
Continue to Part 2 and Part 3 of this project series.
You can sign up for free and get access to the best browser-based PCB editor, schematic editor, and component database. Visit Upverter today to learn more.