Page not Found!
42 |Get Back in HomePage.
43 |
use-external-arduino
option setted on true
in the config.json
file).
2 |
3 | In this directory you'll find sender
, receiver
and a single-arduino-tx-rx
that's a single sketch both for sending and receiving with only one arduino board.
4 |
5 | Use the latter in production environment.
6 |
7 | # RC-Switch
8 |
9 | Every sketch is based on the library ([RC-Switch](https://github.com/sui77/rc-switch)) used to receive and send radio signal through the Arduino. This will most likely work with all popular low cost power outlet sockets, Gas sensor, PIR/Door sensors.
10 | Supported devices should have one of the following chipset: *SC5262 / SC5272, HX2262 / HX2272, PT2262 / PT2272, EV1527, RT1527, FP1527 or HS1527*.
11 |
12 | # Recommended TX/RX Hardware
13 |
14 | Personally my advice is to use an Arduino nano with a common 433mhz radio transmitter and a 433mhz receiver. Both this modules can be bought with few euros on Ebay or Aliexpress.
15 |
16 | 
17 |
18 | better and recommended modules are this **'Super-heterodyne' RXB6**:
19 |
20 | 
21 |
22 | ## Antenna length
23 |
24 | Actually, many 433MHz circuit boards have a coil with a few windings between the circuitry and the solder pad marked ANT. The XD-RF-5V commonly available on the market has a three winding coil with a 5mm diameter. *5mm x 3 x PI accounts* for almost 5cm, so the external part of the antenna should be around 12cm to come to a total length of quarter lambda.
25 |
26 | I always find antenna's to be black magic, but for me 12cm seemed to work! Around the internet the most common antenna's length seems to be 17.3 cm.
27 |
28 | You can even do some more spires if you want or ... if you don't want to make the antenna by yourself, just buy it somewhere.
29 |
30 | ### Outlet sockets
31 |
32 | Referring to RCSwitch library, there are generally few common kinds of outlet switches (working on a Frequency 433.92Mhz). From a 10 pole DIP switch to the one with two rotary (or sliding) switches with four setting possibilities each.
33 |
34 | These are the recommended kind with the 10 pole DIP:
35 |
36 | 
37 |
38 | 
39 |
40 | ### Other devices
41 |
42 | Gas Sensor, Pir Sensor, Door/contact sensor.
43 |
44 | 
45 |
46 | 
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/hardware-layer/rc-switch-2.52.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roccomuso/iot-433mhz/8d0ea6ca6625a6c5c6f11f598df920de747d5c54/hardware-layer/rc-switch-2.52.zip
--------------------------------------------------------------------------------
/hardware-layer/receiver/helperfunctions.ino:
--------------------------------------------------------------------------------
1 | static char * dec2binWzerofill(unsigned long Dec, unsigned int bitLength){
2 | static char bin[64];
3 | unsigned int i=0;
4 |
5 | while (Dec > 0) {
6 | bin[32+i++] = (Dec & 1 > 0) ? '1' : '0';
7 | Dec = Dec >> 1;
8 | }
9 |
10 | for (unsigned int j = 0; j< bitLength; j++) {
11 | if (j >= bitLength - i) {
12 | bin[j] = bin[ 31 + i - (j - (bitLength - i)) ];
13 | }else {
14 | bin[j] = '0';
15 | }
16 | }
17 | bin[bitLength] = '\0';
18 |
19 | return bin;
20 | }
21 |
--------------------------------------------------------------------------------
/hardware-layer/receiver/output.ino:
--------------------------------------------------------------------------------
1 | void output(unsigned long decimal, unsigned int length, unsigned int delay, unsigned int* raw, unsigned int protocol) {
2 |
3 | if (decimal == 0) {
4 | Serial.print("Unknown encoding.");
5 | } else {
6 | char* b = dec2binWzerofill(decimal, length);
7 | Serial.print("Decimal: ");
8 | Serial.print(decimal);
9 | Serial.print(" (");
10 | Serial.print( length );
11 | Serial.print("Bit) Binary: ");
12 | Serial.print( b );
13 | Serial.print(" Tri-State: ");
14 | Serial.print( bin2tristate( b) );
15 | Serial.print(" PulseLength: ");
16 | Serial.print(delay);
17 | Serial.print(" microseconds");
18 | Serial.print(" Protocol: ");
19 | Serial.println(protocol);
20 | }
21 |
22 | Serial.print("Raw data: ");
23 | for (int i=0; i<= length*2; i++) {
24 | Serial.print(raw[i]);
25 | Serial.print(",");
26 | }
27 | Serial.println();
28 | Serial.println();
29 | }
30 |
31 |
32 | static char* bin2tristate(char* bin) {
33 | char returnValue[50];
34 | int pos = 0;
35 | int pos2 = 0;
36 | while (bin[pos]!='\0' && bin[pos+1]!='\0') {
37 | if (bin[pos]=='0' && bin[pos+1]=='0') {
38 | returnValue[pos2] = '0';
39 | } else if (bin[pos]=='1' && bin[pos+1]=='1') {
40 | returnValue[pos2] = '1';
41 | } else if (bin[pos]=='0' && bin[pos+1]=='1') {
42 | returnValue[pos2] = 'F';
43 | } else {
44 | return "not applicable";
45 | }
46 | pos = pos+2;
47 | pos2++;
48 | }
49 | returnValue[pos2] = '\0';
50 | return returnValue;
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/hardware-layer/receiver/receiver.ino:
--------------------------------------------------------------------------------
1 | /*
2 | Example for receiving
3 |
4 | https://github.com/sui77/rc-switch
5 |
6 | How to connect the 433mhz receiver to arduino: GND - 5V - pin D2
7 |
8 | */
9 |
10 | #include "+b.attr("data-hint")+"
"),b.removeAttr("data-hint"));var d={"input-lg":"form-group-lg","input-sm":"form-group-sm"};if(a.each(d,function(a,d){b.hasClass(a)&&(b.removeClass(a),c.addClass(d))}),b.hasClass("floating-label")){var e=b.attr("placeholder");b.attr("placeholder",null).removeClass("floating-label");var f=b.attr("id"),g="";f&&(g="for='"+f+"'"),c.addClass("label-floating"),b.after("")}(null===b.val()||"undefined"==b.val()||""===b.val())&&c.addClass("is-empty"),c.append(""),c.find("input[type=file]").length>0&&c.addClass("is-fileinput")})},attachInputEventHandlers:function(){var d=this.options.validate;a(document).on("change",".checkbox input[type=checkbox]",function(){a(this).blur()}).on("keydown paste",".form-control",function(c){b(c)&&a(this).closest(".form-group").removeClass("is-empty")}).on("keyup change",".form-control",function(){var b=a(this),c=b.closest(".form-group"),e="undefined"==typeof b[0].checkValidity||b[0].checkValidity();""===b.val()?c.addClass("is-empty"):c.removeClass("is-empty"),d&&(e?c.removeClass("has-error"):c.addClass("has-error"))}).on("focus",".form-control, .form-group.is-fileinput",function(){c(this)}).on("blur",".form-control, .form-group.is-fileinput",function(){e(this)}).on("change",".form-group input",function(){var b=a(this);if("file"!=b.attr("type")){var c=b.closest(".form-group"),d=b.val();d?c.removeClass("is-empty"):c.addClass("is-empty")}}).on("change",".form-group.is-fileinput input[type='file']",function(){var b=a(this),c=b.closest(".form-group"),d="";a.each(this.files,function(a,b){d+=b.name+", "}),d=d.substring(0,d.length-2),d?c.removeClass("is-empty"):c.addClass("is-empty"),c.find("input.form-control[readonly]").val(d)})},ripples:function(b){a(b?b:this.options.withRipples).ripples()},autofill:function(){var b=setInterval(function(){a("input[type!=checkbox]").each(function(){var b=a(this);b.val()&&b.val()!==b.attr("value")&&b.trigger("change")})},100);setTimeout(function(){clearInterval(b)},1e4)},attachAutofillEventHandlers:function(){var b;a(document).on("focus","input",function(){var c=a(this).parents("form").find("input").not("[type=file]");b=setInterval(function(){c.each(function(){var b=a(this);b.val()!==b.attr("value")&&b.trigger("change")})},100)}).on("blur",".form-group input",function(){clearInterval(b)})},init:function(b){this.options=a.extend({},this.options,b);var c=a(document);a.fn.ripples&&this.options.ripples&&this.ripples(),this.options.input&&(this.input(),this.attachInputEventHandlers()),this.options.checkbox&&this.checkbox(),this.options.togglebutton&&this.togglebutton(),this.options.radio&&this.radio(),this.options.autofill&&(this.autofill(),this.attachAutofillEventHandlers()),document.arrive&&this.options.arrive&&(a.fn.ripples&&this.options.ripples&&c.arrive(this.options.withRipples,function(){a.material.ripples(a(this))}),this.options.input&&c.arrive(this.options.inputElements,function(){a.material.input(a(this))}),this.options.checkbox&&c.arrive(this.options.checkboxElements,function(){a.material.checkbox(a(this))}),this.options.radio&&c.arrive(this.options.radioElements,function(){a.material.radio(a(this))}),this.options.togglebutton&&c.arrive(this.options.togglebuttonElements,function(){a.material.togglebutton(a(this))}))}}}(jQuery); 2 | //# sourceMappingURL=material.min.js.map -------------------------------------------------------------------------------- /www/dist/js/bootstrap-material-design/ripples.min.js: -------------------------------------------------------------------------------- 1 | !function(a,b,c,d){"use strict";function e(b,c){g=this,this.element=a(b),this.options=a.extend({},h,c),this._defaults=h,this._name=f,this.init()}var f="ripples",g=null,h={};e.prototype.init=function(){var c=this.element;c.on("mousedown touchstart",function(d){if(!g.isTouch()||"mousedown"!==d.type){c.find(".ripple-container").length||c.append('');var e=c.children(".ripple-container"),f=g.getRelY(e,d),h=g.getRelX(e,d);if(f||h){var i=g.getRipplesColor(c),j=a("");j.addClass("ripple").css({left:h,top:f,"background-color":i}),e.append(j),function(){return b.getComputedStyle(j[0]).opacity}(),g.rippleOn(c,j),setTimeout(function(){g.rippleEnd(j)},500),c.on("mouseup mouseleave touchend",function(){j.data("mousedown","off"),"off"===j.data("animating")&&g.rippleOut(j)})}}})},e.prototype.getNewSize=function(a,b){return Math.max(a.outerWidth(),a.outerHeight())/b.outerWidth()*2.5},e.prototype.getRelX=function(a,b){var c=a.offset();return g.isTouch()?(b=b.originalEvent,1===b.touches.length?b.touches[0].pageX-c.left:!1):b.pageX-c.left},e.prototype.getRelY=function(a,b){var c=a.offset();return g.isTouch()?(b=b.originalEvent,1===b.touches.length?b.touches[0].pageY-c.top:!1):b.pageY-c.top},e.prototype.getRipplesColor=function(a){var c=a.data("ripple-color")?a.data("ripple-color"):b.getComputedStyle(a[0]).color;return c},e.prototype.hasTransitionSupport=function(){var a=c.body||c.documentElement,b=a.style,e=b.transition!==d||b.WebkitTransition!==d||b.MozTransition!==d||b.MsTransition!==d||b.OTransition!==d;return e},e.prototype.isTouch=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},e.prototype.rippleEnd=function(a){a.data("animating","off"),"off"===a.data("mousedown")&&g.rippleOut(a)},e.prototype.rippleOut=function(a){a.off(),g.hasTransitionSupport()?a.addClass("ripple-out"):a.animate({opacity:0},100,function(){a.trigger("transitionend")}),a.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){a.remove()})},e.prototype.rippleOn=function(a,b){var c=g.getNewSize(a,b);g.hasTransitionSupport()?b.css({"-ms-transform":"scale("+c+")","-moz-transform":"scale("+c+")","-webkit-transform":"scale("+c+")",transform:"scale("+c+")"}).addClass("ripple-on").data("animating","on").data("mousedown","on"):b.animate({width:2*Math.max(a.outerWidth(),a.outerHeight()),height:2*Math.max(a.outerWidth(),a.outerHeight()),"margin-left":-1*Math.max(a.outerWidth(),a.outerHeight()),"margin-top":-1*Math.max(a.outerWidth(),a.outerHeight()),opacity:.2},500,function(){b.trigger("transitionend")})},a.fn.ripples=function(b){return this.each(function(){a.data(this,"plugin_"+f)||a.data(this,"plugin_"+f,new e(this,b))})}}(jQuery,window,document); 2 | //# sourceMappingURL=ripples.min.js.map -------------------------------------------------------------------------------- /www/dist/js/browser.console.mirror.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Browser module for console mirroring. 3 | * Works with Socket.io 4 | */ 5 | 6 | var consoleMirroring = (function(document){ // Module Pattern Design 7 | 8 | var methods = {}; 9 | var domElem; 10 | 11 | function validateOptions(options){ 12 | return new Promise(function(resolve, reject){ 13 | if (typeof options === 'undefined') return reject('pass a valid option argument'); 14 | if (typeof options.socketLib === 'undefined') return reject('pass a valid socket.io instance'); 15 | if (typeof options.socketLib.io === 'undefined') return reject('Socket.io instance not valid'); 16 | if (typeof options.containerId === 'undefined') return reject('containerId required.'); 17 | if (document.getElementById(options.containerId) === null) return reject('containerId not found in the DOM'); 18 | // set default values 19 | if (typeof options.fullScreen === 'undefined') options.fullScreen = false; 20 | if (typeof options.border === 'undefined') options.border = true; 21 | 22 | resolve(); 23 | }); 24 | } 25 | 26 | function addStyling(elem, extra){ 27 | 28 | elem.style.background = '#000'; 29 | elem.style.border = (extra.border) ? '3px groove #ccc' : 'none'; 30 | elem.style.color = '#ccc'; 31 | elem.style.display = 'block'; 32 | elem.style.padding = '7px'; 33 | elem.style.width = (extra.fullScreen) ? '100%' : '70%'; 34 | elem.style.height = (extra.fullScreen) ? '100%' : '300px'; 35 | elem.style['overflow-y'] = 'scroll'; 36 | } 37 | 38 | methods.init = function(options){ 39 | 40 | validateOptions(options).then(function(){ 41 | domElem = document.getElementById(options.containerId); 42 | addStyling(domElem, options); 43 | var io = options.socketLib; 44 | io.on('logEvent', function(data){ 45 | // {text: '...', color: '#...'} received through socket 46 | var mex = ''+data.text+''+'