Light Timer Project: The Last Connection

1I got a new soldering iron for Christmas which gave me the motivation to do some more work on this project. I’ve always shied away from soldering in my projects because I’ve only owned a crappy $15 irons until now. I didn’t like having that breadboard hanging off of the control unit so I went back at it with my new soldering iron and came out with something a lot closer to what I had in mind in the first place.3The LCD still doesn’t have a cut out but that’s fine. Like I’ve said before, another reason why I didn’t want to put the buttons directly on it was because it was a tight squeeze with all of the wiring and components jammed in there. My concern right now is a bit paranoid, but I’m afraid of a short or something breaking just because of how tightly packed it all is. So far, it seems fine. It won’t be kicked around or vibrating so things should stay in place. I’ll continue to have it running while I’m around just to keep an eye on it. I want to be confident in it before I leave it plugged in overnight.

2

This is the final final product. I hope.

Website Tour: My Theme Park

My Theme Park was the most ambitious project I ever took on. I believe it was a month into it where I felt like it was just too much for one amateur to take on. My Theme Park was supposed to be a detailed theme park manager where you could buy and sell rides, control staff and set wages, and handle emergencies such as weather storms or accidents.
1This was actually the last thing I worked on before giving up on the project. Whenever I make sites and complete the first release, I immediately find something I want to add that would have me adding a column to a table. That’s why I wanted to make the registration as detailed as possible without making it too long. My plan was to have basic setup, and then nagging notifications to get you to fill in necessary things to get started once you first log in.

2I took the registration and log in system from previous projects, but I also added a confirmation email that sends at the end of the registration which was something that was new to me. That’s still my first and only time doing such a thing (sending emails with PHP). And just so you know, the “use the golf cart” thing was just a link to let you skip redirection wait.

3This was the main page of the portal once you logged in. An example of the detail I wanted was that weather would have been affected by the location you chose your park to be in when you registered.
4The Park Analyzer was your park profile and operations panel. Another example of details is that the more hours you had your park open, the more earnings and expenses you’d get and higher ride maintenance costs.

5The administrator panel was also taken from previous projects but this one would have a lot more things to manage. This is an example of adding rides to the catalog where park managers would be able to pick up new rides.

The biggest challenge was setting up the PHP script that would run daily that would automatically tally up numbers throughout your panel (such as expenses, revenue, total ride operating times, etc). It became a lot to handle and I couldn’t get it working reliably. That was the point where I gave this project up, though I don’t regret working on it at all. It was a big project and I got to experiment with many new features that I’d love to add to future sites. You’ll see some of the things on the last two sites I have left to showcase. Stay tuned!

Light Timer Project: Completion

The Light Timer Project is now complete and ready to install. Except it won’t be, at least not right now. I will probably keep it packed up until next year when we can incorporate it into some Christmas decorations.

1This is not the way I pictured the final product but I’m still satisfied with it. It’s a tight fit inside of the case which is why it didn’t turn out as compact as I wanted it to.

2The LCD does not have a cut out, it’s just being seen through the transparent cover. The buttons remain on the breadboard because it’s a mess inside the case so any wires that can escape are lucky.

3Since I probably won’t be using it this year, I wrapped the string lights around the case expecting to throw it on a shelf and let it collect some dust. I realized that it made a really neat glowing effect off of the case. It makes for a really nice desk lamp at times when I don’t need my room completely lit up.
4So that’s the end of another project. If you want to see the construction log, just click the “Light Timer” category on the sidebar. Here are a few more things to wrap this one up.

Product Features

  • Displays current date and time.
  • Automatically turns on and off a set of lights during a certain period of time in the morning and evening.
  • Allows for user to adjust the time ranges in the morning and evening.
  • Allows for user to turn off schedule on the weekend.
  • Allows for user to manually turn on and off lights.
  • Displays a custom message on specific dates.
  • Fades in and out LCD backlight and controlled lights.
  • Times out menu after 10 seconds of inactivity.
  • Dims LCD backlight after 15 seconds of inactivity for power saving.

Code

The code is up for download as-is. It may become unavailable at any time.  It is not meant to be copy and pasted into your project. Instead, it’s there to help you get an idea of what I did to accomplish certain tasks. Some ways I go about things may not be optimal but it worked for me. If you use any of the code and would like to give credit, please link back to this blog post. If you have any reasonable questions, leave a comment. Thanks.

Enjoy: https://www.dropbox.com/s/vg4j11a5pek25ei/TimedLights_draft1.ino

Light Timer Project: Squashing bugs

A lot of bugs were coming out to play over the weekend and I hope that the copy of code I have now is free of any major ones. In addition, I managed to add in a couple of more features, though it’s starting to become that really unnecessary “fluff” but whatever.

To make things a little less jarring and to make use of the PWM pins, the lights and the LCD backlight now fade on and off when they need to. It’s a little thing that helps the project look a little more polished.

The other addition is that I can now post messages that will alternate with the usual info displayed on the bottom line. Right now, the messages are just holidays, and the only holidays I’ve got are Christmas (and eve), New Years (and eve), and Canada Day since most other holidays are ones that are like the third Monday of the month and so on. I wanted to have an alternating line to display more information, so this is the first step toward that. It may or may not change by the time I install the lights, but at least something’s been done to open up the idea.

