tyrrellsystems / node-red-contrib-serial-modbus

This node is now maintained from @leifnel's fork
https://github.com/leifnel/node-red-contrib-serial-modbus
Apache License 2.0
7 stars 13 forks source link

Serial comms issue #6

Closed creativeng closed 8 years ago

creativeng commented 8 years ago

Hi,

im testing usage of the package, however it seems that serial communication doesnt goes through. im working with a rpi 3, pretty clean new installation of raspian jessy, latest versions of Node Js and node red. i have created a simple flow with serial modbus read connected to a debug module. serial port is configured as /dev/ttyUSB0, 9600N81 the "connected" status appear under the modbus serial block, however no messages are read, nor i see traffic on the serial port.. where could be the problem? has anyone a demo flow to check? thanks m

hardillb commented 8 years ago
  1. Please post your flow so I can see what settings you have.
  2. Also what make of RS 435 adapter are you using?
  3. What user is node-red running as and is that user a member of the dialout group?
  4. Are you sure your bus is running at 9600N81?
  5. What device are you trying to query?
  6. What version of NodeJS are you using? Just saying latest is useless as I don't know if that's 0.10, 4.0 or 6.0
creativeng commented 8 years ago

this the FDTI usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0

this is the flow..

[{"id":"14394a47.bb6836","type":"modbusSerial in","z":"46c4675b.5e0378","port":"f8eac122.f172b","slaves":"1","start":"1","count":"5","dtype":"holding","period":"5","topic":"stex","name":"Stelix200","x":447,"y":270,"wires":[["3fc0b758.0dc2c8"]]},{"id":"f8eac122.f172b","type":"modbusSerialConfig","z":"46c4675b.5e0378","port":"/dev/ttyUSB0","baud":"9600","data":"8","parity":"none","stop":"1","name":"FDTIAdapter"}]

what do you mean by node red User? the current user is the default pi

i have interfaced the same unit (it is a light sensor) with other software using the same fdti adapter, so im sure it is 9600N81

hardillb commented 8 years ago

Yes, I did mean the user running node-red, is it part of the dialout group?

I assume there is more to your flow than what you've shared as just the node on it's own isn't going to show anything unless you link it to something like a debug node..

I still need to know what version of node you are running and while your at it the npm version will be useful.

Also attach the node-red console output

creativeng commented 8 years ago

yes the user pi is already member of dialout group

no that's the only flow i have, i'm just testing the basic functionalities before moving forward... i need also to understand how data is transfered by the module.. so i actually have only the modbus serial linked to the debug node... i assume polling is expressed in ... seconds? and i expect the module start polling the serial and send message payload to the debug node

node version is 0.14.6 npm is 2.15.9

hardillb commented 8 years ago

The flow you posted doesn't actually contain anything other than the modbus node and it's config node, which is why I asked about what you have it connected to.

Can you add the node-red console log please as I asked last time, I need to see if there are any messages being logged.

I've just fired up my Raspberry Pi, it currently has Node 4.4. I was getting timeout errors until I pulled and re-plugged in my USB adapter, after that things started to work properly.

creativeng commented 8 years ago

it is working now... honestly dont know why, i have just upgraded node red to version 0.15, i get now binary messages... now i go on trying and testing, ill keep the group informed..

creativeng commented 8 years ago

node 4.4 you make reference to is Nodejs?

hardillb commented 8 years ago

Yes Nodejs 4.4

creativeng commented 8 years ago

I notice that the service is unstable, if i change something and re-deploy, the service doesnt work anymore, i tried to disconnect and reconnect USB bu no change. i need to reboot the rpi to get again the serial stream...

hardillb commented 8 years ago

You've not mentioned what you've changed. If you want help with this you really need to share a lot more information about what you changed when.

creativeng commented 8 years ago

you're right, however what i mean is any type of change... using the same flow as before, so just serial modbus and debug.... i change polling from 10 to 5, redeploy and flow didn't resume.... i rebooted rpi and serial data appear...

all other parameters are same as those i already gave i have tried this several time and resul is always same

creativeng commented 8 years ago

to get data from multiple serial ID i understand i have to provide a list of RTU ID..... could be however possible to use several instantiations of the node? say one to read each ID?

hardillb commented 8 years ago

I have a potential change that may reduce the need to reboot to make changes but I can't test it until I'm in the office.

While you can have multiple nodes attached to the same serial port polling different slaves the node is designed to poll the slaves in turn for the list of registers/coils. You can distinguish the messages from the node by the topic postfix. e.g. if you set the topic in the node to lightmeter then slave 1 data will be sent with the topic set to lightmeter/1.

The code should support multiple nodes attached to the same serial port but I only have 1 slave device so have not tested it with more

creativeng commented 8 years ago

ok thanks, so each tag shall have the ID as part of the suffix... ill go on with more tests... the need to reboot makes things quite slow...

hardillb commented 8 years ago

I've pushed an update that should ensure that the port is closed when the config node is closed.

Please make sure you change the publish mode to only modified nodes, this will ensure that the config node is left alone when you change things in the input node. These changes should not effect the connection to the RS485 bus at all.

creativeng commented 8 years ago

hi it seems it works now, however it yest stucks if you change something, say polling time in the input node, and then redeploy. im yet using the same trivial flow just trying to insert a bynary converter between modbus serial input and debug

winpux commented 4 years ago

I have tried to poll two devices - slaves. In that case I entered " 1,2 " as slaves to poll. It does not worked. Is there a different way to enter a list of slaves to poll?