Project showcase

Laura: Emotional Compass Lamp © LGPL

Compass lamp that changes color by rotating.

  • 5,052 views
  • 0 comments
  • 18 respects

Components and supplies

About this project

Laura

Laura is a "counseling" lamp who is helping me to find myself and to understand where I want to go. For her great help, I wanted to give her a present that represents the work we are doing.

The inspiration came from the need to find my street, and not get lost in the various paths that life presents you. From this, I have devised a "compass / lamp" that, in addition to helping you keep the "direction," illuminates the path.

The Compass

The "compass" does not have cardinal points, because the "right" direction, you have to decide for yourself! She tells you only if you're following the path that you have chosen.

Changing Colors

By turning the lamp, you change color by giving different emotions each time. If for some reason you stop, you can activate the "rainbow" cycle, a continuous series of color shades of red, blue, and green.

The Neopixel

Additional Parts

The electronic construction is very simple; Arduino, LED Neopixel matrix, magnetometer, and a switch.

The magnetometer (HMC5883) connected to the Arduino pin A4 and A5 (Protocol I2c), through the "Adafruit_HMC5883_U.h" library, provides the magnetic intensity of the xy axes. The formula headingyx = atan2 (event.magnetic.x, event .magnetic.y) provides the angle of declination.

The Neopixel LED, connected to pin 9, lights up in a different color, depending on the angle of declination. The switch, connected to pin 8, using the internal pull-up, allows the lamp to change program type (Compass - Rainbow).

Lamp Construction

The hardest part for me was to build the lamp box. The base is a box made of plywood, while the shell is made of opal plexiglass square, glued with cyanoacrylate. For more portability I also added a "Power Bank" battery for mobile phones.

Arduino Libraries:

  • Wire.h: by Arduino IDE

Code:

Most of the code was taken from the examples of the libraries, while the heart of the color change of the compass is:

int headingDegreesyx = headingyx * 180/M_PI;  
  if (headingDegreesyx >= 0 && headingDegreesyx<90) 
  { 
   ResultR = map(headingDegreesyx,0,90,0,255); 
   ResultG = map(headingDegreesyx,0,90,255,0);  
   ResultB = 0; 
   } 
   else if (headingDegreesyx >= 90 && headingDegreesyx<180) 
  { 
   ResultR = map(headingDegreesyx, 90, 180, 255, 0); 
   ResultG = 0; 
   ResultB = map(headingDegreesyx,90,180,0,255); 
  } 
   else if (headingDegreesyx >= 180 && headingDegreesyx< 270) 
  { 
   ResultR = map(headingDegreesyx,180,270,0,255); 
   ResultG = 0;  
   ResultB = map(headingDegreesyx,180,270,255,0); 
  } 
    else if (headingDegreesyx >= 270 && headingDegreesyx<=360) 
  { 
   ResultR = map(headingDegreesyx,270,360,255,0); 
   ResultG = map(headingDegreesyx,270,360,0,255);  
   ResultB = 0; 
  } 

Every 90 degrees, the 3 colors, red, green, and blue, behave differently, in proportion to the magnetic declination. The first passes from 0 to the highest brightness map(headingDegreesyx, 0,90,0,255); the second, from maximum brightness to 0 map(headingDegreesyx,0,90,255,0); while the third is off.

The next 90 degrees, the one that was off, ranges from 0 to 255, the one at 255 goes to 0 and the other is off, etc.

The rainbow cycle was taken from: https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/, which I also used the "Bright Ball IoT".

Schematics

Electric Scheme
Laura schema i899vrnnk1
Fritzing Image
Laura bb iegbheeecs
Fritzing Scheme
laura_WamXuQXq3s.fzz
Scheme PCB Arduino Standalone
Pcb ebu8cpuvq2
Arduino Standalone
P5020013 eic3esyrbw
Neopixel Matrix
P5020016 0z8jn6tlfk

Code

Laura

Comments

Similar projects you might like

Online Attendance System (Without Ethernet)

Project tutorial by gadgetprogrammer

  • 675 views
  • 5 comments
  • 9 respects

Windows PC Lock/Unlock Using RFID

Project tutorial by Prasanth K S

  • 7,120 views
  • 6 comments
  • 31 respects

Arduino Keyboard

Project in progress by Gabriele Scordamaglia

  • 594 views
  • 6 comments
  • 5 respects

Makers (Cubecon) #1 Infrared Transmit & Infrared Receive

Project in progress by Alpha

  • 198 views
  • 0 comments
  • 4 respects
Add projectSign up / Login