IKEA Table Lamp Into a Light Alarm With Dimmer

482

3

2

Introduction: IKEA Table Lamp Into a Light Alarm With Dimmer

About: I know things and I make things. Sometimes I even finish them and publish somewhere. Usually it's something with a touch of repurposal.

A lamp, with an alarm and a dimmer. Based upon a tiny Arduino and a computer mouse scroll. With a bit of repurposal and overthinking.

Well,

at first, before becoming a functional project, it was basically a strange concoction of different parts, factors, and ideas. It began with my horrible tendency to oversleep, mixed with a passion to reuse, fix, and modify things. First, I've found and repaired a half-dead LED lamp and put it on my nightstand. Then I realised that this certain lamp could be easily upgraded into a light alarm with the help of a small microcontroller. Since the use of a microcontroller makes the dimming option via PWM easily accessible, then why shouldn't I make it fancier with an old rotary encoder as an input device?

To be clear, the encoder that came into my mind was a scroll from an old computer mouse, which I perversely wished to reuse in something useful and I found it more than necessary to put it into this project.

OK, but more seriously speaking, the aims of this project were to:

  1. Make a working light alarm from an already possessed and liked LED lamp.
  2. Give it a nice functionality of integrated dimmer.
  3. Use some repurposed parts. The encoder, yes!
  4. Learn some more in the matter of C++/Arduino IDE.
  5. Begin and complete an Instructable for the first time in my life.

Well, it worked and it still works as it should. Plus, two months later, the Instructable is finally completed and published.

Before you start, please remember to take all the necessary precautions when working with electricity and hand/power tools. This project is NOT intended to work with a direct AC supply. By following my steps you are not risking any direct contact with live AC, since the AC/DC power supply is not being opened, nor modified. Anyway, with a bit of bad luck, you can still make some fire due to a short circuit or different mistake. Stay focused.

My rotary optical encoder may seem a strange choice, but I terribly needed to use it. Its implementation is not covered here in many details, but probably will be a matter of another publication.

Step 1: Supplies or Bill of Material

The list of supplies should not be treated soooo explicitly. Most of these items are necessary, but the qualities of them may be changed rather freely. Of course, using the same electronics will ease your work if you ever wished to follow my Instructable.

So, when it comes to materials:

  1. A lamp of your choice. DC power is a must. It's good to start with a LED lamp, suited with an external AC/DC adapter. Even better to get a lamp with the working voltage close to the VCC range of Arduino (3,3V - 5,0 V will do). IKEA JANSJÖ turned out to be an excellent - though totally random - choice. Once a garbage treasure, to be clear.
  2. ATMega board of your choice, with proper flashing tool, if necessary. Here, Arduino Pro Mini (a cheap clone of one!) was used because of its small form factor. USPasb programmer was necessary.
  3. RTC module with on-board battery and I2C communication
  4. 0,91" OLED display with I2C communication
  5. A rotary encoder with an integrated button. It doesn't need to be an optical encoder, and maybe even shouldn't be an optical one. You can use a classic, digital encoder with a bit of workaround. Yet the whole sketch here is intended to use my encoder with all its merits and flaws.
  6. N-MOSFET transistor of your choice. Remember to take care of the accepted voltage and current. I used an IRFZ44N which is an obvious overkill since it can drive up to 49 Amps.
  7. Three resistors: 1x56 kOhm to be used with MOSFET and 2x 110 kOhm as pull-downs for the optical encoder sensor.
  8. A handful of thin cables. I have reused a SCART cable I've found somewhere.
  9. Crimped connectors - here KF2510 (2x 2p male header, 2x 2p female plug). Not a must, but will definitely ease your work in case of future modifications.
  10. A breadboard for prototyping purposes.
  11. A small part of "universal" PCB perfboard. I used a part with the size of 5x8 holes and it was close to an absolute minimum.
  12. "Goldpins". Six of them (6). Needed to make a programming header, which may be not necessary if you use a different solution.
  13. Nylon screws/nuts/spacers. Used to position and mount elements inside a casing.
  14. A casing of your choice. I decided to use an empty cosmetic box. The twist-off lid made it a bit harder and funnier at the same time. Using a rectangular box with a snap-on lid will be much quicker.



And when it comes to tools:

  1. Knife, scissors, pliers, cutting pliers, screwdriver, metal ruler
  2. Fine permanent pen
  3. Hacksaw, drill, small file, a scrap of sandpaper
  4. Soldering iron + accompanying supplies
  5. Crimping tool
  6. Glue gun

Step 2: Prototyping, Gut-diving, Coding, and Getting Everything to Work for the First Time

After understanding and troubleshooting the encoder interface (uh-oh, the hard part), the first working prototype came rather easily.

The mouse provides a complete structure in which the scroll is suspended on some plastic pillars. The button and spring (hidden under the white casing, see pictures) are also integral parts of this suspension. Because, mechanically, everything is almost ready to use, I decided to rather leave it "as is" than destroy it and build it from the beginning.

This mouse seems relatively complicated (much more electronics than you wish to find there) because it's a wireless one. There's a significant amount of power-management elements (i.e.: a DC-DC converter below right button). The radio communication is driven by a second, smaller PCB - not shown here.

First, the button, IR (infrared) LED, and IR receiver need to be isolated (but not disassembled!) from the rest of the mouse circuit. Isolated means you just need to cut the unnecessary copper paths which lead from the needed parts to the unneeded parts. Be careful to not destroy the soldering pads which keep these elements in place.

Second, you need to find which pins of microswitch are common (C), normally opened (NO) and normally closed (NC). In these microswitches, usually (NO) is in the middle, and (C) is the one further from the "clickable" part of the switch, when you look at it from the side (picture).

The polarity of the IR LED may be checked in many ways. Give it a solid GND on the negative side, and a VCC through a potentiometer (I suggest 10 kOhms) on the positive.

The polarity of the IR receiver is simple: VCC in the middle and two different outputs on the side.

But how does it work anyway?

The IR LED lights the IR receiver, which should cause a constant positive signal to appear at its outputs. But the encoder wheel, keeping its "spokes" between the LED and the receiver, interrupts the light path, causing the receiver to obtain a rather interrupted signal, especially when the wheel is in motion. So the movement of the wheel produces an interrupted signal at both outputsof the receiver. And since the two photosensitive elements inside the receiver are not in the same place, but a bit apart, the interruptions take place at a different time - and one always comes before another. The order and the number of these interruptions make it possible to identify the direction of the rotation and the number of single "steps".

And - to keep this Instructable being about the light alarm, and not about diving deeper in the mouse's guts - that will be enough for today. And maybe enough for another Instructable, since I have never found a comprehensive instruction covering the matter of repurposing such components.

My prototype was just a mouse with some cables soldered to it and connected with necessary digital parts (see pictures) via a breadboard. At first - just with Arduino UNO and OLED display. When I got the encoder to work (almost) properly, I've added the MOSFET, a random LED, and finally the RTC module.

The parts were simmered together for two weeks, with everyday upgrades of the code.

Step 3: The CODE (with a Bit of Explanation)

Basically, I wanted this device to:

  • use an upcycled rotary encoder with a single button as an only input device: to dim the lamp, to switch between menus, to set/turn off the alarm and to adjust the RTC
  • be easily dimmable with a simple scroll, with recognition of a quick scroll
  • have a customizable waking-up mode
  • work as a simple clock in "standby" mode
  • have a "dark" operation mode, in which the display does not light my bedroom, yet still says it's working
  • remember the alarm settings in case of power loss
  • engage my brain by some morning math

Coding took me a lot of time, but I've happily realised all the above assumptions. I'm not a professional in this matter, so please forgive me any obvious stupidities you will find there. But of course, you're welcome to point them out.

I've tried to comment everything inline and as clearly as possible. I will also explain something more about it below.

The loop() was intended to be quite short and simply loop through the necessary sub-functions. Some of them are executed every time (reading from the button and scroll; dimming the light; keeping an eye on the alarm), while others are called in longer intervals (i.e. 200ms or when the dim value changes).

I've never used the delay() function. Every interval/threshold is handled by millis(). You can configure the intervals by yourself.

The button() function recognizes three different durations of a press. I haven't implemented any software or hardware debounce solution. My approach is to measure the duration of a single press and take the corresponding action. Presses shorter than 20ms are simply dismissed.

The scrolling is realised by two functions: scrollset() and scroll_it(). The first accepts a given value (int), recognises the direction of movement and forwards this value to an executive function called scroll_it(). The latter checks if the interval between the two last (same-direction!) impulses was short enough to be recognized as a fast scrolling. If so, the value is incremented/decremented by 4. If not - only by 1. The scrollset() loops until the final value is confirmed by a click - here again, the button() is called, so any bouncing behaviour is under control. During scrolling, the variables are limited to their critical values by a simple control function and an array of upper and lower boundaries. The fast scrolling allows to go from zero to full brightness in two moves of a finger. You will probably need to play with the slow/fast threshold when using a different scroll.

The scroll, if used in any of the non-settings views, acts as a simple dimmer. I've implemented a 26-step dimming with non-linear PWM characteristics, to obtain a comfortable, almost-linear perceived brightness range. See next step for better explanation.

The display is refreshed at least 5 times per second via oledprint(). It is called from loop() every 200ms or with every change in the dim value; it is also called from every sub-menu when a value is being changed by scrolling.

You can see 5 different modes with different look and function. Two of them are menus waiting for your interaction:

  • STANDBY: The first thing you see after plugging in the device. A simple view of a 24-hour clock. The seconds are put in place of the colon. I like them this way.
  • DETAILS (after a short click from standby): More detailed view. Full date and time, dim level (0:25).
  • ALARM SET (after a long press (0.5s) from details): Menu used to set an alarm. You can choose the time, the brightness, the status (ON/OFF), and finally - the MODE. The ALARM MODE may be INSTANT (just turns on at a given brightness on a given time), SMOOTH (smoothly lightens up to a given brightness) or FLASH (flashes in a given interval with a given brightness). The brightness is a part of a scroll-menu, while the behaviour in SMOOTH and FLASH modes is configurable in the code. You can speed up/slow down the SMOOTH mode and change the interval used in FLASH mode by changing respective constants (SMOOTHNESS_CONSTANT and FLASH_INTERVAL).
  • RTC SET (after a VERY long press (5s) from details): Menu intended for a manual adjustment of the RTC settings.
  • DARK MODE (after a LONG press (0.5s) from standby): Dark display, with a single dot showing the current time. The dot travels from the top-left corner. Hours flow vertically, minutes - horizontally. This mode serves mostly as a proof that the device is powered and works. Short click switches back to STANDBY.

Once the alarm is called, you'll need to wake up your mind to turn the light off.

The display will ask you to solve a modulo division (%). Pseudo-random numbers are generated via the millis() function, the dividend is in the range 0-100, the divisor is 1-24. The number of repetitions required to turn the alarm off is configurable in the code (SOLVE_REPETITIONS). By default, it is 4.

After obtaining the required number of correct answers, the light will not turn off, but turn back to the former brightness.

See every MODE pictured in the 18th step.

Step 4: Non-linear Dimming?

Your eye is a non-linear device. Deal with it.

It's not because our eyeballs are round ;) It's because they serve us to perceive brightness in a non-linear way. Of course there's also a non-linearity coming from the light source itself, which only complicates this matter. I won't talk about the mechanism behind it, but the point is that we barely see any difference between a given light source at its full brightness and the same source at 75% brightness. But at the same time we see a big difference between 2% and 5%.

To make a useful LED dimmer we need to take this into consideration and remember that a linear dimming (green line in the plot) will provide a higly non-linear visual sensation (violet). The visible changes will be too subtle in the light region and way too harsh in the dark region.

