Go Down

Topic: 4 Nano with 4 RS485 to TTL Converter (Read 140 times) previous topic - next topic

microguy

I would like to control four Arduino nano from my computer. I was not sure what is the best to control by using USB to RS485 convert https://www.ebay.com/itm/USB-to-RS485-Converter-Adapter/301776477568?hash=item4643479d80:g:IeAAAOSw14xWKRMa:sc:USPSFirstClass!84097!US!-1  or using an extra Nano as a master which will be connected to a computer on USB plus 4 slave nano with 4 RS485 module TTL.

In the future, I will use some 4 Channel 5V Relay Shield Module Boards and four servos on each nano.  Right now I would like to control some LEDs to learn how to run it. Is there a place where I can learn how to do this and download the source codes to play with it? I will use Lazarus program to write a window application and control four nano.   



 

noiasca

485 should be fine for a bus system . Probably you should learn about modbus and google for modbus master and slave libraries.
DE: Wie man Fragen postet:
1. was hat man (Sketch und Hardware)
2. was SOLL es machen
3. was macht es: IST (Fehlverhalten, Fehlermeldungen, Serial.Output ...)
4. Eine Frage stellen bzw. erklären was man erwartet

microguy

I have read a lot about modbus RS485 in google. I can't find what I am looking for. I see lot of infomation on master and slave arduino on modbus. That is not what I am looking for. I am looking for PC control several slave arduino on modbus. Also it is my understand that we only send one information at time to one of slave before we can get information from one of slave to PC. I just want to see if someone already setup sample program on PC with several slave arduino.   

adwsystems

#3
Aug 20, 2018, 02:22 am Last Edit: Aug 20, 2018, 02:22 am by adwsystems
First thing to know about RS-485 is that requires the units to connected be daisy-chained, not in a start or hubbed arrangement. The second thing to know is that most pre-made modules are designed for there to be only 2 in a system because ALL of the modules have the termination resistor on them. You will need to remove the termination resistor from all but the first and last modules in the daisy chain.

ron_sutherland

So you want the PC to be the Modbus master. That itself can be a significant challenge. Have a look at libmodbus to run a PC as a Modbus master.

http://libmodbus.org/

https://github.com/stephane/libmodbus

There is also a slave for Arduino by the same person.

https://github.com/stephane/modbusino

You should be able to set up a slave using the Arduino's RS232 to test things out, one advantage this has is the slave can bootload. If that can be got to work then start work on the RS485 multidrop. Unfortunately, with RS485 a simple bootload becomes complicated. It may be best to do all the software development and debug with an RS232 setup.

Note: when I say RS232 I am not talking about the standard, rather the way Arduino does it (e.g. the 5V signals).

Go Up