2 Replies Latest reply on Jun 15, 2020 6:20 AM by BigG

    PC to Arduino with Max485

    microguy

      I am trying to find some example code for PC and Arduino on Max485. I am using Lazarus (pascal code). I would like to control Arduino from PC on rs485. I have some Max485 and USB Connected to rs485. I will use about 50 feet long cable between PC to two Arduino. Each Arduino will have some LEDs, servos, buttons, and IR Infrared sensors.  I did write some programs for stand only Arduino with LED, Servos, Buttons, and IR Infrared sensors just fine. But I could not figure out how to communicate between PC and Arduino. I want to be able to send and receive data from PC to first and second Arduino. I have google and could not find any example code for PC and Arduino But I did found code for Master Arduino with Slave Arduino. That is not what I am looking for. I want PC to be a master and two slaves Arduino. I might add more slave Arduino in the future.  Someone mention that there is code in Wikispace. But no longer exist.

        • Re: PC to Arduino with Max485
          shabaz

          Hi Reid,

           

          You may need to search Pascal forums for this I'm afraid. There's likely to be a lot more users of it on specialist forums, whereas here perhaps one-in-a-hundred? (I'm guessing) may be familiar with the language to the point of knowing how to use the serial interface with it.

           

          The communications method is USB serial (might be known as USB CDC), and you can communicate using serial terminal software (an example is called Hercules).

          You can use that application to send hex bytes and see responses for instance.

           

          To actually code an application to interact with USB serial, ordinarily one can pick a language, and then search for online examples of serial transmit or receive for that language.

          For Pascal I have no idea. However if you can code your Pascal application to call another executable then you could use a different language for the serial interfacing, worst-case (if you cannot find a Pascal example).

           

          An easy-ish language would be Python, and the link to the documentation on how to use serial with it is here: https://pyserial.readthedocs.io/en/latest/index.html

          • Re: PC to Arduino with Max485
            BigG

            Is this the sort of thing you are using: https://www.waveshare.com/usb-to-rs485.htm

             

            On their wiki tutorial page there is some PC software, which could work.

            https://www.waveshare.com/wiki/USB_TO_RS485

             

            Then SeeedStudio have a little Grove RS485 module which would work with Arudino https://wiki.seeedstudio.com/Grove-RS485/

             

            With the two it should act as a transparent UART bridge.