NodeSwitch™ part 3: programming - control lights and motors with the same remote

NodeSwitch™ part 3: programming - control lights and motors with the same remote

NodeSwitch™ LED and DC Motor Controller: Background

Please Note: This page is here for legacy purposes only. The impulse latching switch has been replaced by our new educational ESP32 Micropython kit, with a programmable low voltage relay module that has almost unlimited capabilities.

The NodeSwitch™ RN-12v-10w-0 unit is an Arduino compatible RF remote control LED companion controller for our radio equipped shade and blind motors. A small antenna receives the control signal from the multi-channel remote control and a microprocessor then uses the decoded signals to activate the LED lighting (and optional motor output).

The optional MiniMight™ reversing motor controller can be used to operate devices that have a reversible 12v DC motor, such as our 12v window and skylight openers and motorized shade sliders. It can also be using it for drapery control, and it also makes a great 2 channel relay controller.

The NodeSwitch™ controller can be re-programmed to behave in different ways, according to your needs. In this article we will discuss basic programming and, as a simple example, show step by step how the LED soft start dim rate can be adjusted.

Reprogramming the microprocessor with the Arduino editor program is a relatively simple procedure that essentially sends a text file through the USB port of your PC to the Arduino microrocessor onboard the NodeSwitch™ unit. You can write your own from scratch, or download an example from our website and modify it.

If you have ever wanted to explore the world of embedded microprocessor (AKA microcontroller) programming, the Arduino system is about as easy as it gets. It is a great way to ease into this often complex engineering pursuit, whether you are a student, professional, or hobbyist.

evan at his bench programming Arduino Evan is a budding engineer of 12 years age on our staff that was able to plug the Arduino into his laptop and intuitively reprogram the LED dim rate within about 5 minutes of being introduced to it. He had never seen an Arduino before, and did not know what a microprocessor is.

There are also dozens of example scripts built right into the Arduino program editor, and many thousands more online in the huge library. Chances are, if you are trying to figure out how to do something, somebody else will have already done it, and a simple search will quickly find a solution for you.

The NodeSwitch™ controller (with on-board Arduino) is available in our online store

Step 1: Download and Install the Arduino IDE Program Editor

The Arduino IDE (Integrated Development Environment) is just a fancy name for a text editor that has special built-in functionality specific to the Arduino microcontrollers. It can be downloaded from this page:

Arduino: Getting Started (click to open this in a new browser tab)

If you are using MS Windows, you may have to install a USB serial port driver the first time around, see item 4 on this page:

Installing USB serial port drivers for Arduino (opens in new tab)

Note that Arduino is a 'cross platform solution', there is a similar page if you use Linux or Mac. The screens you see in this article were captured from a Windows (Vista) laptop.

Step 2: Configure the Arduino IDE Program Editor for the NodeSwitch™ Arduino Microprocessor

Once the IDE has been installed, the next step is to configure it correctly for the NodeSwitch™ Arduino microprocessor. There are a number of different Arduino microprocessors and boards, so you need to select the correct one.

We use the Arduino Nano™ from Gravitech USA because it is a fully functional, very compact unit with on-board USB port. This is as close to 'plug and play' as we could make it, in a compact form factor (NodeSwitch™ also supports all the nifty Gravitech add-on boards for extended functionality).

Here is a screen capture of the Arduino editor showing where to make the correct selection:

Step 3: Connect NodeSwitch™ USB Port and Select the Correct Serial Port

At this point you are ready to connect the NodeSwitch™ USB port on the Nano to your PC. The nano has a 'mini USB port' on it, as per the notation on the left in the following picture. You can slide the board up in the slot (or remove the Nano from its socket) and connect the USB cable. It is a good idea to disconnect the 12v power from the NodeSwitch controller first, although it won't harm anything if you forget.

Arduino LED dimmer and motor controller motherboard

When you connect the USB cable the Nano is powered up because there is a 5 volt DC power line inside the cable that provides power from the PC. There is an LED power indicator on the Nano board that will light up. You may also see some other LED activity on the Nano board as soon as you plug it in because it boots up and starts running the default NodeSwitch™ program that is pre-loaded onto every unit.

Keep in mind, the Nano itself is essentially a fully bootable computer (boots as soon as power is applied) with an operating system, solid state 'hard drive' and RAM. That's a lot of smarts packed into a very small package!

You may also see some activity and/or hear sounds on your PC as it detects the fact that you have connected something to its USB port (part of the 'plug and play' system).

The final step is to select the new serial port that is created when the NodeSwitch unit is plugged in. The following screen capture shows an example of this; in our case, port 22 was created but you may not have such a high number. You can confirm that the new port is correct by unlugging the USB cable (port will disappear) and plugging it back in (port will re-appear). If you attempt to use the editor program without setting this, it will prompt you for the correct serial port setting.

connect NodeSwitch™ USB port and select the correct serial port

Now you are ready for testing. Please see Part 4 where we load a simple program into the Arduino that will flash an LED on the Nano microprocessor board.

The NodeSwitch™ controller is available in our online store

NodeSwitch™ Instructions Index:

Part 1: LED/Motor Controller: Introduction

Part 2: LED/Motor/Relay Controller: Basic Operation

Part 3: LED/Motor/Relay Controller: Advanced Operation: Arduino IDE Editor (you are here)

Part 4: LED/Motor/Relay Controller: Advanced Operation: Arduino Programming System

Part 5: LED/Motor/Relay Controller: Advanced Operation: Program Code Structure

Part 6: LED/Motor/Relay Controller: Advanced Operation: Jumper Locations

Part 7: LED/Motor/Relay Controller: Advanced Operation: Control Program Flow

Additional Resources:

Window Opener & Skylight Opener: Operating and Connection Info for our Chain Actuators

We sincerely hope you enjoy using these advanced motors; if you have any questions, please feel free to contact us at any time!