Trigger this 12v remote?

Greetings and Salutations wise ST gurus. UberNoob question here. Whats the cheapest way to “press” these 4 buttons? They do various things like arm/disarm my existing alarm system. I soldered these leads on, now I just need to know what relay or switch to use. My smarthings hub just arrived today so this will be my first automation. Many thanks in advance

Tagging @ogiewon

@Jonathan_Michael - are you familiar with Arduino programming and ESP8266 based micro-controllers?

If so, I think I have the perfect solution for you…

running ST_Anything

Specifically, I already have an example sketch for the LinkSprite Link Node R4 board above.

And you’ll need a USB to Serial programmer board, if you don’t already have one.

Like this one (set to 3.3V so you don’t fry the boards.)

Let me know if you have any questions.

1 Like

Many thanks for this. As a novice this is alot to take in. If I understand correctly I must use the USB/Serial to upload an Arduino sketch (such as the example provided) to the WifiRelay.

Thats what I guess in principle but a how to video or other supporting documentation will be greatly appreciated. UltraNoob edition.

Where should I start? Fwiw I havent configured a single thing on the smarthings system as yet, aside from the actual hib itself. Many thanks once again.

This tutorial should help you get started. Skip the step about signing up for a LinkSprite account.

Instead of using their Arduino example code, you’d use my sketch instead.

This guide should be used more to familiarize yourself with the hardware and wiring of the USB-to-UART adapter…how to put it into FLASH mode…etc… The guide is out of date. Use Arduino 1.8.9, and install support for the ESP8266 via the Arduino IDE’s “Boards Manager”.

Take you time. You’re definitely jumping into the “deep end” ! :wink:

2 Likes

Also, if you decide to buy that Linksprite LinkNode R4 module, be sure to buy a 5V/2A power supply to go with it, like the following one from Amazon.

