In the last video, I showed off these wireless LEDs and I said that it would be really easy
to make your own.
So let's give that a go.
We'll reverse engineer the LEDs and create our own versions from discrete components.
We'll then reverse engineer the driver circuit and build our own version of that
and then we'll see how well it works
Finally, we'll do a cost comparison to see if it was even worth it.
We should end up with a complete working DIY equivalent that you can easily build at home.
Let's take a look at the LEDs.
The actual operation is very simple, they are just a resonant Inductor and Capacitor
circuit with an LED across it.
The circuit is tuned to the frequency that is being output by the driver coil.
In the previous video I wired up a couple of wires on each side of the LED and hooked
it up my oscilloscope, and we saw that the circuit is picking up a signal of 217kH.
The inductor is marked on the bottom 222 that corresponds to a 2.2mH inductor.
Using this inductor value and the frequency the circuit is resonating at we can work out
what the capacitor value should be.
Plugging the values of the frequency and inductor into the calculator we get a capacitor value
of 244pf - 220pf is the closest standard value.
This will give us a resonant frequency of 228kHz which is not a perfect match to the
217kHz but is close enough.
For the inductor, I've got a couple of options - I have these bare inductors and I have these
heat shrink covered wire-wound inductors.
If you peel off the heat shrink of a spare inductor you can see that they really are
very similar to the bare inductors - the only difference is the heat shrink.
It does look like there is less wire, but it's hard to really tell without taking it
completely apart.
It's important that you get unshielded wire-wound inductors for this project - it's the coils
of wire that will be picking up the transmitted power and if you don't have coils or your
inductor is shielded, nothing will be picked up!
Soldering the capacitor across the inductor wires is pretty simple, I found it easiest
to wrap the thinner capacitor leads around the quite thick inductor legs and then solder
the joint.
I've done this for both the inductor options and if we put them inside the coil we can
measure the induced voltage.
The yellow trace is the bare inductor and the blue trace is the heat shrink wrapped
inductor.
There's not a lot of difference and any difference we are seeing could just be due to component
tolerances.
With both inductors, we are getting a peak to peak induced voltage of around 160 volts.
Obviously, this falls off quite quickly as we move the inductors away from the driver coil.
Now, of course, you can use other inductor values - just make sure you calculate the
appropriate capacitor value - I suspect that larger inductors may have more turns which
may give you longer ranger due to the higher induced voltage - but they may also just use
different core materials and there may be other tradeoffs in terms of parasitic resistance
which will use up some of the energy.
Talking of energy - how much current are we getting?
I've placed a 1k resistor across the circuit and measured the voltage across it.
The peak positive voltage is just over 2 volts and the negative voltage is around 3volts
- positive and negative is just determined by which way up the inductor is.
The asymmetry of the signal is interesting and is probably due to how the power coil
is being driven - more on that later.
Given we have a 1k load we have a maximum of 2-3mA - which is more than enough to drive
an LED.
The version that I bought from Aliexpress only has one LED, so it's only really using
half of the energy that is being induced in the circuit.
So I'm going to solder two LEDs in opposite directions across the circuit which in theory
should give me double the brightness.
I've made a bunch of different colours and they all work great - the different LEDs will
all have different ranges due to the varying forward voltage requirements of each colour.
So that's the LED side of things - what about the driver circuit and coil?
Do your projects look like this?
Are you tired of dodgy connections causing gremlins and bugs in your circuits?
Maybe you should get a PCB from PCBWay!
Check out the link in the description.
I've got a photo of the PCB and I've marked up the traces - in the previous video I wasn't
really sure what this chip was - turns out that I was being a bit slow, it's the XKT001
- as marked on the PCB.
The large chip is simply a MOSFET.
Here's the reverse-engineered schematic - it's pretty simple.
The XKT001 is outputting 217kHz on pin 2 and switching the MOSFET on and off.
The mark to space ratio is about 40%.
The coil and capacitor of the transmitter are connected between the power rail and the
drain of this MOSFET and is simply being switched to ground.
Here's a trace of the voltage at the drain of the MOSFET along with the signal being
applied to the gate.
Recreating this circuit is pretty simple.
We need an oscillator, a power MOSFET, a gate driver, a coil of wire and a suitable capacitor.
One thing to make sure of when you build this circuit is that you use a logic level MOSFET
as the circuit will be running at 5v from a USB supply.
You want your MOSFET to be fully turned on when 5v is applied to the gate.
You'll also need a gate driver to make sure the MOSFET turns on and off quickly - if you
try and drive it directly from your MCU then it probably won't turn fully on in time.
Power MOSFETs have quite a high gate capacitance so if you try and drive them directly the
switching time can be too slow.
You'll also find that a lot of logic level MOSFETs won't fully turn on when using 3.3v
logic - so a gate driver is essential.
Great Scott has an excellent video on MOSFET drivers that is definitely worth a watch.
For my coil, I'm making one that has the same number of turns and is approximately the same
size as the commercial coil.
Measuring the inductance of my coil I get around 5.4uH.
The coil from Aliexpress comes in at 5.1uH.
With the homemade coils, it's quite variable and you'll probably end up with anything between
4 and 6 micro henrys.
Plugging my 5.4uH value into the calculator with a 228kHz resonant frequency it wants
a 90nF so a 68nF or 100nF would be suitable.
I've ended up using a 68nF in my circuit after a bit of testing.
You could of course try and construct the exact required value - but given I'm building
this on breadboard just being in the right ballpark will be good enough.
How much current is actually going through our coil and MOSFET - the current is limited
by a couple of things - the first is simply the resistance of the wire making up the coil.
and any parasitic resistances in the components
I measured my homemade coil at between 0.5 and 1 ohms.
If the inductor is fully saturated then we could have between 5-10 amps flowing through the
circuit as the only limit will be the resistance of the coil wire.
This makes the pull-down resistor on the MOSFET gate pretty important - if we leave the gate
floating it could easily allow current to flow and we could cook our circuit!
Provided we turn the MOSFET off before the inductor is fully saturated we'll get a lot less current flowing
We can use this formula to work out the current flowing in the inductor after it has been turned on.
Assuming we have a 5uH coil, a 40% mark to space ratio at 228kHz and our coil and parasitic
resistances in the circuit are 1 ohm the maximum current through our coil should be just under 1.5 amps.
Bear in mind, this is just the peak amps - it's not drawing this continuously the current
ramps up to this value while the MOSFET is switched on.
Also, the MOSFET will be turned off 60% of the time.
Regular viewers of the channel will know that I have a lot of ESP32s lying around.
I'm going to use one of these as my oscillator - it has a PWM output and you can easily adjust
the mark to space ratio on it to tweak the power consumption.
It is however a 3.3v part so definitely needs a gate driver.
Here's the circuit we're going to build, I've added a 20uF capacitor across the power supply
to match the circuit from Aliexpress, this helps keep the supply stable when the MOSFET
is switched on and when the inductor starts to draw a large current.
I've put this together on a breadboard - I've got my ESP32 module and the gate driver chip
- I'm using a TC4469 but any suitable gate driver chip will do.
This is controlling the gate of my power MOSFET.
We've got the coil and capacitor across the drain and the power supply.
If we turn it on our homemade LEDs all turn on.
What's more, the LEDs from Aliexpress also turn on.
The homemade version seems to have a performance that matches the professional version.
All in all a pretty good result.
At the end of the day, it is a pretty simple circuit so we should really expect it to work
well - but it's nice to confirm it.
So, let's do a price comparison of my DIY LEDs vs the Aliexpress version
From Aliexpress, I received 18 wired up LEDs along with two driver circuits and coils.
To build our DIY LEDs - we need an inductor a capacitor and an LED.
You can get 600 LEDs on Amazon for around $12, so for 18 LEDs, it would cost 36 cents.
Inductors are a bit more expensive, I found a pack of 50 for around $10, so for 18, we
need to spend $3.60.
You can pick up a box of 840 capacitors for under $20 so the bill for our capacitors is
about 50 cents.
The total cost of the LED portion of our project comes in at about $4.50 with the inductors
being the majority of the cost.
For the driver we need a power Mosfet, these come in at about $1.20 and we need a gate
driver - I'm using a fairly expensive chip the TC4469 which comes in at around $5
but there's alternative driver ICs that cost around $1.
I'm going to assume you have a handy MCU to provide the oscillator.
So long as it can do 220kHz or so you should be ok
If you want to build an oscillator yourself, that's probably an extra a couple of dollars on top
To make the two driver circuits you need to double the components, so we're looking at about
$4.
So I think the total cost of this project is around $8-$10 to build it yourself depending
on how cheaply you can source components and what you have already lying around.
The cost from Aliexpress was $19.38 once taxes and shipping was added on total was $28.83.
The Aliexpress does come with quite nice compact LEDs that might be quite hard to recreate in a home workshop.
And you get a couple of nice coils and driver circuits.
Let me know what you think in the comments.