Close
0%
0%

Gem Lamp

Origami enclosed smart lamp

ariAri
Similar projects worth following
I really enjoy to make origami figures and to play with led lights, One night that I couldn't sleep and was making a smol lamp to draw. Got the idea to use a diamond origami as shade and I absolutely loved how it look
From there I started to build up the idea to make it use a micro controller and be IoT

Powered  by an ESP32 Feather makes it able to be used as an IoT device. The main functions this lamp will have are:

  • Showing different patterns according to notifications I receive.
  • Mood light that by using animations creates different effects. (Fire, Magic Gem, Breathing)
  • Night light that will shine automatically when I enter the room to draw when I can't sleep.

All this controlled from cellphone or a web browser. Coded using Platform.io IDE (I recently discovered it and I love it) using Arduino and Adafruit libraries for the most part.

Milestone 1 - Showing different patterns according to notifications I receive
The design requirements to accomplish this are:

  • Micro controller having a public IP address.
  • A service that handles the HTTP requests from web pages notifications and forwards them to the ESP32. [Pipedream]
  • Creating different animations to identify each of the notifications.

Milestone 2 - Moonlight

This one is fairly simple. I will create several simple animations and the micro controller will display them after receiving the client instruction. In case it receives a notification while displaying a "permanent" animation. It will save on which animation it was on, display the notification patter and resume with the animation it was on afterwards.

Milestone 3 - Night Light

By grabbing the time from WiFi the lamp will tell when to start running this code. If it's off, and detects the Bluetooth of my cellphone on the specified time range, it will increase brightness as I get closer. Proportional to the signal strength.

  • 1 × Adafruit HUZZAH32 - ESP32 Feather Micro controller
  • 1 × Adafruit 15x7 CharliePlex FeatherWing Addressable Led Lights
  • 1 × LiPo Battery - 3.7V 400mAh The one for Feathers is nifty since you can tuck it between the two boards
  • 1 × Square sheet of paper For the shade

  • Listening to client updates while displaying animations

    Ari06/20/2021 at 23:16 0 comments

    When displaying animations on micro controller each frame is an instruction. Light these leds, now these ones, and so on.

    So I was having the problem of how to make the animation loop keep running but still listen to new commands from the client.
    After several attempts and reading the example programs more in depth I started to understand how the code works,

    The flow for receiving commands is:

    1. Client Connects
    2. Code reads what is at the ending of the client connection url
    3. Runs the code inside the respective url end
    4. Client Disconnects

    server.avaible() will listen if there is a new call to the web server running on the ESP32 board. If there is one, will leave the loop of the animation and start again the general loop where it processes the requests.
    In case the animation is too long we can make a checkpoint during the animation to abort the while loop if there's a new client

    void swirl(){
      uint8_t sweep[] = {1, 2, 3, 4, 6, 8, 10, 15, 20, 30, 40, 60, 60, 40, 30, 20, 15, 10, 8, 6, 4, 3, 2, 1};
      while(!server.available()){ //run while there is no new calls
      for (uint8_t incr = 0; incr < 24; incr++)
        for (uint8_t x = 0; x < 16; x++)
          for (uint8_t y = 0; y < 9; y++)
            matrix.drawPixel(x, y, sweep[(x + y + incr) % 24]); //display leds
      delay(20);
      }
    }

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates