It turns out that NodeMCU hardware connections are almost as easy as using Arduino.
Above is a test circuit I used to learn how to interface some hardware with the NodeMCU. It uses three digital output pins (D5-D7). Two provide a control signal to servo motors, while the other switches on a relay. Control is over WiFi using my local area network.
I turned my breadboard into a circuit diagram in fifteen minutes using the online tool at Schematics.com. This is a very easy circuit design system which is free. You can log on with your Facebook or Twitter account.
NodeMCU Hardware Connections Need 3.3 Volts
Perhaps the most important thing to know is that NodeMCU runs on 3.3 volts and is not tolerant of 5 volt connections. While you can power the module with 5V (it has an on-board voltage regulator) that is where it ends. Another consideration is the amount of current that the GPIO pins can sink or source. This is quite low, in the order of 12 milliamps for source and 20 milliamps for sink. This is not that far off from the Arduino, which can source around 20 milliamps.
So, what did this mean for my 5 volt relay and servos? Not much, as it turns out. In the case of my servos, I just had to use a separate 5V power supply for the motors. The 3.3V pulses from the NodeMCU pins are strong enough to control the servos. I could have used a level shifter to bring the NodeMCU outputs up to the higher voltage, but that was not necessary.
As for the relay, I needed an NPN transistor and a small resistor. When the NodeMCU output pin goes high, it switches the transistor on, which completes a path for the five volts needed to close the relay. The 1K resistor limits current to just what is needed to activate the 2N2222.
And, of course, if you are using both 3.3V and 5.0V power supplies for your project, make sure that you tie the grounds together where necessary to allow completed circuits.