bluetooth and serial object


    Jul 19 2006 | 7:46 am
    Hi
    I am trying to conect a bluetooth device to max using the serial object in windowsXP. It is a microphone connected to a microcontroller that anylize the values of the wave and send me the average data via bluetooth. the microphone is working well and using the hyperterminal i can access to the data without problem.
    I have several problems when connecting to MAX.
    1. The serial object only recognize COM1, COM2, COM3, and COM4. I can only connect to the bluetooth in COM2 and COM4 but when i try to connect the bluetooth via different number port MAX doesnt recognize them.
    2. The second problem is. Using COM2 and COM4 i can get the data but somehow it istotally different to the data i get in the hyperterminal and also it is not responding at all to the sound wave captured by the mic. Using the mic with the hyperterminal i can see clearly the difference numbers when i talk or during silence but in max the data are always more or less the same.
    I am just 2 weeks working with MAX and i have been reading the post in the forum but i can not find any possible solution, maybe i don see it. Can someone explain me how max interprete the data from the bluetooth? how to access diferent port numbers? and it is possible to access to the hyperterminal and get the data from there?
    Where can i find more information about?
    thanks a lot.
    klara

    • Jul 19 2006 | 8:05 am
      I don't have an appropriate Bluetooth device here to test with, but I
      know that Bluetooth Serial works properly on the Mac OS. The serial
      object that came with Max 4.5.7 exhibits some problems when
      specifying COM ports, and definitely had problems with COM ports > 9.
      You might try the version of the object on the Incremental Donwloads
      page:
      and see if you have better luck connecting.
      As for your second point, the serial object in Max is limited to
      unsigned char data - single bytes from 0-255. What kind of data is
      your microphone sending? I've been told that Hyperterminal
      automatically resolves larger data types. The Max serial object does
      not. If you are using values > 255, you'll need to manually parse
      incoming values, and construct numbers of greater bit length. There
      was a thread on this subject yesterday in the forums:
      http://www.cycling74.com/forums/index.php?
      t=msg&th=20921&start=0&rid=0&S=a4e26f6dc050b3a131a658a889178f2b
      If you continue to have problems, let us know. If all of your
      problems go away, let us know that too.
      Thanks
      jb
      Am 19.07.2006 um 09:46 schrieb clara:
      > I am trying to conect a bluetooth device to max using the serial
      > object in windowsXP. It is a microphone connected to a
      > microcontroller that anylize the values of the wave and send me the
      > average data via bluetooth. the microphone is working well and
      > using the hyperterminal i can access to the data without problem.
      > I have several problems when connecting to MAX.
      > 1. The serial object only recognize COM1, COM2, COM3, and COM4. I
      > can only connect to the bluetooth in COM2 and COM4 but when i try
      > to connect the bluetooth via different number port MAX doesnt
      > recognize them.
      >
      > 2. The second problem is. Using COM2 and COM4 i can get the data
      > but somehow it istotally different to the data i get in the
      > hyperterminal and also it is not responding at all to the sound
      > wave captured by the mic. Using the mic with the hyperterminal i
      > can see clearly the difference numbers when i talk or during
      > silence but in max the data are always more or less the same.
      >
      > I am just 2 weeks working with MAX and i have been reading the post
      > in the forum but i can not find any possible solution, maybe i don
      > see it. Can someone explain me how max interprete the data from the
      > bluetooth? how to access diferent port numbers? and it is possible
      > to access to the hyperterminal and get the data from there?
      > Where can i find more information about?
    • Jul 19 2006 | 9:49 am
      OK, I did some research on this. The PICBASIC (and presumably others)
      formatter doesn't pack the bytes into high and low, in the case of
      large decimals. It simply "spells" the number, which is why
      Hyperterminal and the Parallax debugger are capable of "resolving"
      WORDs. They are doing no such thing, but simply displaying ASCII
      values. For instance, the number 256 is output as 3 bytes: 50, 53, 54.
      So, your Max code to resolve a DEC formatted number in PICBASIC (e.g.
      DEBUG DEC myVar or SEROUT 16, 16468, [DEC myVar]) would resemble the
      following:
      Whereas the Max patch to resolve the high and low bytes of a WORD
      variable (256 = 1, 0; 257 = 1, 1; etc.) (e.g. SEROUT 16, 16468,
      [myVar.HIGHBYTE, myVar.LOWBYTE]) would look like this:
      In both cases, you would need to come up with a way to separate
      values, so that you know when the next number begins. So, you might
      reserve an ascii character as a spacer. To what extent you have
      control over this on your device, I have no way of knowing, but
      presumably, this is something you can do, if it's not already being
      done.
      As for your COM1-4 problem. I think this problem is likely limited to
      HyperTerminal, and has nothing to do with Max. A quick look at the
      HyperTerminal Knowledgebase online shows that that software _is_
      limited to COM ports 1-4, and that this is a known limitation of it
      (so that you'll buy their HyperACCESS product). You should try the
      new version of serial, in any case, since it's more reliable than the
      4.5.7 release version.
      jb
      Am 19.07.2006 um 10:05 schrieb Jeremy Bernstein:
      > As for your second point, the serial object in Max is limited to
      > unsigned char data - single bytes from 0-255. What kind of data is
      > your microphone sending? I've been told that Hyperterminal
      > automatically resolves larger data types. The Max serial object
      > does not. If you are using values > 255, you'll need to manually
      > parse incoming values, and construct numbers of greater bit length.
      > There was a thread on this subject yesterday in the forums:
    • Jul 19 2006 | 11:09 am
      thanks very much for your reply
      i am still trying to understand your suggestions (i am very very new at this) but about the COM1-4 problem, i have tried the new version of serial and now i can access almost all port numbers, including >9 but. If i send the print message to the serial object i get information of only COM1 COM3 COM4 and COM9 available but if in the serial object i specifie the port name i can easily get the data.
      about understanding the data problem it will take me some time...
      thanks
      klara
    • Jul 19 2006 | 11:37 am
      The "print" message only prints ports with things connected to them.
      What port is your interface connected to? Or, better, what are you
      expecting to see when you send "print"?
      Am 19.07.2006 um 13:09 schrieb clara:
      > thanks very much for your reply
      > i am still trying to understand your suggestions (i am very very
      > new at this) but about the COM1-4 problem, i have tried the new
      > version of serial and now i can access almost all port numbers,
      > including >9 but. If i send the print message to the serial object
      > i get information of only COM1 COM3 COM4 and COM9 available but if
      > in the serial object i specifie the port name i can easily get the
      > data.
      > about understanding the data problem it will take me some time...
    • Jul 20 2006 | 9:31 am
      hello
      my real problem is (or what i think it is..)
      i am sending ASCII data via bluetooth
      when i receive them in MAX the data are totally
      different. so...what kind of data am i receiving?
      what kind of operation should i do to convert them?
      For example using the hyperterminal i can see this data:
      -120 silenc
      -122 silence
      -120
      -119
      -120
      -90 i am talking to the mic
      -87 i am talking to the mic
      -120
      -122
      -120
      -119
      -120
      but using the serial object in max
      i got
      -49
      -50
      -49
      -13
      -10
      -49
      -50
      -49
      -55
      -41
      -13
      -10
      no matter if i am talking or not.
      it is extrange because 13 10 appear always in the same order at
      regular intervals.
      i am sorry but i can not explain me better. my knowledge on this is very limited but i am trying to understand. In theory i could work with the data that max give me but somehow it seems that something extrange happens because there are not changes when i talk to the mic and some changes (13 10) always appear even in silence.
      About the port problem it is solved, i can connect now to different ports and understand better how it works.
      any help you could give me is marvelous.
      thanks
      klara
    • Jul 20 2006 | 9:44 am
      Spelling this as ASCII:
      121rn1217)rn
      No idea what that (55, 41) is there for - are you sure you didn't
      mistype? However, the rest makes sense - 13,10 is rn - a line
      break, which is being inserted between values.
      Here's another patch that you can use to "unspell" the data coming
      from your device. However, you need to find some documentation about
      the format of data coming through, in order to correctly parse it. I
      assume that your Bluetooth device came with some sort of manual with
      a description of the serial specification.
      jb
      Am 20.07.2006 um 11:31 schrieb clara:
      > -49
      > -50
      > -49
      > -13
      > -10
      > -49
      > -50
      > -49
      > -55
      > -41
      > -13
      > -10
    • Jul 24 2006 | 7:23 am
      Dear Jeremy
      i think i did solve my problem or at least now i understand better what was going on.
      My bluetooth device is handmade. It is connected to a microcontroller that was sending decimal data. The problem is that it seems that Max serial object is expecting to receive characters and convert them to integer. am i right? Even if i was sending already integers, max understood this data as characters and transform again to integers so the resultant data was different to what i was sending. After try some solutions and make some test with the spell you send it to me, the easiest way we have found is to programme the microcontroller to send characters. By this way, i am sending characters and max transform it to integers that corresponds with what i was expecting to get. In the hyperterminal i get something like
      nroptrmqqnrmnqprprompqlpnqrprnpnoporqsropnqrprnonpronqoq
      rmqppqpsnmprprnpsrqqnoqprompnoqorponqrsloposlpoprlnootqnpronqpqqrnnpomonroqrlqpq
      pprpronpqomqorprroromqpmrmnpormooprrlqqqrnpnpspnpomprsrmqqlooqpqnrnnoorpsrpqpnqp
      rprnkprnpoorpqpnpnnpqqrprnpponpornpopsnnonornnponoprpqnlqoqrornoolpomqooqprrooop
      snnoronpnrqsonnnrrnrnnnoonqprnpoonpprrprnnpqqpqrlppnponsqtpmnpqrpsnnomoporprrnpp
      but max understand this as
      107
      108
      106
      107
      108
      106
      110
      112
      102
      that in fact are the values that i need (values of the wave captured by the microphone)
      I dont know if this is the better solution but for the moment it is working and as my knowledge of max is still very poor...i am very happy . Let see what problems i will find later. This is always like a puzzle for me.
      thank you very much for your kind help.
      klara