Moon Lamp

by MagnetLampCreator in Workshop > Laser Cutting

139 Views, 1 Favorites, 0 Comments

Moon Lamp

IMG_3247.jpg

Introducing the Moon Lamp, an engaging project that reimagines the lamp not just as a light source but as a conversation starter.

This lamp isn't your average room accessory; it's a statement piece using magnets for an eye-catching display. This project is ideal for anyone interested in creating a super dope room accessory. Whether it's sitting on your nightstand or in your living room, the Moon Lamp is designed to be a flashy, fun project.

With components that are straightforward to assemble, the project is accessible to makers of all skill levels.

Thank you to Ms. Berbawy and Berbawy Makers for facilitating this work. We made it as our SIDE project in our Principles of Engineering class.

Let's get right into the building process!

Supplies

71xW3XMkbwL.jpg
64-06.jpg
download.jpg

Creating a 3D Moon

moon nd em 5.JPG
moon nd em 4.JPG
FWDXK63LTYDXN61.jpg
IMG_1497-preview.jpg
print.jpeg

Insight

We decided to 3D print our moon because we could choose the exact color that matched our box. We ended up choosing Prusament Galaxy Silver.

CAD/Design Process

  1. We started by mapping out the desired dimensions for the moon. Then, we created a project in Fusion 360.
  2. Using the sketch tool, we drew a 2D crescent shape that fit the desired dimensions and accounted for wiring.
  3. Next, we used the extrude tool to convert the crescent into a solid with 1 inch of thickness.
  4. Using the construction tool, we created a midplane to cut the crescent in half vertically.
  5. We then used this plane to sketch a smaller crescent, which we extruded through the moon to create an center valley to house the LEDs.
  6. On the base of the moon, we created a hole that allowed the power cable for the LEDs to pass through.
  7. Once the model was complete, we exported the file as an STL.
  8. Opening the STL file in Prusa Slicer, we placed the moon on its side and cut it into two parts to avoid overhang.
  9. Finally, we uploaded the sliced file to our PRUSA XL and waited for it to print.

Assembly

  1. Once the two halves were printed we used contact adhesive to attach them
  2. We used clamps to hold the halves together while the glue cured
  3. We let the glue set for 24 hours

Creating a 3D Cork & Magnet Assembly

tube.PNG
top.PNG
FBI6O7LLTYDXJ45.jpg

Purpose

We created the cork to house the magnets. The magnets had to fit with barely any tolerances in the cork so that the magnets could attract each other.

CAD/Design Process

  1. We measured the diameter of the magnets and adjusted the size of the cork to have a slightly larger diameter.
  2. Using the same dimensions of the cork we made the cap 0.05 inches thick
  3. We used the hole tool to create a hole with 0.01 inch diameter to house the string.
  4. Finally, we exported the G-code and started the print on a Original Prusa MINI+.

Assembly

  1. We put the stack of magnets inside the cork
  2. Then, we tied a knot on the small hole using the fishing wire
  3. We sealed the cork using contact adhesive

Laser Cut Box

IMG_8303-preview.jpg
FJPTR9NLTYDXJ5G.jpg

Purpose

We created this box to house the components and made it out of acrylic. We also kept a little space inside to clearly see the components.


  1. We first calculated the dimensions of the components needed inside the box
  2. We created the box with dimensions of 4 inches by 3.5 inches by 5 inches from Maker Case
  3. We created appropriate holes for direct access to the Raspberry PI HDMI port and power
  4. We set up our laser cutter and chose acrylic for the box

*Tip: Test cut the box with wood before using higher-quality materials*

The most important part was waiting to glue the top of the box until we were certain no more troubleshooting was needed.

Using LED Strip

F1LRM2QLTYDXJ6Q.jpg
led.JPG

The setup for the LED was fairly complicated because there are no native solutions for LED support on the PI, and we had to rely on a 3rd party solution. We also had to use resistors because the LED strip had a 24-volt power supply.

Here are the steps of what we did:

  1. We began by measuring and cutting 12 inches of the LED strip, making sure to count the number of individual LEDs along the strip. 
  2. Next, we soldered jumper cables onto the R, G, B, and Power sections of the LED strip, inserting the wires into the appropriate GPIO slots.
  3. We inserted three MOSFETs into the breadboard, one for each color channel. We made sure to correctly place the Gate (G), Drain (D), and Source (S) pins of each MOSFET..
  4. We connected a resistor between each GPIO pin controlling the MOSFET gates and the gates themselves. This protective measure safeguarded the Raspberry Pi and ensured the correct operation of the MOSFETs.


Testing Setup

Once everything was connected and double-checked, we started by powering up the Raspberry Pi and then the LED strip. Use a simple script to test each color channel individually and in combination to verify that everything was working as expected. We used a simple script in the command line to make sure all colors were working properly.


You can also test the colors in the command line without a Python script. The middle number references the pin number of the color getting changed. The number between 1-255 is the strength of the LED. The code using the PIOD library is below:

sudo pigpiod

pigs p 17 255
pigs p 22 128

Limit Switch Mechanism

WhatsApp Image 2024-03-19 at 4.47.08 PM.jpeg

The main mechanism powering the Magnet Lamp is the limit switch. This small component costs only $0.50, but is incredibly powerful. The switch is attached to the magnet through a string, which pulls taught when close to the other magnet. When the switch clicks because of this tension, it activates the lights.


Physical Component:

  1. We soldered a black jumper cable for ground and a red jumper cable for the terminal on the limit switch
  2. We connected jumper cables to ground and GPIO 14

Software Component:

  1. We identified GPIO pin plugged in on Raspberry PI (in our case it was GPIO 14)
  2. We then used GPIO.input(14) to receive "0"s and "1"s for the limit switch being on and off

Raspberry PI Code

codescreenshot.JPG

We used the PIGPIOD library to control the LEDs.


Steps to code LED strip:

  • We started by installing all needed libraries:
sudo apt-get install build-essential unzip wget
wget http://abyz.me.uk/rpi/pigpio/pigpio.zip && unzip pigpio.zip && cd PIGPIO && sudo make install
  • We identified GPIO pins each LED color is connected to. We had 3 in total for RGB
  • We used the PIGPIOD library in the terminal to test the LED strip (many other 3rd party solutions)
sudo pigpiod

pigs p 17 255
pigs p 22 128
pigs p 24 128
  • We wrote the code to control the LEDs in Python
import pigpio
pi = pigpio.pi()
pi.set_PWM_dutycycle(PIN1, BRIGHTNESS)
pi.set_PWM_dutycycle(PIN2, BRIGHTNESS)
pi.set_PWM_dutycycle(PIN3, BRIGHTNESS)

pi.stop()


We had to initialize the PIGPIOD every time the Raspberry PI was rebooted. We streamlined this process by creating a launcher script to run on startup.

Conclusion

Moon Lamp Demo Video

We learned a lot of things about the Raspberry PI through this project. This was also our first experience with LED strips and breadboards. Through this project, we learned more about resistors, which was good experience since we had only ever done theoretical calculations via word problems.


Thanks for reading our Instructable! We hope your room looks as great as our room does with this added accessory!