Suchen Sie etwas anderes?
Scenario details:
- We need to switch a relay depending on the sunrise and sunset to activate a lighting system
- It is not possible to establish a fixed time, since the time of sunrise and sunset depends on the place (sunrise/sunset at the same time in Madrid, Barcelona or Mexico City) and day of the year (summer/winter). To do this, the MTX modem must be configured as an astronomical clock
- For special days, such as Christmas or local holidays, it must be possible to configure schedules to activate/deactivate the relay in a pre-programmed way at a specific time
- The location of the device is Cardedeu, with GPS position latitude: 41.6333 and longitude: 2.36667
Solution: MTX-Tunnel firmware + MTX-Java-IoT
EXAMPLE of settings (file config.txt) for such scenario:
Configuration | Observations |
MTX_PIN: 0000 MTX_model: 199802407 MTX_mode: none MTX_TPProtocol: ntp MTX_TPServer: ntp.roa.es MTX_TPServer2: es.pool.ntp.org MTX_latitude: 41.6333 MTX_longitude: 2.36667 SMS_allPhones: on SMS_ATEnabled: on SMS_ATResponse: on SMS_sendIP: on GPRS_apn: movistar.es GPRS_login: MOVISTAR GPRS_password: MOVISTAR GPRS_timeout: 0 OUTPUT_mode3: astronomical OUTPUT_config3: -30;30 FIREWALL_enabled: off TELNET_enabled: on TELNET_login: user TELNET_password: 1234 TELNET_port: 20023 |
If SIM card doesn’t have PIN, leave as 0000 The MTX model chosen is MTX-DIN We do not want GPRS gateways Time synch. protocol Time server (the MTX must sync the time) Backup time server GPS latitude position GPS longitude position IP by SMS authorized IP by SMS authorized AT by SMS allowed SMS AT responses activated APN GPRS provided by the GSM operator GPRS Login GPRS Password Modem is always GPRS connected Output 3 (relay) depending on the sun No offset for the sunset and sunrise Firewall disabled Telnet is activated Login for Telnet Password for Telnet Telnet port |
Details:
- This scenario can be combined with others that simultaneously perform serial/GPRS gateways to access serial devices (modbus or others) as well as others in which the MTXTunnel autonomously collects modbus data and sends it via JSON to web platforms
- The MTX-Tunnel works in the following way with respect to its astronomical clock: each time a change of day occurs it calculates the hour/minute of the instants “orto” (sunrise) and “ocaso” (sunset). But before calculating those moments it consults the file “astroschedule. txt, where you can define exceptions for certain days. For example, if you define a special sunrise/sunset schedule for January 5th and it is included in the “astroschedule.txt” file, the MTX-Tunnel will use that schedule instead of the calculated one
- The “astroschedule.txt” file has the following format:
ID:day;month;hourOrto;minutesOrto;hourOcaso;minutesOcasorn
Where ID is a value that indicates the time identification (it can range from 1 to 200). Note that after the ID, “:” (calling) must be written, unlike the rest of the parameters that are separated by “;” (semicolon)
day: indicates the day of the month (1 …31)
month: indicates the month (1…12)
hourOrto: indicates the “forced hour” of sunrise (0 … 23)
minutesOrto: indicates the “forced minutes” of sunrise (0 … 59)
hourOcaso: indicates the “forced hour” of sunset (0 … 23)
minutesOcaso: indicates the “forced minutes” of sunset (0 … 59)
For example, if we want to specify 2 schedules, one for January 5th and another one for October 12th, we could write the file “astroschedule.txt” this way:
1:5;1;8;0;17;30
2:12;10;7;45;18;30
Where on the 5th of January the hour of forced orto would be 08:00 and ocaso 17:30 and on October 12th would be 07:45 and 18:30 respectively - The file “astroschedule.txt” can be written manually in the root directory of the memory of the modem (next to the file config.txt“), it can also be downloaded completely in the memory of the modem with the command AT ^ MTXTUNNEL = DOWNLOAD… (it would be downloaded via http from a URL), but it is also possible to use a series of AT commands, such as: AT^MTXTUNNEL=SETASTROSCHEDULE, AT^MTXTUNNEL=GETASTROSCHEDULE, AT^MTXTUNNEL=GETASTROSCHEDULES, AT^MTXTUNNEL=DELASTROSCHEDULES, AT^MTXTUNNEL=DELASTROSCHEDULE. Consult the information of said commands in this manual for more information
- Note that if you set the OUTPUT_config3 parameter (to indicate an orto and ocaso offset) the times specified in the “astroschedule.txt” file will not be affected
- Keep in mind that, as always, the time specified in the “astroschedule.txt” file must be UTC time