Other than those two additions, the rest of the weekend was just debugging bugs that showed up in the time/alarm logic. I’ve also got a plan for the enclosure. It’s a food container.

I’ve got two cheap soldering irons that I haven’t used in months because they really beaten up. I need to do some soldering to package this project up so I tried cleaning up the tips. I’m writing off the one with the bent tip (I don’t even know how that happened anyway). I’d really like to buy one of those Hakko soldering stations everyone’s been raving about, though the Weller WES51 has always been on my wishlist before I heard about the Hakko iron. I also need to get one of those helping/third hand things.

So if the soldering works out, I can start transferring stuff into the enclosure. I’m hoping to show progress on that very soon.

Light Timer Project: Beta testing

Yup, I’m calling it in beta now. After the work done today, I don’t have any other plans or expect any changes to be made. Testing will continue through the weekend, which should be enough time to confirm everything works completely.

1The biggest change was simplifying the logic for the alarms. Each hour and minute has it’s own variable and I originally was checking what hour it was, then look at the minutes, and react appropriately. It became complicated very quickly so I tried something else. Basically, the logic works with the total minutes of every time (the hour multiplied by 60, plus the minutes), instead of the hour and minute values separately. It made the logic a lot simpler to figure out. The code will be released once I’m satisfied it works fine so you’ll see what I did.

2Another change I made was the LCD brightness is now controlled by the code instead of the hardware potentiometer. I had to move the LCD digital inputs somewhere else to free up a PWM pin. Although I said I’m not planning on any other changes, I am willing to move around the button input pins to free up two more PWM pins if I come up with something else that would need it. Anyway, on the default screen with the time and date, the LCD dims five seconds after you press any button or return from the menu. In the menu, it stays on full brightness.

The last change I made was the menu now times out after 10 seconds after the last button press and returns to the default screen. As I mentioned in a previous post, the alarm processing is done when it’s on the default screen so it’s important that it’s not left idling in the menu. I still have to make sure it works on all of the menus but so far it’s been fine.

Now that the guts are nearing completion, I’m trying to figure out how I’m going to package it. I don’t want to use cardboard because I want it to look more presentable this time. The last resort is cardboard covered in coloured construction paper, but I’d really like to find another way.

Light Timer Project: First draft of code

I posted about this project about a week ago. I’m building a system to turn a string of lights on and off during certain time periods during the day. To recap, here are the main objectives:

  • Turn on and off the string of lights automatically during specific times during the day.
  • Have an LCD display the current date and time, as well as when the lights are going to change state next.
  • Allow for manual control of lights.
  • Allow change of time periods through use of menu buttons and LCD.
  • Allow enable/disable for weekend automation.

Bugs pop up from time to time, but I’m slowly going through them. It’ll be a few days before I can say these objectives are complete.

I haven’t been documenting the progress very well because I get excited after finishing one piece of it and then hurry onto the next. Here’s what I’ve got up to this point.

1Before I received the parts for the real time clock (which I’ll now be calling RTC), I was playing around with the LCD I already had from Greg the robot. When I got the parts and tried hooking it up alongside the LCD, the RTC didn’t work. After a couple hours of frustration, I pulled it all apart and started over. It was just a connection problem and had nothing to do with the LCD. It’s easier to work with one thing at a time.

2Once I confirmed that the RTC was working and that it kept going after the Arduino was unplugged, I wrapped it all up in electrical tape. The coin battery lasts for years (I think I read 9 years somewhere) so I won’t be needing to get to anything wrapped up in there any time soon. After that, I reconnected the LCD, along with the buttons I was playing with.

3Programming took a solid 4 hours. The biggest issue was getting the logic right to turn on the light (the blue LED I’m using for the testing phase). There is a library that would accomplish this, but I already had an idea of how I was going to go about it.

Along the way, I made a few notes that will probably be posted somewhere near the panel:

  • The time will remain correct if powered off. However, any changes through the menu (schedule, weekend setting, override) will be lost.
  • It expects you to enter times when you’ll be around and it’s dark. You cannot set time ranges overnight or around noon.
  • Be sure to completely exit out of the menu as the light timer will not function until it is on the default screen (Default screen displays time and date). [I will address this by having the menu timeout after some time.]

So there’s still some more work to do! Stay tuned!

Website Tour: Electronics Engineering Toolbox

The Electronics Engineering Toolbox was my first attempt at making a website using PHP and MySQL databases. The highlight of the site were the calculators that helped you convert between number systems (like binary, hex, octal) and figure out values of your components.

v1The first theme of the site wasn’t the most polished, kind of like the first version of my personal website. The focus at that time was the functionality of the site. PHP has functions to convert between number systems so that wasn’t much work compared to the component calculators. Those didn’t take all that long either.

v1pageI could never get the colors to work together… There was something just off looking at the entire page.

Before a redesign came, I tried implementing a user system. I wanted to make the site more interactive by offering quizzes and allowing people to favorite terminology pages or save calculations. I did get the user system up but none of the features that would use it were completed. Obviously it was a bust, so I went ahead with a redesign and threw out the user system.

v2This was my first site that actually looked decent. I was really proud of it.
v2pageThe pages and content remained pretty much the same while everything around it changed for the better. This is definitely a layout I would reuse again for a resource website.

So that’s the story for the Electronics Engineering Toolbox. It was a great project to work on as I got a good taste of working with PHP and MySQL. Thanks for reading! Stay tuned for the next website tour!