element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum using bluetooth with arduino
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 10 replies
  • Answers 2 answers
  • Subscribers 417 subscribers
  • Views 1500 views
  • Users 0 members are here
  • arduino_tutorials
  • arduino_tutorial
Related

using bluetooth with arduino

e14 Contributor
e14 Contributor over 12 years ago

Hi i want to use a bluetooth module with an iphone and i want something to happen once iphone loses connection i currently have the bluetooth silver mate from sparkfun. How can i make this happen need help plz thank you.

  • Sign in to reply
  • Cancel

Top Replies

  • gihu
    gihu over 12 years ago in reply to e14 Contributor +1 verified
    Ok, Step by step, 1.In the void setup, you are inialitating UART in 115200 of Arduino, to contact the RN42, then you are changing the UART of the RN42 to 9600, and the you change the uart of the Arduino…
  • e14 Contributor
    e14 Contributor over 12 years ago in reply to gihu +1
    ok thank you for the help im going to try all the suggestions really appreciate you taking the time out to help me learned alot
Parents
  • gihu
    0 gihu over 12 years ago

    Hi John,

     

    Probably a more detailed explanation will help.

    i suppose that you use a microcontroller connected on the bluetooth silver mate side, right? If you have good ability with a hand-soldering tool, try to weld a wire-wrap to PIO2 of the RN42, this pin if used for the purpose you need, it is high when connected, and low when disconnected.

    If you want to avoid burning out anything I think that you can use the SPP just to send a character, and wait for an echo, (then you have to implement an app in IOS just for this) if time out is disconnected, if you receive the echo, is connected.

     

    By the way, Have you chacked that this BT silver mate is IOS compatible? The roving network module build-in must be RN42APL, if is just RN42 it will not work well with IOS.

     

    I hope it helps, if not try to give a little more information just to help us to understand wath you need, I have used before RN42 to work with an android phone, and it works really well!!

     

    Regards,

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to gihu

    hi miguel thanks for responding and your answer was really helpful the pin on the bluetooth silver that i have say P106 im guessing it does the same thing with the HIGH/LOW functions.

    I have paired the bluetooth module and iphone successfully but initially the iphone wouldnt find the bluetooth device i had to go into comannd mode using $$$ once connected to arduino using this code here

    /*

      Example Bluetooth Serial Passthrough Sketch

    by: Jim Lindblom

    SparkFun Electronics

    date: February 26, 2013

    license: Public domain

     

     

    This example sketch converts an RN-42 bluetooth module to

    communicate at 9600 bps (from 115200), and passes any serial

    data between Serial Monitor and bluetooth module.

    */

    #include <SoftwareSerial.h> 

     

     

    int bluetoothTx = 2;  // TX-O pin of bluetooth mate, Arduino D2

    int bluetoothRx = 3;  // RX-I pin of bluetooth mate, Arduino D3

     

     

    SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

     

     

    void setup()

    {

      Serial.begin(9600);  // Begin the serial monitor at 9600bps

     

     

      bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps

      bluetooth.print("$");  // Print three times individually

      bluetooth.print("$");

      bluetooth.print("$");  // Enter command mode

      delay(100);  // Short delay, wait for the Mate to send back CMD

      bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity

      // 115200 can be too fast at times for NewSoftSerial to relay the data reliably

      bluetooth.begin(9600);  // Start bluetooth serial at 9600

    }

     

     

    void loop()

    {

      if(bluetooth.available())  // If the bluetooth sent any characters

      {

        // Send any characters the bluetooth prints to the serial monitor

        Serial.print((char)bluetooth.read()); 

      }

      if(Serial.available())  // If stuff was typed in the serial monitor

      {

        // Send any characters the Serial monitor prints to the bluetooth

        bluetooth.print((char)Serial.read());

      }

      // and loop forever and ever!

    }

     

    But i have to do that everytime i want to connect. Is there a way to pair automactic once in range ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gihu
    0 gihu over 12 years ago in reply to e14 Contributor

    Ok,

     

    Step by step,

    1.In the void setup, you are inialitating UART in 115200 of Arduino, to contact the RN42, then you are changing the UART of the RN42 to 9600, and the you change the uart of the Arduino to 9600.

    You can use Serial. begin(115200), and use every time the serial class, never more the bluetooth class, even this setup will not be needed.

    2.Please, let me know if I am wrong, but I think serial.read is doing exactly the same  than bluetooth.read; bluetooth.avaliable is exactly the same than serial.avaliable, and so on... If I am rigth, you just need to use one of them.

    3.For autoconnection and seeing then status of the RN42, you need to acces to pin that they are not in your module. Try to get one like this:

    https://www.sparkfun.com/products/11601

    Check before that it is compatible with IOS.

    Tie PIO6 to 3V to make that every time the module 'sees' your Iphone connects with it.

    Check the the status of PIO2, to know the status connection.

    Remember that your mudules seems to have acces to PIO6, but in fact it is PIO4, not PIO6 (that's what sparkfun says)

     

    I can check that RN42XV is compatible with IOS or not (I've got one), but not before next week (I am android user...).

     

    Hope it helps,

    Miguel

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to gihu

    Thank you I will check out that module and try your suggestion I really appreciate your help I want to make something similar to the bluetooth bracelets and watches they have out now so was trying to see how to include the bluetooth in there and was wondering is arduino best for that or should I use some other mcu. Let me know what you think thank

    ,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to gihu

    Thank you I will check out that module and try your suggestion I really appreciate your help I want to make something similar to the bluetooth bracelets and watches they have out now so was trying to see how to include the bluetooth in there and was wondering is arduino best for that or should I use some other mcu. Let me know what you think thank

    ,

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • gihu
    0 gihu over 12 years ago in reply to e14 Contributor

    Search and read info about bluetooth profiles, the most used by hobbyist are SPP to have serial communicatios, and HID to act as a mouse oy keyboard. For the purpose you want I think there are HDP and HRP. These are which normally are used in standard products, so if you can work with this profiles you will be able to works with comercial apps like nike+ or endomondo (I think). If not you can build your own app and harware based on SPP, but PIO6 and PIO2 will be very helpfull.

    If you find helpful my comments I will appreciate if you mark it as useful, image

     

    Please let me know your achievements on it, it is a very nice project.

     

    Regards,

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to gihu

    i did some research on the different bluetooth profiles you showed me and didn't know there was so many profiles that can do different things that was really helpful. Where can you find a specific bluetooth module that supports most of those for purchase ?

    or how can you change the one I have to do those things ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gihu
    0 gihu over 12 years ago in reply to e14 Contributor

    After some research... I think that RN42 has no HDP capabilities, you can find WT11 or WT12 from bluegiga, or PAN1455 and PAN155 from panasonic, BTM443 from lairdtech. These ones has HDP, search a little bit more, my advice, chose that one which have breakout board and many documentation. For example BTM443 (I used it) has a lot of information on its website, but I could not find breakout board (and burned out three modules...image)

    PAN1555 has a breakout board:

    DKSB1013A Digi-Key Evaluation Boards | 876-1005-ND | DigiKey

    And a lot of information for this one:

    http://www.stollmann.de/en/modules/bluetooth-products/bluemod-p24p25g2.html

     

    Read it carefully, at the beggining it complex to understand how it works.

     

    How do you want to solve the sensing part?

     

    Regards,

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to gihu

    I Like the BTM443 seems like it will do a lot of the things I need it to do thanks do I need a breakout board for that ?

    also with the silver mate from what I'm understanding is your saying to solder a wire to PI06 and that pin will go high when connected and low when it loose connection right? Could I use the arduino to do a digital read from PIO6 to do output from arduino ? And also I wasn't sure how to make the silvermate connect automatic to IOS or is that not possible with the current module I have?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gihu
    0 gihu over 12 years ago in reply to e14 Contributor

    Hi John,

    For the BTM443, it is much easier handle with it, if you have built in a breakout board, or even you can make a pcb to solder the module, so, breakout board strongly recommended.

    About PIO6 functionality, this function on PIO6 is by default, and even can be changed (at command), Before connect it to the arduino, just use a tester, to check it is working, Once you know it works, connect it to the arduino, and test it. When you get it working, see more info about auto connection, because it not depends only on RN42 side, it also depends on the Iphone side, the code of your app shuold accept incomming connection, but better you first deal with PIO6, the autoconnection can be done also in the Iphone side.

    Regards,

    Miguel

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to gihu

    ok thank you for the help im going to try all the suggestions really appreciate you taking the time out to help me learned alot 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube