Home | Software | Rules and About | Atom feed
Admin | Edit
published: Sunday 29 January 2023
modified: Monday 30 January 2023
author: Hales
markup: textile

Desk improvements: 3d printed webcam ball socket, lightbar friction mounts and lightbar brightness controller

Heavily improving my webcam and desk lighting adjustability. Several years of work and different projects combined. Abuse of nonlinear circuits to defeat other nonlinear circuits.

My computer desk has both a webcam and and some LED strips:

There is a lot of hidden convenience that I’ve designed into my desks over the years.

Webcam mount

The default Logitech C920 webcam bracket was garbage on my central monitor as it is too thin to hang onto and has no bezel. Balancing the webcam ontop was like trying to watch a crane-truck mate with a mobile phone.

I designed this balljoint and it has been the ducks guts:

I can rotate my camera on all three axes: yaw, roll and pan. This lets me choose my seating position, background and head height (depending on chair) whilst keeping the image good.

The grey part is printed in TPU so that it’s flexible. The metal ball is 15mm in diameter, I got it from magnetic toys years ago. I adhered the mount to the camera with double-sided tape.

My ball mounting is a bit complicated, I probably could have just glued it up there but this way looks neater. I drilled a hole in the top of the ball and tapped a thread for an M3 screw. The remaining woodwork is cobbled together from scraps.

webcam_logi930_ballmount.tar.xz - source .blend and .stl files for 3d printing. Non-commercial license (permission granted to beat the crap out of bot uploaders on paid sites on my behalf).

Lightbar mounts

My lightbars are L-shaped aluminium profile with some strips of white LEDs adhered on. Being able to adjust their angle is very useful, sometimes I only want a dim light behind my monitors at night whilst other times I want a strong light on my desk to do paperwork. Most of all: I need to be able to raise them up above the bottom of my shelve when I use my webcam, otherwise a bit of lightbar obscures the top of the video feed.

I used to implement this by hanging the bars from bendy pieces of aluminium roof flashing, but these would eventually fatigue and break. After the third break I thought I should design something better:

These brackets are printed in TPU. You can slide the bar up, down and rotate it. It’s held in place by friction on both ends made by the rubbery TPU being pressed together by the spring (even though the spring itself sits only on one end).

The ends do not need to be perfectly aligned, the TPU is flexible and forgiving. Operation does however require two hands (each end of the lightbar moves independently).

LEDstrip_rotmount.tar.xz - source .blend and .stl files for 3d printing. Non-commercial license (permission granted to beat the crap out of bot uploaders on paid sites on my behalf).

Lightbar brightness control.

What I want is a knob that lets me control the brightness of my LEDs. A dimmer. I want it to “feel” good, not be fiddly. And it must NOT FLICKER UNDER ANY CIRCUMSTANCES.

LEDs are surprisingly difficult to control the brightness of.

Normally I would start ranting about “you can’t control the brightness of LEDs by changing their voltage, use current control instead so you don’t blow them up” but that’s completely invalid here. LED strips are not just LEDs, they are LEDs with resistors. These are more inefficient but they allow a much simpler design where you can just feed the whole strip 12V (or whatever the strip’s rating is) and it “just works”. You vary the brightness of such a setup by reducing the voltage. Typically around 9V or so the LEDs will turn off completely.

Sadly the voltage versus perceived brightness relationship is nonlinear. Tiny voltage changes at the low end (around 9V) will make dramatic changes in brightness. The same voltage changes at the high end (around 12V) will make no visual difference whatsoever. You can even dramatically reduce the power drawn by the LED strip (eg by 20%) at the high end and not see much difference in brightness, especially if the LEDs are over-driven (common in most strips because the manufacturer doesn’t have to pay your electricity bill).

This is caused by three problems all compounded:

One of these problems would be bad enough. The three of them multiplied together makes things much worse.

Very few LED driver designs seem to care about addressing this. Instead you get controls that feel like they do nothing at the bright end, but then change the brightness in big steps at the low end. You will notice this if you watch a slowly pulsing LED on something like a charging laptop — it’s not using a small gremlin turning a knob, but the problem is still the same.

Years back I devised a really simple circuit that beats some of these problems. I mount one of these next to each of my LED strips, for scale it’s the thickness of the shelf timber behind it (about 20mm):

The main knob adjusts brightness. By default it travels “too far” (too far below “LEDs off” and too far above “LEDs fully on”) so you adjust the two endstop trimpots to make it more comfortable to use. You can’t predict these positions, it depends on the mosfet, LEDs and strip length used, so you adjust them by feel until happy and then never touch them again.

It’s a linear driver (instead of a switchmode driver). That means it is traditionally considered to have bad efficiency, it wastes power as heat. This design choice makes the circuit very simple, prevents it from flickering and I think the inefficiency is perfectly fine given the limitations of the whole setup anyway:

ie you can’t win anyway, unless you ditch the series-resistor LED strip design and use better LEDs, so it’s a completely appropriate solution. There is no point in making a super-efficient complex driver for already inefficient lights, the final power draw impact would be much smaller than you expect (might even be less than 20% once averaged out).

Schematic and villainy

Now for the nitty gritty detail into why this circuit is pure evil:

I will award bonus Timtams to anyone that can work out what’s “wrong” (in a traditional sense) with this design before reading any further.

timtam crunching noises

No it’s not the 3 potentiometers, that’s perfectly legit. Keep using your noggin. If you’re familiar with NPN transistors (yuck!) then replace the N-mosfet with an NPN transistor mentally, see if that helps.

Given up?

It’s the way the mosfet is wired.

If you know your single-transistor amplifiers then you might know that driving a common-source amp with a variable voltage is not kosher for two reasons:

(1) The gate voltage (pot position) versus LED current relationship will be very non linear. Small changes at low voltages will yield small changes, but the same changes at high currents will yield big changes.

… except that’s EXACTLY WHAT WE WANT. It’s the opposite of the (three) evil LED non-linearity problems I mentioned earlier. I’m pitting the evil non-linearity of the common-emitter mosfet amplifier against the evil non-linearity of the optics and winning. It works surprisingly well, the pot knob “feels” really good across it’s whole turn range. It’s not perfect (there are some spots where brightness doesn’t change much) but it is still magnitudes better than any other design I’ve twisted.

(2) The LED current will depend on the mosfet temperature and the mosfet temperature will increase due to the big power loss there. In theory this should be a problem, in practice I’ve never noticed. Not sure why — maybe the change happens so fast that you adjust for it anyway when twisting the knob.

Problems with this circuit

Mosfet choice

Many mosfets can’t handle being used as a linear resistors, instead they’re design to be fully on or fully off at all times. Look for Safe Operating Area (SOA) graphs in the datasheets, if there is not a line for “DC”/”continous”/”infinite” operation then the part might not work.

Checkout this SOA for an Phillips semiconductor IRF540 mosfet:

As we change the pot’s position we will make the mosfet suffer different currents and voltages. With enough testing you could draw a line on this graph of all the possible settings, but I’m lazy and instead going to approximate:

It’s unlikely that the mosfet will see both 12V and 1.2A at the same time (that would be 12 watts! flames!). But let’s pretend it does. Even then we will still be within the DC SOA for this mosfet (yay) so we’re good on this measure.

Of course I went “screw all of this theory” and did completely the wrong thing: I grabbed the WORST N-channel TO-220 mosfet I had. A greymarket IRF540 I bought on eBay whilst sorting from cheapest to most expensive. Guaranteed to be some form of N channel mosfet, but nothing more.

It’s been fine. I’ve made three of these things and none have ever failed. Maybe the crappier, older parts the greymarket sellers blacktop and relabel are actually better choices than some newer mosfets (which tend to have worse SOAs). ¯\_ (o.o) _/¯

Capacitor size

You don’t need 1000u. It might even work without any capacitance. Never bothered testing.

Some 12V power supplies might misbehave (flicker) without capacitance. Others will misbehave because of the capacitance.

The series fuse is important here, it adds some resistance to avoid the inductance of the 12V power lead combining with the capacitor to make an LC oscillator.

Fuse efficiency

The fuse runs warm. That’s normal, fuses like this can be something like 1 ohm once warmed up. Again, just another inefficiency to add to the pile.

Flicker problems

EDIT: Pad on my home-etched PCB had torn off, was barely touching other tracks.

