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.)

New NodeMCU Project: Garage Door Monitor

The Objective

For whatever reason, our garage door opener doesn’t work reliably when it’s cold. Only the remotes that are inside in the warmth actually work so we have to remember to close the garage from inside the house. Sometimes it’s forgotten and the garage door is left open. There’s no way to see whether or not the door is open from inside the house. Thus, this project came to mind.

The main objective is to create a wireless way to know whether or not the garage door is open.

The Planimg_20170126_190721

The plan is to use two NodeMCU boards. One inside the garage will talk to the other inside the house. The one in the garage will be connected to a limit switch which will be closed when the door is closed. The one inside the home will have some sort of indicator that will tell us whether the door is closed or not. This will likely just be a labelled LED.

These Two Don’t Like Each Other

I received the two NodeMCU boards in two weeks from China. The experiments trying to get them to talk to each other (one as an access point, the other as a client) did not work out. I went hours trying to get something going but I couldn’t, so I went back to something I knew already, which is to have it talk to some PHP code hosted on my website.

The NEW Plan

I wasn’t planning on having the internet involved but I actually think it’s going to be a better idea. This way, I can get something going with just one board and then integrate the second one into the project later. I can check the status of my garage door right from my phone’s web browser from anywhere. The future is here people!

 

The new plan has a couple phases.

Phase 1: Set up one NodeMCU in the garage with the limit switch. The switch will send the status to my website which I can then check to see the status of the door. I can use some PHP code to send me an email if the door has been open unusually long.

Phase 2: Have the second NodeMCU connect to my website and build hardware around it so that anyone that walks in the front door can see whether or not the door is closed.

Progress Update

img_20170129_151905

It’s been going pretty well so far, even with it’s problems. I’ve got two limit switches sending values to a MySQL database hosted on my website. (The full process: It accesses a URL with the switch values inserted into them, and then some PHP code on that page grabs them and inserts them into the MySQL database table.)

BTW, I am using the Arduino IDE to program the NodeMCU.

screenshot_20170130-091040-01

I have no issues with it inserting values. The big issue I’ve been having is I haven’t gotten it running for longer than two hours at a time. I don’t know if it’s something on the server’s end or if the NodeMCU is hanging or something. It took me a while to get it to wake from deep sleep without doing something weird so I suspect it may have something to do with that. If this issue keeps going on, I may stop it from deep sleep and see how that goes. It’ll draw more energy but I’m leaning toward giving it a wall plug.

Keep Following the Project

I hope you enjoyed this first update post about my first NodeMCU project! Stay tuned for more!

screenshot_20170131-174839

If you’ve got Instagram, follow me as I’ve found it to be an easy way to share progress updates as they happen.

Pulling the plug on the ESP8266 project

IMG_0001Look at all that dust!

I had my ESP8266 capsule plugged in and sitting in a corner of my room where I just sort of forgot about it. I decided to check up on it today on ThingSpeak and discovered it stopped transmitting data a week ago. After about two months powered up and 9735 recorded entries, I’ve decided it’s time to take it offline.

I haven’t been fully attentive on what’s been going on but I’ve been seeing a few things here and there about some new things being done with the ESP8266 module that I’d love to check out. I still need a new project idea so we’ll see what happens.

A significant chunk of my blog’s traffic has been for my ESP8266 posts so I hope everyone is finding what they’re looking for. Check out my Github for code! Thanks for visiting!

ESP8266 Rolling Back

Capture

After some thought, I have decided to roll back the ESP8266 project to a previous version that only sends data to Thing Speak. The features of emailing and inserting data into a MySQL database have been dropped.

One of the reasons is that this project will eventually be taken completely offline, so gradually taking it down before I decide what I want to do next seems like a decent plan to me. This project was a great way to get started with the ESP8266 as I’ve learned a lot about how to use it. Since I got it online, I’ve come across more projects that I’d love to give a shot myself but I only have one ESP8266, so this project will need to be sacrificed if I want to play with the module. The hardware will stay as is whenever that happens so I can always stick the ESP8266 back in and have it work immediately again.

The other reason is that I’m planning on ditching my webhost. They’re free and they’ve served me well… but I can’t help but be worried about security and uptime. My same concerns go for any other free, or impracticably cheap, webhosts out there, and I can’t afford paid webhosting right now. Some changes are coming to my websites and blog so stay tuned!

Thanks for following this project! You can keep following the live data at ThingSpeak, and you can always get the different versions of code on GitHub.

Eye on the power

I added in the battery level code from https://code.google.com/p/tinkerit/wiki/SecretVoltmeter into my ESP8266 program and it works like a charm. The code uses a reference voltage in the Atmega328p microcontroller to get a reading of Vcc going into the ATmega328p. For the ESP8266 project, that would be the 5v output of the AMS1117 board. In my testing with the dead-ish battery yesterday, I found that the system started to fall apart once it dropped below 5v. The LCD backlight would start flickering and the sending of data seemed to fail more often.

I already have the system sending me emails if it gets bad values from the DHT22 sensor or the ESP8266 fails at sending to both ThingSpeak and my webhost in the same cycle. It was easy enough to add a little more code so it would send me emails at certain voltage levels. I’ve got it sending emails to me when it drops to 5, 4.8, 4.6, and 4.4 volts.

Screenshot_2015-01-24-00-02-03I got this email when I retried the battery for the third time after bringing it in from outside in yesterdays outdoor trial. If I give the battery a rest, it’ll be able to power up the system again but it’ll die after a short period. The lowest threshold email I got was for 4.6v before the battery died again.

I don’t expect this project to go battery powered again but this is definitely something I’m glad I found and I hope it finds a place in other projects.

At this point, I feel like the project is over. It’s been a great learning experience working with two programming languages, my custom PCBs, and seeing the community that has gathered around the ESP8266. It doesn’t have to be over though… Solar power, anyone? Perhaps in the future.

Like I mentioned a couple posts ago, I have other projects coming up, including some experiments with some RF transmitter and receivers, and my custom shift register PCBs that should come in next week if the postal service is consistent with the last two times I ordered from Dirty PCBs.

 Thanks for reading!

ESP8266 Capsule now live, OUTSIDE!

Yesterday, I put the ESP8266 project into an enclosure. It uses a 9v battery style connector for power so it can be powered directly with a 9V battery or with a wall power supply. It’s too cold to run wires through the window (not that I would do it in the summer either, because bugs) so it’ll go battery powered whenever I want to put it outside.

It’s short notice, but my ESP8266 project will be put outside and will send data live starting at 1PM EST today until the battery runs out. It will be using a 9v battery that I’ve been using while prototyping other things so I’m not sure how long it will last. The project will be placed in a bag to protect it from moisture, even though it’s not raining today. I don’t want to take any chances.

IMG_0001

View the data at Thing Speak and my ESP8266 webpage.

Presenting the ESP8266 Capsule!

This project went exceptionally well. With just under two weeks of prototyping and 3.5 straight hours of soldering, the ESP8266 Capsule is complete! The project as I’ve been showing you in previous posts has been crammed into an enclosure (a food container). Let’s take a look at how the soldering went.

IMG_0001The only plan I had was a very rough schematic of the project. I skipped the perfboard planning on paper which is something I started doing with my projects that ended up on perfboards. I thought the circuits were simple enough to wing it… While that’s was somewhat true, it was challenging at times but it all worked out.

IMG_0002I pulled apart the prototype since I had the schematic to work with. I used fresh ATmega328p and AMS1117 boards since I like to have a couple rough assembled ones laying around for prototyping with.

I used some cut jumper wires that still have the female connector on it to connect up the LCD. The ones I used were actually cut off of the old Box project that was sacrificed for this project. I like to think of this as the Box 2.0 since it’s pretty much the same thing, except it gains an internet connection but loses the real-time clock.

IMG_0003This was about halfway through the soldering process. I got increasingly concerned with all of the connections flying out everywhere. They’re that long just for assembly. They would be cut down when it was time to connect everything together.

IMG_0004The first test was scary, as it usually is. The LCD lit up but didn’t show anything. After a few minutes, I realized the potentiometer that adjusts the contrast of the text was turned all the way down for some reason. I thought it would have stayed the same since it was directly taken from the prototype.

The only real issue was with the photoresistor. One of the legs had a loose connection that I had to touch up with my soldering iron a couple more times to get right. I would have liked to hot glued parts of this project but I don’t think I have enough glue for my glue gun. I put some tape in hopes that it’ll help things stay in place. Everything is so tightly packed in there, mostly because of the female connector for the LCD connections, so things aren’t shifting around too much inside.

IMG_0006This is the final product. The sensors are mounted on the top with the LCD underneath it. Beside the LCD is a switch to turn on and off the LCD backlight.

It looks very similar to the Light Timer Project since it uses the same kind of enclosure and LCD. I’d like to think I’ve progressed since then. There are no breadboards tucked in there, and I’m using some custom PCBs… That’s progress to me!

IMG_0007I find that inexpensive switches are hard to find so my previous projects usually never had one unless I had a switch I pulled from an old toy or something. My switches from China finally came in yesterday. They’re cheap and don’t fit in a breadboard, but they work great in the project.

Now that it’s in the enclosure, it can be moved around, especially since it can still be powered by batteries. I’m thinking of leaving it outside for a day and watch the data come in. It’ll be a designated day I’d announce since I’d have to pick a good day to do it. The enclosure is hardly weatherproof, and the power in contacts are fully exposed. I could put it in a bag, but I think that would affect the humidity readings. I’ll let you know.

Thank you for following along with this project! Stay tuned for more projects coming soon!

Here are some links for this project: MYSQL Database Live DemoThing SpeakGitHub Repository