@ogiewon Just wanted to say thanks again. I purchased both the items suggested (although had to get this instead because of shipping restrictions to my country : https://www.amazon.com/gp/product/B07RQQJZ12/ref=ox_sc_act_title_2?smid=A6XFOEP1GGE5M&psc=1).

Ive already installed the Arduino IDE and configured the boards manager. Waiting on shipping now. Anyway thanks for taking the time to respond. You have inspired me. Im sure Ill have more questions during build time. 1 quick question. Do I still need to install via the ST classic app?:+1:

As far as I know, yes you need to use the Classic ST App. I have never used the ‘New’ ST App. These days I run my house completely off of my Hubitat Elevation hub. Therefore, I only use ST to help test ST_Anything for users like yourself.

1 Like

Hi Dan,

My hardware finally arrived. I was extra delayed because I thought I had a 5v power source but it was actually a 12v! Had to wait for the last order. Anyway, I’m about ready to upload but the sketch doesn’t compile. I get a “SmartThingsESP8266WiFi.h: No such file or directory” error. I’ve selected the esp8266 generic board and changed the flash mode to QIO as per the instructions. Am I missing something? Much appreciated.

Sincerely,
Jon

Sounds like you may have not copied all of the Arduino\libraries from my GitHub repo into your computer’s Arduino folder. The details are in the ReadMe.

1 Like

Of course. Brilliant. Many thanks. Compiles perfectly now. How do I change from a switch to a button press. I changed “static st::EX_Switch executor1(F(“switch1”), PIN_S2, LOW, false); //Non-Inverted logic for “Active High” Relay Board” to “static st::S_TimedRelay executor1(F(“switch1”), PIN_S2, LOW, false, 1000, 0, 1); //Non-Inverted logic for “Active High” Relay Board” but get a “no matching function for call to ‘st::Everything::addExecutor(st::S_TimedRelay*)’” compile error?

Im not trying to get you to complete my project but just a pointer to what to google would help. Thanks again Dan the Man

If I understand you correctly, you’re wanting momentary relay outputs, instead of normal ‘switch’ relay outputs? (Note: you mention changing from a switch to a button - which is a little confusing as ST_Anything does support the creation of ‘Button’ devices, which are literally user pushable button inputs. However, I believe you’re really looking for a momentary output device.)

Take a look at the following sketch to understand the syntax of declaring a S_TimedRelay device. Also, be sure to have the following #include statement in your sketch. Also, the TimedRelay is considered a “Sensor”, not an “Executor”, so you’ll need an addSensor() call instead of an addExecutor() call.

#include <S_TimedRelay.h> //Implements a Sensor to control a digital output pin with timing capabilities

The following is just an example of how to use the S_TimedRelay device. Be sure to use the original LinkNode sketch as your starting point as it explains the pin-out properly.

Apologies Dan. Yes I mean momentary switch. Thank you for deciphering.

I managed to successfully change the sketch and verify, however uploading produced a timeout error.
Heres is what I can confirm:
-My jumper is set to to “program via uart”, as shown in the pic.
-Set to 3.3v as per pic
-‘TX to UX’, ‘UX to TX’ and ‘GND to GND’
-External power supply is connected

Heres what I tried so far:
1 - I suspected it could be the changes so I reverted to the original sketch but unfortunately receive the same errors.
1a- Decided to use a simple sketch from here: “http://linksprite.com/wiki/index.php?title=LinkNode_R4:_Arduino-compatible_WiFi_relay_controller”. Same errors
2 -So I downgraded using boards manager to 2.5.1 (originally had 2.5.2) but got the same error. Following this advice"https://github.com/espressif/esptool/issues/432"
3- Downgraded to 2.5.0 but got a “error:espcomm_sync failed” error
4-Changed the upload speed to 9600 but the error persists
5-removed usb hub and connected directly. No luck

At this point Im not sure how to proceed. Can you point me in the right direction once more please?

What operating system are you running? I have only ever programmed an Arduino using MS Windows. So you might be having issues pertaining to your host platform.

Sounds like you haven’t been able to download any code to the LinkSprite LinkNode4 board whatsoever… Best advice I have is to follow the guide I linked earlier (see below.) If I find some free time, I’ll try to load one of these boards again and will take some up to date screen shots to share with you. It has been months since I tried this board, and I really can’t recall the details…

@Jonathan_Michael - I found some time this evening and pulled out my FT232 USB to Serial UART board, along with my LinkSprite LinkNode R4. I was able to easily program the LinkNode using the following settings:

Of course your serial “Port:” will be different than mine.

Here is the wiring and jumper settings. I also have the 5VDC power supply plugged into the LinkNodeR4 AFTER setting the jumper to the programming position.

After the Arduino IDE uploads the sketch to the LinkNodeR4, unplug the 5VDC power supply from the LinkNode R4, move the jumper back to its normal position on the LinkNodeR4 board, and then plug the 5VDC back into the LinkNodeR4. You should be able to see the debug statements in the Arduino IDE Serial Monitor windows (115,200 baud).

@Jonathan_Michael - any progress update on this?

Hi Dan. Sorry I wanted to respond with good news but unfortunately I had no luck. I suspect its something to do with the usb port permissions. Gonna fish out my old windows hdd and setup on my laptop this weekend hopefully. I cant thank you enough for your assistance. Will def keep you updated

Hi Dan,
I’m sorry next weekend turned into 4 months! I really wanted to get to this sooner but life got in the way. The good news is that today I managed to successfully upload my sketch using my Windows Laptop. I was still receiving communication errors during uploading but I decided to cycle the power on the Linknode just before upload, which seemed to do the trick.
My serial monitor says “Everything: Free Ram 47728” and occasionally “Everything: Sending: switch 1 off” . I can successfully ping the IP address of the linknode. However, the smarthings classic app says searching for “Looking for Devices” and doesn’t pick anything up. Any thoughts on troubleshooting? Is it possible that I need to specify a specific hub IP. There are 3 hubs so i was just wondering if 1 of them perhaps acts as main 1.
Apologies again for such a late reply.
Thanks Dan

Welcome back!

Please go back through the ST_Anything ReadMe and make sure you follow the steps on how to set up the ST Web IDE, and then the steps for manually adding a new ST_Anything Parent Ethernet device. You will not use the “Device Discovery” feature of the ST Class App at all to get things working. You will need to manually add a device in the ST Web IDE, and then configure that new device from within your ST Classic App on your phone. All of the instructions are in the ReadMe.

I have never used the ST WiFi Mesh/Hub combo setup. I would assume that the main router device is also the ST Hub, but I really don’t know. In the ST Web IDE, you should be able to look at the details of your ST Hub. I believe the IP address of the hub will be listed on that page.

Hi Dan,
Of course that was an integral step I missed.
YES Success!!! Still a small problem but I think Im close. Almost there now. I can see all the child devices. However there is strange behaviour by ‘button3’(momentary relay switch3). The other switches come on for a second and go off again (as they are supposed to) but button3 just says “turning off” and never displays “off” when I click it. The other working buttons say “turningon-on-off” when I click them.

A corresponding error appears on the app saying “Child device creation failed. Please make sure null is installed and published”. A related error appears on the Smartthings IDE Live Logging Window like so:" 09:35:43: error Child device creation failed with error = grails.validation.ValidationException: Validation Error(s) occurred during save():

  • Field error in object ‘physicalgraph.device.Device’ on field ‘deviceNetworkId’: rejected value [ECFABC2840B4-switch3]; codes"

I think its something to do with reporting the relay status rather than the actual relay function because I can hear the clickon-waitasecond-clickoff behaviour.
Heres the sketch below. What am I doing wrong?

`// Date Who What
// ---- — ----
// 2019-03-26 Dan Ogorchock Original Creation
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for ESP8266WiFi
//******************************************************************************************
#include <SmartThingsESP8266WiFi.h>

//******************************************************************************************
// ST_Anything Library
//******************************************************************************************
#include <Constants.h> //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library
#include <Device.h> //Generic Device Class, inherited by Sensor and Executor classes
#include <Sensor.h> //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc…)
#include <Executor.h> //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)
#include <InterruptSensor.h> //Generic Interrupt “Sensor” Class, waits for change of state on digital input
#include <PollingSensor.h> //Generic Polling “Sensor” Class, polls Arduino pins periodically
#include <Everything.h> //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

#include <EX_Switch.h> //Implements an Executor (EX) via a digital output to a relay
#include <S_TimedRelay.h> //Implements a Sensor to control a digital output pin with timing capabilities

//******************************************************************************************
//Define which Arduino Pins will be used for each device
//******************************************************************************************
#define PIN_S2 16 //LinkNode R4 Board Marking D3
#define PIN_S3 14 //LinkNode R4 Board Marking D4
#define PIN_S4 12 //LinkNode R4 Board Marking D10
#define PIN_S5 13 //LinkNode R4 Board Marking D8

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid = “hulahoops”; // <—You must edit this line!
String str_password = “hul@h00p$”; // <—You must edit this line!
IPAddress ip(192, 168, 8, 227); //Device IP Address // <—You must edit this line!
IPAddress gateway(192, 168, 8, 1); //Router gateway // <—You must edit this line!
IPAddress subnet(255, 255, 255, 0); //LAN subnet mask // <—You must edit this line!
IPAddress dnsserver(192, 168, 8, 1); //DNS server // <—You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings Hub Information
IPAddress hubIp(192, 168, 8, 117); // smartthings hub ip // <—You must edit this line!
const unsigned int hubPort = 39500; // smartthings hub port

// Hubitat Hub Information
//IPAddress hubIp(192, 168, 1, 143); // hubitat hub ip // <—You must edit this line!
//const unsigned int hubPort = 39501; // hubitat hub port

//******************************************************************************************
//st::Everything::callOnMsgSend() optional callback routine. This is a sniffer to monitor
// data being sent to ST. This allows a user to act on data changes locally within the
// Arduino sktech.
//******************************************************************************************
void callback(const String &msg)
{
// Serial.print(F("ST_Anything Callback: Sniffed data = "));
// Serial.println(msg);

//TODO: Add local logic here to take action when a device’s value/state is changed

//Masquerade as the ThingShield to send data to the Arduino, as if from the ST Cloud (uncomment and edit following line)
//st::receiveSmartString(“Put your command here!”); //use same strings that the Device Handler would send
}

//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
//******************************************************************************************
//Declare each Device that is attached to the Arduino
// Notes: - For each device, there is typically a corresponding “tile” defined in your
// SmartThings Device Hanlder Groovy code, except when using new COMPOSITE Device Handler
// - For details on each device’s constructor arguments below, please refer to the
// corresponding header (.h) and program (.cpp) files.
// - The name assigned to each device (1st argument below) must match the Groovy
// Device Handler names. (Note: “temphumid” below is the exception to this rule
// as the DHT sensors produce both “temperature” and “humidity”. Data from that
// particular sensor is sent to the ST Hub in two separate updates, one for
// “temperature” and one for “humidity”)
// - The new Composite Device Handler is comprised of a Parent DH and various Child
// DH’s. The names used below MUST not be changed for the Automatic Creation of
// child devices to work properly. Simply increment the number by +1 for each duplicate
// device (e.g. contact1, contact2, contact3, etc…) You can rename the Child Devices
// to match your specific use case in the ST Phone Application.
//******************************************************************************************
//Polling Sensors

//Interrupt Sensors

//Special sensors/executors (uses portions of both polling and executor classes)
static st::S_TimedRelay sensor1(F(“switch1”), PIN_S2, LOW, false, 1000, 0, 1); //Non-Inverted logic for “Active High” Relay Board //Added to test button press
static st::S_TimedRelay sensor2(F(“switch2”), PIN_S3, LOW, false, 1000, 0, 1);
static st::S_TimedRelay sensor3(F(“switch3”), PIN_S4, LOW, false, 1000, 0, 1);
static st::S_TimedRelay sensor4(F(“switch4”), PIN_S5, LOW, false, 1000, 0, 1);

//Executors
//static st::EX_Switch executor1(F(“switch1”), PIN_S2, LOW, false); //Non-Inverted logic for “Active High” Relay Board
//static st::EX_Switch executor2(F(“switch2”), PIN_S3, LOW, false); //Non-Inverted logic for “Active High” Relay Board
//static st::EX_Switch executor3(F(“switch3”), PIN_S4, LOW, false); //Non-Inverted logic for “Active High” Relay Board
//static st::EX_Switch executor4(F(“switch4”), PIN_S5, LOW, false); //Non-Inverted logic for “Active High” Relay Board

//*****************************************************************************
// Configure debug print output from each main class
// -Note: Set these to “false” if using Hardware Serial on pins 0 & 1
// to prevent communication conflicts with the ST Shield communications
//*****************************************************************************
st::Everything::debug=true;
st::Executor::debug=true;
st::Device::debug=true;
st::PollingSensor::debug=true;
st::InterruptSensor::debug=true;

//*****************************************************************************
//Initialize the “Everything” Class
//*****************************************************************************

//Initialize the optional local callback routine (safe to comment out if not desired)
st::Everything::callOnMsgSend = callback;

//Create the SmartThings ESP8266WiFi Communications Object
//STATIC IP Assignment - Recommended
st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString, “OfficeESP”);

//DHCP IP Assigment - Must set your router's DHCP server to provice a static IP address for this device's MAC address
//st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, serverPort, hubIp, hubPort, st::receiveSmartString);

//Run the Everything class’ init() routine which establishes WiFi communications with SmartThings Hub
st::Everything::init();

//*****************************************************************************
//Add each sensor to the “Everything” Class
//*****************************************************************************
st::Everything::addSensor(&sensor1);
st::Everything::addSensor(&sensor2);
st::Everything::addSensor(&sensor3);
st::Everything::addSensor(&sensor4);

//*****************************************************************************
//Add each executor to the “Everything” Class
//*****************************************************************************
//st::Everything::addExecutor(&executor1);
//st::Everything::addExecutor(&executor2);
//st::Everything::addExecutor(&executor3);
//st::Everything::addExecutor(&executor4);

//*****************************************************************************
//Initialize each of the devices which were added to the Everything Class
//*****************************************************************************
st::Everything::initDevices();
}

//******************************************************************************************
//Arduino Loop() routine
//******************************************************************************************
void loop()
{
//*****************************************************************************
//Execute the Everything run method which takes care of “Everything”
//*****************************************************************************
st::Everything::run();
}`

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.