This project adds wireless functionality and an Arduino Pro-Mini compatible microntroller to an Ikea Molgan LED light with motion sensor.
The project consists of a custom PCB, which is mounted on top of the original Molgan PCB. I had the custom PCB produced in white, to prevent it from being visible trhough the semi-transparent cover of the Molgan.
To keep the PCB small, it is built with SMD components and thus requires quite some soldering skills to put it all together! Start by mounting the ATmega328, followed by the other SMD components. The headers are the only through-hole components used, but the bottom of the resulting add-on PCB should be as flat as possible. I used a wire clipper to clip the ends off the headers before mounting them, as shown in the following picture (bottom image is after clipping).
Try to insert them without extending below the bottom of the PCB. Next picture from the side shows how flat it can be.
Finish by soldering the nRF24L01+ SMD module.
Remove the top cover by carefully prying something flat between the bottom and top cover. Work your way around carefully, without damaging the enclosure. The Molgan's I opened were all glued together with some double sticky tape which makes them harder to open. With the top cover removed the PCB reveals itself.
Remove the two screws and the blobs of solder als the + and - connection, which connect the PCB to the battery compartiment. Flip over the PCB.
Now decide if you want to keep the (partial) LED function of the Molgan, or if you turn it into a wireless motion sensor only:
Solder a small wire to the right pad of R17, which will signal the add-on PCB that motion has been detected. Make it about as long as on the next picture.
Remove the light sensor on the front (marked 'cds') or the sensor will only detect motion in the dark. I also replaced R11 by a 120 ohms resistor, to decrease the retrigger time of the PIR to less than a second.
Now drill a small hole next to the battery spring, close to the mounting screw and solder a small wire to the spring base. Use a knife to scratch the surface of the metal a bit or the solder won't stick to it.
Place the Molgan PCB back into the bottom enclosure and fasten only the left screw. Align the add-on PCB on top of the Molgan PCB, as shown in the picture.
Solder the new power connection from the battery compartment to the + connection of the add-on PCB. Connect the - on the add-on PCB to the - on the Molgan PCB (I used a small piece of solder wick). Restore both connections to the batteries.
This step is required when you acquired a bare ATmega, without Arduino bootlader. I won't go into details how to do this, as the internet is full of guides, e.g. using an Arduino.
Connect the ISP to the add-on PCB, put some batteries in the Molgan and flash the default Pro-Mini bootloader (called 'ATmegaBOOT_168_atmega328_pro_8MHz.hex') which is part of the Arduino IDE, or can be found here.
Set the fuses to
Remove the batteries and connect a standard FTDI serial cable (the ones used to program an Arduino Pro-Mini) to the FTDI connector of the add-on PCB. Replace the batteries and plug the FTDI cable in your PC.
Start the Arduino IDE and load the sketch. Change target board to 'Arduino Pro or Pro Mini' and set processor to 'ATmeag328 (3.3V, 8MHz)'.
The sketch will sleep until woken by a motion trigger from the Molgan, or wake up once every 24 hours to check battery level. It will send a V_TRIPPED message to the gateway and measures the battery level. For this it uses my Vcc library, whcih should be installed in the IDE. After a short blind time (set to 30 sec default) the motion sensor is sensitive to triggers again. This blind time prevents the motion sensor from spamming the gateway with tripped-messages. This time can also be set in hardware (by resistor R11), but software allows for easier tweaking.
The onboard LED is used as a Tx indication by the MySensors library.
Tune the sketch to your liking and upload the sketch.
|Qty||Value||Device||Package||Parts||Description||Source||Price (Ex. VAT)||Total (Ex. VAT)|
|1||LEDCHIPLED_0805||CHIPLED_0805||L1||Yellow, SMD, 2mm x 1.25mm (0805), 20 mA, 2 V, 590 nm||Farnell: 8529914||€ 0,22||€ 0,22|
|1||M06SIP||1X06||FTDI||Header 6x1 (FTDI)||AliExpress||€ 0,01||€ 0,01|
|1||1.8V||DIODESOD-123||SOD-123||D1||Zener 1.8V, 500mW, 5%||Farnell: 1858631||€ 0,28||€ 0,28|
|4||100nF||C-EUC0805||C0805||C1, C2, C3, C4||C1 Optional, 10%, X7R, 50V||Farnell: 2496944||€ 0,01||€ 0,06|
|3||10k||R-EU_R0805||R0805||R2, R3, R5||R2 Optional, 100mW, 1%, 150V||Farnell: 9332391||€ 0,00||€ 0,01|
|1||1k||R-EU_R0805||R0805||R1||100mW, 1%, 150V||Farnell: 9332383||€ 0,00||€ 0,00|
|1||56||R-EU_R0805||R0805||R4||125mW, 1%, 150V||Farnell: 2447689||€ 0,01||€ 0,01|
|1||AVR-ISP-6||ISP||Header 3x2 (ISP)||AliExpress||€ 0,01||€ 0,01|
|1||MEGA328P-AU||MEGA48/88/168-AU||TQFP32-08||U2||Farnell: 1715486||€ 2,73||€ 2,73|
|1||WIRELESS-NRF24L01SMD2||WIRELESS-NRF24L01-SMD-2||NRF24L01+||2.4 GHz Wireless Module based on NRF24L01 chip||AliExpress||€ 1,00||€ 1,00|
|1||PCB||DirtyPcbs.com||€ 1,12||€ 1,12|
|rev1||4 years ago||2||28 × 35|