Smart Ceiling Lamp

This is my first instructables!

Here I will try to show a project that can make the lighting in your room interesting!

The project was designed using Fusion360, to get a design idea; the design chosen is quite strange.

The project expected to achieve these requirements:

  1. -LED lighting
  2. -LEDs driven in constant current; 0 flicker!
  3. -High efficiency >150 lumen/watt
  4. -Management by Smartphone and buttons on the wall
  5. -Possibility of dimming
  6. -Direct+indirect lighting (I love indirect light)
  7. -Economical wood base
  8. -All special parts designed with Fusion360 and printed in 3d

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Step 1 : Designing Ideas in Fusion360

The first step was to draw ideas using the Fusion360 program;

I've been using fusion360 for about 2 years for my 3d printing projects; it's a fantastic program because it's quite easy to learn how to use it, I certainly don't know how to draw very well; but I'll try!

The drawing has been made using real dimensions, to have an immediate idea of the size of the overall dimensions of all parts, this approach allows you to have better control over your project and choose how to achieve it during the process.

You don't have to worry about drawing everything perfect, but initially give shape to ideas;

Initially I had designed the 80mm holes but I realized after that the cutter I had available was about 73mm; no problem, Fusion360 is a parametric software and allows you to change the size without compromising your work.

As you will see later on the initial drawing were drawn the LEDs with a positioning, at the end was changed the position.

Step 2: Step 2 : Nice Design, But How Do I Make It?

At some point the first problem... how to cut a board with a similar design, with a jigsaw ?

Still using fusion I thought that I could print many parts of the design, in A4 format and put them together!

From the drawing, the board must have a size of 1200*600

So I created a scketches with many spaces 290*180 to cover the whole design; I cut the design with the split function creating so many parts of printable size;

Through the drawing function I put all the pieces on the table, generating a pdf of 21 pages!

the 21 pages were printed and put together with ribbon, so as to bring the mask on the wood.

Then patiently the table was cut easily!

It would be nice to know if there is a simpler function in fusion to export a large drawing in several parts... let's hope for a future function!

You need these tools to do this:

- Drill

- Cup for 73mm hole

- Cup for 35mm hole

- Wooden chisel

- Jigsaw

The holes that accommodate the diffuser for the LEDs that are printed in 3D are ~10mm deep
the 35mm holes that hold the LED heat sinks must be arranged with the wood chisel to fit them together.

I add all the .stl files of the project
and the .F3D files that can be imported into fusion360

There are .pdf files with the dimensions of the components to be printed, and the dimensions used for the hole in the wood.

Step 3: Step 3: How to Make It Smart?

The project foresees that the chandelier can be controlled by blynk apps for smartphones, and by 2 buttons on the wall.

The controls to drive the chandelier from the blynk app are 3:

-On or off (also with timer)

-Change of brightness

-Deactivation or activation of the LEDs installed at the bottom. To have only indirect light bouncing from the ceiling.

There are 2 controls on the wall:

-Button for on/off control

-Button for changing brightness

to improve the chandelier and make it more "smart", a DHT22 sensor has been inserted to control the temperature and humidity of the room.

During the connection time of the esp, (about 5-8 seconds) it is not possible to manage the buttons on the wall; if the connection to the server is not established, a timer of 30sec is activated that allows to use the buttons on the esp. After connection the buttons can be used at any time without interruption.

--------------------------------------

Inside the code there is the setup of the pins used on ESP8266 and on Blynk app, if you want to easily rebuild the interface yourself; otherwise you might be able to clone the app from QRCODE that I attach; to have full functions maybe you have to buy some energy;

Connect esp8266 to your computer and upload the attached code; (to use ESP with sw arduino look for hundreds of tutorials online)

I wanted to make the project clean, so after trying some testing on a prototyping board I drew the wiring diagram on the EasyEDA site, then there is the possibility to order directly from the pcb editor the plates from the site https://jlcpcb.com; with a cost of $ 10 with fast shipping!

Project :

https://easyeda.com/antonino.dattola/led-lamp

When the pcb arrives, solder everything, it should be very simple, they are all components easy to solder.

I insert the boom file of all components used and the relative cost

-----------------------

Subsequently, after having realized the pcb, with the dimensions in possession has been designed a simple box in fusion360 to contain all the electronics.

The most difficult part was to realize the dimming management system for the meanwell power supply both from the app and from the external button; in the end a simple solution was found that can be used on many other projects; using a 4n35 phototransistor with a negligible cost, the 0-10V power supply output is used and with pwm output on the phototransistor the input range to the power supply is changed!

In the future it is possible to make the chandelier smarter; I think of a motion sensor; a neopixel ring to create a minimum of atmosphere of different colors;

/*
The project foresees that the chandelier can be controlled by blynk apps for smartphones, and by 2 buttons on the wall.

The controls to drive the chandelier from the blynk app are 3: -On or off (also with timer) -Change of brightness -Deactivation or activation of the LEDs installed at the bottom. To have only indirect light bouncing from the ceiling.

There are 2 controls on the wall:

-Button for on/off control -Button for changing brightness

to improve the chandelier and make it more "smart", a DHT22 sensor has been inserted to control the temperature and humidity of the room.

During the connection time of the esp, (about 5-8 seconds) it is not possible to manage the buttons on the wall; if the connection to the server is not established, a timer of 30sec is activated that allows to use the buttons on the esp.

-------------------------------------------------------

USE PIN ESP8266: PIN D1 - OUTPUT PWM OPTOISOLATOR 4N35 "PIN 1" PIN D2 - NOT USE PIN D3 - NOT USE PIN D4 - OUTPUT Relay led down ON/OFF PIN D5 - INPUT Pushbutton DIMMER (pulldown 10kohm) PIN D6 - OUTPUT Relay ON/OFF ALIM MEANWELL PIN D7 - INPUT SENSOR DHT22 PIN D8 - INPUT Pushbutton ON/OFF (pulldown 10Kohm) USE PIN APP_Blynk: V1 = RSSI Widget wifi power (GAUGE) V2 = ON-OFF Widget ALIM LED_Sync pushbutton D8 (BUTTON) V5 = Temperature DHT22 (GAUGE) V6 = Humidity DHT22 (GAUGE) V7 = Connection status ESP8266 D2 = Relay led down ON/OFF (BUTTON) */

#include #include #define BLYNK_PRINT Serial #include

#define VPIN V2 #define VPIN1 V1 #define DHTPIN D7 #define DHTTYPE DHT22

WidgetLED led1(V7); //connection status led widget

char auth[] = "xxxxxxxxxxxx"; //token blink app char ssid[] = "xxxxxxxxxx"; //ssid wifi char pass[] = "xxxxxxx"; //password wifi //char server[] = "xxx.xxx.xxx.xxx"; // IP for Local Cloud Server char server[] = "blynk-cloud.com"; // URL for Blynk Cloud Server int port = 80;

int DeviceLED = 2; //led onboard esp int ReCnctFlag; // Reconnection Flag int ReCnctCount = 0; // Reconnection counter

float h; //dht22 float t; //dht22

BlynkTimer timer; DHT dht(DHTPIN, DHTTYPE);

void lightOn(); void lightOff();

boolean LampState = 0; boolean SwitchReset = true;

const int PULSANTE_EXT = D8; const int ALIM = D6;

const int BUTTON_DIMMER = D5; const int LED = D1;

//---------------setup dimmer button------------

int dir = 70; //step dimmer +e- int lum = 0; boolean toggle = false;

//-----------------------------------------------

void setup() { Serial.begin(115000); pinMode(2, OUTPUT); //led board esp pinMode(D2, OUTPUT);// Relay led down ON/OFF pinMode(ALIM, OUTPUT); pinMode(PULSANTE_EXT, INPUT); pinMode(BUTTON_DIMMER, INPUT); pinMode(LED, OUTPUT); delay(10); digitalWrite(ALIM, HIGH); digitalWrite(2, HIGH); //spegni led ESP digitalWrite(D2, HIGH); // relay led down 0 WiFi.begin(ssid, pass); // Non-blocking if no WiFi available Blynk.config(auth, server, port); Blynk.connect(); timer.setInterval(300L, ButtonCheck); //ciclo button on/off timer.setInterval(450L, dimmerled); // ciclo dimmerled timer.setInterval(8000L, myTimerEvent); //dht22 8sec timer.setInterval(2100L, rssi); //rssi power wifi timer.setInterval(1000L, blinkLedWidget); // //Blynk.syncVirtual(V2); //sync app blynk pin V2 dht.begin(); Serial.println("DHT22 Blynk ready !!!"); }

BLYNK_CONNECTED() { Serial.println("Connected"); ReCnctCount = 0; } //----------------------------------------------------------------------------------------------------- void loop() { timer.run();

if (Blynk.connected()) { // If connected run as normal Blynk.run(); } else if (ReCnctFlag == 0) { // If NOT connected and not already trying to reconnect, set timer to try to reconnect in 30 seconds ReCnctFlag = 1; // Set reconnection Flag Serial.println("Starting reconnection timer in 30 seconds..."); timer.setTimeout(30000L, []() { // Lambda Reconnection Timer Function ReCnctFlag = 0; // Reset reconnection Flag ReCnctCount++; // Increment reconnection Counter Serial.print("Attempting reconnection #"); Serial.println(ReCnctCount); Blynk.connect(); // Try to reconnect to the server //Blynk.syncVirtual(V2); }); } }

//-----------------------------------------------Button ON/OFF------------------------------------------

void ButtonCheck() { boolean SwitchState = (digitalRead(PULSANTE_EXT)); Blynk.virtualWrite(V2,LampState); //Aggiorna il widget blynk on/off sincronizzato con pulsante ext if (!SwitchState && SwitchReset == true) { if (LampState) { lightOff(); } else { lightOn(); } SwitchReset = false; delay(50); } else if (SwitchState) { SwitchReset = true; } } void ToggleRelay() { LampState = !LampState; if (LampState) { lightOn(); } else lightOff(); } void lightOn() { digitalWrite(ALIM, LOW); LampState = 1; } void lightOff() { digitalWrite(ALIM, HIGH); LampState = 0; }

//---------------------------------------DIMMER LED BUTTON-------------------------------------

void dimmerled() { if (digitalRead(BUTTON_DIMMER) == HIGH) { toggle = true; lum += dir; if ((lum >= 0) && (lum < 840)) analogWrite(LED, lum); delay(20); } else { // toggle direction if (toggle) { dir = -1 * dir; toggle = false; } } }

BLYNK_WRITE(VPIN) { int SwitchStatus = param.asInt(); if (SwitchStatus == 2){ ToggleRelay(); } else if (SwitchStatus){ lightOn(); } else lightOff(); }

//-------------------------------------DHT22---------------------------------------------------- void myTimerEvent() { getData(); Blynk.virtualWrite(V5, t);//Temp for widget blynk Blynk.virtualWrite(V6, h);//humidity for widget blynk } void getData() { h = dht.readHumidity(); t = (dht.readTemperature()); if (isnan(h) || isnan(t)) { Serial.println("Failed to read from DHT sensor!"); return; } Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.print(t); Serial.println(" *C "); }

//-------------widget rssi wifi-------------------- void rssi() {

Blynk.virtualWrite(V1, WiFi.RSSI()); //Signal strengt wifi

}

//-----------widget vitality esp connect----------- void blinkLedWidget() { if (led1.getValue()) { led1.off(); //Serial.println("LED on V1: off"); } else { led1.on(); //Serial.println("LED on V1: on"); } }

Step 4: Step 4 : We Create a Case for the Pcb With Fusion360

- From the EasyEDA program we import the PCB in .svg format

- In Fusion360 we click on Insert>Insert svg

Now we have the exact dimensions of our PCB and we can draw our box. This mode is convenient because it allows you to see the predisposition of the components and create holes/openings in the exact position.

Step 5: Step 5 : Mounting LEDs and Wiring

In the center of the heat sinks make a hole with a 2.5mm tip so as to easily tighten an M3x10 screw to hold the led to the heat sink.

After having screwed all the LEDs to the heat sinks, you can start the wiring, use the diagram otherwise it becomes difficult to make the connections.

You need these tools to do this:

-Drill

-Soldering iron

-Wire

-Hot glue

-Patience ;)

Step 6: Step 6 : Assembly and Testing

To hang the chandelier were used steel cables section 2mm, with 4 hooks to the wood and 4 dowels to the wall;

The chandelier is 40cm away from the ceiling, to have a fairly soft indirect light effect;

A video shows the interface of the app simple.

I hope that this project can be a starting point for others to create innovative chandeliers!

For the future we want to implement:

- a neopixel ring

- Control on/off from smartwhatch

Recent changes:

On the blynk app has been added a timer at 07:00 that commands the chandelier to set all strings, it may happen that in the evening you use only the upper LEDs and does not reset the functionality of all LEDs, doing so automatically.

Greetings to the whole community!

Indoor Lighting Contest

Participated in the
Indoor Lighting Contest

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Cardboard Speed Challenge

      Cardboard Speed Challenge
    • Multi-Discipline Contest

      Multi-Discipline Contest

    6 Discussions

    None
    OliverH26

    23 days ago

    This looks very smart to me. Unfortunately the youtube video says it's private. Any chance we might see it?

    1 reply
    None
    antoledOliverH26

    Reply 22 days ago

    It should work now; I forgot to change the mode!

    None
    thebigpotatoe

    22 days ago

    Awesome project! I can see how much work you had to put in to get your final product. Great PCB and very nice choice in power supply.

    1 reply
    None
    antoledthebigpotatoe

    Reply 22 days ago

    Thank you so much;
    The final product is quite satisfying! now for LED lighting I use only meanwell power supplies; really efficient and reliable, you also have the support dimmer without pwm!
    With the low price of the PCB it comes a better job to design and build it, and it is not difficult at all!
    The designed PCB can be used for other projects, the functionality of using it via smartphone is really useful when you are in bed and your system does not have buttons near!
    Thank you so much for your compliments!