Turning on the Bright Lights, Part Deux

Story so Far: See Story so Far and TL;DR sections of Part 1.

TL;DR: My circuit needs another resistor or it will continue frying everything. It claimed another few victims before I realised this though.

After the traumatic experience it had endured I decided to give the laptop a break for a while and instead maybe check up on my circuit wiring. We were well into the evening now and the garage was engulfed by the umbra of the garden hedges, but I had been using the head torch all day, so had to switch it to the dimmer mode to save energy. The dimmer works exactly how I described dimming LEDs in “The Impossible Dim” except badly done whereby the flicker is pretty noticeable, giving a slight stroboscopic effect. It was annoying, but still better than being stuck in the dark before I finished. I rewired my circuit and gave it juice, same problem as in part 1, light comes on but just stays at full brightness. I had pretty much exhausted my troubleshooting list at this point, so I let the lamp stay on and willed the problem to make itself known. The “warm” white lamp really gave a much more homely feel to the workstation than the migraine inducing “Transfiguration of Christ brilliant” white headtorch LEDs.

The cooker hood bulbs being used in the lamp meant it gave off that special hue of light that is enriched with nostalgia. Nostalgia for all those nights having went straight to hurling training after school and arriving home battered, bruised and seeking comfort. Finding it wrapped in foil on the stove top. A home-made dinner that had watched on while everyone else enjoyed their meal and discussed their day; during post-dinner clean-up it was lovingly wrapped up in foil so as to capture a healthy serving of the Family Table spirit under there with it. Then as I land home, I am welcomed by the working-class cloche basking in the warm glow of the cooker hood bulb; a glittering, scintillating treasure trove. I approach the light through the darkened kitchen, with each step forward my shoulders bob up and shrug off more of the day’s tension, and with each breath inward the scents of the kitchen build hope for what might be waiting. I reach the stove. Quick breath in. Hold it. Lift the foil . . . pork chops. Stuff that I’ll have porridge.

Yep, the light being given off by the bulbs was lovely, but I wasn’t so keen on the smell – the smell?! . . . suddenly the illusion of homeliness came crashing down as the scent of melting plastic made itself known. I glanced down to the workbench and the strobe of the headtorch made the pixie smoke1 cast a large, jittery shadow, giving the illusion of a much larger plume of smoke billowing out than there was. I’ll blame the ensuing overreaction on that.

I immediately switched the supply off and for absolutely no rational reason whatsoever began ripping my circuit apart. I believe I believed I was protecting the components from being harmed by the now disconnected and harmless power supply. All very silly behaviour. The only component really in use was the FET (the “dimmer switch” that the Arduino was supposed to be controlling). Now, there’s a couple of conditions where a FET will get very hot inside and try to get rid of that heat through its back panel; I had created one such condition2. To get rid of dangerous levels of heat the small back panel of a FET often requires a larger heatsink3 stuck on to it, I didn’t have such a tool attached, that is, until I tried to grab the FET and disconnect it. At that moment, my hand became the additional heatsink and the FET did its utmost to utilise it, sending whatever heat it could into my fingers. Very painful. Very very stupid. Very very very educational.
So, in summary, things fried in an attempt to build the simplest part of this alarm clock:

  1. Laptop’s USB port
  2. FET
  3. My fingers
  4. My brain
  5. Voltage regulator chip on the Arduino

The last of which was what had actually been producing the pixie smoke earlier. It takes the 12-Volts from the supply and steps it down to 5-Volts for the bits that like to work at 5-Volts. The only one of which I was using at the time is the pin controlling the FET. I had pretty much shorted said pin to the ground which meant it was trying to draw Unlimited Power (infinite current more specifically but Star Wars). That power was (obviously) too much for the wires in the voltage regulator to carry so they started trying to get rid of it by heating up their plastic casing. Which melted.

Slick patches on “AMS 117” chip are the bits that melted especially well.


The fix is very simple; add a resistor to the wire. All this is like dropping a watermelon off a 45-metre tower. As it falls it will get faster and faster, creating self-destructive carnage when it lands. Adding the resistor is like giving the melon a parachute, it limits the amount of speed the melon can gather on its way down to the point where you can drop it all day and not see red.


My short-sighted shorting had one more side effect; it had actually caused a failure inside the FET which meant it no longer operated as a dimmer switch and instead had become just a lump of metal, or a dimmer switch stuck at its maximum brightness4 hence the issues I was having. I suspect things got quite hot inside the FET and some tiny bits melted together, only to be cooled down by passing their heat off to my fingers.


After making sense of everything I ordered a new Arduino and repeated the experiment, now incorporating an appropriate resistor and new FET, the lamp works perfectly, dimming and brightening at will.
Incidentally, I referred to the Arduino as an “Uno board” in early blog posts, said posts were written before this Series of Unfortunate Events, at a time when I was using the Oosoyoo Uno (a knock-off of the Arduino Uno) which now, as you know, has a burnt-out voltage regulator. After the events detailed above, I figured I’d like to splash out on the real deal Arduino model. Started From The Bottom Now We’re Here.

1 – See previous post “Mouth Function Malfunction” for etymology of “pixie smoke”. Suffice to say it’s a quirky term for smoke from electronics.

2 – FET == MOSFET for the sake of this blog. My FET wasn’t for microcontrollers – the gate voltage should have been much higher than 5V to fully turn it on. Since I was only giving it 5V it was only partially turned on and still had quite a large resistance. Thus it was a resistive heating element, melting itself and giving off heat. It is now switched out for a “logic level” FET. 5V turns it on all the way – assuming my pwm frequency isn’t ridiculously high, apparently this can lead to the gate not having time to fully activate every cycle.

3 – A heatsink is just a block of metal that absorbs heat from a component faster than the air around that component can. It then has a large surface area in contact with the air to pass that heat on to the environment effectively. It then keeps on wicking heat away from the component. The more surface area exposed to air it has the better at its job a heat sink is – this is why they almost always have a finned design.

4 – I know that’s not quite right as the FET isn’t a dimmer switch in the classical sense (a potentiometer) but it’s accurate enough. More accurately the FET became just another bit of wire in a circuit with a 12V source (wall wart) and a 5V source (digital pin) powering 2 LEDs.

Just a reminder this is what the end circuit will now look like. Except the pins aren’t accurately labeled and there’s a grounding wire omitted. I think the omitted wire is superfluous anyway though.

Turning on the Bright Lights, Part 1

Turning on the Bright Lights, Part Deux” is also live.

Story So Far: Heater prototype didn’t work, waiting on alternative parts. Playing with using pwm (unimportant technical term) to control some LED bulbs for the lamp.

TL;DR: I set up a dodgy circuit to test the lamp part of the alarm clock. Plugged said dodgy circuit into my laptop and gave the PC a fairly debilitating case of agoraphobia. Shock therapy not advised.

I think experimenting with the lamp made for a high-octane chain of disasters so I think I’ll use a sort of dramatic retelling to detail how I transcend the limits of my single-headed human form to fit so much stupid in. How Does That Grab You, Darlin’?

While waiting on new parts for the new heater I figured I could work on the lamp, this would have to be addressed at some point anyway and it would be a nice proof of concept for the heater circuit as they are identical in all the ways that matter. So, out to the garage I went, full of misplaced complacency and bright ideas about this lamp. I set up a very simple circuit1 which is stylised to be even simpler below.

Left: Stick person controls dimmer switch for light bulb, powered by car battery
Right: Arduino controls current flow through a MOSFET (3-legged box which I forgot to label) to control the lamp circuit, powered by 12V supply


After having set up the hardware I had to tackle the minor issue of the software; just a little bit of code to make the lamp brighten/dim brighten/dim repeatedly. My laptop had been enjoying a well earned rest up until that morning – it’s a coin toss between it and the kettle for hardest working appliance throughout my final year of uni – nonetheless it sprung to life right spritely like and was ready for a new project; like an over-zealous sheepdog pup; keen to impress.

Brightness of the lamp is on a scale of 0 – 255 so I set about writing code that would peruse said scale up and down at intervals of 5, updating every second.

Once the code was written, I began uploading it to the Arduino. The Arduino blinked intensely and thoughtfully while it tried to comprehend its instructions and commit them to memory, then, once it felt it had a grasp on them it returned to its steady state; a bright-eyed thousand-yard stare2. This vapid expression concealed a mind that was furiously rehearsing the instructions which now constituted its entire raison d’être. The only thing that could interrupt this fervent meditation was the command to effectuate these orders and begin actually making the world a brighter place – just waiting on the word “GO”. Like a well-disciplined (read indoctrinated) soldier, not yet jaded by combat. The word “GO” in this case was me hooking the Arduino up to the big ol’ 60-Watt power brick. Using a 60-Watt supply to run a circuit this modest is a bit like using a forest fire to dry your hair but I’m told that the Arduino knows exactly how to keep its distance and not get set alight so I went ahead and gave the order anyway.

Turn on the Bright Lights


The lamp came on immediately when connected and was beaten only by my celebratory smile for brightest thing in the room. However, for every second that passed without the lamp getting any dimmer, my expression picked up the slack; finally my face was furrowed and frowning in equal measures at the failure. My first guess was that there was a bug in the code and the brightness level wasn’t updating as it should. So, I opened the laptop and started rewriting the code in a more obvious, less succinct way. Just by habit at this point I had also disconnected the lamp from the Arduino.

At this point I had both the big ol’ power supply from the wall and a USB lead from my laptop going into the Arduino and as I reconnected the lamp circuit it came on with that same, persistent full-beam of failure . . . the garage didn’t seem all that much brighter. Not metaphorically or anything. It was because my laptop screen had gone to sleep at the same time. I hit the space bar a smack to wake it up again (and perhaps vent some anger at my incompetence), but the screen remained black. Interesting. Immediately I ripped the USB lead out from the laptop. Intuitive. I turned all off and began CPR on the laptop. On-button compressions triggered a gasp of air through the fans but it still remained unresponsive, after 40 minutes of poking and prodding we had him back and fully lucid. The diagnosis was that a rush of current from the Arduino into the laptop’s USB port triggered some sort of safety feature that protects the motherboard; this feature cuts the machine off from the outside world until a certain secret knock on the power button lets it know the coast is clear. While researching it I discovered “USB killers”; pen drives that when plugged in, give a massive shock to the motherboard to try and fry it and brick the target machine, honestly, that’s their only purpose – a perfect, pocket-sized example of man-kinds malevolence. I’m glad they exist though because if they didn’t the safety feature I triggered might not exist and my laptop could very well be toast right now.

Turning on the Bright Lights, Part Deux” is now live to conclude this part of the build.

1 – If you’re technically inclined, the actual circuit I ended up using is drawn and carelessly discussed below. In the picture of the physical circuit up above though you can see I only have one resistor in *spoiler alert for part two* it’s not the important one.
2 – Arduinos actually do have an LED that blinks while they load up with new instructions and then switches to a fixed on state to show it has accepted the new code. This isn’t just me rambling. Let me try again. This isn’t just me rambling.

Probably the final circuit schematic

Blue box = Arduino
Red box = MOSFET
Basically Vin will put 12V across the LED light when the MOSFET is set as a short circuit. The MOSFET will be set as a short circuit when its gate pin has a voltage applied to it (when pin D2 is high [It won’t be pin D2 in reality, it’ll be one of the pwm pins to allow variable brightness]). There’s a 10 K-ohm resistor from gate to ground on the FET to avoid floating states. The two 220 ohm resistors are just current limiting resistors. D1 will be polled continuously, if the button is pushed, D1 receives a signal from the 5V rail and the Arduino toggles the state of the lamp (fully on/fully off) as long as it isn’t already in the middle of brightening the lamp for the morning routine.

Create a website or blog at WordPress.com

Up ↑