How to create an office or studio status indicator and doorbell with NodeMCU Part #1


Anders Kitson

This is a fun project, if you ever wanted to show your status outside your office or studio door, with a button where someone could notify you and you could let them in with a button press, then this is the tutorial for you. Your total parts cost is going to be less than $40 and you may already have the parts you need if you have some electronics stuff lying around. I am going to be using Mongoose OS for development framework and cli.

I am also going to be using the KeeYees development board you can buy from Amazon for 3 for $20.99 or 1 for $10.99​ I bought the three since you can make a receiver device and button to notify it from this status indicator. But that will be in the next tutorial.

In the end we are going to setup an aws lambda function where we can send a request to aws iot, and update the shadow of our development board so we can change the led. Simply you could have the led change based a zapier or any post request, we'll setup from a simple website a button turning on the led.

Let's get started ;)

Let's list out the parts we need first

  1. KeeYees development board linked before
  2. Solderless breadboard this one will work fine
  3. Breadboard jumper cables these will work good
  4. LED for status indication these will be fine
  5. Micro usb cable this is good
  6. 1 x 20 ohmΩ | 2 x 100 ohmΩ this resistor pack will work fine

*Note the resistor value varies for the led, I used the LED'S in the link, and colour matters too.

Once you have the following in front of you you can get started

Here's a image of my parts

All the needed parts

Here is the video walk through if you get stuck

Next plugin the Board into the breadboard and connect via usb to your computer

Your light on your board may flash when it starts, but will probably not remain on and if it does it doesn't matter we are going to flash our code on it anyways overwriting any current code.

In order to do that we are going to install Mongoose OS, in order to communicate with our board and write a JavaScript program that can run the board and trigger the LED via a post request, so you could set your status from a Zapier webhook if you like.

Step #1 install Mongoose OS mos cli

Visit the Mongoose OS quickstart setup for your operating system I will be following the Ubuntu Linux, but after the setup everything will be the same. Here are the commands I needed to run in my terminal

sudo add-apt-repository ppa:mongoose-os/mos
sudo apt-get update
sudo apt-get install mos

Once you run mos it will open up your browser with a serial console to view what's happening on the board and a command console where you see your commands execute on your computer on the left hand side. Below is what you should see and you should choose the port your board is on and select ESP8266 in the board drop down

Selecting USB port and Board

Step #2 clone the demo-js app to run on your board

In the bottom of the Mongoose OS window you can enter commands, enter the following code you can change the app1 to name it whatever you like, you will notice once it's done it will automatically change you to that directory and you will run mos build to prepare the code for flashing

mos clone app1

mos build

You can see in the images below cloning and building

Clone the demo-js repo

Now you can name the app1 anything you like in the video I called it wispy-series-1, but you can call it status-indicator, anything descriptive is helpful

Build the code to prepare for flash

mos build & mos flash

Next up we want to build and flash the device with the following command inside of mongoose os. Once the device is flashed you should be getting results in your serial console to the right. Such as online false, ram, so on...

mos build
mos flash

Next we are going to be hooking up our red led, you will notice on the red led that it has a longer end, generally that is the positive end. We will be hooking that end up to 3v3, we are going to be having a 100ohm resistor between that.

So there will be a resistor between the positive on the breadboard to the positive on the led. And a jumper cable from the positive on the breadboard to the 3v3

Then a jumper cable from the pin d5 to the other end of the led. If you want to check the led is working you can first connect to pin d4 and see if it lights up. Now move it to d5.

Pin d5(GPIO14) red led setup

Next we want to modify our code

In order to modify our code you can open up mos and hit the folder button in the bottom left corner, or run code . if you are using vscode. Once you are in your code root directory navigate to fs/init.js

We will be modifying the following code to write to led, the ellipses represent the rest of the code top and bottom.

We want to set_mode of the output to 14 with is pin d5 and we can write to it with 14,0

  GPIO.set_mode(led, GPIO.MODE_OUTPUT);
  GPIO.set_mode(14, GPIO.MODE_OUTPUT);

Next we want to build and flash the device, once it's flashed our red led should turn on. We do this inside of mongoose os

mos build
mos flash

red led on, move on to part 2

Part 2 view here