Skip navigation

Enchanted Objects

14 Posts authored by: rpbruiser

Unfortunately, I was unable to create a video to show you guys how beautifully my magic lamp was working. When I asked the genie to come out and play today he instead thought to introduce me to some magic smoke, and like that he was gone (In other words, my Infineon RGB  Shield went BOOM!). But I had a blast working on this project. I have a quick, very pathetic, mock up of what the final thing would look like.



The big box around the shield and Arduino is the 3D printed container. The finished product was very simple for any user to use. You only needed to know very basic things about Arduino to get started, (I tested it on my mother). All you needed to know is how to setup the Yun to connect to your home WiFi and how to upload a sketch onto the board. After that was done, the lamp would run on its own. I started looking into possibly even preloading the sketch to the board, but didn't get too far with that. The case I printed was Ivory, and I thought about taking it further and painting it oak, or different colors that matched the surrounding environment. The LED was placed on an Edison screw in bulb, so it fit in most household lamp sockets, however, you'd have to "plug" the lamp into the shield rather than straight into the wall. It was also relatively cheap, other than the case (but I got to print it for free! ).


Arduino Yun$55.01
Infineon RGB Shield$23.90
LED Chip and Bulb$20.00
Edison Screw In$15.00


And a lot of these costs can really be lowered depending on what you have already, and whether or not you really need to use the Yun. But I feel as though this product meets the requirements. I believe that it does as intended, even though I unfortunately have no proof other than this screenshot .

I also believe, as I stated before, and my mother would agree, that it is very easy for a non technical person to use. However, the price is a little steep for a lamp, but as I stated it wouldn't be incredibly hard to adapt it some to make it much more cost effective. Also when you realize that it can also act as an alarm clock with a strobing feature at the designated time you wish to wake up, this price begins to be more realistic. And when properly cased, or placed, this would last a one a very long time, I see it as incredibly durable, well it was , but also aesthetically pleasing. I wish I had pictures and videos for you all, and I may later, but for now I believe this to be a farewell, hopefully a see you soon. I had a great time and appreciate all of you! Look forward to seeing the out come of these other projects and who is announced the winner!


Quick Update

Posted by rpbruiser Jun 16, 2015

This is just a quick update, I have created a library that will calculate the sunrise and sunset times for any location for the current day, and whether or not that location is currently in daylight savings or not. This is an update here because the library is based on the code I wrote for this project. If you would like to check it out, or us it, you can go here and find it. It has capabilities for those with or without internet access, and has been helpful to me, I hope you guys find it helpful in future, or current, projects.


The Lamp Has Been Completed

Posted by rpbruiser Jun 14, 2015

The Genie has finished his renovations and is ready to show off his new crib, unfortunately he went on vacation and will not be able to show any pictures or videos until he returns home, but he has decided to release a listing of the house for all who are interested to see the new things that he has done to his new pimped out crib. Unfortunately the code is too long to post here, and I will add a link to pastebin here. I have also created a library that does a very similar thing to what I have done in my code and you can find it on my GitHub page.


I have really enjoyed this experience, and am so glad that this amazing community has given me the chance to explore something I have a passion for. All my competitors are so helpful and friendly, and I just love the atmosphere here, so thank you to all for this amazing opportunity and I hope to see you all again in future challenges or roadtests! And stay tuned for pictures and videos to come!!


The Genie Takes A Hiatus

Posted by rpbruiser Jun 7, 2015

My apologies for no update this week. This week was exams week leading up to my graduation this Saturday so I had no time to make a post. I attempted to access the Internet through the Yun while at school, but to no avail, unfortunately the Yun does not support WPA2 Enterprise networks. I have finished my code and will post that this upcoming week when I get access to my computer again. I hope everyone else's projects are going well. All I have left is to connect the Yun and double check all runs as it should. This has been a great experience and resume builder and I couldn't have done it without the help all of you provided me. I will update you all later this weeks with the finished product and I hope success comes to all of you and your projects as well.

Thank you,

Parker Ellwanger

So this weekend the genie buckled down, determined to finish the project he had started. His heart was delighted to see that he had finally finished all the wiring to his house! Now all that need to be done was furnishing and some aesthetics!

#include <TimeAlarms.h>
#include <infineonrgb.h>
#include <Wire.h>
#include <Time.h>
#include <stdlib.h>

InfineonRGB LEDS;

void setup() {
     // put your setup code here, to run once:
     setTime(5,41,0,5,24,14); // set time to Saturday 5:41:00am May 24 2015
     Alarm.alarmRepeat(5,41,05, Light);  // 5:41:05am every day


void loop() {
     // put your main code here, to run repeatedly:

void Light() {
     LEDS.SetIntensityRGB(0x01FF, 0x0000, 0x0000);


Above is the code that I used for the video, this will be implemented in the final code, but not using the TimeAlarm library. Also I would like to give Inderpreet Singh a huge thanks. His library infineonrgb.h was very useful. You can find it here.




Stay tuned to see what magic the genie preforms next!


The Genie's Day Brightens

Posted by rpbruiser May 22, 2015

The week was full of rain and clouds for the poor genie all week. Unable to leave his house and make any progress on the things that needed to get done, due to the unfortunate consequences of doing your electrical work in the rain, but today the sun peeked out from behind the clouds and shone with the brightness of 2000-2500 lumen. It was magnificent! However, shortly after its arrival, the clouds took over again . But while the sun was out the genie made headway on his electrical wiring of his sweet new crib. He set the power supply to roughly thirty volts and tested out his lights to see if they worked.


And it worked! How excited the genie was! This was a huge step in the right direction with the build of his new pad. Now all that was needed to be done was wire it all up to his sweet new dimmer and you could call him Xzibit Jr.


WAIT! There is no light!!!! What in the world is going on? No explosions, check. No fire or smoke, check. Then what? The genie checked the voltage coming out and the light intensity and found:


But that doesn’t make sense! 30 Volts in and only a 100th of that out? How could this be? The genie has yet to figure this out, but he will be working diligently over the weekend to figure out a solution!


So the genie decided that it would be fun to start learning how to use new tools and build things instead of tiring himself out with using all of his magic. He hopped out of his cramped and cluttered lamp and decided he would need an area to store some of his items so that he had more space in his lamp. He decided to build a shed. But so it would look nice, no matter the surrounding he also decided to use a color that went well with all styles, white (*cough* ivory). He slaved for 5 hours and 11 minutes building it. But when it was over he was pleased with the results and immediately began moving items in.


                                                     The roof and the floor separated


                                                          Together, but empty


                                                                   Perfect fit!


                                                    My first ever 3D print!


I apologize for the funky orientations but I can't seem to rotate them in here. Also I still need to drill holes in the four corners so the top can be screwed in to the bottom piece!


Genie Lamp [Update]

Posted by rpbruiser May 8, 2015

So there is no real progress on my project this week unfortunately. Being a high school senior in a residential program is difficult to find the necessary  tools at appropriate times. I have talked to the engineering professors and have begun to set up times in which I will be allowed to use the labs and materials based on my schedule. However, I was able to start a 5 hour print of my enclosure for the Yun and Infineon and RGB. I won't be able to access this enclosure until Monday though. I plan on using the labs next week and finishing up the last leg of my project before I begin working on aesthetics. I just thought I would give everyone an update, and hope the rest of your projects are coming along as well too!

I just received an dimmable LED (LOHAS 20W LED Chip). I plan on running a few test programs, starting with the ones that Infineon provide, while I wait for my recessed can whip extension to arrive and I will start prototyping the lamp.


Here is a picture of the beauty:



I have also been messing around with TinkerCAD to build a case for the Arduino Yún and Infineon RGB Shield, which is also how I will attempt to prototype multiple lampstands. I would also like to thank all who helped me on my last post!





Genie Update

Posted by rpbruiser Apr 25, 2015

Unfortunately I have gotten stuck on my project and stuffed the genie back in his lamp for a short while. I am currently working with the Infineon RGB Shield and have run into multiple issues. I am trying to run a single 5mm Red LED with it. I realize that the bulb needs to be rated for 300mA, thats why I am using resistors to allow for the 20mA LED not to burn out. I am driving it with a 9V battery, yet I realize that the rating is for 12V-48V, and this may be my issue. I am running into some mysterious magic, and I am beginning to believe that my genie has placed a curse on me. I am reading 4V-4.5V output and across the resistor, but 8V across the LED, along with the fact it will not light up unless I touch the leads of my multimeter while trying to measure the resistance, AND apparently there is no current throughout the circuit. I have bought a 300mA rated LED and am waiting on my low impact CFL to arrive, but I was trying to run test codes with a simple LED for an update. Unfortunately this has been a larger obstacle than presumed originally. But luckily I am a persistent competitor and will not let this unfortunate setback stop me from finishing this amazing opportunity.


As The Sunsets...

Posted by rpbruiser Apr 5, 2015

As the sunsets on the genie's home, he is curious as to what time it is, since he forgot to buy a clock. Silly him . Fortunately he had a smart home, and all he needed was internet for his house to tell him the time! But how? Well just say the magic word, and the genie will show you!

           "I WISH....."


First you have to find the longitude and latitude for where you live. The genie found it would be much easier to use an API that simply used your IP address to give you this!


String findLon() {
    HttpClient clientLon;

    while (clientLon.available()) {
      lon = clientLon.readString();

    Serial.print("Lon: ");

    return lon;

String findLat() {
    HttpClient clientLat;

    while (clientLat.available()) {
      lat = clientLat.readString();

    Serial.print("Lat: ");

    return lat;


Once the genie knows where he is, he now can figure out when the sunsets and rises, using an algorithm that can be found here.

   A = year() / 100;
   B = A / 4;
   C = 2 - A + B;
   E = 365.25 * (year() + 4716);
   F = 30.6001 * (month() + 1);
   JD = C + day() + E + F - 1524.5;
   JC = (JD - 2451545) / 36525;
   longSun = int(280.46646 + JC * (36000.76983 + JC * 0.0003032)) % 360;
   anomSun = 357.52911 + JC * (35999.05029 - 0.0001537 * JC);
   eOrbit = 0.016708634 - JC * (0.000042037 + 0.0000001267 * JC);
   sunEqCtr = sin(D2R * (anomSun)) * (1.914602 - JC * (0.004817 + 0.000014 * JC)) + sin(D2R * (2 * anomSun)) * (0.019993 - 0.000101 * JC) + sin(D2R * (3 * anomSun)) * 0.000289;
   trueLongSun = longSun + sunEqCtr;
   trueAnomSun = anomSun + sunEqCtr;
   sunRadVector = (1.000001018 * (1 - eOrbit * eOrbit)) / (1 + eOrbit * cos(D2R * (trueAnomSun)));
   sunAppLong = trueLongSun - 0.00569 - 0.00478 * sin(D2R * (125.04 - 1934.136 * JC));
   obliqEcliptic = 23 + (26 + ((21.448 - JC * (46.815 + JC * (0.00059 - JC * 0.001813)))) / 60) / 60;
   obliqCorr = obliqEcliptic + 0.00256 * cos(D2R * (125.04 - 1934.136 * JC));
   sunAscen = R2D * (atan2(cos(D2R * (sunAppLong)), cos(D2R * (obliqCorr)) * sin(D2R * (sunAppLong))));
   sunDeclin = R2D * (asin(sin(D2R * (obliqCorr)) * sin(D2R * (sunAppLong))));
   varY = tan(D2R * (obliqCorr / 2)) * tan(D2R * (obliqCorr / 2));
   eqTime = 4 * R2D * (varY * sin(2 * D2R * (longSun)) - 2 * eOrbit * sin(D2R * (anomSun)) + 4 * eOrbit * varY * sin(D2R * (anomSun)) * cos(2 * D2R * (longSun)) - 0.5 * varY * varY *
     sin(4 * D2R * (longSun)) - 1.25 * eOrbit * eOrbit * sin(2 * D2R * (anomSun)));
   haSunrise = R2D * (acos(cos(D2R * (90.833)) / (cos(D2R * (lati)) * cos(D2R * (sunDeclin))) - tan(D2R * (lati)) * tan(D2R * (sunDeclin))));
   if (daylight == true) {
     solarNoon = (720 - 4 * longi - eqTime + -5 * 60) / 1440; //TODO: Change -5 to a method for finding timezone
     solarNoon = solarNoon + .041667;
   else {
     solarNoon = (720 - 4 * longi - eqTime + -5 * 60) / 1440; //TODO: Change -5 to a method for finding timezone
   localRiseTime = (solarNoon * 1440 - haSunrise * 4) / 1440;

For sunset all you have to do is manipulate the local rise time to be the local set time by changing it like so:

localSetTime = (solarNoon * 1440 + haSunrise * 4) / 1440;

Unfortunately, this algorithm does not account for daylight savings time, which of course only applies to certain places, but the genie, residing in the US, decided he should account for it.

boolean isDaylightSavings() {
  int marchSecondSunday, novFirstSunday, cent, i, n;

  cent = floor(year() / 100);

  for (i = 8; i <= 14; i++) {
    if (marchSecondSunday != 0) {
      marchSecondSunday = int((i + floor(2.6 * 3 - 0.2) - 2 * cent + year() + floor(year() / 4) + floor(cent / 4))) % 7;
  for (n = 1; n <= 7; n++) {
    if (novFirstSunday != 0) {
      novFirstSunday = int((i + floor(2.6 * 11 - 0.2) - 2 * cent + year() + floor(year() / 4) + floor(cent / 4))) % 7;

  if (month() == 3) {
   if (day() >= i) {
     daylight = true;
  else if (month() == 11) {
   if (day() <= n) {
    daylight = true;
  else if (month() > 3) {
   daylight = true;
  else if (month() < 11) {
   daylight = true;
  else {
   daylight = false;

  return daylight;

From here, the genie can also get the current time, and compare the two! and of course his house, the lamp, will shine bright if between the sunset and sunrise!

However, the electrician has not finished at the house, so as of right now, no lights .




More to come...

The genie being proud in nature, wished to show off his sweet new crib. He would like to invite all of you to an informal open house, where you can see his sweet new setup, and all his cool furniture. Arduino Yun was the architect of the genies sweet new living quarters. Mr. Infineon was the electrician. He wired the building to be as bright as the sun, but Mr. Infineon was also a good guy and wanted the energy consumption to be minimized, and allowed this through his setup. The lamp itself looks like it is a normal 60W bulb, shines just as bright too, but it only a 12V/15W bulb! Also the lamp doesn't have to be much larger than the average lamp, since the power required to power both units is minimal. So from the genie, "Welcome to my Magic Lamp!"



Wish One Was Granted

Posted by rpbruiser Mar 19, 2015

As I sit at my desk, alone in the dark, I remember wishing that there was someway I could make my dream of a magical lamp, that fulfilled all my wildest dreams a reality, rather than just another picture on a piece of paper somewhere in the landfill. Well apparently I had rubbed my lamp because just like that



my magic genie was there! My wish came true! I had everything I would ever possibly need to make my idea, for all to have there own special genie lamp, come to fruition. I would like to thank all the "genies" that made this possibly! (Also I apologize for the mess, you know, genies create quite the gush of wind when they come out of that lamp so fast!).


The Magic Lamp

Posted by rpbruiser Mar 16, 2015

Late one night...

You are sitting at your desk, doing your work in the late afternoon. Its a beautiful day outside and your desk is by a door, there is no need for you to have your lights on. But the sun begins to set, and you are stuck in the dark, too immersed in your work to get up and turn on the lights. Fortunately you have a magic lamp! This lamp has the power to know when the sun is setting and turn itself on.



And the Genie granted your wishes...

For a consumer friendly solution to all your lazy problems! The genie, Premier Farnell, poofed in all the tools need and all the workers necessary to turn your wish a reality. His new help toiled day and night until your wish came true. Your lights are now Smart. They will function independent of user input, minus the initial setup, and we will all live happily ever after.

To Be Continued...