Skip to content
DIY Head Tracking w...
Clear all

DIY Head Tracking with LEDs for Flight Simulation, etc.

2 Posts
1 Users
0 Reactions
Posts: 476
Topic starter

Suggested by a member. If they chose to reveal themselves, that's up to them. (All cloak and dagger, me.) Project suggestions at the end. 😉

This board is one of those odd ones that's more about LEDs and electronics but the function is about computers, specifically gaming and in particular racing and flight sims. Software like OpenTrack ( which uses three points of light, the LEDs mentioned to track an object in 3D space. This is cheaper than accelerometers and doesn't require trailing wires.

The tracking is done by analysing the camera feed and noting how the three separate points of light move.


In a separate post I've talked about using a constant current source/sink to drive a current mirror, but current multipliers are useful too. This one takes the programming current and sinks (takes current from a device) four times that programming current. 5 mA of programming current results in an extra 60 mA being pulled through the LEDs and that will stay like that until the battery pretty much gives up.  

Current mirrors are one of the more interesting building blocks we have because they allow us to separate out the vagaries of a power supply (such as a battery that's getting weaker over time) and automatically adjust the voltage in the other parts of the circuit so that the current remains the same.

A 9v battery connected to a 100 ohm resistor would push 

9 / 100 = 0.009 mA through the resistor.

So when the battery has drained to 50% of its rate voltage, so has the current 4.5mA now).

So it starts to get weaker, current drop is a bit of a bind if you're relying on it for something. LEDs are one example where it's the current that determines the brightness (for the same LED, each one produces light levels according to other factors too). 

But one of the issues with mirrors is that you need to set the current source to draw the programming current too which can be wasteful, and is something that's to avoided with a battery powered piece of tech.

For this application I've created an SMD board that's still within the capabilities of the home constructer (which includes me, I don't have any of that fancy-schmansy hot-air rework stations and multi-stage ovens.

But I do have a soldering iron and some solder. (This job is a fair bit easier with lead-based solder but if you can use lead free that is better for your health and everyone else's). Leaded solder flows better even at lower temperatures but this is still doable with some care.

Keep in mind though, it's only about 2" x 1" (50 mm by 25 mm) so it's not very large but all of the pads are nice and large to make the job of hand soldering much easier. Even if you do have these assembled, the parts are less than a $50 in total per board so it's not going to cost you the earth to order five from JLC (for example) and flog the others on eBay.

Given this is a prototype it's up to the you if you trust me (or not). I'll be ordering a set myself and leaning on @diyperks to do the design/construction. He can probably do the design while he eats his morning cornflakes to be honest, but knowing Matt he might well come up with something all steampunk and fancy! 🙂

Alternatively this can be used to drive coloured LEDs in a way so they don't go dim as the power fades but will keep bright until the battery is pretty much exhausted. How long that takes is set by a single resistor which can be fixed or variable. With a 4.5V source you should be able to drive 2x red LEDs per point (wired in series) for a total of six which sounds ... "HUH?" doesn't but there may be applications someone. The number of LEDs each LED socket can handle isn't limited by the current, it's limited by the voltage.

The little IR LEDs in your TV clicker (unless you have one of those fancy Bluetooth ones) only "drop" 1.7 volts typically which is too much for a 1.5V cell but just nice for two. That's why most TV clickers have two - and only two - 1.5V cells in there.

That extra room (1.3 volts at "full" capacity) ensures there's plenty of charge left.

But how bright those LEDs (infra-red is just light remember) are is determined by the current and the lower you can get the current and still have the remote work 12 feet away on the couch the better. We're not trying to shine it across the street to change the neighbours set! (There are stories of this happening with early remotes but I suspect they may be apocryphal.)

When you're using a camera tracker as this is really intended for, we're trying to get the best performance and longest life out of three of those LEDs lit 100% of the time. (Pulsing them is possible but I suspect the software might get a bit uptight about that.)

Construction is simply a matter of mounting the required SMD parts first. The through hole parts can be added last. The only odd man out is the PNP transistor - this is required to set the initial programming current so it's highlighted on the board. An MMBT3906 was in my original plan but the SS8550 and MMBT2907 should work as well. Ideally if you can get 

SS8550 - use SS8050

MMBT3906  - use MMBT 3904

MMBT2907 - use MMBT2222

Combinations work but it's use use the same one for all the NPN transistors to at least offer some modicum of respectability. Such a simple mirror is only accurate to a few 100 nano amps anyway but that's not going to matter. Everything here is tuned for battery with the intention of keeping the lights on for almost as long as possible. Longer? You'll need a Joule Thief but that flashes...

This circuit can supply current to up to three "somethings" which don't have to be LEDs, the can be anything that requires a consistent current in a situation where the supply voltage will fluctuate. Better yet, as you once programmed it pretty much stays that way regardless even if, in desperation, you put in a half-used battery you found in the back of the drawer...

Just one word of warning. Don't look at the spec sheet for these transistors and imagine that this will handle four times as much current as a single transistor. The 2222a for example is rated to 600 mA collector current but this board with almost two amps going through that would probably fuse, assuming the transistors don't got into thermal runaway first. This is a design for conveniently driving LEDs not high-power amplification after all.

100 mA per port should be perfectly achievable with a 3V or 4.5V supply. 9V batteries are just a bunch of smaller ones wired together so what you gain on the voltage you lose in the capacity. 


So how do you know what the current is going to be?

You can (but you shouldn't) work blind and assume that the 1.2V dropped across the two diodes means that (due to the 0.6V drop across the base-emitter junction) means that 0.6V appears across R2.  

If it did, we can just use Ohm's law to set the collector emitter current and we're golden.

Let's say 20 mA per port for a good start. 

OK so that means 5mA in the programming current (each port is 4x the Ip remember).

0.6 V / 0.005A = 120 ohms.

Not an unreasonable starting value - a close (easily available one) is 100 ohms.

Plug that back in:

0.6 V / 100 R = 6 mA = 24 mA per port.

Have you noticed what's missing here?

It's the Vf calculation for the current limiting resistor. There's no need to know the forward voltage drop (Vf) for the LED - the circuit looks after all of that in real time. We don't really care too much about the supply voltage either. Why? It's the current that breaks semiconductors (strictly, it's heat, but heat comes from excess current).

Even if those LED ports are shorted nothing will burn out because the current is already set by the programming current. Just don't short R2; if you short that you will almost certainly get a visit from the Magic Smoke Genie and it's possible a track could go with it.

Credit to the OP (it came via PM and intrigued me because I flight sim and race) this can be done with a very, very simple rig using 4.5v from three AA cells to drive the LEDs in series. Again the current is the same through all of the devices and can be limited by a single resistor.

The simple solution is, well simple and it will work but it lacks the elegance and predictability of the overengineered one to work across a very wide range of voltage without having its performance affected. 


Take everything I say with a pinch of salt, I might be wrong!

Posted : 10/05/2024 9:24 am
Posts: 476
Topic starter

Aisler link for the project if anyone wants to order one (without parts of course) and without all the usual fuss.

Take everything I say with a pinch of salt, I might be wrong!

Posted : 12/05/2024 5:35 pm