Main page
Recent changes
Arduino MEGA 63 relay Web switch
B
I
U
S
link
image
code
list
Show page
Syntax
!!!Compose individual parts [https://remoteqth.com/img/wiki-web-switch-10.png] ✔ Main board + Ethernet shield + microSD card + Arduino MEGA [https://remoteqth.com/img/wiki-web-switch-11.png] ✔ How to deploy ---- The idea behind this multi multi switch is, that if you own a bigger station, you want to control everthing... Switching on Radios, PA, Antenna Switches, Webcams, ... all want you can switch by a relay, the webswitch is able to control! This web switch will grow with your station setup! But what if you have to press a button for 5s to turn on an amplifier... Or if you have to define a group of buttons, which belong together like switching your 80m coil from cw to midband or ssb? This is the webswitch! To be faster than normal, the idea is to move all the needed javascript and css files to a webserver. Therefore you need to upload them to your webserver and change the urls in the config. You dont have a webserver? No problem! Use local path, but see the reminder down below... '''Here comes the config...''' [https://remoteqth.com/img/microsd.png|noborder|left] Before you plug the '''micro SD card''' into the ethernet shield, format, configure and upload the file '''config.cfg''' from the downloaded repostory. Remember: All settings of the SD card will overwrite the sketch data. '''IMPORTANT:''' The count of the comma separated values is always 16! Start counting by 0....15, not by 1... :P If you mess up the config by using the wrong positions, it will have a strange behaviour, so be careful... Here is the description of the values (dont copy the content below, use a text editor and edit the config.cfg from the repository) {{ [ajaxUrl=https://192.168.1.179] => this is the url, the webclient will call. It coun be in your local network (that its the same as you deviceIp) or its a dynDNS url like dm5xx.dynden.org:8888 to call it via the internet. [deviceIp=192.168.1.179] => your device's ip-adress. Choose a free one! Depending on your local network. [gatewayIp=192.168.1.40] => If your network has a gateway (router) to reach the internet, please use the gateways ip here [title=DM5XX] => Give the web client page a meanful title. This will be shown in your browser... [jsUrl=https://h.mmmedia-online.de/mega_webswitch.js] => This is the url to the javascript file you have to place on a webserver. Or.. You change this to be on your local machines filesystem - this can be also a path! If you have problems see https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally. So change this to file:///C:\your_directory\mega_webswitch.js. You need to modify the labels in the javascript file, so you need to customize the js file... [cssUrl=https://h.mmmedia-online.de/mega_webswitch.css] => Same fun this the css, but no need to change something... Only if you want to... [faviconUrl=https://h.mmmedia-online.de/favicon.ico] => Change this to get a different favicon - the little green alien head.. But it would be nice to leave it untouched... [dotUrl=https://h.mmmedia-online.de/dot.png] => Url to the png image of the green blinking circle.. Everytime this circle is blinking, the button status is updated. [jqueryUrl=https://code.jquery.com/jquery-1.11.2.min.js] => Dont change this. Its just the url to the jquery lib. [strpinsBank0=54,2,3,5,6,7,8,9,11,12,13,14,15,16,17,18] [strpinsBank1=19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34] [strpinsBank2=35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,53] [strpinsBank3=55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,1] => Here the pins are defined, which belon to a bank. Feel free to change it, but maybe its ok to leave it for the moment... [stris5sPinBank0=0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0] => the 6th Button from bank 0 is a long-on-hold button. Look to strPinsBank0: Its pin 7 by the way... And so on [stris5sPinBank1=0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0] [stris5sPinBank2=0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0] [stris5sPinBank3=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] => here you define, which of the buttons is a "long"/"hold" button. 0 for no, 1 for yes... [strisOffPinBank0=0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0] [strisOffPinBank1=0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0] [strisOffPinBank2=0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1] [strisOffPinBank3=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] => here you define, which of the buttons is a button who switches another button OFF. 0 for no, 1 for yes... [strindexOfOffPinPairBank0=0,0,0,0,0,0,5,0,0,8,0,0,11,0,0,0] [strindexOfOffPinPairBank1=0,0,0,2,0,0,0,0,0,0,9,0,11,0,0,0] [strindexOfOffPinPairBank2=0,0,0,2,0,4,0,6,0,8,0,0,0,12,0,14] [strindexOfOffPinPairBank3=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] => But who belongs together? This is defined here... the 7th button from bank 0 switches the button off who is on postion 5 in this example... ATTENTION: The count starts with 0... not with 1! [strpushDurationBank0=0,0,0,0,0,5,1,0,5,1,0,5,1,0,0,0] [strpushDurationBank1=0,0,1,1,0,0,0,0,0,5,1,1,1,0,0,0] [strpushDurationBank2=0,0,5,1,1,1,5,1,1,1,0,0,5,1,5,1] [strpushDurationBank3=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] => Here you define, how long a button/relay remains active. After that period in s, the relay is switched off [strToken=Abcdgfghij123!#*] => Store the password from SecuGenerator.html here (must be the same!). Must be exact 16 characters dont use [ or ] or ' or " or / or \ or { or } or = [intSalt=3333] => Use SecuGenerator.html to define a salt number (must be the same!). Try 2-5 digits. Store it here and in mega_webswitch.js (var salt = ur_value) }} [https://remoteqth.com/img/wiki-web-switch-12.png] ❏ microSD plug to Ethernet shield and deployed to Arduino MEGA [https://remoteqth.com/img/wiki-web-switch-13.png] ❏ then connect to Main board
Password
Summary of changes