Comments: Understanding the BC127 Bluetooth Module

Pages

Comments 25 comments

  • ———– Tech Support Tips/Troubleshooting/Common Issues ———-

    FTDI to Configure the BC127

    To configure a BC127, you would need 1x FTDI basic breakout [5V FTDI – https://www.sparkfun.com/products/9716 or right angle https://www.sparkfun.com/products/553 ], and mini-B cable [ https://www.sparkfun.com/products/11301 ] . This is only one way to connect to the device. The micro-B connector on the Purpletooth Jamboree Development Board is used for firmware upgrades and they are connected to the USB data pins of the BC127. You can always use M/F premium jumper wire to extend the connection. As long as there is a connection with the metal plated through holes, you can configure the BC127.

    Connecting the BC127 Breakout Board to a Serial Terminal

    Don’t expect to directly connect the 5V FTDI breakout board to the bottom FTDI header pins on the BC127 breakout board. The Eagle board layout & schematic files show that the Tx pin would connect to your Tx on the FTDI and the Rx to the Rx pin on the FTDI. This was due to the design of the BC127 Breakout board so that you can connect it directly to an Arduino Pro, Pro Mini, and LilyPad. If you place it on a breadboard or wired the pins appropriately from Tx to Rx and vice versa, you are able to go into command mode with the BC127 through the serial terminal (with settings 9600 8-none-1-none). By default, the BC127 will be in command mode.

    Setting the BC127 for Autoconnect

    Assuming that you are in command mode, to set the bluetooth to autoconnect you must configure one of the BC127’s settings through a serial terminal and press the enter button between each command. I recommend resetting the bluetooth to its default before configuring the device. Make sure to use the set command with the configuration parameter equal to the new value like so:

    restore
    write
    set autoconn=1
    write
    reset
    

    By connecting a smartphone as the “source” with the bluetooth enabled, you will be able to connect to the BC127 as a “sink”. The device will remember the bluetooth address and connect to the first bluetooth in its vicinity that it remembers.

    If the BC127 has been turned on before your smartphone’s bluetooth is enabled, try hitting the RESET button to power cycle the BC127 so that it can re-scan through its saved list of previously paired devices. For more information, try looking at page 11 and 12 of the user manual for more information this feature.

    Note: If you add a space between the “=” sign, the BC127 will not recognize the command. It will respond with the “ERROR” notification.

    Setting the Name for the BC127

    To set the name of your BC127 from the default BlueCreation-XXXXXX to a custom name, you would use the set command with the configuration parameter equal to the new value like so:

    set name=BlueBlock1750
    write
    reset
    

    To view if the name has been saved after reset, you can use this command:

    get name
    

    You should get a response with the configuration parameter and value as “NAME=BlueBlock1750”. For more information, try looking at page 11 and 15 of the user manual for more information this feature.

    Setting the HFP

    To turn off the HFP so that the bluetooth does not connect to your smartphone during phone calls:

    set enable_hfp=off
    write
    reset
    

    BC127 Output Error and Not Connecting to a Source Bluetooth?

    If you are seeing this error with your BC127:

    OPEN_ERROR AG
    OPEN_ERROR AG
    

    , it’s possible that the BC127 has somehow been set to source mode instead of sink mode. This can happen randomly or if you press and hold the momentary push button labeled VREGEN “long”. BlueCreations defines a long as holding it down for 1000ms or more. For more information, try checking out the user manual on page 9.

    You would just need to set the BC127 as a sink if you are connecting it with another bluetooth set as a source:

    set classic_role=0
    write
    reset
    

    True Wireless Stereo Mode

    You can set up a source audio bluetooth (like a smartphone) to connect to 2x BC127 audio bluetooth sinks. One sink will be connected to the “left” speaker while the second sink will be connected to the “right” speaker. BlueCreation refers this configuration as the “True Wireless Stereo” setup.

    For more information, I recommend checking out this tutorial from the manufacturer => https://youtu.be/CSz-Wq-Q074.

    Microphone Input?

    I have not used the microphone feature that much let alone with external mics attached to the input pins. Theoretically, it should work if you configure the bluetooth to the correct setting. I do not have any specific details on how to do this. It looks like the circuit for the microphone is based on a differential audio input. The best would be to test it out by soldering the mic to the R_IN or L_IN pins or connecting a microphone to the audio jack. You will probably need to flip the switch to the “Mic In” side. You might need some decoupling capacitors to filter any unwanted sound. Try checking the user manual to also see if you need to configure the BC127’s settings to output audio via the MIC pins. Try using the “set” command with the configuration parameter “FORCE_ANALOG_MIC” listed on page 15 of the user manual.

    Resources, Video Demos, and Additional Documentation

    For video demos and additional documentation of the BC127 IC, feel free to check out BlueCreation’s product page => https://www.bluecreation.com/product_info.php?products_id=38 .

    • Audio Bridge: Configuring Two BC127s as Source and Sink using a Serial Terminal

      Below are the instructions configure the BC127 as source and sink. It also includes information about how to pair/connect the bluetooth and stream audio from the source to your sink.

      I recommend powering both bluetooths to easily configure, pair, and connect a BC127 source with a BC127 sink. This example uses the Purpletooth Jamboree development board because there is a connector that is broken out for the “MIC in/LINE in” pins and additional application circuits. You will need a 5V FTDI USB-to-serial converter [ https://www.sparkfun.com/products/9716 ], mini-B USB Cable [ https://www.sparkfun.com/products/11301 ], and a serial terminal [ like Tera Term - https://learn.sparkfun.com/tutorials/terminal-basics/tera-term-windows ]. Two FTDI’s and mini-b USB cables will make it easier to set up. The instructions below will assume that you are using two FTDIs and two mini-b USB cables.

      1.) Configuring Your BC127 as a Source

      1.1) First, solder the header pins to the FTDI->PC side to connect an FTDI to the two Purpletooth Jamboree development boards. This will provide a secure connection between the Purpletooth and the FTDI.

      1.2) Decide what BC127 to use as your Source . I recommend labeling the board as a source with a sticky note or Sharpie.

      1.3) Connect one FTDI to the Purpletooth Jamboree by aligning BLK and GRN silkscreens.

      1.4) Connect the FTDI to your computer with your USB cable. Take note of what COM port it enumerates to using your computer’s device manager.

      Note: This is assuming that you have installed the FTDI drivers. If you have not installed drivers before, try looking at this tutorial [ https://learn.sparkfun.com/tutorials/how-to-install-ftdi-drivers ] or FTDI for in-depth installation guides [ http://www.ftdichip.com/Support/Documents/InstallGuides.htm ].

      1.5) Open a serial terminal connected to the FTDI. Make sure the settings are (9600-8-none-1-none). I prefer using Tera Term.

      1.6) Type this sequence of commands in the serial terminal to restore the bluetooth to its default settings just in case:

      restore
      write
      reset
      

      1.7) Use these sequence of commands to set the BC127 as a source:

      set classic_role=1
      write
      reset
      

      1.8) Use this command to get the BC127’s address and take note of the bluetooth’s address:

      get local_addr
      

      The BC127 will respond in the serial terminal with its unique address. In my case, my BC127 responded with the address “ 20FABB018221 ”.

      1.9) This step is optional but it might help in identifying the bluetooth device in the future. I named my source as “ BC_018221_Source ” but you could use a different name if you prefer:

      set name=BC_018221_Source
      write
      reset
      

      2.) Configuring Your BC127 as a Sink

      2.1) Assuming that you have soldered the header pins to the second Purpletooth, label the board as a sink with another sticky note or Sharpie.

      2.2) Connect the second FTDI and Purpletooth to your computer and take note of what COM port it enumerates to using the device manager.

      2.3) Open a second serial terminal on your computer configured to the second COM port and 9600-8-none-1-none.

      2.4) Type the sequence of commands to restore the bluetooth to its default settings like the source:

      restore
      write
      reset
      

      2.5) Use this sequence of commands to set the BC127 as a sink this time:

      set classic_role=0
      write
      reset
      

      2.6) Assuming that your Purpletooth labeled as “Source” is powered from your computer via FTDI, type this command to determine the bluetooths in range"

      inquiry 10
      

      This should output the bluetooths that are in range for a few seconds. You should notice the source bluetooth that is in range. As an alternative, you could use a LiPo battery to power the source bluetooth.

      2.7) With the bluetooth source’s unique address from earlier, you will connect to the Advanced Audio Distribution Profile (A2DP) like so:

      open 20FABB018221 a2dp
      

      Note: The bluetooth’s unique address is case sensitive. You need to make sure that you are entering the bluetooth’s address exactly as it was given from the first BC127. Make sure that both bluetooths are set to advertising/discover mode in order execute this command. If you had followed the steps to initiate the “restore” command earlier, the blue LED labeled “LED1” and red LED labeled “LED0” will be blinking rapidly back and forth.

      2.8) You will also need to connect to the Audio/Visual Remote Control Profile (AVRCP)

      open 20FABB018221 avrcp
      

      You will only need to do this once. If you have connected to the bluetooth previously and the bluetooth remembers the address with its history, you will just need to connect using the open command once. It will automatically open and connect the avrcp after initiating the command again.

      2.9) At this point, you will notice that your source’s green LED labeled “LED2” is ON

      2.10) Hit the play button on either the source or sink’s PCB labeled as “ PIO2 ” or the symbol for play/pause to send audio through the audio bridge from the sink to your source. You can also send the command:

      music play
      

      3.) Playing Audio from Source to Sink

      Assuming that you have male to male 3.5mm audio jack cable, connect an audio device to the audio jack on the source’s bluetooth labeled as “ MIC in/ LINE in ”. I just used the audio out from my computer for testing and decided to play a track from a web browser in SoundCloud [ https://soundcloud.com/foxxboogie/foxx-boogie-official-bnc-mixtape-2014 ]. I noticed that there was better audio quality with the BC127 source’s switch flipped to the “ LINE in ” side. This might be due to the microphone being disabled with the BC127’s configuration.

      Note: I recommend powering the BC127 Source separately with a LiPo battery. When connecting the FTDI from my computer, it created a ground loop which causes a noticeable hum or hiss in the audio signal. This can happen when handling audio applications.

      After a power cycle, the bluetooths will disconnect and you will need to connect using the “open” command again. To easily connect, I recommend using this command to have the sink auto connect to the source:

      set autoconn=1
      write
      reset
      
  • I have a bluetooth microphone and bc127 purpletooth jamboree development board. How do I stream the sound from the microphone to the board ? I can pair the two devices successfully but no output on the BC127, please help ! Do they use A2DP or ARVCP profile to work ?

    • I’m just guessing here, since I’ve never played with the BC127 using a bluetooth mic, but it probably uses HFP, which is intended for just this sort of application (HFP stands for hands-free protocol, and it’s what most BT phones are using to talk to an earpiece).

      • Thanks. I tried command open BT_Address HFP but it said OPEN_ERROR HFP. I can do OPEN BT_ADDRESS A2DP or OPEN BT_ADDRESS AVRCP. and the deivce can be paired. But then what command next ? I tried MUSIC PLAY but won’t work.

        There is an IOS apps that come with this mic and inisde the Apps there is a buttom to activate the mic sound coming out on the iphone speaker. So the bluetooth mic must be working fine but what is/are the underlying command(s) to activate the mic on BC127 if I use BC127 development board ???

        Or how can I find out how to activate the bluetooth mic ?

        • I’m sorry, without the actual hardware to play with I don’t think I can do much more.

          Guessing: maybe try using the AVRCP play command? It seems weird to me that it connects via AVRCP, as that’s a remote control protocol for media players, so maybe it needs to be “played”. Also, make sure your volume is turned up. Also, maybe make sure you’ve set it to SINK mode. Check out the Audio Bridge example in this tutorial. Maybe using the receiver example from that will work.

          • everything is set as you said Let me ask in another way. If i have a bluetooth headset (mic and earphone together). Can I connect the headset to bc127 so that bc127 can hear the sound capture from the headset mic ? (i.e. no phone is involved) If that can be done, what are the commands or profile to achieve it ?

            • You should be able to; I’d expect it to operate through the HFP mode. If it’s not, then I’m afraid it may not work at all.

              • I don’t understand, so is that the problem of the product ? If we put the mic aside, In general, it should work with normal bluetooth headset. is that correct ? I tried to connect normal bluetooth headset, paired and connect HFP mode but no sound coming out. What am I missing ?

                • I really can’t say. At this point it’s so far into the specifics of dealing with one particular headset that I’m out of my experience range. It’s possible that that headset just won’t work with the BC127.

  • Is it possible to have one BC127 (master) connect up to 2+ BC127(slaves) at the same time? or is it a one to one device?

    • I’m afraid I don’t have an answer for that. I suspect multiple devices can connect at once, however, but you wouldn’t be able to stream multipoint audio. That’s just an educated guess.

      EDIT: If you go to the BC127 product webpage they mention multiple connections as a feature. So clearly, it’s possible; it may require a firmware upgrade, however.

  • Hi there,

    I’m looking to develop a project that requires the use of both the Bluetooth Audio and Serial profile at the same time, preferably in connection to an iOS device. Is this possible? Can I stream audio from my phone thought the DAC while -simultaneously- sending serial data from my app to the BC127 and have this get picked up by a micro controller?

    Thanks a lot

    • it can be done but not with iOS. iOS doesn’t support serial port protocol. if you’re writing your own app, you can do it via BLE, but it’s not for the faint of heart.

      • Good news :) A quick google for iOS / BLE shows indeed that it requires some hoop jumping. Luckily the number of operations that I have in mind is limited, so I think I can put something together without loosing too much sanity.

        Thanks for the info!

  • How to connect BC127 to PC for configuring. Using FTDI board? Thanks in advance.

  • Is it possible to connect a uno or a mega?

    • Yes, but it’s a little harder, as you’ll need to use jumper wires to connect the serial pins to the headers on the board. Also, you’ll find that having anything connected to the serial port on an Uno (or to the first serial port on the Mega) interferes with the upload process. It may be possible to use a software serial port on the Uno to avoid that, but I wouldn’t recommend it, because software serial ports don’t deal with long data strings very well.

  • Is the micro-USB usable at all for connecting to a PC? The guide is showing using the Bluecreation USB app to talk to the board, but I can’t get it to connect. What’s the trick?

    • You’ll need to connect via the 6-pin serial header (the one that says “FTDI->PC”); as far as I know, BlueCreation hasn’t yet added support for that USB port to the device. The D+/D- lines are run, in case they do, and that port can be used to charge a LiPo battery connected to the board, but it’s not currently active as a USB port.

  • Hi. I am unable to Send any command to Jamboree Bluetooth module kit. While when I press reset button it send me back response at Hyper Terminal. When I send any command via Hyper Terminal. It is not giving any response. Please suggest me what can be wrong. and how to tackle with that problem thanks.

  • Good day, I am having trouble getting the Purpletooth Jamboree (PJ) working with a Plantronics Voyager Pro headset. This is just a bluetooth headset for phones. I wish to send music to the headset thru the PJ and allow the wearer to also sing into the mic and have that at the PJ for output. Currently just trying to get music playing in the Plantronics earpiece. I can successfully get music playing from the PJ to a Sony Bluetooth headset, just a set of earphones basically. And I can get the BT127 to xmit the music to another BT127. (Input is just hooked to an iPod playing music). I can successfully get an iPhone to transmit music via bluetooth to the Plantronics earpiece. So I think I am using the correct sequence of commands to the BT127 (I am using a terminal emulation to send the cmds direct, I am not using the Arduino), and all the hardware is good. I am using the play button on the board to initiate the music play cmd, since the Plantronics nor the Sony have AVRCP. I have the screen captures of the commands and the BT127 responses, the status and list command outputs and the “config” cmd output if needed. It is almost as though the Plantronics is not directing the A2DP stream to the earpiece? But the iPhone can successfully get it to do it. While I don’t understand it, I have also tried to use the “set audio=x” for all values, to no avail. Can someone give me a hint of what I might be doing wrong and need to do to make this configuration work please?

    Thank you, Pete

  • So, any way you guys can publish what the serial command set for the interface is? I ask because in the library tutorial, you guys say:

    To make things easy for the advance user, we’ve also included three additional functions that allow you to send any command in the datasheet, and to alter or retrieve any parameter setting.

    But if you look at the datasheet(http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/Bluetooth/DataSheet-BC127(10).pdf) linked here, there are no such commands listed.

    • Aha! Good catch. The manual you want is the Melody Manual, Melody being the name of the firmware that BlueCreation made for the module to provide user connectivity.

      I’ll update the links in the tutorial and the product pages.


If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!