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

Status
Not open for further replies.

austin519

Member
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
 
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/Control-LED-Using-MIT-App-Inventor-and-Arduino/


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


Hope this helps.
 
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
 
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.
 
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.
 
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!
 
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).
 
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.
 
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.
 
Thanks. I think for something this easy I may just get a MacInCloud account and cobble together some Xcode that’s out there.
 
Status
Not open for further replies.
Back
Top