To solve this problem, we need to compensate for this non-linearity with another non-linearity. A simple solution is to flip the perception curve (violet) against y=x line (linear relationship, green), obtaining the current curve (blue).

Since the perception curve is said to be nearly proportional to the square root of the LED current (or PWM duty cycle), we need to perform the dimming in a rather exponential manner.

But how?

Assuming that we use an 8-bit PWM resolution, which gives 256 steps, we need to perform a transformation of "linear" variable being changed in a chosen range (no, it doesn't have to be 256-step) into an "exponential" PWM signal (analogWrite), which should cover the whole 8-bit range, which is 0-255.

To obtain a convenient dimming, covering the whole range with one-two full scrolls, I chose to have 26 steps in my "scrolled" variable (called simply dim), and transform them into a 256-step variable used in analogWrite (called "dim2"). The first dim and dim2 must be ZERO (lamp turned off), the last dim and dim2 must be 25 and 255, respectively (lamp at full brightness). The remaining 24 steps in between should rise very slowly in the leftmost 1/3 of the range, and then speed up to create a more steep curve in the rightmost 1/3.

While the correct arithmetics behind this said:

dim2 = (dim/25)^2 * 255,

the result was quite troublesome in the lower region.

The lowest non-zero value fell under 1 and was then rounded to 0. Bad - lamp didn't turn on at dim = 1.

The second was OK, yet was rounded to 2. Still bad, 1/255 was missing. I wanted to use the lowest achievable brightness! The third was rounded to 4. Again, why not 3? It was obvious that the LOW region was not used effectively. I decided to alter these values manually and transform them via an array and not with written arithmetics or a scale() function.

The crossed points in the 2. and 3. plot show my altered values. You can see clearly that the four lowest settings (1/255, 2/255, 3/255, 4/255) are covered. Now I'm ok.

I'm not saying you this is the one and only correct solution. The best solution might be even more curved than this. I will definitely play with this array to get the ultimate relationship.

Step 5: Releasing the Useful Parts of Your Mouse...

When the code works, the prototype says it was worth trying, and when you and your mouse are ready for the procedure, it's time for some disassembly.

To not over-do the idea, and to keep the mechanical part intact, you need to cut off the necessary part of the original PCB.

But first, desolder the unnecessary parts. You don't want to destroy them (or at least I don't) and you don't want them to bother you when cutting the PCB.

Second, cut the PCB to the desired size, keeping in mind the locations of: 1) necessary elements, 2) pillars suspending the scroll, 3) the housing of the spring. We need these parts and these places to stay safe.

Step 6: ...then Making It Better, and Changing Your Mind to Make It Smaller, But Again Better.

After the cut, try to fit the obtained PCB piece (PIECE-B!?) in the remainings of the original mouse case. May fit well, may fit not.

In my case, it needed some support at the rear side to be in level with the case. I prepared two "legs" from two different pieces of copper wire. They worked excellently. But then I realized I needed to reduce the size of the PCB. So I cut it once again, losing one of these freshly prepared legs.

Step 7: Cutting the Mouse Casing to the Desired Size

After you finally find the right size and shape of the PCB, forget about the lost leg and cut the case/base.

It doesn't need to be any significantly bigger than the final cut of your PCB.

Don't leave the spring in place when using a hacksaw, as I did. It won't hesitate to fly away.

Step 8: Finding an Enclosure, Preferably an Empty Container Which Can Be Upcycled

Since I was born with a less-waste attitude, this project must engage not only the remnants of a dead mouse but also a piece of repurposed packaging. I highly encourage you to follow my way, just maybe not in this project :) I think the proper adjustment of my container was the most time-consuming task.

The truth is I tried to fit it inside an electrical box (white one, last picture), but I wasn't satisfied. The idea of mounting an OLED under a convex lid is a BAD idea. And the screw in the middle doesn't help with it at all. And with the whole love I feel towards electrical boxes, I must admit this one was ugly.

So I have chosen an empty cosmetic container, which was round (I don't mind it - fits well with the style of the lamp) and pink (I mind it - doesn't fit well with the style of the author).

Find a box you like, and try to place all of the elements inside. Remember that the scroll must stick a bit over the lid in the final configuration. I have put three nylon nuts/spacers under the base of the scroll module, to make it higher and to make it mountable.
Leave some room for later to place the MOSFET and input/output connectors. Two cables must also find their way in/out of the box - so keep a part of the wall not covered by other elements.

You will be going to cut two neat openings in the lid/wall (as you wish) for the OLED and the scroll. Keep it in mind when choosing your box. Avoid troublesome materials and shapes.

Step 9: Checking the RTC (in)accuracy

The accuracy of cheap RTC modules may differ. There are some more or less obvious reasons for it, like bad PCB design or corrupted (overheated!) quartz oscillator. An unstable ambient temperature will also alter the accuracy of time measurement, especially if the module is not equipped with a temperature compensation mechanism.

In the case of a constant "drift" inaccuracy, the problem, once checked and measured, may be solved in the code.

In my case, a nearly constant, positive drift, reached the level of ~167 ppm (parts per million). This means that over one million (1 000 000) of "real" seconds, the RTC will count a million and 167 more (1 000 167). In other words, my RTC speeds the time up by a factor of 1.000167.

Is it bad? Not very bad when measuring the time for a couple of minutes or hours. But let me show you prolonged consequences of this error:

Since one day is equal to 86 400 seconds (24 * 60 * 60 = 86 400), a positive drift of 167 ppm will give: 86 400 * 1.000167 = 86 414.4 sec, which is a gain of almost 15 seconds, every day. A hundred (101.0) seconds every week. Over 7 minutes (432.9 sec) every month (30d). And nearly an hour and a half (87.8 min) every year.

Yup, this is unacceptable for a maintenance-free device that is designed to help with oversleeping and being late. Be careful.

I will edit this step later and further explain my methods. The current code does not handle this problem yet!

Step 10: Tracing the Most Troublesome Opening in the Container

Harder part, no jokes.

Find a definitive location for the scroll module. Trace the mounting holes and screw it in place.

Try to fit the lid. You should NOT be able to close it comfortably - the scroll MUST be a bit too high at this stage.

Adjust the nylon nuts (cut them to size) if they are way too high. But leave them alone if they are just too high.

Remove the scroll module. Yes, remove.

Then put the box upside-down on a piece of paper and trace it. Cut the stencil around the trace, fit it to an empty box, then leave at least two pairs of corresponding marks on the lid and the stencil (at the circumference).

Put the scroll module in place.

Mark the top section of the scroll with a NON-PERMANENT marker. Make it wet, make it stainy.

Carefully put the stencil on the box, matching the marks at first, and then touching the marked part of the scroll with the stencil. Don't move it - just touch, keeping the circumferential marks in place all the time.

Paint a nice rectangle on your stencil. This rectangle will be a starting point for making the opening in the lid. Paint it in parallel to the revolution plane of the scroll (or parallel to the longer axis of the mark - if the mark is sharp enough).

Carefully cut the rectangle out of your stencil.

Remove the scroll, put the lid on, tightly. Fit the stencil to the circumferential marks and trace the rectangle onto the lid.

Remove the lid. Try to fit the stencil to the bottom of the lid, trace the rectangle down there. Put the lid in front of a bright light source and check if your upper and lower marks lay in the same place (of course if your lid is at least a bit translucent). They should be in a close distance and a similar angle.

Well done.

Go eat something.

Step 11: Making the Most Troublesome Opening (scary Part) and the Less Troublesome Opening (less Scary Part)

Punch/drill two holes inside the rectangle from the previous step. The best way is to make them tangential to the rectangle - touching it from the inside. The size of the hole should be no larger than the width of the wheel. You need a margin for further corrections.

Connect the holes in any way. Knife? Chisel?

Don't overdo this part, don't make it shiny - there's a chance you have already messed up and you may be currently looking at a proud result of a big mistake. Connect them, put the scroll back in its place, try to put the lid on and check if anything fits.

It should fit a bit.

So keep adjusting the hole with a hole punch/knife/whatever you wish, checking the alignment after every correction.

The aim is to obtain a hole a bit wider than the scroll and a bit longer than the visible arc of the scroll. The scroll has some natural play in its suspension, which must be taken into consideration. A click of the scroll must be possible without jamming.

The less scary opening:

Measure the active area of your OLED display and trace a rectangle 1 mm wider and longer than that.

Measure again. Twice, as they say.

Cut it. Ruler, knife, a bit of patience. Put the ruler in line and run the first, very shallow pass with your knife. Make it as straight and even as possible - you should not cut through the plastic, but only leave a fine groove, being your definitive guide for the real cut. Run the next pass over it. Rotate the piece and run the next pass starting from the opposite end of the line. Push the knife a bit harder with every next cut. Rotate, run, repeat until done. Avoid finishing any cuts in the corners - you can easily over-cut them. It's far better to start every pass of the knife in a corner.

Fine the edges. Scratch them carefully with your knife, holding it at a proper angle. I'd say 45 degrees makes the trick.

Done.

If you've ever tried cutting PE/PP plastics, you already know it's not as easy as it seems. Every scratch is visible and there's no room for corrections. Filing/sanding of an uneven cut is not an option. The best advice I can give is to use the sharpest tool you have to obtain a clean cut. OH, and please wear cut-proof gloves!

I think you may try to use a CMC mill. I think, but I've never used one. Tell me!

Step 12: Making Some Real Connections, Vol. 1

Plan the connections and solder some short pieces of cable to the crucial points of the PCB.

If you ever happen to get a similar scroll module, you should connect here:

  • GND
  • VCC for the IR receiver
  • VCC for the IR LED - through a tiny 10 kOhm potentiometer
  • clickPin -> to Arduino digital input (4)
  • ylwPin -> to Arduino digital input (7)
  • grnPin -> to Arduino digital input (8)
  • + pull-down resistors between GND and ylw/grnPin (outputs of the IR receiver

See the connections pictured/marked in the next step.

Step 13: Making Some Real Connections, Vol. 2

Since the RTC module has similar 2 headers, I decided to use first of them to connect with the OLED, and the second to connect with Arduino. This way, I'm saving myself a bit of trouble in the matter of wiring ergonomy.

I don't use any DuPont connectors or goldpins at all. It is a solder-and-use circuit and I don't think they are necessary, plus they waste the necessary space.

Measure the proper length, cut 4 cables to size and solder them between the OLED and the RTC module, connecting the pins according to their names.

The headers should be marked as VCC, GND, SDA, SCL (or "SCK"). I used black color for GND, red for VCC, yellow for SDA and green for SCL.

Attach the Arduino to the bottom of the scroll base with a piece of two-sided adhesive tape and once again try to fit everything in your box, just to be sure. Connect the scroll PCB to the Arduino, according to the description from the previous step. Connect the second header of the RTC module to proper pins, remembering that SDA (here A4) and SCL (here A5) may be hidden in different places, affected by the revision and genesis of your Arduino(-like) board.

Step 14: Designing a Tiny PCB for MOSFET and Necessary Headers

Get a piece of a fresh "universal" perfboard. Plan the locations of necessary elements, then cut the board to its final size and solder everything in place:

  • N-MOSFET transistor, preferably in the TO-220 package (as the one I pictured)
  • a resistor (560 kOhm*) between the GATE (left) and the SOURCE (right) of the transistor
  • DC input connector (VCC and GND from the power supply) - VCC and GND are interpreted here as they should be in every other place
  • DC output connector (VCC and GND for the lamp, in this case for the LED) - the VCC goes directly to VCC, but the GND goes to DRAIN (middle) of the transistor

I connected every pin called "VCC" directly to the "VCC" of my Arduino. Please do it only if you're sure that the input voltage IS stabilized and fits in the range 3.3 - 5.0 V. In any other case, the input/output VCC should be connected to the RAW pin of Arduino (but every other VCC - from OLED, RTC, scroll PCB - to the VCC of the Arduino).

Additionally, you need to make at least two more connections between this board and your Arduino:

  • GND to GND
  • the GATE of the transistor (left) to a dimPin - the one which provides the PWM signal

Using crimped terminals as input/output connectors is not a must. You can omit them if you wish to solder everything and never disconnect it again.

*A 560 kOhm resistor is waaaay too much. I was sure I used 56 kOhm, but I've just now realized the third strip was yellow instead of orange :)

I have also placed a 6-pin programming header for the USBasp programmer, which turned out to be very useful in the process of "polishing" of the code. Of course, you can flash your chip once (before assembling the circuit) and forget about it, but if you ever wished to change anything later, you need to bring the programming pins to an easily-accessible place. USBasp needs 6 pins: VCC, GND, RST, MOSI, MISO, SCK. If you're advanced enough to know how to use the programmer, I think I'll omit more explanations here.

Especially for those curious and sharp-eyed: in the last picture showing the connections underneath the piece of perfboard, one cable (MOSI) IS still missing :)

Step 15: The First and Last Check Before Assembly

Inspect the connections visually. If everything looks OK and there are no misconnected VCCs or GNDs, you can try connecting a +5V power source.

Does the OLED show anything?

Does it respond to any signal from the encoder?

Can you enter the settings menu and set the time/alarm?

If YES - disconnect the power source and put the RTC battery in place.

Connect everything to your lamp circuit, power it up and check the dimming function.

Set the time again - the RTC without battery has forgotten everything.

Step 16: Adjusting the Power Cable of Your Lamp

I've decided to fully replace the original ON-OFF switch with my device.

To do so, you can simply cut the cable near the switch (lazy way) or open the switch and disconnect the cables from the inside (time-consuming way). The original IKEA switches are quite hard to be opened without leaving any visible damage. In addition, the crimped ends are integral parts of the switch, which makes it even more complicated. Sooo... cut it, like I did.

Then crimp two pairs of connectors of your choice, or simply solder them to your circuit. As you wish or as you are capable of.

I've chosen KF2510 connectors, which turned out to be not perfect for such unexpectedly thick cables. The producer used 0.75mm^2 copper cable for a mere 800 mAmps of current. Wow.

Images may be added later.

Step 17: Final Assembly

Once the electrical and mechanical work is done and the circuit is tested, it's time to finish this thing.

Disconnect everything again. Put your circuit in the box.

Screw in the screws, connect the connectors.

Light the lights?

NO, wait.

Since the lid is removable and I was probably going to remove it many times while performing future code improvements, I wanted to secure the OLED cables against breaking off. Even though I'm not a big fan of hot glue, I decided it was the time and place to use it. Another place was the OLED itself. Hot-glueing it into place was the easiest solution.

Step 18: Alarm in Use

Just look at the pictures to see every mode described earlied together with the code:

  1. Standby
  2. Details
  3. Set ALARM
  4. Set RTC
  5. Dark mode (DOT)
  6. ALARM!

Yup, the lid has been scratched a bit when I've been making the rectangular opening.

Step 19: Final Results and Thoughts

I like it.

First Time Author Contest

Participated in the
First Time Author Contest

Be the First to Share

    Recommendations

    • DIY Summer Camp Contest

      DIY Summer Camp Contest
    • Maps Challenge

      Maps Challenge
    • Metal Contest

      Metal Contest

    2 Comments

    0
    seamster
    seamster

    1 year ago

    Clever work, and a very detailed presentation of your project. Nicely done!

    0
    wuwuer3
    wuwuer3

    Reply 1 year ago

    Thanks! I'm working on some more details in this very moment! :)