My project is to design a smart lantern which will work when it come dark.
I care about this because I love to combined between decorate and technology in the same time. Also we have one week for Ramadan so I thought it will be good if I designed something relate to the culture of this holy month.
My main source of inspiration in terms of the idea was our old use of the traditional lantern in Ramadan month, also I get inspired the design from a YouTube video .
I used the Fusion 360 to design from scratch on sketches and saved it as a DXF file to develop it on RD works software .and the project was divided into several parts...
For the first part , I drew the parts of the lantern, I drew the upper and lower part and the connections, then I made sure that the drawing was valid by extruding and assembly options.
Face2 of the lantern (for two sides)
The design for face 1 fully defined
The design for face 2 (for two sides) fully defined
The upper part of the lantern (first part)
The design for face 1 (for two sides)
The top of lantern
The base of lantern (upper part)
The upper part of the lantern (second part)
Left side part(down part )
The upper part of the lantern (second part) fully defined.
The upper part of the lantern (first part) fully defined.
The base of lantern (upper part) fully defined
Front and back side base (down part)
In the second part, I drew the Components enclosure and import the components from GRABCAD to assemble it and make the final sketches with screws holes.
lantern after add Arduino
Simplified the lantern after join all parts
Lantern after added the appearance (cherry)
First , after I finished the design in Fusion 360 ,I export it as DXF then import the parts on RD Works to prepare the parts for fabrication .
Second, I downloaded an Islamic shape from 3axis to decorate my design with .
The dxf Islamic design
In the third part, I imported the lantern's parts and the Islamic design in RD works, then started to resize the Islamic shape, delete some unneeded parts, added a circle around the shape to be able to cut the parts inside and centered the shape inside my lantern parts.
The lantern parts after uploaded in RD works and inserted the Islamic design
The simulation in RD works to see how the design will look like after cutting.
Machines:
Malky Design CNC Machines Laser Cut Machine.
Materials:
Plywood 3mm, it's suitable material for the lamp cover and components enclosure.
screw and nuts, to join the parts.
Tools:
Screwdriver to join the screws and nuts.
Wood file to adjust the measurements after implementation.
Sandpaper to smooth the surface and remove the effect of the laser beam.
This circuit contains 4 LED strips, and one LDR light sensor, and these are the main components to perform the lamp's function. Once the light sensor senses a low light intensity the LED strip lights up.
I connected each LED with negative and positive on the breadborad and one to the pins(3,4,5and 6).
I the connect LDR to negative and positive of the breadboard and one for pin 7.
and wrote the code if the LDR =low light ,the LEDs with turn on.
also I added a switch to my circuit to open and close the circuit ,as I connect the switch with DC connector .
The positive wire of Dc connector to VIN in Arduino and the negative wire to the negative wire of switch and the second wire of switch on the negative on breadboard.
Neopixel strip 8 :
neopixel strip has 4 pins but I needed to use only 3 pins ,
Connected the GND pin to the ground on the breadboard
Connected the VDC with positive in breadboard
Connected the DIN with digital pin in Arduino
The input components:
LDR Sensor: to sense the intensity of light, if it lows the lamp turns on
On/off switch: to turn on the circuit.
The output components:
4 LEDs Strip: the main lighting unit.
Other components:
Arduino Uno Board: for controlling the electronic circuit.
Breadboard: to connect the GND and VCC wires.
power jack female: to receive power from the electrical source.
I used the 9V adapter for powering the lamp as I test it and worked good with the 4 LEDs
I added a switch to my circuit to open and close the circuit ,as I connect the switch with DC connector .
The positive wire of Dc connector to VIN in Arduino and the negative wire to the negative wire of switch and the second wire of switch on the negative on breadboard.
I connected the Dc connector with power adapter of 9V to turn on\off the circits.
First I downloaded the library "Adafruit NeoPixel" library , I started to change some codes like :
The LED in this library was giving a green light ,so I changed the pixels colors to (150,150,150) to give me the white light .
Also there is a delay 500 before next pass through loop,I changed by removing the delay.
Also the library was for one LED strip ,I added 3 other codes for the 3 other LEDs by the pens for each LED ,and gave the "pixels" numbers
Adafruit_NeoPixel pixels1(NUMPIXELS1, PIN1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels2(NUMPIXELS2, PIN2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels3(NUMPIXELS3, PIN3, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels4(NUMPIXELS4, PIN4, NEO_GRB + NEO_KHZ800);
Finally I defined LDR as value
I defined the 4 LEDs in pins 3,4,5and 6 with pin1 , pin2 , pin3 and pin4.
#define PIN1 6
#define PIN2 5
#define PIN3 4
#define PIN4 3
I defined LDR with pin 7.
#define ldr 7
I defined the number of pixels in each LED which is 8.
#define NUMPIXELS4 8
#define NUMPIXELS1 8
#define NUMPIXELS2 8
#define NUMPIXELS3 8
Then wrote the code :if the LDR = low light pixels1, pixels2, pixels3,and pixels 4 begins.
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
pinMode(ldr, INPUT);
pixels1.begin();
pixels2.begin();
pixels3.begin();
pixels4.begin();
Serial.begin(9600);
I set the pixels color to (150,150,150) for the wight color.
pixels1.setPixelColor(i, pixels1.Color(150, 150, 150));
If LDR = high light the pixels will turn off .
else
{
for(int i=0; i<NUMPIXELS4; i++) {
pixels4.setPixelColor(i, pixels4.Color(0, 0, 0));
pixels4.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels3.setPixelColor(i, pixels3.Color(0, 0, 0));
pixels3.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels2.setPixelColor(i, pixels2.Color(0, 0, 0));
pixels2.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels1.setPixelColor(i, pixels1.Color(0, 0, 0));
pixels1.show();
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
int ldr_value;
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN1 6
#define PIN2 5
#define PIN3 4
#define PIN4 3
#define ldr 7
// On Trinket or Gemma, suggest changing this to 1
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS4 8
#define NUMPIXELS1 8
#define NUMPIXELS2 8
#define NUMPIXELS3 8 // Popular NeoPixel ring size
// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels1(NUMPIXELS1, PIN1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels2(NUMPIXELS2, PIN2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels3(NUMPIXELS3, PIN3, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels4(NUMPIXELS4, PIN4, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels
void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.
pinMode(ldr, INPUT);
pixels1.begin();
pixels2.begin();
pixels3.begin();
pixels4.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
Serial.begin(9600);
}
void loop() {
Serial.println(digitalRead(ldr));
pixels1.clear();
pixels2.clear();
pixels3.clear();
pixels4.clear(); // Set all pixel colors to 'off'
// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
ldr_value=digitalRead(ldr); // Read the data from digital pin 12 and store in LDR_value
if (ldr_value==HIGH) //if LDR_value value is low that means its dark outside so LED should be turn on
{
for(int i=0; i<NUMPIXELS1; i++) {
pixels1.setPixelColor(i, pixels1.Color(150, 150, 150));
pixels1.show();
}
for(int i=0; i<NUMPIXELS2; i++) {
pixels2.setPixelColor(i, pixels2.Color(150, 150, 150));
pixels2.show();
}
for(int i=0; i<NUMPIXELS3; i++) {
pixels3.setPixelColor(i, pixels3.Color(150, 150, 150));
pixels3.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels4.setPixelColor(i, pixels4.Color(150, 150, 150));
pixels4.show();
}
}
else
{
for(int i=0; i<NUMPIXELS4; i++) {
pixels4.setPixelColor(i, pixels4.Color(0, 0, 0));
pixels4.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels3.setPixelColor(i, pixels3.Color(0, 0, 0));
pixels3.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels2.setPixelColor(i, pixels2.Color(0, 0, 0));
pixels2.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels1.setPixelColor(i, pixels1.Color(0, 0, 0));
pixels1.show();
}
}
}
First, I assembled the parts of the enclosure with screws and nuts and assembled the electronic components inside it, and connected the wires, then I assembled the upper cover of the lamp and installed the coupling with screws and then tested the code before the final assembly.
I used T-slot and captive nut to attach all lantern's parts together
I used the screw to attach the door ,also make 4 holes for the 4 LEDs
Also I used the alignment slots in two faces in the down part + the T-slot an captives nuts with the other two faces .
Also, I made 5 holes:
2 for the Arduino power source and USB cable
2 for LDR sensor
1 for Knob as (complete feature)
I made 4 holes in the base to fix the Arduino .
In the other side of the base ,I made 2 holes ,one for the switch and the other one for the PC connector
I always ask for feedback from my instructor and my peers , especially Israa.
Israa advised me to give the power to my circuits through connector instead of powering from Arduino .
Ibrahim and Israa helped specially in coding part .Also I finished my design and fabrication early so I started helping my peers in their projects.
Also a lot of my peers kept asking me about the Islamic design in my lantern and helped them to added to their design with shapes suitable for their designs .
When I added the Adamfruit library the coding was for one LED strip I tried to add the other LEDs but it didn't work ,
I asked Ibrahim and told me that I have to number each pixel separately, and it worked finally.
Serial.println(digitalRead(ldr));
pixels1.clear();
pixels2.clear();
pixels3.clear();
pixels4.clear();
ldr_value=digitalRead(ldr);
if (ldr_value==HIGH)
for(int i=0; i<NUMPIXELS1; i++) {
pixels1.setPixelColor(i, pixels1.Color(150, 150, 150));
pixels1.show();
}
for(int i=0; i<NUMPIXELS2; i++) {
pixels2.setPixelColor(i, pixels2.Color(150, 150, 150));
pixels2.show();
}
for(int i=0; i<NUMPIXELS3; i++) {
pixels3.setPixelColor(i, pixels3.Color(150, 150, 150));
pixels3.show();
}
for(int i=0; i<NUMPIXELS4; i++) {
pixels4.setPixelColor(i, pixels4.Color(150, 150, 150));
pixels4.show();
I would add some other tools and coding in my design, as I would add :
Servo motor to open the Lantern door by distance sensor.
Also I would add an LCD to write :Ramadan Karim"