📜 ⬆️ ⬇️

Smart socket REDMOND SkyPort 100S

This is a continuation of my first article on the smart redmond base . In this article we will talk about another device company Redmond - Smart socket REDMOND SkyPort 100S. This device is also based on the nRF51822 chip and as they say here God himself ordered to try. So, this outlet was purchased. The case is disassembled as easily as the base, access to the programming port is even more convenient. But looking ahead I will say that everything is a little more complicated than it seemed to me at first. The scheme of this outlet did not ring out, because There are already a bunch of reviews on the modernization and modification of these outlets.



In one of the reviews found the scheme, and this is limited. From the scheme it is clear that only 4 pins on the nRF51822 module are involved as well as in the smart socket. The device has a clock button connected to pin p0.00, two LEDs, red connected to pin p0.01, green connected to pin p0.02. Electromagnetic relay 10A connected to pin p0.03. So, launch the Arduino IDE and start building instances:


#define BUTTON_PIN 0 #define RED_LED_PIN 1 #define GREEN_LED_PIN 2 #define RELAY_PIN 3 boolean iswitch = 0; boolean flag_button = 0; static uint32_t previousMillis; //#define MY_DEBUG #define MY_DISABLED_SERIAL #define MY_RADIO_NRF5_ESB //#define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_LOW) #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX) //#define MY_PASSIVE_NODE #define MY_NODE_ID 201 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define MY_TRANSPORT_UPLINK_CHECK_DISABLED #define RELAY_ID 1 #include <MySensors.h> MyMessage lMsg(RELAY_ID, V_STATUS); void preHwInit() { pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(RED_LED_PIN, OUTPUT); pinMode(GREEN_LED_PIN, OUTPUT); pinMode(RELAY_PIN, OUTPUT); } void before() { digitalWrite(RED_LED_PIN, HIGH); } void presentation() { sendSketchInfo("REDMOND R nRF51", "1.0"); wait(300); present(RELAY_ID, S_BINARY, "RELAY SWITCH"); wait(300); } void setup() { digitalWrite(RED_LED_PIN, LOW); wait(300); digitalWrite(GREEN_LED_PIN, HIGH); wait(200); digitalWrite(GREEN_LED_PIN, LOW); wait(200); digitalWrite(GREEN_LED_PIN, HIGH); wait(200); digitalWrite(GREEN_LED_PIN, LOW); wait(200); digitalWrite(GREEN_LED_PIN, HIGH); wait(200); digitalWrite(GREEN_LED_PIN, LOW); wait(500); send(lMsg.set(iswitch)); wait(500); } void loop() { if (digitalRead(BUTTON_PIN) == LOW && flag_button == 0) { flag_button = 1; previousMillis = millis(); wait(20); } if (digitalRead(BUTTON_PIN) == LOW && flag_button == 1) { //   ,   } if (digitalRead(BUTTON_PIN) == HIGH && flag_button == 1) { if ((millis() - previousMillis > 0) && (millis() - previousMillis <= 3000)) { if (iswitch == 0) { digitalWrite(GREEN_LED_PIN, HIGH); wait(10); } else if (iswitch == 1) { digitalWrite(GREEN_LED_PIN, LOW); wait(10); } flag_button = 0; iswitch = !iswitch; digitalWrite(RELAY_PIN, iswitch); wait(1500); send(lMsg.set(iswitch)); } if (millis() - previousMillis > 3000) { flag_button = 0; } } } void receive(const MyMessage & message) { if (message.type == V_STATUS) { if (message.sensor == RELAY_ID) { if (mGetCommand(message) == 1) { if (message.isAck()) { //AckG = 1; } else { wait(50); if (iswitch == 0) { digitalWrite(GREEN_LED_PIN, HIGH); }else if (iswitch == 1) { digitalWrite(GREEN_LED_PIN, LOW); } iswitch = !iswitch; wait(10); digitalWrite(RELAY_PIN, iswitch); wait(1500); send(lMsg.set(iswitch)); } } if (mGetCommand(message) == 2) { } } } } 

As you can see, the code is small and fairly simple, thanks for this to the Mysensors community.


As the code was completed, I connected the programmer to the device and reshooted it. Connecting the programmer to the socket is very simple, in my case I took two conventional output resistors, bit off the wire with wire cutters, made hooks from the wire, bent it, inserted these hooks into the programmer's wires and “hooked” to the outlet, the video shows how I do it It's time to test what happened. I inserted a smart outlet into the outlet :), opened the Majordomo , everything is fine, the outlet was already present in the network Meissensors. I send the first command to turn on and ... reboot:) ... an unexpected turn. The first thing that came to mind was a power drawdown when the relay was turned on. I sat down and redid the program, turned off the LED when the relay was turned on, so as to reduce consumption. And it worked, the socket stopped rebooting when the relay was turned off. ... But not for long :). And so it became clear that the module does not have enough power. The scheme of a transformerless power supply unit is designed so that it would suffice only to work in the BLE mode. In Mysensors, another 2.4 GHz radio mode is used (compatibility with RF24 - ANT). So we have a deficit of about 10mA. Having discussed the problem in our chat, Mysensors focused on the decision to add a ballast capacitor, since this is a very simple manipulation, which is necessary for repetition. Here's what happened:


image


image


Having collected the socket again, I proceeded to the tests with a bit of anxiety. Working off was excellent now. Rewrote the logic of the program back, added #define MY_NRF5_ESB_PA_LEVEL (NRF5_PA_MAX), that is, “cut in” the radio at full capacity (yes, with Mysensors it is very simple). ... It works. No mistakes. No reboot. This is victory :)


image



But this manufacturer also has other devices on the nRF51822 - a smoke sensor, a motion sensor, a gas sensor, thermal converters, fans, humidifiers, cleaners, kettles ...;)


Telegrams chat of our community, where they always help to install libraries, support boards, explain how to assemble a network of sensors without a headache on arduinkas in half an hour - https://t.me/mysensors_eng


')

Source: https://habr.com/ru/post/450860/


All Articles