How to add xS40 to Neuron L203 using custom software
How do I connect an xS40 to my Neuron L203? I see no documentation how to do this.
I connected the RS485-A and -B to the Neuron, but when I go to the IP address in my browser, I do not see the extra in/outputs. Do I have to configure something in the system?
I am using the websockets API in my custom software to manage in and outputs. What should I do to make this work?
@Boy-Lenssen Ok, so I guess you are using Evok, right? So moving this to Evok section.
You have to 'tell' evok that you connected the extension - this is done in the /etc/evok.conf. See this the example starting on line 27: https://github.com/UniPiTechnology/evok/blob/master/etc/evok-neuron.conf#L27
I have no idea yet how to handle this. Can I also just set the hardware DIP switches to something and have it working without any software adjustments? I read this in the manual, but don't understand how it works
Ok, I've added it to /etc/evok.conf
#!! don't use # for inline comments [MAIN] log_level = ERROR ; one of INFO, DEBUG, WARNING, ERROR, CRITICAL log_file = /var/log/evok.log webname = unipi-neuron staticfiles = /var/www/evok ;password = test ;rpcpassword = test secret = ut5kB3hhf6VmZCujXGQ5ZHb1EAfiXHcy port = 80 enable_cors = False cors_domains = * modbus_port = 0 #modbus_address = 127.0.0.1 modbus_address = * [NEURON_1] scan_frequency = 50 scan_enabled = True [OWBUS_1] owbus = --i2c=/dev/i2c-1:ALL ; scanned bus (--i2c=/dev/i2c-1:ALL or localhost:2122 or 'u' for USB dongle) interval = 3 ; [s] default sensor reading scan_interval = 300 ; [s] how often is made searching [EXTENSION_1] global_id = 5 ; Mandatory, REQUIRED TO BE UNIQUE device_name = xS40 ; Mandatory modbus_uart_port = /dev/extcomm/0/0 ; Mandatory ;neuron_uart_circuit = 1_01 ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0) ;allow_register_access = True ; Optional, False default, is mandatory with third-party devices ;address = 15 ; Optional, 15 default ;scan_frequency = 2 ; Optional, 1 default ;scan_enabled = True ; Optional, True default ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0 ;baud_rate = 19200 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN ;parity = N ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN ;stop_bits = 1 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
But still the led on the xS40 keeps blinking slowly (every 2 seconds), so not up-and-running apparently.
I'm using the evok software from may 2017 btw.
It should be running now, the slow blinking is only for on-board modules.
You can increase the reading speed by altering the scan_frequency setting.
Are you sure? The slow blinking usually shows me the boards are not communicating with evok. I Had this issue before, restarting evok fixed that.
If they are blinking slowly, they do not show up in the web interface.
I updated the system to the newest EVOK version (2.0.5b), but no input/outputs are showing up in the webinterface, so I broke my setup. Already in contact with support in this issue. Hope we will be able to fix it.
I'm now actually seeing this issue: https://forum.unipi.technology/topic/557/evok-stopped-working/3
The flashing TX/RX leds signal UART communication, specifically a reply from the device. If you uncomment and increase the scan_frequency setting you should see the blinking frequency increase.
Try to play with the address/parity options instead, since it looks like the device replies but with invalid data. If you don't see the TX/RX leds lighting up at all, then it is likely a cabling issue.
The RUN LED works in a different manner, and it does work in the way you describe.
the run led is blinking slowly, so there is no communication.
Can you tell me or point me to somewhere where it describes step-by-step what to do to connect the extension module? I have no idea what to do with the dip switches and if I set them, what do I need to do to configure them? I'm quite novice on this. I see 8 DIP switches and have them set to 0 atm.
I also se an 'on/off' dipswitch next to the rs485 connection on the Neuron. That needs to be put to 'on'?
Do you see the TX and RX leds blinking? That's the most part important. Ideally if you could mention the status of all four of them.
The dip switches are used to set speed, parity and address, as per the descriptions on top. They need to be set to 19200, N, and e.g. 1 (you will need to set the address to 1 in the configuration file as well).
The switch on the Neuron (there is another equivalent switch on the extension marked END) is used to turn on termination resistors. These are used to make the line more resistant to noise, and you can ignore it for now.
I have no idea how to set the dipswitches to 19200 N and 1. They are just 8 "toggles".
The TX / RX on both xS40 and Neuron don't do anything. I have all dipswitches to 'off'.
The run led is blinking every 2 seconds. Power led is on ofcourse
Do I need a minimum version of the EVOK service installed on the system?
Does the file /dev/extcomm/0/0 exist? Try changing it to /dev/ttyNS0 if it does not.
If the TX light on the Neuron doesn't turn on it means there is no communication at all.
I'm not quite clear on what you by having an EVOK service installed.
root@raspberrypi:/home/pi# ls /dev/extcomm/
root@raspberrypi:/home/pi# ls /dev/extcomm/0/0
seems to exists.
With evok service, I mean the latest EVOK software from Github.
Is it correct to have the RS-485-A connected to the RS-485-A of the xS40 and the
Can you point me to the page in the documentation someone should follow when adding an Extension unit?
It should be connected A-A, B-B, yes, the other way around will not work. The documentation, such as it is, is available from https://evok-6.api-docs.io/1.05/cgct7pncnqf9fper7/introduction, but it's targeted at users with prior experience with serial lines.
I would use the following settings myself:
[EXTENSION_1] global_id = 2 ; Mandatory, REQUIRED TO BE UNIQUE device_name = xS40 ; Mandatory modbus_uart_port = /dev/extcomm/0/0 ; Mandatory neuron_uart_circuit = 1_01 ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0) ;allow_register_access = True ; Optional, False default, is mandatory with third-party devices address = 1 ; Optional, 15 default scan_frequency = 10 ; Optional, 1 default ;scan_enabled = True ; Optional, True default ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0 baud_rate = 19200 ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN parity = N ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN stop_bits = 1
Then connect the line and set the dip switches to the following positions:
(apologies for the rotation)
I have verified that these settings work with a fresh EVOK install, with the device in the photo.
@TomasKnot Hey, thanks a lot! I got it working now. I think I might have forgotten to remove the semi-colon before [EXTENSION 1]
Now the Rx light on the xS40 is now constant on, the run light is still going on / off every 2 seconds. On the neuron, the TX flashes on very swiftly.
I don't see the extra in/outputs when I go to my ip address. How can I read / write the ports now? I thought I would get some ports like 4_05 or so...
I tried something like this: http://192.168.1.16/rest/relay/UART_1_2 but gives a 500 error
This looks like an address problem perhaps, or possibly some other communication setting issue. Did you try to set it up as I have above? At least for testing purposes.
If you did do so then it may be another issue, possibly with a hardware definition; if you can run the following commands while connected to the Neuron and paste the output here we may find the problem.
sudo su systemctl stop evok python /opt/evok.py