I’m still to work this one out. One of my drivers flickers sometimes. It seems to be related to physical stress (tapping it fixes the issue). It could be a bad connector, bad joint or even a bad pot.

Future designs

I was trying to put together a non-linear current-controlled switchmode version, but its complexity has started sky-rocketing. I’m not sure if it’s worth it. Perhaps if I go for 24V strips, which waste less power in the resistors? I’ll have to see.

I hope some of my desk improvements and circuit abuse shenanigans have been interesting.

Matthew Payor - Saturday 11 February 2023

Log pot? Maybe with an off the shelf buck module.

Hales - (site author) - Saturday 11 February 2023

The nonlinearity of the transistor is free. Other transistor arrangements are not as good (eg source/emitter followers don't allow you to get the full 12V unless your power supply is eg 14V to begin with). Adding a logpot will add another layer of nonlinearity, no idea if it will make things better or worse.

N.B. I've never used a logpot, I've only ever used linear pots with a wiper resistor (this makes them logarithmic). Checkout http://tomjewell.com/Technical/logpot/logpot.html

Hales - (site author) - Saturday 11 February 2023

Doh, forgot to reply to your "buck module" bit.

I've done some spice simulations since posting this. It turns out that at peak mosfet power dissipation the mosfet is 85% efficient (!!!), ie only 15% of circuit power gets wasted in the mosfet. That's an unreasonably high number for a linear regulator, but a magic property of the LED string makes this possible.

3 series white LEDs is about 9V of drop. That 9V stays about the same regardless of current level. That means the mosfet and on-strip resistor are both only playing with the remaining 3V. At peak power loss the resistor and the mosfet both waste 50% of that remaining 3V (ie 1.5V each).

Technically at lower brightness levels the efficiency of the mosfet is lower, but the overall power draw is so low (less than 1/20th of full brightness) that no one cares.

A switchmode power supply can definitely do better than 85% (90% isn't crazy hard) but I'm not sure if it's really worth it. Lower brightness efficiency might be better or might be worse (depending on quiescent draw of the switchmode PSU). You would still be losing power in the resistors on the strip.

Also you'd still had to use endstop pots for your brightness control pot, you would really only be switching out the final mosfet for the DC-DC module.

The best solution would be to remove the series 50 ohm resistors on the LED strip itself, but then you would also need to rewire the strip itself (you can't put LEDs in parallel easily).

Matthew Payor - Thursday 23 February 2023

How do you feel about high frequency switching of the LEDs? E.g. Khz not Hz like cheap mains bulbs.

Hales - (site author) - Thursday 23 February 2023

To me the whole idea of PWMing room lighting (ie high power) LEDs seems silly. For the cost of 3 more parts (diode, cap, inductor) you can turn it into a proper switchmode power supply.

Advantages of doing this:
- Higher LED efficiency. PWMing runs the LED at max during the on-cycle where the lumens per watt efficiency is worse.
- Dramatically less flicker (depending on several factors)

You don't need any feedback. You don't need a different controller. Just 3 more parts added to your existing design with no other changes whatsoever. In most cases the cost of these parts will be dwarfed by the cost of the LEDs themselves. You might even be able to get away with just 2 parts (ie no diode).

KHz PWM can work, provided:
- It's high KHz (only 1KHz is probably still visible when you move objects quickly, especially at low duty cycles)
- It doesn't emit acoustic noise

The second point is a big one. Many designers assume that if they can't hear it then it doesn't exist. As you get older your upper hearing range drops out. As I kid I couldn't stand being near some electronics because they SCREAMED but none of the adults could hear it. It hurt my ears.

Now imagine being a pet nearby (rule of thumb: smaller the animal, higher the hearing frequency range). It could be awful and really hard to communicate with your owner, you'd just be upset and grumpy. Local predators (birds, etc) might also be dissuaded.

Switchmode supplies can still emit acoustic noise, but the switching current doesn't leave the supply itself, so it has a better chance of being quiet. Filtering is also easier at higher frequencies.

Add your own comment:

Email (optional):
URL (optional):
Enter the word 'irrlicht' (antispam):
Leave this box blank (antispam):

Comment (plaintext only):

If you provide an email address: it will only be used for the site admin to contact you, it will not be made public.

If you provide a URL: your name will hyperlink to it.