Skip to content

Commit

Permalink
EM Scripts update.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitskevich committed Sep 2, 2022
1 parent 203fbd3 commit 1603a6a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
17 changes: 9 additions & 8 deletions em48x-scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Novatek-Electro EM-48X Programing
# Novatek-Electro EM-48X Programming

![EM-481](./examples/imgs/em-481.jpg)

[Novatek-Electro](https://www.novatek-electro.com/) EM-48X controllers are often used in conjunction with [Overvis](https://www.overvis.com/) to set up industrial automation with remote control.

Following EM-48X controllers support simple programming logic language to automate some tasks that require PLC to do otherwise:
* [EM-481](https://www.overvis.com/equipment/em-481/)
* EM-483 (upcoming)
* EM-484 (upcoming)
* [EM-486](https://www.overvis.com/equipment/em-486/)

- [EM-481](https://www.overvis.com/equipment/em-481/)
- EM-483 (upcoming)
- EM-484 (upcoming)
- [EM-486](https://www.overvis.com/equipment/em-486/)

This language and its usage is described in details in the device's manuals (e.g. see [EM-481 manual](https://novatek-electro.com/docs/en/doc_em-481_en.pdf), appendix C).

This documentation contains several examples that provide you with the start point to write your own automation. We will update this list to include more examples.

* [Simple timer-based relay control using EM-486](./examples/simple-timer.md)
* [Simple temperature control based on EM-486](./examples/simple-temperature-control.md)
* [Astronomical timer or light sensor relay control for street lightning based on EM-481 + OB-215](./examples/astronomical-timer.md)
- [Simple timer-based relay control using EM-486](./examples/simple-timer.md)
- [Simple temperature control based on EM-486](./examples/simple-temperature-control.md)
- [Astronomical timer or light sensor relay control for street lightning based on EM-481 + OB-215](./examples/astronomical-timer.md)

Please contact [email protected] if you have any questions and don't hesitate to create pull requests with more examples or fixes.
39 changes: 19 additions & 20 deletions em48x-scripts/examples/astronomical-timer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Diagram](imgs/astronomical-timer-diagram.svg)

This example [EM-481](https://www.overvis.com/equipment/em-481/) program turns on/off the [OB-215](https://www.overvis.com/equipment/ob-215/) relay based on sunset/sunrise or light sensor connected to OB-215.
This example [EM-481](https://www.overvis.com/equipment/em-481/) program turns on/off the [OB-215](https://www.overvis.com/equipment/ob-215/) relay based on sunset/sunrise or light sensor connected to OB-215.

It also includes additional energy saving interval (during night) when the relay should be switched off.

Expand All @@ -14,24 +14,24 @@ The program is controlled through Overvis using registers on EM-481 device.

**Logic mode setting:**

Address | Description
--------|------------
5256 | Logic mode switch (1 = astronomical timer, 2 = sensor-based).
| Address | Description |
| ------- | ------------------------------------------------------------- |
| 5256 | Logic mode switch (1 = astronomical timer, 2 = sensor-based). |

**Astronomical timer mode settings:**

Address | Description
--------|------------
5250 | Shift in seconds **before** sunrise (to switch relay OFF).
5251 | Shift in seconds **after** sunset (to switch relay ON).
5252 | Time of day in seconds to force-switch relay OFF to enter energy saving period.
5254 | Time of day in seconds to force-switch relay ON to exit energy saving period.
| Address | Description |
| ------- | ------------------------------------------------------------------------------- |
| 5250 | Shift in seconds **before** sunrise (to switch relay OFF). |
| 5251 | Shift in seconds **after** sunset (to switch relay ON). |
| 5252 | Time of day in seconds to force-switch relay OFF to enter energy saving period. |
| 5254 | Time of day in seconds to force-switch relay ON to exit energy saving period. |

**Sensor-based mode settings:**

Address | Description
--------|------------
5257 | Sensor threshold: below this threshold relay will be switched OFF, above or equal to threshold - ON.
| Address | Description |
| ------- | ---------------------------------------------------------------------------------------------------- |
| 5257 | Sensor threshold: below this threshold relay will be switched OFF, above or equal to threshold - ON. |

## Code

Expand Down Expand Up @@ -60,7 +60,6 @@ Address | Description
# In Overvis, this parameter can be changed through address 5251.
4 * INT16 H 5501

# ?
# Additional energy saving mode: time in seconds after midnight to turn relay off.
# E.g. to turn off at 01:00, set this to 3600.
# to turn off at 23:00, set this to 3600*23 = 82800.
Expand Down Expand Up @@ -150,7 +149,7 @@ Address | Description
# The relay should be switched off in that case.
8 AND C4 C7
# C9: C2 || C8 = ((V0 >= V5) && (V0 <= V6)) || ((V8 > V7) && (V0 >= V7) && (V0 <= V8))
# Either currently is daytime or we are in energy saving mode.
# Either currently is daytime or we are in energy saving mode.
# In any case we have to turn relay off.
9 OR C2 C8
# С10: !C9 (Relay should be on)
Expand All @@ -170,7 +169,7 @@ Address | Description
# The relay should be switched off in that case.
13 AND C11 C12
# C14: C2 || C13 = ((V0 >= V5) && (V0 <= V6)) || ((V8 <= V7) && ((V0 >= V7) || (V0 <= V8)))
# Either currently is daytime or we are in energy saving mode.
# Either currently is daytime or we are in energy saving mode.
# In any case we have to turn relay off.
14 OR C2 C13
# С15: !C10 (Relay should be on)
Expand Down Expand Up @@ -215,13 +214,13 @@ Address | Description
# C27: C17 && C26 (We are in light sensor mode and current sensor reading is ERROR).
27 AND C17 C26
# C28: C23 || C27
# We are in light sensor mode and
# We are in light sensor mode and
# current light level is less than threshold or reading is ERROR.
28 OR C23 C27
# C29: V11 != V12 (Current sensor reading is not ERROR).
29 NOT C26
# C30: C25 && C29
# We are in light sensor mode and current light level is greater than threshold
# We are in light sensor mode and current light level is greater than threshold
# and current sensor reading is not ERROR.
30 AND C25 C29

Expand Down Expand Up @@ -252,10 +251,10 @@ Address | Description
# Turn relay ON if we are in astronomical timer mode and relay should be on.
* C21 ACT A0

# Turn relay ON if we are in light sensor mode and
# Turn relay ON if we are in light sensor mode and
# current light level is less than threshold or reading is ERROR.
* C28 ACT A0
# Turn relay OFF if we are in light sensor mode and
# Turn relay OFF if we are in light sensor mode and
# current light level is greater than threshold and reading is not ERROR.
* C30 ACT A1

Expand Down

0 comments on commit 1603a6a

Please sign in to comment.