๐Ÿ’ฌ Building a wired RS485 sensor network


  • Admin

    This thread contains comments for the article "Building a wired RS485 sensor network" posted on MySensors.org.



  • Is it possible to have 1pcs NRF24L01 as serial gateway + 1 pcs RS485 as serial gateway (both with it's own Arduino Nano) connected at the same time to a controller? Will I just have to add 2 USB/serial gateways to my Domoticz?


  • Admin

    Yes. I'm almost certain Domoticz can handle multiple gateways..


  • Mod

    Yes it does



  • Could you provide details about the MySensor release version this was made on? I was not able to get it running on version 2.0.0. The development branch however worked fine.


  • Mod

    @Bart could you clarify what you mean by "this"?



  • On the Demonstration video what is each device? There are three devices but only two code examples.

    Am I right in saying the left device is the motion sensor, the middle device is getting the sensor data over RS-485 from the left device and sending it over the air to the right device which is an Ethernet gateway by the looks of it? Or has the video got nothing to do with the code examples?


  • Admin

    @Qu3Uk

    The video was created by @LeoDesigner and was posted here, my guess it was just test:

    https://forum.mysensors.org/topic/1947/rs485-rs232-serial-transport-class-for-mysensors-org/11



  • @mfalkvidd I am referring to the code samples from the article ๐Ÿ™‚ I think it would be good to have a well documented working example. Maybe that's just me but I am getting a feeling there's a lot of scattered info about RS485 configuration.


  • Admin

    @Bart
    The article was written only a day ago. I'm open to add more information you see fit. Asked the community for help creating a wiring diagram in Fritzing but no one took up the request ๐Ÿ˜‰

    The examples in the article are from directly from the 2.0 repository and should contain the configuration needed.



  • @hek OK, thanks for the hint - thought the article is older. Anyway as I am already on it, I will try to prepare something.

    BTW, Apart from the SerialGateway (where Serial is obviously not available for the debug), should the Serial work for the debug? Assuming I am using AltSoftSerial or Serial1 for the RS485 I guess it should be possible. However with DEBUG on I was not able to get it to work.


  • Admin

    Yes, for a regular node you should be able to print debug info.



  • Please, how many sensors on the bus you tested? I think, that this multimaster rs485 protocol is not very usefull for large number of nodes and heavy traffic..
    I am working on protocol for CAN bus nodes connected to to the serial gateway, but documentation for mysensors code is very bad.
    Its easier for me make it from scratch and use mysensors serial protocol between gateway and controller. only.





  • I would like to create a rs485 network that is 'local' to a specific device, (one that uses many arduinos to manage a process currently using a mega hardware serial ports as the intermediary and local interface ) and one mysensors note to relay sensor data from the rs485(local network) to the wireless mysensors network. Mostly I am wondering if I can use the wired network gateway and wireless network repeter features at the same time? any help is appreciated.

    https://github.com/rayvenwalker/mysensors-distillation/



  • Hi, I build up the set up with serial gateway and the motion sensor but nothing happens (only nonsence is is seen in the serial monitor)
    However if I run this small program using the AltSoftSerial library I can communicatie without any issue in both directions.
    Have others the same issue, or what do I overlook?

    #include <AltSoftSerial.h>

    AltSoftSerial altSerial;
    #define SSerialTxControl 2 //RS485 Direction control

    #define RS485Transmit HIGH
    #define RS485Receive LOW
    bool ReceiveOrSend = RS485Transmit;

    void setup() {

    Serial.begin(9600);
    Serial.println("AltSoftSerial Test Begin");
    pinMode(SSerialTxControl, OUTPUT);
    digitalWrite(SSerialTxControl, RS485Transmit); // Enable RS485 Transmit
    altSerial.begin(9600);
    if (ReceiveOrSend ){
    Serial.println("send mode");
    digitalWrite(SSerialTxControl, RS485Transmit); // Enable RS485 Transmit
    } else
    {
    digitalWrite(SSerialTxControl, RS485Receive); // Enable RS485 Transmit
    Serial.println("receive mode");
    }
    }

    void loop() {
    char receivedOnRS485;

    if (ReceiveOrSend ){
    altSerial.println(" Hello world");
    delay(2000);
    } else
    {

    if (altSerial.available()) {
    receivedOnRS485 = altSerial.read();
    Serial.print("ontvagen=");
    Serial.println(receivedOnRS485);
    }
    }
    }



  • 2.1.0-beta tested and works between two nanos over altsoftserial
    COM6:GW, COM9:Bus monitor and COM5:Node
    0_1482020748958_rs485_working.png



  • Tried this but I get an errormessage when I complile sketch for the gateway.
    The node presents itself but the messsage is not recognised/ answered by the gateway.



  • Has anyone else got this working alright ? I've connected 5v, GND, pins 8 to RD. 9 to DI. DE + RE to 2 and connected the rs485 modules via A B. Not getting any replys. Does the rs485 link need a resistor across it? Cheers.





  • @wimd Thanks mate! That topic was just what I was looking for. Works perfectly with defining a node ID!

    Just added this to my sensor node:

    #define MY_NODE_ID <X>
    

    and everything came together. Thank you for your quick reply.



  • Yes. It is very bad for beginners, that examples in MySensors library are wrong.
    Example "MotionSensorRS485" will never work and I think, that author not tested it.
    MY_NODE_ID must be always defined for node in RS485 network, because is used for RS485 network addressing.
    Obtaining NODE_ID from controller with currentRS485 network implementation is impossible and I think it should be clearly mentioned in the examples and documentation.


  • Admin

    Would be better if someone with a RS485 setup could analyse and fix the root cause of why automatic id assignment doesn't work than just change the example to use static ids.

    Did the id request reach your controller or gateway? Did the id response get to your gateway?



  • @hek
    I think it is simply. In radio network, each node has its unique "radio ID" , witch is used for delivering messages between nodes in radio network. So node can send message " Give me NODE_ID" and gateway or controller knows to witch radio ID send message with assigned NODE_ID in it.
    But in RS485 network we had not unique network ID by default - we use directly NODE_ID for addressing messages between nodes.


  • Admin

    No, it follow exactly the same flow as in a radio network. The gateway (and nodes) should listen to "channel" 255 which is used for broadcast messages (picked up by anyone interested; I.e. repeaters and nodes waiting for new id).

    When a id request is sent out from a node, the gateway will forward it to the controller.. the controller sends out the new id on 255 (which is forwarded by the gateway) and (hopefully) picked up by the new node.

    So somewhere in stil flow the message is not sent along for some reason. Which controller do you use @kimot?



  • @hek
    I am using Domoticz, but not using RS485, instead I am working on CAN protocol layer for MySensors or using only MySensors serial gateway protocol in my CAN-to-Domoticz gateway. For that reason I am studying source code of MYSensors a lot of. Its only useful documentation source, unfortunately.
    Imagine, if you "switch on" entire your network with 10 nodes. Each node send request for NODE_ID to the gateway and gateway send broadcast with assigned NODE_ID. How RS485 nodes recognizes, that this NODE_ID is exactly for specific node?
    Why in radio network is something like MY_RF24_NODE_ADDRESS?
    ( five bytes long, 4 are constant, fifth is radio ID )
    I seems, that entire this "MySensors network DHCP" stuff is made in different level then MyTransportXXXXX.cpp level. Maybe radio drivers ?
    If you know, how it works, pleas write here or send link, please.
    I can imagine only mechanism, when only one new node is connected at time, or some random generated number in each node or unique serial number etc. Then gateway can send NODE_ID with this "mark" end receiving node knows, that this is for it.


  • Admin

    @kimot said:

    Imagine, if you "switch on" entire your network with 10 nodes. Each node send request for NODE_ID to the gateway and gateway send broadcast with assigned NODE_ID. How RS485 nodes recognizes, that this NODE_ID is exactly for specific node?

    This will not work (and the same applies for a radio network). All nodes will then pick the broadcasted id.

    This is known limitation and has its technical background in how the radios work and that the new have problem generating a good unique random number when it starts blank.

    I know we had some ideas of adding a payload (random number) on the id-request payload identifying the requesting node. The node then also check that this number is the same in the id-response. But would break backward compatibility with the serial protocol so it would only happen in a bigger (3.0?) release.

    Edit: Added issue so we won't forget it.
    https://github.com/mysensors/MySensors/issues/732



  • @hek
    Thanks for your explanation.
    Last question for you. I cannot find information about internal message strukture.
    Only this discussion:
    https://forum.mysensors.org/topic/305/mysensors-protocol-format
    or
    "hacking" libraries

    Witch version is actual?

    I need myself write translation between my network message format and MySensors message format to use
    something like MyTransportRS485.cpp. But I have limited number of bytes for payload, so I need modify and test "data" array too.
    Thanks.



  • is domoticz support this gateway ?



  • @Reza yes, select MySensors Gateway USB for type if you add hardware.



  • @wimd
    i have problem with usb port in raspberry. everytime after power off/on , usb port lost for me. so now i use a raspberry gateway . rs485 can run on gpio ? with a virtual usb port



  • @Reza sory but I'm not able to help you with this.



  • @wimd
    thank you ๐Ÿ™



  • @wimd
    i have problem with nrf24. and this is work bad for me in distance 10 or 20 meter. i have problem in wireless connection. this protocol have not this problem ? connection is good ? with out any disconnect ?



  • @Reza Check https://www.mysensors.org/build/raspberry. There is a comment for a serialgateway.



  • @wimd
    i see this, but this is not for a arduino wiring. this is for a nrf24 . perhaps @marceloaqno can setup a rs485 gateway on raspberry. thank you



  • @Reza Struggling also with the radio network if the distance is more then 5m (and I'm using the ones with the antenna) I have troubles
    Add #define MY_RF24_PA_LEVEL RF24_PA_HIGH to send on maximum power.
    Added the capacitor give a bit extra power on the 3,3V?

    I do not have a RS485 network installed yet but trails on a 10m ethernet cable did not give any issues. Still in program phase.



  • @Reza scroll down on the page down to the serial gateway chapter on that page.



  • @wimd
    i use capacitor 4.7 , 100 , 470 uf.
    i use 3 type of radio. (usual + 2chip + 2chip+pa+lna)
    i use radio adapter. i use regolator 5 to 3.3 module.
    but i have problem yet.
    i dont test #define MY_RF24_PA_LEVEL RF24_PA_HIGH !
    what is code ? and where i can add this ? for gateway or nodes?
    this code can solve my problem ? in other means this code can increase power of radio ?



  • @Reza yes adding this code increases the power of the radio.
    you add this code at the begin of your sketch (both gateway and nodes)

    #define MY_RADIO_NRF24
    
    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    


  • @wimd
    thank you very much , i test this and i hope this is answer for me. because i am tired really ๐Ÿ˜ž
    thank you my friend๐Ÿ™



  • @wimd
    i test with "PA_HIGH" and "PA_MAX" (for nodes and gateway) but this is more bad.
    (for example for 10-15 meter with 2 wall)
    in default PA for 10 command i have 2 error
    in PA_HIGH for 10 command i have 8 error
    in PA_MAX my connection is disconnect completly
    can you understand where is problem? i think this is related to power supply of radio (because when i want more power for more distance so radio can not have a good connection) but i providing enough power for radio. i use a adapter 5v 2A and connect this to a radio adapter(reglator 5 to 3.3) even use a 4.7u capacitor for radio. similar to photo:
    0_1484474385522_photo_2017-01-15_13-28-34.jpg



  • @Reza You have exactly the same problem as I had when I first found MySensors in march last year.
    I got a couple of radio and started to play with them. All worked fine as long as they were not more than 5m away from each other. I dropped the idea at that time.

    2 months ago I saw the possibility on the website to build a wired network. I started again. With the order for the RS485 bricks I ordered also some radios but now with antenna and amplifier. The only improvement I got was now up to 7m.
    I managed now to connect with my greenhouse that is 12m away but had to place a repeater in between but the connection is no reliable.

    The discussion that is now ongoing is not related anymore to a RS485 network. I suggest you start an new topic specific for your radio issue. Or we both did do something wrong or the hardware that we buy does not meet the specification for transmitting distance.

    Let me now if you started a new topic.




  • Mod

    What are the main advantages of rs485 over I2C bus?



  • @gohan
    I2C bus is designed for short distances, obviously between circuits on one PCB.
    Max allowed capacitance i2c bus is 400pF. CAT5 cable has nominal 52pf/m.
    Ideally you can communicate to distance 8m.
    It is very short bus for home network, I think.
    Or we need some "hacking" for i2c bus, for example at page 4 in this document:

    http://www.nxp.com/documents/application_note/AN460.pdf

    For each node we need one bus expander ( P82B96 ) and two CAN bus drivers ( PCA82C250 ).
    7 + 2*0.5 US$ ( ebay )
    Plus second pair of wires.
    Or buy this: http://mayhewlabs.com/products/i2c-power-extender
    You can read bus length, number of nodes and speed limit, there.

    But, interesting idea.
    With some smart "node addressing" and multi-master i2c bus I can imagine, that on some places you do not need processor.
    For actuator simply use PCF8574 for example.


  • Mod

    So basically for 10-15 meters distance it's better and cheaper to use cheap rs485 modules, right?



  • @gohan
    Yes



  • @wimd thank you friend . i started several topic about this issue , but dont found any answer so i delete all topics. also i dont start new topic because friends are sad for my topics and admin told me dont start any topic ๐Ÿ˜ž
    i have exactly this problem. now for 10 meter i must use a repeater ! for 10 meter ! ! ! ! this is strange ! i use 4.7u capacitor and more. i use radio adaptor. i use reglator module. use 3 type of radio . in sketch use PA_MAX and PA_HIGH ... but effectless. so you told me if i want change my network to wiring with RS485 , i will have same problem again ? i can not found any way for this problem .
    now please let me for read this topic perhaps i can found any way for this problem . thank you



  • @Reza I have written earlier that I didnโ€™t have any problem with RS485 on a cable of 10m but did not trail longer yet.
    If you make trails with the wired network, make sure that you define your node id number

    #define MY_NODE_ID <X>```


  • @hek I was wondering if it could be useful to have an extra sensor that a bridge between the wireless and wire network.
    This bridge is made between the SPI dealing with the wireless network and the hardware serial that is dealing with the wire network.
    It would allow you to connect a remote wired network.

    IF the CE pin for the radio (9) could be user defined, a 2nd thought (based on the bridge idea).
    Canโ€™t something similar be done for the serial gateway and make that one suitable for wired and wireless network in the same gateway?


  • Mod

    Cable will always be better that wireless, so if you can go with cable. I tried NRF24 but with those smd modules I can't get more than 6-7 meters. I have to try to add a longer antenna



  • @gohan
    In some cases 'with cable' is the better option. In some cases wireless is the better option. I totally disagree with you on your statement that cable will be ALWAYS be better than wireless. that's nonsense!

    There are good NRF24 modules out there and there are worse variants, maybe fake ones. I've bought from several ebay stores throughout time. I found out the hard way that some perform good with a 100uF capacitor attached (the simplest variants, costing no more than $0.85), and other perform better with a smaller size capacitor (4.7uF). I get distances with these modules over more than 25 mtrs. with all kinds of obstructions (even faraday alike) in between. All it takes is some (hobby) time to find out what works best (e.g. move a node 1 meter to the left or right or align the antenna somewhat...)
    I never ever modified an antenna, never needed to do so. I once bought 2 nrf24L01+-PA-LNA antenna's for wider coverage as I thought I would need that for better/wider coverage, but now, 2 years later, they still are lying around in my workshop.

    Maybe good to say that these distances can only be achieved with a speed set at 250 kBs and this is only possible using the nrf24L01+ modules!

    If I can, I use wireless, as it is cheap, simple, and convenient, but the best reason for going wireless is that I don't need to use a cable! Simple as that.

    For the sake of staying somewhat on topic ("Building a wired RS485 sensor network")...
    There are occasions in which a wired (RS485) network would be the better choice. In my opinion one occasion is when you need instantly acknowledge that a command really was delivered to a node.

    BR,

    Boozz



  • @wimd
    how long wiring can i use between a node and gateway with rs485 (without repeater)? how many node can support ? delay for send and receive for nrf24 is more or rs485 ? thank you



  • @boozz
    how detect a fake radio with a original radio ?


  • Mod

    @boozz

    I said it's better because in terms of stability and reliability you can't beat cable and I also added that if he can use a cable to go with it otherwise wireless it's still an option, but as you said it takes time and trial and error to make good use of those nrf24 especially for the reason that there are lots of clones on the market that behave slightly differently from one another and thus adding more complexity to the project.
    In addition once you have a cable you can also use it for power.
    Of course cable is not the universal solution for all the problems, but if I had to choose between a wired or wireless security system I'd choose wired and if I would need to have a temperature sensor that reports data every now and then I'd go most likely wireless



  • @gohan
    My reaction was only based on your last post in this tread โ˜บ, I totally agree with you on the wired security system where wireless is not an option.



  • @Reza
    There are many options for detecting fake radio's. For me it works best to test them in a node that has a good working radio attached (preferrably far as far away from its parent node as possible) and exchange it with the suspected fake one.

    There's also a thread in this forum that describes a method to test the quality of nrf24L01+ connections. It's a quality meter. I know for sure you can find this one using the search function.

    By the way; about the wiring distance between a node and gateway: the fastest way to get an answer is to get multiple answers on such questions is using an universal search engine: www.google.com


  • Mod

    @boozz
    What are the codes on the NRF24 chip of the modules you consider being the best performing?


  • Admin



  • for wiring , is this true ?
    rs485...............arduino
    vcc......................5v
    gnd....................gnd
    DI.........................9
    DE........................2
    RE.......................10
    R0........................8



  • @Reza

    DI and DO depends on your board type.
    Look at AltSoftSerial_Boards.h
    DE and RE should be connected together and connected to pin,
    which is defined in your program:
    #define MY_RS485_DE_PIN 2





  • @kimot thank you friend ๐ŸŒน



  • @kimot
    for a raspberry pi gateway this wiring is true ?
    0_1485417941637_RS485_Serial_Module_Wiring.png



  • @Reza No. You need to have your gateway inbetween. Your controller can't "talk" directly with you MySensors network. Wee the picture from kimot.


  • Mod

    @wimd
    actually RPI can act as gateway https://www.mysensors.org/build/raspberry , but I agree that's much easier to have an Arduino as a gateway



  • @wimd we can build a gateway with raspberrypi without arduino . @gohan saying true . but i have to use gpio for serial gateway because when i use a usb serial port after turn on/off or reboot raspberry can not detect my gateway... but with gpio i test and this is true, so i have to use gpio for gateway



  • if i use rs485 for my network , can solve problems about signaling and distance and wall? and solve problem about NACK ?



  • @Reza
    Maybe your problem and its solution with "serial-through USB" connection on Raspberry is described here:

    https://g0kao.wordpress.com/2013/08/08/usb-port-assignment-on-a-raspberry-pi/



  • @kimot
    I am not sure, that Raspberry can work like RS485 gateway for MySensors RS485 network.
    On a "quick" look through code, I do not find anything for RS485.


  • Mod

    @Reza
    Maybe it is worth a try and get a W5100 network shield and make an ethernet gateway. I have one now and so far I'm happy with it.



  • thank you friends



  • @kimot @gohan do you use a wired network with rs485 ? i have problem with rf24 and i want change my wireless network to a wiring network , but i want know with a rs485 all command are send? without error and NACK ? now for wireless network i have for example every 5 true commands 1 fail command(NACK)


  • Mod

    @Reza
    not yet, but I am getting the parts to make a wired rs485 network of 4 nodes + gateway. About the NACK error it should be handled by the library and retransmit the lost packet.



  • Currently there is no "hw" ack functionlity like the radio has.
    You can check out the rs485 transmit code from here.

    But you can of course use the ack functionality between controller software and node to make sure message will get to destination.



  • @gohan now my sensors lib how many send packet if first is lost ? how more this ?
    i want after send command Turn on light Certainly



  • i am tired for test and trying to configure wiring network with RS485. this is strange ๐Ÿ˜ 
    i build a gateway and a relay with rs485 . for test i now use 2raspberry pi and 1orangepi and a laptop ! every time disconnect gateway from one and connect to other one ( with out other change for example sketch and wiring and etc. just change controller) some time this is very good work on laptop. some time good work on orange and some time good on raspbrrey pis !! some time same first command has sent(LED on gateway and on node just one blink. some time LEDs 2 blink and turn on later)
    i am using 15cm wire between 2nodes! when change to some meter so dont work never...
    so there is not any one that understand what is reason this issue !!!

    i am ready and i have devices and madules. so any body that think can solve this , told me so i test on my devices and feedback.



  • @Reza have you tried to use terminating resistors?

    And perhaps it could be good to try 1k pull-up and pull-downs at the gateway end. The left diagram:
    alt text

    With these two tricks I got my setup stable.

    And a little tweak to transport class could help also..



  • @pjr
    i use 120 ohm in terminate before. but now i use 1k for pull-up and down.but this is effectless.
    please wait until i read this topic (rs485 stress test) and do it and feedback here . thank you



  • @pjr thank you for help , i read that topic hardly ๐Ÿ™‚ because i am weak in english.
    What I understand , this problem is about collision , command and ack ! and related to transport rs485 and other friends trying to solve this ! is this true ?now , a rs485 network is not complete and Ideal and stable in mysensors.
    i think all problem is related to collision in short wire and long wire. in many short wire i have not problem(between two nodes). in short wire gateway detect node and connect but many command are failed . in long wire gateway can not detect node and can not connect never.



  • @Reza
    Original RS485 library was written so, that multiple SOH characters is sended on start of package.
    In Mysensors library it is only one times and it can be problem for synchronization and arbitration.

    Try in MyTransportRS485.cpp in function "transportSend" change line 274 from

    for(byte w=0; w<1; w++) {

    to

    for(byte w=0; w<3; w++) {



  • @kimot said in ๐Ÿ’ฌ Building a wired RS485 sensor network:

    for(byte w=0; w<1;

    thank you i will test this and again feedback here



  • @kimot this is good. i am testing . in the first test ((just for 2 node: gateway and one relay)) i see this is work well with 15cm wire. other test with 1meter and 5 meter work well.for 30 meter (CAT6) with 120 ohm resistor (first and end bus) dont work ๐Ÿ™‚ without resistor work with 15-20% error ( dont receive or send command and ack)
    but i think this is good for 2 nodes and short distance and for more nodes and distance increase % errors. is this true ?



  • @kimot also do you have idea for improve wireless transport(nrf24)?
    because for wireless also i have 50% error for commands.



  • Will the result change if you add more sync(SOH) chars?



  • @pjr i dont know what is this "for(byte w=0; w<3; w++)" because i am beginner but i see after change this , my network work better. very better. but no perfect



  • @Reza
    This code makes, that your node sends three SOH bytes on beginning of message instead of only one SOH.



  • @Reza
    Sorry, I do not know.
    I am not using radio now (but RS485 too not).
    I only look to code and try some RS485 library things,
    but only two nodes connected through serial lines.
    I am trying understand like MySensors code works to write my own library for CAN bus.

    https://forum.mysensors.org/topic/5327/can-bus-transport-implementation-for-mys/17



  • @kimot thank you for help ๐Ÿ™



  • @Reza
    Like someone writes here, your module maybe includes all needed resistors for the bus on PCB.

    http://yourduino.com/sunshop//index.php?l=product_detail&p=323

    For two nodes it ok and you must not connect any terminating resistors.
    For three and more, you must remove this resistors from PCB exclude those nodes, which are on the ends of bus.
    Maybe you can divide your "big" problem to several "small" problems.
    RS485 is tested bus and MUST work even on long cables.
    It must be problem with electricity circuit or software.
    Maybe software switchs direction pin to receiving mode early and not all data are send on the bus.
    In MyTransportRS485.cpp maybe it is wrong .
    It is "hard coded" for crystal 20MHz and bus speed 9600 bd. Try put your values.
    //
    _dev.flush();
    delayMicroseconds((20000000UL/9600)+1);
    //

    Try examples from AltSoftSerial library with different lengths of cables and do not forgot handle your DE pin.
    https://github.com/PaulStoffregen/AltSoftSerial

    Or connect your two nodes only through serial wires and check functionality of your code without rs485 converters.



  • @kimot how remove resistors from PCB ? ๐Ÿ˜ฎ there is resistor onboard? so for first and end dont need connect external resistor ? in other means i must for example for 10 nodes , any change in node 1 and 10 ! and remove resistor for node 2 - 9 with soldering?
    i test with some hardware. for 30 meter cable i dont use sheild cable. this is without sheild? may be problem for 30 meter is related to this ! is this true ?
    i dont change any things in mytransport rs485 just W<3. also sketch is from site
    im my transport is:
    _dev.flush();
    delayMicroseconds((20000000UL/9600)+1);

    your last experience how many nodes you use ? with how much wire? and how % error for send and receive you have?


  • Hardware Contributor

    @Reza

    I agree regarding your rs485 network you may need to adjust resistors. But i've not this setup, even if i would like to try it!

    about removing smd resistor..if you have a solder iron, a simple trick :
    Let's assume you want to push and remove your resistor to the right..

    1. Add a blob of solder to the right pad (take a magnifier if you're not confident or smd is too small)
    2. Heat well this pad. Not like hell, lol, but enough so solder will still be melted, for,
    3. Then quickly move to the left pad, heat it, and push the resistor to the right for removing it.

    Be careful with others parts around of course ๐Ÿ˜‰

    I hope it's clear ๐Ÿ™‚



  • @scalz This is an exciting job ๐Ÿ™‚
    thank you
    i hope it is clear too ๐Ÿ™‚



  • @Reza
    I recommend nothing solder or unsolder now.
    Simply start with two Arduinos on two ends of cable.
    When your communication will work for these two devices, then you can go further.
    For one Arduino write simple sketch, which will periodically send something ("Hello World/n" )
    to the bus. Other Arduino with sketch witch will receive characters and sends then through USB serial port to serial monitor on PC. Only with AltSoftSerial library, not with MySensors.
    When this communication will work on any length of cable ( I suppose you have not cable longer then 1km at your home ), you can go further.
    You do not need drive DE and RE pins by software, simply on transmitting Arduino set it for transmit ( to +5V ) and on receiving Arduino to ground.



  • @kimot this hard for me because i am beginner ๐Ÿ™‚ but thank you very thank you for help ๐Ÿ™ ๐Ÿ™ ๐Ÿ™


  • Hardware Contributor

    Hi, i have a Gateway running and the motion-sensor. The Sensors talks with the Gateway. (Arduino Pins: D2,D8,D9)
    Now i have to switch to another Hardware. On the Arduino-Pro Mini i have easy access to 0-RX, 1-TX, 2-D5, 3-D5, 4-D7, 10-13, A1-A3)
    Which combination of this pins would be the best, and how can i define it in the sketch ?
    Im happe for each hint.



  • The 510 ohm pull up and pull down resistors are usually mounted on the master side. Theoretically it
    would be best to install it in the middle of your bus line. The 120 ohm termination resistor must always
    be used on distances greater than 1 meter and/or baud rates higher than 9600. Itโ€™s best to install it as a
    norm as noise and reflections will cause havoc on your communication once implemented in the field.
    The termination resistors should be mounted at both ends of the bus line. Please note that adding bias
    resistors will load the driver IC output. With the indicated values the max number of units on the bus
    line is limited to eight 12kโ„ฆ, sixteen 24kโ„ฆ, or thirty-two 48kโ„ฆ units.
    For further protection transient suppressors can be installed across the differential lines, from the Vcc to
    D+ and from GND to D-.!
    0_1491314128147_upload-f4c63383-2b9a-4f3d-bd48-1e25fcf9dc76



  • Google for simple Modbus Master dcouments (arduino forum)

    The MAX485 is not the best RS485 chip because of it's own internal impedance.
    The chip in the diagram can be change by MAX485, MAX...
    0_1491314500978_upload-db69c9ce-43b6-430d-8807-74438ad83b96

    https://datasheets.maximintegrated.com/en/ds/MAX1487-MAX491.pdf



  • FYI
    0_1491315316611_upload-40d28ad1-8ba3-4a11-aa7b-5bd1e84424d2


 

400
Online

7.8k
Users

8.7k
Topics

92.9k
Posts