Stair Night Lights

I wanted to have some soft lighting on the stairs and didn’t really want anything too fancy.  Over the holidays I was able to pick up some 10ft Decorative LED String lights.  62 LEDs in various colors.  Connecting two together and then shortening it a bit leaves me with a nice string of lights.

These LED’s will tuck into the trim using some 3D printed holders.

About 18 ft of LED’s for the project running off of 3 AA batteries.

Initial Design:

NODEMCU in a box controlling a transistor to 5V for the LED.  USB power at 2A+.  All in a custom printed container.

  • On at Sunset
  • Off at Sunrise
  • PWM control for brightness TBD
  • Maybe Dim at midnight until sunrise to the rescue

I got stubborn and wanted to have a way to send data from my sensor to a Google script and then have the Google script update a Google Sheet.  The problem I ran into was that Google was looking for an HTTPS connection to act like a good secure internet citizen.  I could not figure out how to call my Google Script directly from the NODEMCU.  There are some libraries being worked on to support HTTPS, but it was way beyond my programming and patience.

So, I found Thinger.IO and tried the HTTP Endpoint.  Although it did not work at first, Alvaro was great and helped to get it working.  Google is still very fragile in how it wants to handle JSON data coming through this path, but we can pass the required data.

The other advantage of linking into is that with the other endpoints I can connect in many other capabilities that should be fun.  Who new a garage door opening and closing could be so exciting.

I’ll get the code loaded somewhere when I get a chance.

Thinger.IO to the rescue

Thinger.IO to the rescue

Protoboard Connections

There are several pieces to this portion of the project.

  1. Get the project running on my breadboard to make sure all of the pieces worked.
  2. Design and create a box to hold the protoboard so I can mount it in the garage.
  3. Figure out a 5V power supply.
  4. Position all of the components on the board.
  5. Solder it all up.
  6. Debug and replace a blown diode (loads of fun)
  7. Test and document.

Here’s the Solidworks model I created. I plan to screw it to the ceiling near to power for the garage door and then run the wires to the sensors and the opener.

Solidworks model of module assembly

Solidworks model of module assembly

I found a 5Volt 1Amp USB charger around the house and opened it up to see the inside.  I removed the USB connector and the hooked up some 18Ga wire to the output.  While I was at it I replaced the input wires as well as they were really small and seemed to be acting up a bit. The result is a nice compact little power supply.  I think I may add some silicone to the opening to seal it up a bit.

Hack a USB charger for IoT

Hack a USB charger for IoT

I added a 2 conductor plug so it’s easy to disconnect.


Here’s the layout of the protoboard.  I have not decided if I’m going to bother with an external connector for the sensors and opener wires or not.  I can pull the NODEMCU board out and replace with another one to update software or at some point I may add over the air software update capability.


Board mounted in the case.


Bottom of the board. Not real pretty, but functional.


Tried to use Red for power, Black for ground, Yellow for signals.

Breadboard and testing

I’ve actually been testing this for a while.  I use the Arduino IDE 1.6.5 with the NODEMCU board and then just connect with USB. Works well and I can use the serial port for debugging and learning.
The switch test fixture has made it really easy to test this out. As with the other stuff, I just modeled in Solidworks and then printed the pieces.
In the picture it is powered by a hacked USB powercube. This shouldn’t need much power to operate.
I’m using a 2N2222 to switch a 5V relay. The NODEMCU handles the conversion to the 3.3V the ESP8266 needs and I’m using that logic level to control 5V to the relay through the transistor.
I know it’s pretty simple, but still a lot of parts to get working.

The next step is to connect this up on a proto-board so I can mount it in the garage. I’ve created a box with holes for leads and LEDs to be visible from the outside. I’m starting the positioning of the key components.IMG_1064

The 6 wire header at the bottom is for the 2 sensors and the relay connection to the opener. The power will connect to the connector just above the relay.

State Diagram for the garage door

I’ve been trying to figure out how to characterize and check for the states and transitions that I want to monitor and control.  It’s making my head hurt since I’ve not done this type of stuff in a while.

Here’s what the state of the door looks like over time.


The information I am gathering is the status of the Open and Closed sensor and time.

Building on this, here’s the chart


So now, I need the code to interpret the sensors so I can respond and control the door.

OK and Notify is when I want to update the spreadsheet that the door has opened or closed. Time Check is when the door will be auto-closed after a period of time (15 minutes?, maybe 5 minutes in winter).


Designing and printing the sensor brackets

Sensor Mounting Brackets.

The first step was to measure the area around where I thought I would install the sensors. The Magnet will go on the door and then a sensor clipped onto the rail for the open position and to the wall bracket for closed.  I just used a set of calipers and a couple of sketches.

I then modeled the open and closed arrangement in Solidworks 2015 and designed the brackets.  The blue one was my first attempt.  I did not take into account the sticky backed tape on the magnet and sensor so it was pretty closed.  Then I could also see that this orientation of magnet would not work very well so I decided to switch it and redesign the brackets.



This is the original mounting orientation.  I don’t like how close the magnet is to the weight compensating cable. So, looks like I need to rotate the magnet.

GDM10 Here the magnet has more clearance to everything.

Here are the brackets being printed and when complete.

GDM9 SeeMeCNC Rostock Max V2GDM4 There are 4 total parts.  The closed bracket has 3 pieces.  For manufacturing purposes and to clamp it to the bracket.  Here’s an exploded view from Solidworks.


GDM5 GDM6 Here’s the open bracket installed.  Friction seems to hold just fine.  I’m using the stick backed tape to hold the sensor in place.

GDM8 GDM7 The door closed sensor clears everything and looks OK.  Both sensors are close enough to the magnet to close.   I’m only checking the sensors every few seconds (to be determined) so I’m not really worried about switch bounce.


Here you can see the sensors mounted in place.

Now back to the control unit.

IoT Adventures. Getting all of the pieces to talk (ESP8266 WiFi to/from stuff)

I decided I needed to outline my design for the esp8266 monitor project.

GDR Archtecture

The problem is I’d like to pass the status (an integer representing Open, Closed, Operating) to a Google script. The Google script can then add a row to the table, calculate the delta time and show the status.

Well, since I’m not an expert, I’ve learned that just about everything requires an HTTPS POST or GET and the security stuff for the ESP8266 is over my head.  So, now I’m trying a bunch of different intermediaries to set what can work.

Next, loot at the options for IoT connections.