User manual – HOW TO version 1.0 IP Power Surge for “Pi of the Sky” project Function of the device: Remote controll of power supply at 5 power sockets over IP (LAN / Ethernet). Two modes: – default: (5) each socket independly – backward compatibility mode (old, obsolete): (2+3) two sets of sockets independly The power surge hardware consists of: – power block: transformer, Greatz bridge, filters, pulse voltage converter 3.3V, zero-cross detector – isolated power executor: relays or solid state relays (triacs / optotriacs) – Serial to Ethernet converter: XPort-03 module (made by Lantronix) (U2) – application microcontroller (MCU): ATMega8 (U1, firmware needed, upload by CON1) – optional secondary UART/RS232 (JP1, switched with XPort by application microcontroller) – optional I/O lines or bus (for future usage, firmware changes needed) XPort default settings: IP address assigned by external LAN's DHCP server TCP port (channel 1): 10001 What IP was assigned by DHCP server? In order to find out the XPort on a network you should install Device Installer application for Microsoft Windows operating system. The software can be downloaded from Lantronic's web page. You can also use MAC address of the XPort (placed also on bottom of the power surge enclosure) and find it in “leases file” of a DHCP server. How to communicate with application microcontroller to changing of power socket state? eg. telnet 192.168.1.2 10001 One session workaround XPort supports only one session on the desired TCP port. In case of any problems solution is to reset the connection or whole XPort. Simply workaround is: Setting of Inactivity Timeout option (Channel 1 | TCP Connection Settings | Disconnect Mode) and TCP keepalive value is highly recommended. Apply Settings causes reset of XPort and its active TCP connection(s) closing also. Password / secure XPort configuration brings password protection feature for serial Channel 1 connection. Then after TCP port openning (for example by telnet) password entering is necessary. For practice details look at "surge_test" code and scripts (software for the power surge testings). 1 Acronyms dictionary Acronym <NUM> <n> Values / format 1, 2, 3, 4, 5, A Description An ASCII char which defines numer of power socket. 'A' means apply to all sockets. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 An ASCII char in range from '0' to '9'. Number char. <h> 0...9, A...F An ASCII char in range from '0' to '9' or 'A' to 'F'. Hex number char. <.> . <STR> string<.> A string of chars finished by dot. SOCNAM!<STR> string<.> A string of alphanumeric chars finished by dot. Length of the string is limited up to 15 chars. SOC<NUM>LAG!<STR> <n><n><n><.> from 000. up to 300. Three number chars finished by dot. Interpreted as delay time in 100ms resolution in range from 0 to 30 seconds. For exmaple the string “173.” means 17.3 seconds (17s 300 ms). <state> ON, OFF Two or three ASCII chars for socket state define (ON or OFF). ASCII dot char. Syntax of commands All commands are interpretted immediately without waiting for next line characters (CR / LF). However a lot of terminals need "enter" to send a line outside. Some commands consist '!' character. It means the command can cause partial or whole configuration save in non-volatile EEPROM memory of the device (its MCU). Hence "set" in command description usually means "save". 2 Commands description Command SOC<NUM>ON Description Turn on a socket(s) identified by <NUM>. włącz gniazdko/-a o numerze <NUM> response: none example: "SOC2ON" - socket 2 is now on SOC<NUM>OFF Turn off a socket(s) identified by <NUM>. wyłącz gniazdko/-a o numerze <NUM> response: none example: "SOC1OFF" - socket 1 is now off SOC<NUM>STA Show current state of a socket(s) identified by <NUM>. wyślij status gniazdka/-ek o numerze <NUM> response: SOC<NUM><state> examples: "SOCASTA" - display status of all sockets, "SOC3STA" - status of socket 3 SOC<NUM>LAG!<STR> Set a delay time (lag) to turn on a socket(s) after whole device startup (start-up is about 2s after power-on). Delay time is specified by <STR> and socket(s) by <NUM>. The delay time (lag) value has no effect if: – DEF<NUM>OFF! is/was done – SOC<NUM>ON / SOC<NUM>OFF is/was done ustaw opóźnienie w załączaniu gniazdka/-ek przy starcie response: none examples: "SOC1LAG!123." - set delay 12.3s for socket 1 "SOC2LAG!023." - set delay 2.3s for socket 2 "SOC3LAG!000." - set delay 0s for socket 3 "SOC4LAG!100." - set delay 10s for socket 4 "SOC5LAG!000." - set delay 0s for socket 5 LAG<NUM>STA Show the saved delay time (lag) of turning on a socket(s) identyfied by <NUM>. wyślij aktualnie zapisane opóźnienie dla gniazdka/-ek <NUM> response: LAG<NUM><STR> example: "LAGASTA" - display lags for all sockets DEF<NUM>ON! Set turned on state of a socket(s) identified by <NUM> as default. ustaw domyślny status gniazdka/-ek <NUM> jako włączone response: none 3 Command Description examples: "DEFAON!" - define all ON as default state, "DEF2ON!"- define state on for socket 2 as default DEF<NUM>OFF! Set turned off state of a socket(s) identified by <NUM> as default. ustaw domyślny status gniazdka/-ek <NUM> jako wyłączone response: none example: "DEF1OFF!" - define state off for socket 1 as default DEF<NUM>STA Show saved a default state of a socket(s) identified by <NUM>. wyślij domyślny status gniazdka/-ek response: DEF<NUM><state> examples: "DEF3STA" - display default state for socket 3 "DEFASTA" - display default state for all sockets SOCSAV! Save current state of the all sockets as default. zapisz aktualny stan gniazdek jako domyślny response: none example: "SOCNAME" - name of the device SOCNAM!<STR> Set a name of the device (power surge). If the name was set and <STR> is emply (only dot char) saved name of the device will be displayed. If the name (string) is longer than 15 characters, command is ignored. (let's check it). ustaw nazwę listwy, wyświetl nazwę, jeśli nazwa jest już ustawiona i brakuje parametru w wywołaniu (tylko kropka) response: none or <STR> example: "SOCNAM!<string>." - sets new name. SOCNAME Show saved name of the device if the name has been set. wyświetl nazwę, jeśli nazwa jest już ustawiona response: <STR> or none SOCALT Switch the device into compatibility mode. Every other command should switch the device into default mode. przełącz się w stary, kompatybilny tryb ustawiania gniazdek, każda inna komenda powoduje przejście w domyślny tryb sterowania response: '>' char every 100ms WDTEST! Test MCU's watchdog. It should reset MCU and XPort module. If reset did not occur 4 Command Description One more way to swich from compatibility mode to default mode. test watchdoga, powoduje reset MCU i XPorta. Inny sposob na przejscie ze starego trybu pracy w nowy. Jeśli reset nie nastąpi listwa nie posiada poprawnego firmware'u do pracy, a jedynie testowy. response: none WDTCHK Show (check) reason of MCU reset. sprawdzenie przyczyny resetu, wzraca CSR<h>, gdzie <h> to 4 bity w kodzie hex response: CSR<h> where <h> is a hexadecimal number coded as following: • bit3: watchdog reset • bit2: brown-out reset • bit1: external reset • bit0: power-on reset PWREAD Read and show not stabilized power voltage inside the device. odczytuje wartość analogową z dzielnika napięcia zasilania, zwraca PWR<h><h><h>, gdzie <h><h><h> representuje 12 bitow w kodzie hex. Przetwornik ADC jest 10 bitowy, a wiec wartosci beda od 000 do 3FF. Typowe wartosci przy 231V+/-1V, np. 0x335 .. 0x345 (rozbieznosc <2%) => 2.05V .. 2.09V => 12.32V .. 12.56V Pomiar ten pozwala nie tyle mierzyć pośrednio napięcie w sieci energetycznej, co ocenić jakość zasilania wewnątrz listwy, a tym samym jej stabilność. Vref = 2.56V (wewnętrzny daje dokładność rzędu 5%, ale lepsze niż niezbyt stabilne 3.3V z przetwornicy DC/DC), a więc napięcie Vin na wejściu ADC0 powinno być w przedziale od 0V do 2.56V response: PWR<h><h><h> where <h><h><h> repesents 12bits in hex code. ADC has 10bits resolution there possible values are in rage 000 to 3FF. ADC = Vin * 1024 / Vref → Vin = ADC * 2.56V / 1024 "12V" (not stabilized voltage) = Vin * (100k + 20k) / 20k VERSION Show type of the device (Power Surge), hardware details, date and time firmware compilation. zwraca typ urzadzenia, opis sprzetu (hardware), date oraz czas kompilacji firmware'u. Lancuch znakow zakonczony kropka, np. "Power Surge, XPort-03 + ATMEGA8, Mar 13 2009, 15:11:24." response: <STR> EXTUON Turn on communication between XPort serial port and external UART / RS232. włącza komunikację XPORTa z zewnętrznym portem UART / RS232 response: none 5 Command EXTUOFF Description Turn off communication between XPort serial port and external UART / RS232. wyłącza komunikację XPORTa z zewnętrznym portem UART / RS232 response: none 6
© Copyright 2024