background image

 

dS378  

dS378  

 

  

                                                       User Manual v2.19

Boolean equations

Both relay automation and email triggering use the boolean equation solver.

The three types that can be used in boolean equations are:

1. Relays, R1 – R8

2. Digital I/O's, D1 – D7
3. Analog inputs, A1 – A7

4. Schedules, S1 – S8
5. Counters, C1 – C8

6. 1Hz Time base, T1

The simplest equation is R1. This is true when R1 is active and not true when R1 is in-active. If
you enter R1 in the relay 2 automation box it will simply follow whatever R1 does.

The exclamation mark ! is used as a “not”. So !R1 is true when relay 1 is in-active. 

Enter !R1 in the relay 2 automation box it will follow the opposite of R1. Relay 2 will be active 
when relay 1 is inactive.

The same applies to the digital I/O's. Enter D2 in the relay 2 automation box and the relay will 

follow the input.

Analog inputs are compared with a value to obtain a true/false boolean result. In this example 
we have set I/O8 to be an analogue input with a 5v reference. Then we can enter A1<1000 in 

the relay2 automation box. This will turn on relay 2 when the input A1 falls below 1000. If A1 
is connected to a temperature sensor and R2 controls a heater – well, you get the idea. Analog

comparisons use the “less than” < and “greater than” > symbols only. There is no equal or not
equal. Checking for equality on a potentially jittery analogue input is not really useful.

As well as “not” !, you can use “and” & and “or” | in your equations.

Enter D2&D3 and the result is true only when both D2 and D3 are active.
Enter D2|D3 and the result is true when either D2 or D3 is active.

What happens here:

D2|D3&D4
The answer is that boolean expressions are evaluated left to right. So D2 is ORed with D3 and 

the result ANDed with D4. You can change the order of precedence by using parenthesis ().
D2|(D3&D4)

will now AND D3 with D4 and the result is Ored with D2.

Copyright 

© 2016-2017,

 Devantech Ltd.

All rights reserved.

www.robot-electronics.co.uk

27

www.pishrobot.com

Содержание dS378

Страница 1: ...dS378 dS378 User Manual v2 19 dS378 dS378 User Manual Version 2 19 Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 1 w w w p i s h r o b o t c o m ...

Страница 2: ...equations 27 TCP IP command sets 29 ASCII command set 29 Binary command set 31 AES binary command set 33 Modbus commands 35 Function 01 0x01 Read Coils 35 Function 04 0x04 Read Input Registers 35 Function 05 0x05 Write Single Coil 35 Error code 1 36 Error code 2 36 Error code 3 36 Loading the application firmware 37 dS378 hardware 39 LED indication 40 Power supply 40 Operating temperature 40 Power...

Страница 3: ...anual V2 19 Added new features Peer to Peer Use events to control relays on another dSxxxx module Schedules Create regular timed events Counters Count input transitions or seconds Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 3 w w w p i s h r o b o t c o m ...

Страница 4: ...ically by secure webpage or optionally one of ASCII Binary or Modbus command sets over TCP IP Email notifications 8 selectable notifications up to 100 emails hour max Peer to Peer Control relays on other modules Schedules Able to schedule events based on time of day week Counter Timers Count or time events 20 counts second Max Also available when optionally programming in dScript are two TTL level...

Страница 5: ...ronics co uk universal 12vdc html The dS378 has four built in control methods Primary control method is graphically by using its built in secure website Secondary control may be one of ASCII type in commands via a program such as PuTTY Binary Command set using binary codes Modbus Functions 1 4 and 5 supported And if you should wish to modify the supplied firmware you can Behind the scenes there is...

Страница 6: ...e If the blue led does not flash you will need to load in the control firmware Don t worry this is very easy to do Just go to the chapter on installing the firmware and follow the instructions there If you are using a Win7 8 10 PC open your browser and into the address bar not the search bar type http dS378 index htm You should now see the application webpage and you can control relays and I O s C...

Страница 7: ...e LAN client list Above is the entry from our ASUS RT N66U router So now you type 192 168 0 90 index htm into your browser address bar and you should see the application webpage shown on the previous page If you prefer you can download a java program that will run on Windows MAC or Linux and will list all of our modules that are connected to your LAN DevantechModuleFinder jar Copyright 2016 2017 D...

Страница 8: ... the module you really don t want these configuration pages available for others to change So with the USB cable disconnected the _config pages are not available If you try to access them you just get served a not authorised page instead So for now you do want to look over the config pages If you have a Win10 Linux or MAC PC you can go right ahead and plug in the USB cable These machines will inst...

Страница 9: ...ation firmware revisions as well as the supplied voltage to the board and its internal temperature If you hover your mouse cursor over the menu buttons on the left the help panel will give you an overview of each one Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 9 w w w p i s h r o b o t c o m ...

Страница 10: ...n 5 seconds after you stop changing anything Choose an IP address for the module something outside of the DHCP settings on your router so it will not assign anything to that address The subnet mask Gateway and DNS can all be left as the defaults Network changes only take effect after the next re boot so wait until the Update Pending light goes out and give the reset button on the module a quick pr...

Страница 11: ... raw mode The Binary command set operates in a similar way to our ETHxxx range of boards but uses different commands by sending binary commands to the module AES Binary adds encryption Note the AES key MUST be 32 bytes long We have a test applications written in C and Java to demonstrate AES encryption The Modbus command set implements functions 1 4 and 5 When selecting the Modbus command set make...

Страница 12: ...u can use any characters from the ASCII character set from 0x20 to 0x7E except 0x22 It may be up to 200 characters long and you don t have to memorise it so make it a long one with plenty of uppercase lowercase numbers and symbols Accessing a special webpage _pw htm will install the password on your browser To do this make sure the Enable _pw htm box is checked When the Update Pending light goes o...

Страница 13: ...sword When the Update Pending light goes out re boot the module again The default port used by html webpages is 80 You can change this if required If you do so then you will need to include the port number in the address If you change the port to 2345 then the webpage will be at YourIP 2345 index htm For example 192 168 0 123 2345 index htm Copyright 2016 2017 Devantech Ltd All rights reserved www...

Страница 14: ... page Names may be up to 20 characters long but keep them shorter if you want to use a phone as the controller Here we have renamed relay 4 as YardLights and those 10 characters are about the limit on a vertical Galaxy S6 screen Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 14 w w w p i s h r o b o t c o m ...

Страница 15: ...s after 30 minutes 1800000 mS is 1800 seconds 1800 seconds is 30 minutes It also possible to insert a boolean equation into the automation box Boolean equations are just simple equations that evaluate to a 0 or 1 For example Relay 1 is referred to a R1 I O1 is referred to as D1 Digital 1 Analogue input 1 is referred to as A1 Here s a very simple example Enter R1 into the Relay 2 automation box Thi...

Страница 16: ...ltage The with pullup option turns on a weak pull up to 12v actually nearer 7 8v because of the input design This is useful for directly connecting volt free contacts such as relay contacts or switches They are connected between the pin P and ground 0v To use as inputs make sure the output drive is off or the NPN transistor will drive the output low The NPN transistor can sink about 100mA The anal...

Страница 17: ... The trigger event uses the same boolean equation solver as the relay automation So if you want to trigger an email when digital input 1 I O1 becomes active just enter D1 The email message is automatically filled in with useful information on the state of the relays I O s etc Boolean equations are used for controlling relays as well as triggering email notifications See the Boolean equation sectio...

Страница 18: ...e the Boolean equation section later in this manual for full documentation Target IP Port Relay No should be set to locate the target relay Target action determines how the relay will be controlled 0 No action this Peer to Peer event is disabled 1 Follow Me the relay will follow the input or the Boolean result of any equation here 2 Set Relay the relay will be set by this event You will need anoth...

Страница 19: ... to control the relay When highlighted in red the weekday is active There are two sets of Start and Stop times for each of the eight schedules The relay is set when the start time transitions from inactive to active ie at the start time and reset when the stop time is reached It is not held on or off It can be changed by other events including the webpage buttons The current time originates from a...

Страница 20: ... required It advances the time by 1 hour between the last Sunday in March and the last Sunday in October As well as controlling a relay directly schedules may also be used in the boolean equation fields of other controls A relay could be controlled by placing S1 for schedule 1 in its automation field Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 20 w w w p i s h...

Страница 21: ...will be counted D4 will count pulses on input 4 Capture Input This is the event that will cause the current counter value to be stored in the capture register The capture register is displayed on the application page and may also be read using the TCP IP commands Reset Input This input will reset the counter value to zero If the capture Input has been left blank then it will store the current coun...

Страница 22: ... greater than 3599 with C1 3599 The counter will count from 0 3599 Next we will use counter 2 to do the counting of input 2 pulses The count input is set to D2 to count the pulses The reset input is controlled be counter 1 When it gets reset to zero each hour so does counter 2 As the capture input is blank the reset event also captures the count value This may be read any time in the next hour The...

Страница 23: ...s we don t need to use any relays for this All week days are set so we perform the synchronization every day Start stop time 1 is used to activate the schedule at 1 second past midnight each day The second start stop time is disabled as both times are identical Now go back to counter1 and add S1 to the reset input Now our time base timer will reset every hour or when schedule1 triggers it Copyrigh...

Страница 24: ... of your configuration changes The I O indicators show grey when the I O is inactive When an active input is applied they show green Red indicates an active output from the module The I O s are clickable just like the relay buttons to turn them on and off Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 24 w w w p i s h r o b o t c o m ...

Страница 25: ...able _pw htm checkbox is checked on the Webpage Security tab If the password field is left blank the application page will always be served to anyone Entering a password means the application page will only be served to a browser that has the matching password set Everyone else will just just be served a simple webpage saying You do not have permission to view this page To summarize set a password...

Страница 26: ...the webpage However its a good idea to use a different port number for our boards as this will avoid conflict with any web server you may have on your network Pick a number I ll choose 19321 as our port number Just make sure its different from any TCP IP port number you are using The HTML port is set on the Webpage Security tab After you have re loaded the program you can access the webpage with 1...

Страница 27: ...lean result In this example we have set I O8 to be an analogue input with a 5v reference Then we can enter A1 1000 in the relay2 automation box This will turn on relay 2 when the input A1 falls below 1000 If A1 is connected to a temperature sensor and R2 controls a heater well you get the idea Analog comparisons use the less than and greater than symbols only There is no equal or not equal Checkin...

Страница 28: ... To do that we will use R2 in its own equation A1 1000 R2 A1 1234 R2 Assume R2 in inactive off The 2nd half of the equation A1 1234 R2 will have no effect So when A1 falls below 1000 the relay comes on Now the 2nd half of the equation is true and will stay true until A1 climbs above 1234 So the relay becomes active when A1 is below 1000 and inactive above 1234 We have hysteresis Copyright 2016 201...

Страница 29: ...to type commands using a TCP IP terminal program such as PuTTY Use PuTTy in raw mode Make sure you have you module set to ASCII mode and after the update Pending indicator has gone out re booted the module so the changes take effect ASCII commands are all two character commands and are not case sensitive Type ST followed by the return key This is the STatus command You will see Copyright 2016 2017...

Страница 30: ...ctive or Inactive GI Input number GI 1 Get Input 1 status responds with Active or Inactive GA Analog Input number GA 1 Get Analog input 1 responds with the 10 bit analog value GC Counter number GC 1 Get Counter1 responds with count capture values Note on the dS378 GI and GA are identical getting the digital state or analogue value depending on the port configuration in the I O Types tab Typical Pu...

Страница 31: ... command returning 1 byte This command turns a relay on or off or pulses it for a time period and returns an ACK NACK byte ACK 0 NACK non zero actually the unknown relay number 0x31 The actual command the rest are parameters 0x02 Relay number Valid numbers are 1 8 0x01 0x08 0x01 Turn relay on 0x00 for off This is ignored when following pulse time is 100 0x00 high byte Pulse time 0x00 mid high Thes...

Страница 32: ...returned byte is the state of the requested relay 0x00 off or 0x01 on the 2nd byte packs the states of all 8 relays Bit 7 is relay 8 through to bit 0 which is relay 1 Byte 2 Bit No 7 6 5 4 3 2 1 0 Relay 8 7 6 5 4 3 2 1 If the bit is set the relay is on zero otherwise 0x34 0x01 Get Input 2 byte command returning 2 bytes This command is used to get the states of the inputs The second byte is the inp...

Страница 33: ... 4 byte value returned high byte first AES binary command set The AES Binary commands are the same as the Binary commands described above The only difference is that they are AES encrypted and always 16 bytes in length The first bytes are the same as described in the Binary command set The last 4 bytes is the Nonce a random number and the bytes in the middle are undefined The module will decrypt t...

Страница 34: ...used in the next Set Relay or Set Ouput command 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Get Status 0x30 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx Response 0x23 0x02 0x12 0x01 0x02 0x7D 0x01 0x0B xx xx xx xx 0x89 0xAB 0xCD 0xEF Set Relay 0x31 0x02 0x01 0x00 0x00 0x00 0x00 xx xx xx xx xx 0x89 0xAB 0xCD 0xEF Response 0x00 xx xx xx xx xx xx xx xx xx xx xx 0x1A 0x2B 0x3C 0x4D Set Relay 0x31 0x03 0x01 ...

Страница 35: ...nter3 high word Register 14 Counter3 low word Register 15 Counter4 high word Register 16 Counter4 low word Register 17 Counter5 high word Register 18 Counter5 low word Register 19 Counter6 high word Register 20 Counter6 low word Register 21 Counter7 high word Register 22 Counter7 low word Register 23 Counter8 high word Register 24 Counter8 low word Register 25 Capture1 high word Register 26 Captur...

Страница 36: ...egal address is requested Addresses greater than 15 for functions 1 5 or greater than 7 for function 4 will generate this error Error code 3 This error is returned if an illegal data value is received Number of points zero will generate this as will an illegal data value for function 5 Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 36 w w w p i s h r o b o t c o ...

Страница 37: ...the Installation directory and click setup to install the dScript IDE if you have already installed a previous version you will need to uninstall it before installing the new one The USBdriver folder contains the USB com port driver for the modules Copy the Examples directory to a convenient location on your computer it contains both dScript source code examples and associated web pages one of whi...

Страница 38: ... indicates it s the boot loader that is running 7 Click the file open button or File Open and load dScriptPublish Examples dS378 v 13 dS378 v1 3 dsj 8 Make sure the webpage folder is correctly set Substitute the path for where you placed the dScriptPublish folder Click the blue world button if you need to search for the folder 9 Click the build button white triangle on green button This will updat...

Страница 39: ...dS378 dS378 User Manual v2 19 dS378 hardware Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 39 w w w p i s h r o b o t c o m ...

Страница 40: ... Red LED lights when the module is in bootloader mode this is when the IDE is uploading system firmware to the module The Green LED lights the board begins running user programs All three LEDs are available and can be controlled as digitalports 32 34 digitalport LedBlue 32 digitalport LedGreen 33 digitalport LedRed 34 The FlashingLeds example provides a colourful display showing how to use them Th...

Страница 41: ... a normally open output The relay coil is powered by the 12vdc incoming supply on user command Coil C Relay in passive state NC NO Coil C Relay in powered state NC NO A full datasheet for the relays used on the dS378 is here HF115FD datasheet Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 41 w w w p i s h r o b o t c o m ...

Страница 42: ...wire the switch between a pin P and ground 0v When the switch closes the input will become active Make sure you use the 1 option in the digitalport declaration to enable the ports passive pull up Example output connect a relay You can connect your own 12V relays 200mA max the first coil pin of the relay is wired to the 12V supply terminals on the board the other is wired to the output pin P When t...

Страница 43: ...by the option in the digitalport declaration in digital modes Q1 controls the open collector NPN output It is set by writing to the port D1 is the ports input It supplies the 10bit ADC in analogue modes and is read as 0 or 1 in digital modes Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 43 w w w p i s h r o b o t c o m ...

Страница 44: ...n pin1 to power external modules RS485 serial port Referred to as serial port 3 in dScript The 12v power is not part of the RS485 specification it is there to provide convenient power for any 12v sensors you may wish to connect such as our SRF485 ultrasonic rangers Connections for the RS485 port are also clearly labeled on the PCB The two pin link near to the RS485 terminal block should be shorted...

Страница 45: ...dS378 dS378 User Manual v2 19 dS378 dimensions Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 45 w w w p i s h r o b o t c o m ...

Страница 46: ...dS378 dS378 User Manual v2 19 Notes Copyright 2016 2017 Devantech Ltd All rights reserved www robot electronics co uk 46 w w w p i s h r o b o t c o m ...

Отзывы: