Loading ...
Sorry, an error occurred while loading the content.
 

Re: [SeattleRobotics] OT: HC-04 errors

Expand Messages
  • robotMaker
    Hi Peter: I m using one HC-05 and an Android device, either a Motorola Citrus or the Acer100 7 tablet. I ve never had much luck with BT dongles and the PC.
    Message 1 of 11 , Apr 26, 2012
    Hi Peter:

    I'm using one HC-05 and an Android device, either a Motorola Citrus or the Acer100 7" tablet. I've never had much luck with BT dongles and the PC.

    Because my communication with my bot is course, I use all ASCII for data bytes. Since I need to test it with the BlueTerm Dumb Terminal app. Also I use ASCII because the Mintoris Basic running in the Android device can parse the data coming back from my bot.

    The CTS and RTS are there for the handshaking with the PC or host. I have not used them, since what would change the state of either?

    I included the datasheet that I used. Since the module worked right away, there hasn't been much to reference in the datasheet. To access the IO pins and other things on the HC-05, the module has to be rebooted to put it in the AT command mode, which is not practical when running my bots.

    I hope that I can attach the datasheet and it gets to the list. I posted the links to the datasheets in previous posts.

    Cesar


    From: Peter Balch <peterbalch@...>
    To: SeattleRobotics@yahoogroups.com
    Sent: Thursday, April 26, 2012 3:47 PM
    Subject: Re: [SeattleRobotics] OT: HC-04 errors

    Cesar

    > I think that I subconsciously have added some error
    > correction

    My data is formatted into 11-byte blocks: 1 start byte ($AA), 9 data bytes
    and one checksum that is the XOR of the previous 10 bytes. So I can spot and
    reject (most) bad blocks. However, the error rate is way higher than I think
    it should be. And, with such a high error rate, some bad blocks get through.

    > requires some error recovery

    I feel that shouldn't be the case. The Bluetooth protocol has error
    detection built in. It would be nice to know how many errors the Bluetooth
    protocol detects but I haven't found out how to do that yet.

    > or flow control protocol

    AFAIK, the HC-04 doesn't export any flow control signals. It would be nice
    if it had a "buffer almost full" signal as one gets with, say, USB chips.
    But that doesn't seem to exist.

    There are pins labeled CTS and RTS but I think they're for transmission from
    the PC to the module. I'm only interested in sending data from the module to
    a PC/Android.

    It's hard to know. The supplier doesn't publish a data sheet. Data sheets
    are available from other retailers which look like they refer to the same
    part. My belief is that the HC-04 hardware is supplied with a variety of
    different firmwares. It's very hard to know which is which. There's an I/O
    port which the firmware can treat as it likes so modules from some retailers
    have different pinouts. Maybe.

    What data sheet have you used?

    > such as something as simple as Xmodem, Ymodem, Zmodem, Kermit

    Well, that would require me to know when a buffer (inside the HC-04) was
    filling up and I don't think I have that information.

    To test whether it is a problem of buffer overflow, I slowed the data down
    to one byte every 100mS but the error rate stayed much the same.

    >
    But it also sounds to me that your wireless medium might be too noisy, too
    > much traffic in the airwaves.

    Could be but how would I tell? The same problem seems to happen in my flat,
    the office and a car park in a different city!

    The transmission distance is two or three metres.

    > Are you using two HC-04s?

    No. One HC-04 and a bluetooth dongle (two different brands) or the bluetooth
    built into a PC or the bluetooth built into an Android.

    > How's the hardware handshaking with between the HC04 and your host?

    I guess that's up to Windows or Android.

    Have you seen this sort of problem with your robot?

    Do you use two HC-04s? With handshaking?

    Peter




    ------------------------------------

    Visit the SRS Website at http://www.seattlerobotics.orgYahoo! Groups Links

    <*> To visit your group on the web, go to:
        http://groups.yahoo.com/group/SeattleRobotics/

    <*> Your email settings:
        Individual Email | Traditional

    <*> To change settings online go to:
        http://groups.yahoo.com/group/SeattleRobotics/join
        (Yahoo! ID required)

    <*> To change settings via email:
        SeattleRobotics-digest@yahoogroups.com
        SeattleRobotics-fullfeatured@yahoogroups.com

    <*> To unsubscribe from this group, send an email to:
        SeattleRobotics-unsubscribe@yahoogroups.com

    <*> Your use of Yahoo! Groups is subject to:
        http://docs.yahoo.com/info/terms/



  • Peter Balch
    It gets weirder. As I said, my data is formatted into 11-byte blocks. I changed the app in the PC so that when it receives a block, it sends a $00 byte back to
    Message 2 of 11 , Apr 27, 2012
      It gets weirder.

      As I said, my data is formatted into 11-byte blocks. I changed the app in
      the PC so that when it receives a block, it sends a $00 byte back to the
      HC-04 as an Ack.

      What the HC-04 produces is sometimes a $00 and sometimes a few of the bytes
      it has just sent to the PC.

      It's as though its firmware is getting its Tx and Rx buffers confused.

      I presume you've never seen anything like that?

      Peter
    • Randy M. Dumse
      Peter Balch said: Friday, April 27, 2012 6:35 AM ... I haven t been paying close attention, but it sounds ike you are using the device as a 8-bit binary pipe.
      Message 3 of 11 , Apr 27, 2012
        Peter Balch said: Friday, April 27, 2012 6:35 AM
        > What the HC-04 produces is sometimes a $00 and sometimes a
        > few of the bytes it has just sent to the PC.

        I haven't been paying close attention, but it sounds ike you are
        using the device as a 8-bit binary pipe. I think it uses escape
        codes, and if it does, binary data won't pass without causing
        problems. Might want to look at that. Have you already
        considered that? Might have to send ASCII encoded hex, or the
        like, instead.

        Randy
      • robotMaker
        I have not seen anything like you described. If I did see it, my natural instinct is to work around it, since in my case I m looking for results, and make sure
        Message 4 of 11 , Apr 27, 2012
          I have not seen anything like you described. If I did see it, my natural instinct is to work around it, since in my case I'm looking for results, and make sure that I document the workaround. But I think that in your case, you're doing it for a customer. Right?

          Why are you using the HC-04 and not the HC-05? I bought my HC-05 from http://www.dealextreme.com/p/wireless-bluetooth-rs232-ttl-transceiver-module-80711 It came in less than a week.

          In my case, when I query my bot, the bot sends back less than 128 ASCII bytes, since it has a camera, it has to send back what the camera sees.

          Cesar




          From: Peter Balch <peterbalch@...>
          To: SeattleRobotics@yahoogroups.com
          Sent: Friday, April 27, 2012 6:35 AM
          Subject: Re: [SeattleRobotics] OT: HC-04 errors

          It gets weirder.

          As I said, my data is formatted into 11-byte blocks. I changed the app in
          the PC so that when it receives a block, it sends a $00 byte back to the
          HC-04 as an Ack.

          What the HC-04 produces is sometimes a $00 and sometimes a few of the bytes
          it has just sent to the PC.

          It's as though its firmware is getting its Tx and Rx buffers confused.

          I presume you've never seen anything like that?

          Peter



          ------------------------------------

          Visit the SRS Website at http://www.seattlerobotics.orgYahoo! Groups Links

          <*> To visit your group on the web, go to:
              http://groups.yahoo.com/group/SeattleRobotics/

          <*> Your email settings:
              Individual Email | Traditional

          <*> To change settings online go to:
              http://groups.yahoo.com/group/SeattleRobotics/join
              (Yahoo! ID required)

          <*> To change settings via email:
              SeattleRobotics-digest@yahoogroups.com
              SeattleRobotics-fullfeatured@yahoogroups.com

          <*> To unsubscribe from this group, send an email to:
              SeattleRobotics-unsubscribe@yahoogroups.com

          <*> Your use of Yahoo! Groups is subject to:
              http://docs.yahoo.com/info/terms/



        • Peter Balch
          Cesar ... Yes. But they look like very useful modules for fun projects too. If they work. They re so cheap I d put one in every bot I built. ... That s
          Message 5 of 11 , Apr 28, 2012
            Cesar

            > I have not seen anything like you described.
            > If I did see it, my natural instinct is to work
            > around it,
            > But I think that in your case, you're doing it for a customer. Right?

            Yes. But they look like very useful modules for fun projects too. If they
            work.

            They're so cheap I'd put one in every bot I built.

            > > do you send a query, then look at the response, then send another query,
            > Yes, I send a query command, it's a single letter, either the 'b' or
            > the '?', and wait for the response.

            That's interesting. Maybe if you do it that way, the module doesn't receive
            the command until it's ready to. At which time, it's also ready to send the
            response.

            However, I slowed may data stream down to one byte every 200mS and it still
            had a high error rate. So I don't really believe that's the problem.

            > Why are you using the HC-04 and not the HC-05?
            > I bought my HC-05 from
            > http://www.dealextreme.com/p/wireless-bluetooth-rs232-ttl-transceiver-module-80711

            I bought some modules on eBay from Hong Kong (which is where I think
            DealExtreme are). The advert didn't say what model they were - none of the
            HK ads do!

            How do you know they're HC-05? The obvious difference is which pin the
            status LED is on.

            I've just found a local supplier here in Edinburgh that's selling modules
            for $10. I'm told they're HC-06. I'll try a couple of them and see how
            reliable they are. My customer isn't too bothered about price - paying a few
            dollars more for a reliable module would be OK.

            In the meantime I've got quite a few HC-04 which I could use in my own
            projects. I'll try your query-response protocol and see if it works.

            Peter
          • Peter Balch
            Randy ... Yes. ... It uses AT commands. However, I don t _think_ they re causing problems: 1. If I repeatedly send 00 01 02 03 ... FE FF 00 01 ... then they re
            Message 6 of 11 , Apr 28, 2012
              Randy

              > I haven't been paying close attention, but it sounds ike you are
              > using the device as a 8-bit binary pipe.

              Yes.

              > I think it uses escape
              > codes, and if it does, binary data won't pass without causing
              > problems.

              It uses AT commands. However, I don't _think_ they're causing problems:

              1. If I repeatedly send 00 01 02 03 ... FE FF 00 01 ...
              then they're doesn't seem to be any pattern to when the errors occur. Bytes
              just get lost duplicated or corrupted.

              2. Maybe the AT command mode only works when pin 34 is high (that depends on
              the firmware version in the module and I don't know which I've got).
              Certainly the modules I've got seem sensitive to pin 34.

              3. Maybe the AT commands need a pause beforehand (that depends on the
              firmware version)

              4. Maybe the AT commands don't work when the module is paired (that depends
              on the firmware version)

              5. Maybe the AT commands only work when they come via the serial pins - not
              via the bluetooth connection and I'm seeing corrupted data in both
              directions.

              Cesar's suggestion that traffic on the bluetooth bands means that some data
              gets lost makes sense but no matter how slowly I send the data, it gets
              corrupted.

              It's as though there's a bug in the firmware. Or maybe that I'm doing
              something wrong.

              One problem is that it's hard to find the right data sheet. I _think_ there
              are different versions of the firmware out there and there are a few
              different data sheets. It's not clear what matches what. When you see an ad
              for a module, the supplier never says what version it is.

              I think these are great modules for indoor robotics. They're easy to use.
              They're so cheap you wouldn't think twice about putting one in every robot.
              Every computer now has bluetooth. The data rate isn't too bad for commands
              and feedback. I think they're way better than, say, zigbee.

              If only they worked!

              Peter
            • Randy M. Dumse
              ... Yeah, you need to look at this seriously. Remember you have two modems with AT command sets. The one sending and the one receiving, and either one can be
              Message 7 of 11 , Apr 28, 2012
                > It uses AT commands. However, I don't _think_ they're causing
                > problems:
                >
                > 1. If I repeatedly send 00 01 02 03 ... FE FF 00 01 ...
                > then they're doesn't seem to be any pattern to when the
                > errors occur. Bytes just get lost duplicated or corrupted.

                Yeah, you need to look at this seriously.

                Remember you have two modems with AT command sets. The one
                sending and the one receiving, and either one can be tricked
                into a mode by passing certain bytes. I've been "bitten" often
                enough I just won't do binary data on a link with escape codes.
                As an sort-of different example, in the seismograph data,
                autostart codes showed up on autostart boundaries in lower
                memory. Data crashing the machine. You might think what are the
                odds, and it seems unlikely. Auotstart pattern 1:65536. On a 1K
                boundary in a 32K data space 32:32768. But unlikely things still
                happens.

                So here's my suggestion, do your test runs with hex 20 up to 7F
                and repeat. Stay in the safe ASCII set. (Don't let
                non-printables like "space" or "backspace" fool you)) See if the
                errors stop. Then you'll have a pretty good idea what was
                causing it. If the errors are still present,,,at least you've
                eliminated one possibility.

                Randy
              • robotMaker
                I m sure that my modules are HC-05, I did some research and it was without a doubt. The main source was of course the various datasheets. Please post your
                Message 8 of 11 , Apr 28, 2012
                  I'm sure that my modules are HC-05, I did some research and it was without a doubt. The main source was of course the various datasheets. Please post your results with the new modules. Soon I will be using the HC-05 in a more complex bot, which will require of course more data/sec communications, every little bit of knowledge only helps.

                  Cesar


                  From: Peter Balch <peterbalch@...>
                  To: SeattleRobotics@yahoogroups.com
                  Sent: Saturday, April 28, 2012 3:43 AM
                  Subject: Re: [SeattleRobotics] OT: HC-04 errors

                  Cesar

                  > I have not seen anything like you described.
                  > If I did see it, my natural instinct is to work
                  > around it,
                  > But I think that in your case, you're doing it for a customer. Right?

                  Yes. But they look like very useful modules for fun projects too. If they
                  work.

                  They're so cheap I'd put one in every bot I built.

                  > > do you send a query, then look at the response, then send another query,
                  > Yes, I send a query command, it's a single letter, either the 'b' or
                  > the '?', and wait for the response.

                  That's interesting. Maybe if you do it that way, the module doesn't receive
                  the command until it's ready to. At which time, it's also ready to send the
                  response.

                  However, I slowed may data stream down to one byte every 200mS and it still
                  had a high error rate. So I don't really believe that's the problem.

                  > Why are you using the HC-04 and not the
                  HC-05?
                  > I bought my HC-05 from
                  > http://www.dealextreme.com/p/wireless-bluetooth-rs232-ttl-transceiver-module-80711

                  I bought some modules on eBay from Hong Kong (which is where I think
                  DealExtreme are). The advert didn't say what model they were - none of the
                  HK ads do!

                  How do you know they're HC-05? The obvious difference is which pin the
                  status LED is on.

                  I've just found a local supplier here in Edinburgh that's selling modules
                  for $10. I'm told they're HC-06. I'll try a couple of them and see how
                  reliable they are. My customer isn't too bothered about price - paying a few
                  dollars more for a reliable module would be OK.

                  In the meantime I've got quite a few HC-04 which I could use in my own
                  projects. I'll try your query-response protocol and see if it works.

                  Peter



                  ------------------------------------

                  Visit the SRS Website at http://www.seattlerobotics.orgYahoo! Groups Links

                  <*> To visit your group on the web, go to:
                      http://groups.yahoo.com/group/SeattleRobotics/

                  <*> Your email settings:
                      Individual Email | Traditional

                  <*> To change settings online go to:
                      http://groups.yahoo.com/group/SeattleRobotics/join
                      (Yahoo! ID required)

                  <*> To change settings via email:
                      SeattleRobotics-digest@yahoogroups.com
                      SeattleRobotics-fullfeatured@yahoogroups.com

                  <*> To unsubscribe from this group, send an email to:
                      SeattleRobotics-unsubscribe@yahoogroups.com

                  <*> Your use of Yahoo! Groups is subject to:
                      http://docs.yahoo.com/info/terms/



                Your message has been successfully submitted and would be delivered to recipients shortly.