Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Custom Lamp Help

  1. #1
    Senior Member
    Join Date
    Jul 2014
    Posts
    124

    Custom Lamp Help

    Hi, I am building a lamp that has a picture of the moon on the front but is back-lit by WS2812 LEDs. I would like the back lights to reflect the current phase of the moon every night. I have done other projects so I know I can control the LEDs with the Teensy, my problem is figuring out how best to tell the Teensy what the current phase of the moon is.

    I will be connecting the lamp to a wall outlet that is controlled by a wall switch in the bedroom so reducing lag time between flipping the switch and seeing the LEDs is important. I am also trying to make this consume as little extra power as possible so I am trying to avoid hooking it up to a big computer or something (I try to be as green as possible).

    It would also be cool if I could change the LED colors or pattern remotely with my phone.

    All ideas are welcome!

    Click image for larger version. 

Name:	moon.png 
Views:	2 
Size:	22.1 KB 
ID:	25020

  2. #2
    I've seen sites that show how to calculate the phase based on a data. Some methods are better than others. Then get your RTC working on the Teensy and add a battery back up connected to VBAT. Set the clock, create the equation based on data, and all should work. I guess--never tried it.

    Several ways to change the color pattern via the phone 1) could be done by adding a bluetooth module and have phone send data through bluetooth. MIT appinventor can help you create such app (not sure if it supports iPhone). 2) connect an internet module to your Teensy and connect to your internet and act as a server, then have Teensy create a web page so any device connected to your home internet could control the page. Either are a bit involved unless you know your way around getting free libs to work. I've done both methods here to turn lights on/off.

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    124
    Thanks @KrisKasprzak! I have never tried to use my Teensy to create a webpage but maybe that is the way to go. I am a bit of a novice so any hardware advice or code snippets you have would be greatly appreciated. For now, I am firing up the Google machine to try and figure it out.

  4. #4
    Member
    Join Date
    Aug 2018
    Location
    Brisbane, Australia
    Posts
    52
    If your RTC has the current date, then you can easily translate this description into code to get the current moon phase
    https://en.wikipedia.org/wiki/Lunar_...culating_phase

  5. #5
    Senior Member
    Join Date
    Jul 2014
    Posts
    124
    Thanks @thebigg I was not aware that the teensy had an RTC but I will figure out how to use that too

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,146
    Not indicated which Teensy? T_3.2 does if a crystal is added, and T_3.5 and later have working RTC onboard without an added crystal.

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    124
    I have a bunch of Teensys lying around. I probably have a spare 3.2 I can use for this one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •