NodeSwitch™ part 4: programming - control drapery motors, LED lights and relays with the same remote

NodeSwitch™ part 4: programming - control drapery motors, LED lights and relays 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 drapery, shade and blind motors. The optional MiniMight™ reversing motor controller can be used to operate other devices that have a reversible 12v DC motor, such as our 12v window and skylight openers.

As discussed in Part 3 (see links at bottom), the NodeSwitch™ controller can be re-programmed to behave in different ways, according to your needs. 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.

In Part 3 we covered the installation of the Arduino development environment (the editor), and how to connect the NodeSwitch™ USB port to your PC. There are dozens of example scripts built right into the Arduino program editor, and we will use one of the very simplest scripts called 'blink' to test the connection and upload capability of the system to the Arduino microprocessor. It will flash the built-in LED on the Nano board, so you don't need to connect anything to test it and see that it worked.

This test procedure will over-write (replace) the default NodeSwitch™ LED dimming factory program, but we will download and restore it once the testing is complete. If you aren't comfortable erasing the default program, this is the point where you should stop.

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

Step 1: Open the Arduino IDE Program Editor and Load the 'Blink' Program

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

loading the Arduino blink example program for NodeSwitch™ programming

Once it is loaded into the Arduino IDE editor, the Blink program should look like this in the code display area:

using the Arduino blink example program as a NodeSwitch™ test

Assuming you have already connected the Arduino with a USB cable and assigned the serial COM port, you are now ready to upload the Blink program to the microprocessor solid state 'hard drive' memory. We'll take a look at the code structure in the next article; for now we'll see if we can just make it work.

Step 2: Uploading the Blink Program to the Arduino

uploading the Arduino blink example program as a NodeSwitch™ test Transferring (uploading) the program to the Arduino microcontroller memory is as easy as clicking the 'upload' icon shown in this picture (the right arrow). You can hover your mouse pointer over the icons if you can't remember this; pop-up titles will be displayed.

Once the process starts, you will see some LED flashing on the Arduino board for about a second or so as the system communicates with the microprocessor. The PC and microprocessor are said to be 'handshaking', as each attempts to identify the other to prepare for the actual program upload.

Shortly thereafter, assuming the handshake is successful, the Tx (transmit) and Rx (receive) LED indicators will start flashing rapidly as the data is transferred, and the status screen at the bottom of the Arduino IDE will report on progress, finishing with a confirmation message. This will happen very quickly with the Blink program, as it is very small.

Once the program has been installed, the microprocessor will reboot, and the program will start executing. The blink program simply makes the test LED in the diagram blink at a rate of 1 second intervals as per the notations in the program. Note the RST button in front of the LED array on the Nano board; it is sort for 'reset' and pressing this at any time will interrupt the process that is running and reboot the microprocessor, restarting the loaded program.

Note that pin D13 is connected in parallel with the test LED, with a current limiting resistor integrated into the circuit, so you can safely connect an external LED between pin 13 and ground if you want to operate an external LED (a convenient header socket is provided for this functionality on the NodeSwitch™ motherboard).

Here is an image showing the Arduino Nano pinouts and LED indicators used by the Blink program:

Arduino Nano pinouts and LED indicators

If you see the test LED blink at 1 second intervals, with no errors on the IDE status screen, you can safely assume you have successfully uploaded the Blink program into the Arduino. In the next article we'll examine the actual code structure and see if we can modify the program to adjust the blink rate.

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

Part 4: LED/Motor/Relay Controller: Advanced Operation: Arduino Programming System (you are here)

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!