Garage Door Monitor likes its sleep

Garage Door Monitor Update #2

The NodeMCU project is still chugging along. I’ve gotten more experiments done which I’ll share with you shortly. Unfortunately, all of this information has left me more indecisive of how I want things. To recap, I want to make something to be able to tell me whether or not my garage door is open or closed without going outside to check. Click here to see the first post about the project.

garage1Problem: Is it dead or does it just like to sleep?

The problem with the NodeMCU working for a while and then giving up on life is still the big one. I’ve done a few overnight tests with a few tweaks (mostly giving it delays/time to do things) with them all resulting in entries stopping after about six hours.

When I use my bench power supply, I’m able to see how much current it’s drawing. When it’s on, it’s pulling about 69mA and peaks to about 71mA when it’s transmitting data. It doesn’t seem like much, but it registers as pulling no current on my power supply when it’s in its deep sleep. Seeing that, it’s hard not to want that sort of power saving on the final build.

More likely than not, I won’t let it go to sleep and have it on all the time. I haven’t actually tested this yet to see if it will stop working again. Stay tuned!

Experiment 1: They still can’t hear each other

I tried to get two NodeMCUs to talk to one another again but it’s still not working out. Basically, I had one that would set up as an access point with a webpage that I’d try to get the other NodeMCU to connect to and read. I could get it to connect once but then it failed at reading any data. After that, I couldn’t get it to connect to the AP NodeMCU anymore. I have no idea what changed in that time.

The alternative solution is to continue sending my data to my webhost, and then having the NodeMCU connect to a webpage I have online which will feed it the information it needs. The webpage it would connect to would give it raw unlabeled data that it knows how to decipher.

Experiment 2: Keeping it local

After banging my head for a few hours, I strayed away into another alternative, which would eliminate the second NodeMCU where I use my phone to see what the NodeMCU in the garage is up to.

It went very well since it was easy to modify the WifiAP example sketch (at least that’s what I think it’s based off of, I’ve been accidentally saving over the example sketches). I was able to see the values on my phone by visiting an IP address once I connected to the NodeMCU. However, the fact that I have to switch my wifi is a bit annoying which makes this an undesirable option. It’s still good to know I can do this though as I could use it in some other project.

So now what?

With everything in mind, I’ve got some updated objectives:

  1. Garage NodeMCU has a limit switch which will tell whether the door is open or not. It will connect to my webhost and send data. This NodeMCU is no longer allowed to go to sleep!
  2. Webhost will present the data to me on a page much like the screenshots I’ve been sharing. It will also have a seperate webpage with raw recent values.
  3. Inside NodeMCU will connect to my wifi network and then to that webpage with the raw recent values. It will take those values and decide what to do. (Light up an LED, make a sound after a few minutes, etc.)

Information everywhere: Take 2!

Last night, I worked on my ESP8266 project code so that the data would be sent to both Thing Speak and the MySQL database on my webhost. After working out some reliability issues, the information from my ESP8266 project is now in three places: Thing Speak, an LCD, and a MySQL database on my webhost.

IMG_20150119_010336Since I’m using my ATmega328p breakout, I can’t see what’s happening in a serial monitor, but I was able to print out messages on the LCD that helped me debug. The problem was that it was sending values fine to my webhost but it kept failing at sending anything to Thing Speak except for one lucky time. I recall seeing some delay when closing the TCP connection when the project was still on the Arduino Uno so I tried adding delays to give it some time to close the TCP connection to my webhost before attempting the Thing Speak transmission. After some trial-and-error with the delay value, it finally became reliable.

The new code is available on GitHub. I also took the time to clean up the folders so that it’s easier to find the different versions of code.

I’m still waiting on some mini slide switches in the mail before I can put everything into an enclosure. I had a beefy switch in my spare parts bin that I was going to use for the input power but I measured the input current during a full cycle with the LCD on. It seems to go between 50mA and 100mA, 100mA presumably whenever it’s taking a measurement from the DHT22 and when it’s sending data through the ESP8266. I had the impression that the ESP8266 drew more current than that so I’m pleasantly surprised it stays that low. The mini switches I’m waiting for have a current rating of 500mA so that should be fine for the power supply.

Thanks for reading!

ESP8266 with a MySQL database

If you been following my blog since the beginning, you should remember a tour of some of the websites I’ve built in the past. The last websites I built back then involved PHP and MySQL databases and, even though it’s been such a long time, it certainly helped with this next experiment I did with the ESP8266 module.

tableI now have the ESP8266 module accessing a URL that contains the sensor information. Some PHP code grabs the information from the URL and inserts it into a table on a MySQL database. Check out the code on GitHub. Soon, I’ll have it sending data to both the database and Thing Speak, as it’s currently only sending data to the database.

You can view the live demo at

Once I finish up with the code, it’ll be time to put it into an enclosure… though I’m still waiting for a switch for the LCD backlight…

Thanks for reading!

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!

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!

Website Tour: My personal website

In my return to web design a few years ago, I came back with the goal of learning PHP which was something I always wanted to learn. With that goal, I also expanded my use of CSS and different HTML techniques to come out with a better looking final presentation, in most cases.

v1The first version of the website was kind of cheesy-looking but certainly better than the bland square tables I used to use before. After getting a hang of PHP and opening up the Electronics Engineering Toolbox website, I felt a redesign was in order.

v2_0The redesign came back using more techniques I was experimenting with. With some more CSS research, I could achieve rounded corners (which were done with graphics before) and shadows. With the PHP and MySQL knowledge from the EEToolbox, I built myself a simple blog system. Soon after, I added More Than Starlight to my web portfolio. The blog thing also got a little tired. The next version (numbered as 2.1) was moving toward a static portfolio. v2_1The site was stripped of the blog and it was back to mostly HTML as I got my fix of PHP working on the other two sites. Around the time of the redesign, I was midway through my electronics engineering training and I was starting to work on other projects. I wanted a place to gather and present them all so the next changes were made (version 2.5) to create a portfolio that expanded past my websites.

v2_5There were some more CSS and PHP techniques thrown in again. As you hovered over those four menu items seen in the screenshot above, the opacity of the image would change, thanks to CSS. All of the content was thrown into one file and the appropriate content was displayed using info from the link, grabbed by PHP. Otherwise, I would have created separated pages for everything, although there’s not much of a downside for a site this size. It was just because I could.

It’s always satisfying seeing a website grow in stages. Luckily for me, this was not the only site to do that. Next, we’ll be taking a look at the Electronics Engineering Toolbox. Stay tuned!