Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Serial port break/freeze when sending data to arduino using QT
Forum Updated to NodeBB v4.3 + New Features

Serial port break/freeze when sending data to arduino using QT

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 4 Posters 3.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kuzulis
    Qt Champions 2020
    wrote on last edited by
    #4

    Just connect the Rx/Tx pins of your serial port, open the qtserialport terminal example and try to enter any symbols and see what happens. In this case you will be know that a problem is in HW or in qtserialport.

    J 1 Reply Last reply
    2
    • J jkprog

      Also after the serial port freezes (when pressing the button has no effect ), I close the window of my GUI, unplug the USB cables from the PC and then plug it back again, then it works. But I cant do this all the time, I want a permanent solution to this problem. Please guide me on this.
      Thank you

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by aha_1980
      #5

      @jkprog that sounds indeed like a HW problem.

      I have these too sometimes, most often due to electrical ARCs in the slave device.

      but it can also happen if the electrical ground (GND) between PC and Arduiono is bad. in that case, electrical current flows trough the USB ground wire and disturbs communication.

      Regards

      Qt has to stay free or it will die.

      J 1 Reply Last reply
      2
      • aha_1980A aha_1980

        @jkprog that sounds indeed like a HW problem.

        I have these too sometimes, most often due to electrical ARCs in the slave device.

        but it can also happen if the electrical ground (GND) between PC and Arduiono is bad. in that case, electrical current flows trough the USB ground wire and disturbs communication.

        Regards

        J Offline
        J Offline
        jkprog
        wrote on last edited by
        #6

        @aha_1980 but how do I solve the problem? How to make sure that the electrical ground is fine?

        1 Reply Last reply
        0
        • K kuzulis

          Just connect the Rx/Tx pins of your serial port, open the qtserialport terminal example and try to enter any symbols and see what happens. In this case you will be know that a problem is in HW or in qtserialport.

          J Offline
          J Offline
          jkprog
          wrote on last edited by
          #7

          @kuzulis I bought another arduino, and uploaded the same program to it. Then I made a similar gui with 9 buttons. The arduino is connected since 3 days to my computer, and I try switching the buttons on the GUI and it has been working fine.
          But on the original controller with 2 arduinos connected to a different PC with windows 10 it doesnt seem to work as desired.
          I have also disabled the USB suspend settings on windows 10 to eliminate any chances of USB port getting disabled.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jkprog
            wrote on last edited by
            #8

            I have attached the circuit diagrams as to how I have connected my 2 arduino mega to power and relay module.
            The first circuit diagram shows how I powered my arduino and the relay modules.
            0_1530207034124_arduino_relay_power.jpeg

            The following diagram shows how the arduino GPIO pins are connected to the low voltage relays.0_1530207088771_arduino_relaymodule.jpeg

            Each arduino mega 2560 is connected to 4 relay modules. I have powered my relay modules with the same power source that is used to power each relay module. Both arduinos are being powered separately using a 7.5V 700mA regulated supply. The arduinos are powered from the same socket on 2nd floor and the computer is on 1st floor and is powered from a different socket.

            The GPIO pins of arduino are connected to the relays on the module. The output of the relays is connected to high voltage relays which are then connected to the lights to be switched on/off.

            Is there anything that I am doing wrong in the wiring?

            The 8-relay modules that I am using are :
            srd-05Vdc-SL-C

            aha_1980A 1 Reply Last reply
            0
            • J jkprog

              I have attached the circuit diagrams as to how I have connected my 2 arduino mega to power and relay module.
              The first circuit diagram shows how I powered my arduino and the relay modules.
              0_1530207034124_arduino_relay_power.jpeg

              The following diagram shows how the arduino GPIO pins are connected to the low voltage relays.0_1530207088771_arduino_relaymodule.jpeg

              Each arduino mega 2560 is connected to 4 relay modules. I have powered my relay modules with the same power source that is used to power each relay module. Both arduinos are being powered separately using a 7.5V 700mA regulated supply. The arduinos are powered from the same socket on 2nd floor and the computer is on 1st floor and is powered from a different socket.

              The GPIO pins of arduino are connected to the relays on the module. The output of the relays is connected to high voltage relays which are then connected to the lights to be switched on/off.

              Is there anything that I am doing wrong in the wiring?

              The 8-relay modules that I am using are :
              srd-05Vdc-SL-C

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #9

              @jkprog I'm no expert for the power supply part, just two questions:

              1. how long are the USB cables?
              2. can you try the arduionos without the power (relay) part?

              Qt has to stay free or it will die.

              J 1 Reply Last reply
              0
              • aha_1980A aha_1980

                @jkprog I'm no expert for the power supply part, just two questions:

                1. how long are the USB cables?
                2. can you try the arduionos without the power (relay) part?
                J Offline
                J Offline
                jkprog
                wrote on last edited by jkprog
                #10

                @aha_1980 The arduino usb cable A/B is around 4ft. But then I have used USB extension cables which are of length 15-17ft.
                At times, just closing the GUI window and reopening it also makes it work.

                aha_1980A 1 Reply Last reply
                0
                • J jkprog

                  @aha_1980 The arduino usb cable A/B is around 4ft. But then I have used USB extension cables which are of length 15-17ft.
                  At times, just closing the GUI window and reopening it also makes it work.

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  @jkprog everything over 3m works a bit, over 5m not at all. please check the max. length.

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jkprog
                    wrote on last edited by jkprog
                    #12

                    It is approx 8m.

                    Is there some solution to this problem other than switching to WiFi? Will increasing the baud rate help to fix this problem?

                    By the way, I have used the USB booster cable extension. Initially I used normal USB extension cables and the problem was even more frequent. With the usage of booster cables it got better but still this is not acceptable for my seniors.
                    I cannot move the computer or the arduinos to the same floor.

                    mrjjM 1 Reply Last reply
                    0
                    • J jkprog

                      It is approx 8m.

                      Is there some solution to this problem other than switching to WiFi? Will increasing the baud rate help to fix this problem?

                      By the way, I have used the USB booster cable extension. Initially I used normal USB extension cables and the problem was even more frequent. With the usage of booster cables it got better but still this is not acceptable for my seniors.
                      I cannot move the computer or the arduinos to the same floor.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      @jkprog

                      Hi
                      Why not use a serial over lan device ?
                      Like
                      https://www.startech.com/eu/Networking-IO/Serial-over-IP/1-port-RS232-serial-over-ip-adapter~NETRS2321P

                      I had good result with those when i need serial from office to machine.

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved