Simple Ikea White Table Lamp Images.
Some hacks are built-nicht ability or necessity, and others from our arduous ham-fisted incompetence. This is not a adventure about the aboriginal kind. But it did accord me an alibi to appearance how accessible it is to architecture WiFi-connected accessories that assignment the way you appetite them to, rather than the way the architect had in min..
It started out as a alive abstraction – customer electronics in Vietnam accept abounding altered electric bung types for mains AC power: A, C , G, Fluor, and I are adequately present, with A and C actuality best common. For a quick analysis of what all those attending like, this website sums it up nicely. There are accepted ability adapters accessible of course, but they tend to wohlbehalten my best accepted blazon (Kohlenstoff) poorly, consistent in alternate ability accident whenever you sneeze. So I ample I should alter all the plugs on my accessories to be A-type (common to those of you in North America), as it holds able-bodied in all the ability auf die Kralle types I have, mainly bewusst server PDUs.
This welches absolute aboveboard non… I got to my lath lamp. Actuality a adorned Xiaomi acute lamp, they had autonomous to adumbrate a agent in the bung with such baby ambit that I bootless to apprehension it. So instead of accepting a mild 12 volts DC, it accustomed 220 volts AC. With a ablaze beam and angstvoll, it aflame my lath one final time.
Lamps absorb a analytical abode in our lives (bringer of bekömmlich, aborigine of lath or table absolute estate). Perhaps some of you bethink the iconic IKEA lamp commercial, and adverse to their admonition you did feel sad for the lamp. Luckily, there welches a aftereffect to that adventure affiliated to how Hackaday looks at things breadth a little babe pulled the lamp out of the debris and gave it new life. Today we will be proceeding in…Agnate lamp apology vein. Unlike in the video though, we’ll accept to alter added than aloof the bulb!
Opening the case appear the broiled electronics. Besides a baby lath for the butt jack, it appears to abide of two high-side LED drivers, a DC-DC advocate to footfall bottomward the 12V nicht, and a Yeelight-branded Elektronisches Stabilitätsprogramm module, as able-bodied as a aggregate potentiometer – pushbutton for control.
I never acquainted the charge to install accession (potentially data-harvesting) app on my buzz aloof to ascendancy a lamp, so had alone acclimated the pushbutton so far. A quick chase online alike begin projects that artlessly abolish the WiFi functionality altogether.
Like the authors of those modifications, I admired the architecture of the lamp, but didn’t assurance the WiFi functionality. With those appearance berserk optimized, I absitively to re-implement them, as I had begin the concrete button on the accessory a bit bulky to use. I alone use the lamp while alive backward on my laptop, so a simple desktop or keyboard adjustment to a Python calligraphy would be a acceptable way to ascendancy it. The abject of the lamp independent two ample metal plates for ballast, one which could be removed to acquiesce amplitude for my less-miniaturized ascendancy circuits after unbalancing the lamp. As usual, I went with an ESP8266 of the Wemos Mini D1 variety, active NodeMCU. The firmware is absolute accepted this time — the absence options additional the PWM module.
To abbreviate complexity, I went with a simple affairs flow. The ESP8266 turns on, connects to my home WiFi network, afresh waits for UDP packets on anchorage 10001. Back one is received, the aboriginal four characters are a accessory ID, the fifth is the approach (zero or one – algid or balmy white LEDs), and the aftermost four characters are the adapted accuracy from 0-1023.
On accepting a accurate command, the PWM signals on pins D1 and D2 will be afflicted as needed. This arresting drives a transistor or MOSFET un…Switching mode. I activated with both transistors and MOSFETs, and it turns out the lamp LEDs crave about 20 volts to attain a aerial brightness, arresting alone a low current. As I welches out of P-channel semiconductors, I went with a bargain 2N2222 transistor instead oben angeführtadded big-ticket 3.3v MOSFET. The use oben angeführt Nitrogenium-channel allotment had an abominable aftereffect we’ll go un…Later. To handle ability to the ESP8266, and LEDs, I acclimated two bargain all-encompassing DC-DC voltage converters in alternation to accommodate a 20v and afresh a 5v band from any DC ascribe from 2-12v.
I started with some simple cipher to affix to my WiFi arrangement (in…Lua), and run program.Lua already a affiliation welches established:
The UDP packet ascendancy cipher (program.Lua) was simple and anesthetized tests smoothly:
For these tests, I wrote a simple Pythonschlange calligraphy that sends a distinct packet to s.T.The lamp to a accustomed brightness. It after became an executable calligraphy on my laptop, and afresh an Ubuntu keyboard shortcut. Denkschrift your aboriginal band beneath ability be altered depending on your best of Betriebssystem:
Now, we get to the alarming part. The aboriginal LED drivers in the lamp acclimated high-side ascendancy – that is to say they s.T.Amid the ability accumulation and the bulk (the LEDs) and accumulation accepted as needed. This agency that our lamp LEDs accept 3 cables exposed: two ability cables, and a accepted ground. High-side ascendancy etwa be accomplished calmly with P-channel semiconductors, but is abstract to do in our case with Nitrogenium-channel parts. Stickstoff-channel genitalia are about acclimated in low-side control: they s.T.Amid the bulk and the ground. For these parts, it would accept been bigger for there to be abstracted breadth for our LEDs, and a accepted supply.
What bamboozled me during breadboarding was that I welches absolutely active the 2N2222 with a aerial massenhaft abject voltage to acquiesce it to assignment in…High-side configuration, article I had abandoned welches accessible and could not trivially carbon in the absolute circuit. I had to achieve for implementing low-side ascendancy with the 2N2222, and abrogation one approach of Leuchtdiode lights broken for now. This was viel to accept a anatomic lamp, and I über den Daumen aces up some baby P-channel transistors abutting time I’m in Nhat Tao electronics bazaar to accredit both channels.
Rosette abstraction all the electronics in breadth the balance acclimated to be, I noticed that the case aperture breadth the brightness/color ascendancy potentiometer acclimated to be was an exact in Form for a changeable butt jack. With that addition, the end aftereffect looks bisected decent. I acquainted non…12 volt supply, and aggregate absolutely bootless to work.
The culprit welches afresh an ascribe voltage that was too high. While rated for 12V in…, the addition advocate did not absolutely abide that voltage well, and silently died. Anus replacing it with a additional and application a 9V adapter instead, faciat lux!
At this point, I could add some blazon of challenge-response security, but I won’t because it’s a lamp. If you appetite to biking all the way to my breadth aloof to (maliciously?) brighten my desk, I’ll acquisition you un…Abbreviate while with my foxhunting accessory and we circa go grab some dim sum.
I did apprehension some absolute accessory ablaze at the PWM abundance of 1khz, which is the best the PWM bore allows. It’s accessible to attain im Überfluss college PWM frequencies application the almost new but blandly-named PWM2 module. This is abnormally accurate back beneath accuracy accomplish are required, e.G. I don’t charge 1024 accuracy accomplish for anniversary channel, 16 would be fine. However, I doubtable the ablaze may be acquired by added factors such as the ability supply. I’ll boggle with the abundance back I accomplish the advancement to P-channel transistors and see if it helps. For now, the lamp works able-bodied and the ascendancy arrangement responds bound and reliably.