📜 ⬆️ ⬇️

Z-uno or how to add any device to the z-wave network

Somehow the client installed a smart home: the task was to unite all the consoles into one and the phone became this remote. There were three remotes, two of them were with an infrared signal, but the third - from the curtains - turned out to be on a radio signal. I can record and transmit a signal with the help of a ztx-120 device, but you cannot record a radio signal. What to do in this case, I want to tell in this article. Only in the example there will be not a radio control, but a cell phone, the meaning will not change.

For this, I took the z-uno board, uploaded my code onto it with a usb cable through the arduino IDE 1.6.5 program (how to install arduino for z-uno on windows, I read on z-uno.z-wave.me/ install - instruction in English, but everything is clear from the pictures). Since I do not know the C language, I took the code from the standard socket, it is in the arduino program as a template (called “SimpleSwitch”) and propagated it to pins 13,14,15. Below is the code that I uploaded to the z-uno board.

view code
/* * That is a Simple Sensor Multilevel example * It measures the value on the potentiometer * And sends report to the controller if changed */ // LED pin number #define LED_PIN 13 #define LED_PINN 14 #define LED_PINNN 15 // Last saved LED value byte currentLEDValue; byte currentLEDValuee; byte currentLEDValueee; // next macro sets up the Z-Uno channels // in this example we set up 1 switch binary channel // you can read more on http://z-uno.z-wave.me/Reference/ZUNO_SWITCH_BINARY/ ZUNO_SETUP_CHANNELS(ZUNO_SWITCH_BINARY(getter, setter), ZUNO_SWITCH_BINARY(getterr, setterr), ZUNO_SWITCH_BINARY(getterrr, setterrr)); // next macro sets up the Z-Uno frequency ZUNO_SETUP_FREQUENCY(ZUNO_FREQ_RU); void setup() { pinMode(LED_PIN, OUTPUT); // setup pin as output pinMode(LED_PINN, OUTPUT); // setup pin as output pinMode(LED_PINNN, OUTPUT); // setup pin as output } void loop() { // loop is empty, because all the control comes over the Z-Wave } // function, which sets new relay state // this function runs only once the controller sends new value void setter (byte value) { // value is a variable, holding a "new value" // which came from the controller or other Z-Wave device if (value > 0) { // if greater then zero digitalWrite (LED_PIN, HIGH); //turn LED on } else { // if equals zero digitalWrite(LED_PIN, LOW); //turn LED off } // let's save our value for the situation, when the controller will ask us about it currentLEDValue = value; } void setterr (byte valuee) { // value is a variable, holding a "new value" // which came from the controller or other Z-Wave device if (valuee > 0) { // if greater then zero digitalWrite (LED_PINN, HIGH); //turn LED on } else { // if equals zero digitalWrite(LED_PINN, LOW); //turn LED off } // let's save our value for the situation, when the controller will ask us about it currentLEDValuee = valuee; } void setterrr (byte valueee) { // value is a variable, holding a "new value" // which came from the controller or other Z-Wave device if (valueee > 0) { // if greater then zero digitalWrite (LED_PINNN, HIGH); //turn LED on } else { // if equals zero digitalWrite(LED_PINNN, LOW); //turn LED off } // let's save our value for the situation, when the controller will ask us about it currentLEDValueee = valueee; } // function, which returns the previously saved relay value // this function runs only once the controller asks byte getter (){ return currentLEDValue; } byte getterr (){ return currentLEDValuee; } byte getterrr (){ return currentLEDValueee; } 


At the time of this writing, I didn’t have a remote at hand, but for example, I took my old cell phone with buttons, disassembled and soldered to the “one”, “two” and “reset” buttons. Then I decided to take all the “ground” from the phone buttons and twist it into one, and scattered the pluses on the pins 13,14,15.

At the same time, nothing worked for me, since all the buttons were in the same electrical circuit, and it should have its own button on each button.
')


For such cases, a transistor optocoupler is used.

In order to make it more convenient to combine all this, I took a model board and connected it with optocouplers. It should be noted that there is a circle or a notch on the optocoupler - this is the optocoupler's leg where the diode is located plus, respectively, we will add pluses from z-uno to these legs, and this is our pins 13,14,15. “Earth” on optocouplers from the side of the diode, we merge everything into one on the breadboard and attach them to the gnd port on z-uno.



Next, we attach the buttons of a mobile phone to our scheme, where there will be a plus, and where the “earth” doesn’t matter, since the buttons work to close. In the picture below you can see the working sample assembly.



Next, we add z-uno to the z-wave network, and check it for operability. As we see, everything works.



Successful to you inventions. In the video below you can see the whole process.

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


All Articles