Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Best way to add bluetooth to Teensy 3.2 + simple iPhone programming interface?

  1. #1

    Best way to add bluetooth to Teensy 3.2 + simple iPhone programming interface?

    Hey all,
    I've built a Teensy 3.2 + Prop Shield + TeensyView powered controller for WS2812 LEDs, and now I want to add bluetooth LE control to the project to be able to control it with an iPhone. I'd like to find a module that has a companion (or is compatible with some other) app for iPhone that is very easy to program. On the iPhone side, I'm just looking for virtual momentary buttons and a slider to send one way commands to the board (to emulate two momentary buttons and a potentiometer). If I can get bidirectional communication going to be able to get feedback from the system back to the app, that's a bonus but not required. I'm looking for the shortest path to do this because I'm rapidly running out of time to complete my project. If anyone can point me in the right direction, I would greatly appreciate it. Thanks in advance!

    Austin

  2. #2
    Senior Member
    Join Date
    Apr 2017
    Posts
    125
    Getting some basic code working is not to bad to send data to a phone or have phone control something. I've used HC-05 modules ($7 from Amazon), and used MIT app inventor to write the phone app. My project read some temps, and sent them to a phone. The example at this website goes the other way where a button press on the phone will turn and LED on and off. The example uses an Arduino, but a Teensy will work just as well (actually better). Code changes will need to replace the Arduino SoftwareSerial(rx, tx); statement to "#define MySerial Serial1" get it working with Teensy.

    https://www.instructables.com/id/Con...r-and-Arduino/


    Follow the steps carefully especially when connecting the HC-05 as Rx-Tx are flipped


    Hope this helps.

  3. #3
    It does KrisKasprzak, thank you! I've dived into this a lot more, and I'm wondering whether I could find a more updated module than the HC-05 (for instance, the HM-19, which has Bluetooth 4.2 EDR etc etc) that provides lower power consumption and better range and is much smaller. Do you have any experience with any other modules?

    Austin

  4. #4
    Senior Member
    Join Date
    Apr 2017
    Posts
    125
    Once i got my bluetooth project working and found out you can only pair one phone with the module, i dropped working on it. My goals were to have my Teensy send data to several phones--I guess the only way is some web server. Hence I don't have much experience past the HC-06 module.

    I'd recommend just getting something working first and go from there.

  5. #5
    Gotcha, thanks. Also I think I read about a master mode for the newer bluetooth modules that would allow this. I haven't done enough research to know for sure yet, but I think I saw someone else doing what you're saying.

  6. #6
    As a quick update, KrisKasprzak I was able to immediately get this to work. I looked at the code above and made an extremely similar program, and have it turning a string of LEDs on and off. I used an HM-10, here: https://www.amazon.com/gp/product/B06WGZB2N4/, which gives me BLE 4.0 (compatible with newer phones). Thanks for your help!

  7. #7
    Oh and in case anyone is looking for a quick app to get up and running on iPhone without having to program, I just went through like, 10 of them and the best/easiest one is "HM10 Bluetooth Serial Pro" (it works with other ble dongles besides hm-10s).

  8. #8
    Junior Member
    Join Date
    Aug 2018
    Posts
    3
    Thanks Austin519.

    I'm not far enough in this to have used it yet, but Martyn Currey's "Bluetooth Control Panel" deserves some publicity. The idea is that your Teensy sends some data to the phone app which then uses that to construct the push-buttons, switches, etc that make up a user interface for the project.

  9. #9
    While that's really cool kdahlhaus, it also says at the top: "The app is Android only and can be downloaded from Google Play." Unless I'm missing something on that page, it doesn't work with iOS.

  10. #10
    Junior Member
    Join Date
    Aug 2018
    Posts
    3
    Nope, you're good. I missed the "iPhone" line in the topic.

  11. #11
    Thanks. I think for something this easy I may just get a MacInCloud account and cobble together some Xcode thatís out there.

  12. #12
    Senior Member
    Join Date
    Jan 2014
    Posts
    141
    Yes you can have a teensy send ble packets to many phones. Must step teensy as central and phones as periperals.

  13. #13
    helpful information.

  14. #14
    Quote Originally Posted by RichardFerraro View Post
    Yes you can have a teensy send ble packets to many phones. Must step teensy as central and phones as periperals.
    ^^^ this is what I was talking about KrisKasprzak. Thanks Richard!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •