Bluetooth interaction with mobile phone
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Bluetooth interaction with mobile phone
I'm completely new in the field of connection a microchip with a mobile phone.
I found the software HMIDroid(Studio) http://www.idea-teknik.com/en/hmi_droid ... munication which shows the possible protocols and connections: Is this possible to make the bluetooth conenction by means of Flowcode and this HMIDroid software?
Who can help me in some way?
Kind regards
Jan
I found the software HMIDroid(Studio) http://www.idea-teknik.com/en/hmi_droid ... munication which shows the possible protocols and connections: Is this possible to make the bluetooth conenction by means of Flowcode and this HMIDroid software?
Who can help me in some way?
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
I can help you out there.
I created a way to use a mobile phone via Bluetooth to control Outputs of a microcontroller, which fed back the information to the phone showing what output was enabled.
No comms then the buttons greyed out.
At least microcontroller can be hidden away and know via feedback if output has been enabled or not.
This was a prototype but will give you an idea.
My plan is to do a matrix blog on how to create the app on an Android mobile.
I used the hc06 Bluetooth module and MI2 app Inventor to develop mobile app.
I can help you out there.
I created a way to use a mobile phone via Bluetooth to control Outputs of a microcontroller, which fed back the information to the phone showing what output was enabled.
No comms then the buttons greyed out.
At least microcontroller can be hidden away and know via feedback if output has been enabled or not.
This was a prototype but will give you an idea.
My plan is to do a matrix blog on how to create the app on an Android mobile.
I used the hc06 Bluetooth module and MI2 app Inventor to develop mobile app.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Dear Martin
A Matrix blog about this subject will be wonderful! Keep me informed.
Kind regards
Jan
A Matrix blog about this subject will be wonderful! Keep me informed.
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
Starting the writing and software modification on the blog today.
If you want to get hardware working sooner rather than later then you could order a HC06 Bluetooth Module in advance.
My target device is 16F1828, but its easily adaptable to other target devices, so long as it has a RX interrupt.
Do you have an Android phone or tablet?
Sorry blog not compatible with Iphone due to MIT App inventor.
Starting the writing and software modification on the blog today.
If you want to get hardware working sooner rather than later then you could order a HC06 Bluetooth Module in advance.
My target device is 16F1828, but its easily adaptable to other target devices, so long as it has a RX interrupt.
Do you have an Android phone or tablet?
Sorry blog not compatible with Iphone due to MIT App inventor.
Martin
-
- Valued Contributor
- Posts: 1189
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 439 times
- Contact:
Re: Bluetooth interaction with mobile phone
Thanks Martin,
Where's the blog @ ??? - Sounds interesting.
As an aside - I'm not sure if this belongs here on in the 'stack overflow' topic. I tried a simple Bluetooth receiver on an Arduino micro (I have a long term project where I'm using the HID keyboard - and wanted to have control via Bluetooth) (& I know I probably can't use the HID keyboard and Bluetooth on the TxRx pins at the same time - but I couldn't get the Bluetooth working at all on the micro - originally using Software mode on different pins - and then trying hardware mode either with or without an interrupt)
But the micro doesn't seem to generate the UARTRx interrupt - so new fcdx file for the 32u4 as well please....
If it helps anyone - a simple Bluetooth program for the Arduino Nano - using a circular-buffer to store the input...
Martin
Where's the blog @ ??? - Sounds interesting.
As an aside - I'm not sure if this belongs here on in the 'stack overflow' topic. I tried a simple Bluetooth receiver on an Arduino micro (I have a long term project where I'm using the HID keyboard - and wanted to have control via Bluetooth) (& I know I probably can't use the HID keyboard and Bluetooth on the TxRx pins at the same time - but I couldn't get the Bluetooth working at all on the micro - originally using Software mode on different pins - and then trying hardware mode either with or without an interrupt)
But the micro doesn't seem to generate the UARTRx interrupt - so new fcdx file for the 32u4 as well please....
If it helps anyone - a simple Bluetooth program for the Arduino Nano - using a circular-buffer to store the input...
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin.
Then when it's finished, it will be transferred from the document to the blog.
Started the document yesterday and currently on page 3.
Here is a small snippet in it's first draft form: It then goes in to step by step detail how to create the app for Bluetooth communication's,
The interesting thing, I have done it so you can send up to 98 different commands.
So you can adjust PWM, D2A converters etc.
I'm assuming that the person reading the blog has never created an app before.
Part 2 of the blog will demonstrate reading of multiple ADCs and showing values on the mobile.
Part 3 will be using a DFPlayer to speak the values of DC voltages.
Thanks for the Circular Bluetooth.fcfx.
Currently it's in a word document I'm using to create the blog.mnf wrote:Where's the blog @ ???
Then when it's finished, it will be transferred from the document to the blog.
Started the document yesterday and currently on page 3.
Here is a small snippet in it's first draft form: It then goes in to step by step detail how to create the app for Bluetooth communication's,
The interesting thing, I have done it so you can send up to 98 different commands.
So you can adjust PWM, D2A converters etc.
I'm assuming that the person reading the blog has never created an app before.
Part 2 of the blog will demonstrate reading of multiple ADCs and showing values on the mobile.
Part 3 will be using a DFPlayer to speak the values of DC voltages.
Thanks for the Circular Bluetooth.fcfx.
Last edited by medelec35 on Thu Nov 29, 2018 12:01 am, edited 1 time in total.
Reason: Added future blog details.
Reason: Added future blog details.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin
Fine you started writing for the blog. I will order the HC06. And I have both android phone and tablet.
Have a nice sunday
Jan
Fine you started writing for the blog. I will order the HC06. And I have both android phone and tablet.
Have a nice sunday
Jan
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin
I just bought 2x HC-06 modules. But, in contrast to the HC-05 module, these HC-06 are only bluetooth slaves. Is that correct for your setup?
Kind Regards
Jan
I just bought 2x HC-06 modules. But, in contrast to the HC-05 module, these HC-06 are only bluetooth slaves. Is that correct for your setup?
Kind Regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Yes they are being used as slave mode.
That's why is does not matter.
I have got taking away from the blog writing, but back on it soon.
That's why is does not matter.
I have got taking away from the blog writing, but back on it soon.
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
As I have been delayed for various reasons,
I will develop an app for you.
Can you let me know how many outputs you would like to control?
We can set up outputs to toggle.
Once we have done that, I will help you with the hardware side.
As I have been delayed for various reasons,
I will develop an app for you.
Can you let me know how many outputs you would like to control?
We can set up outputs to toggle.
Once we have done that, I will help you with the hardware side.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin,
That is good news!
In the first setup I intend to send one variable to the cell phone (in Dutch we call it "mobieltje"= little mobiel) and I need one button on the cell phone to start a process in the microchip. Is this the information you need?
Kind regards
Jan
That is good news!
In the first setup I intend to send one variable to the cell phone (in Dutch we call it "mobieltje"= little mobiel) and I need one button on the cell phone to start a process in the microchip. Is this the information you need?
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
One 8 bit variable can control 8 pins.
Can you confirm you only want to control 1 single pin?
Or did you wan to do something different from controlling one or more pins?
For example, you can enter text on the phone and it will appear on an LCD that's connected to a microcontroller.
Can you do a rough sketch showing a labeled button for example.
At least then I can see the size and position of the button.
One 8 bit variable can control 8 pins.
Can you confirm you only want to control 1 single pin?
Or did you wan to do something different from controlling one or more pins?
For example, you can enter text on the phone and it will appear on an LCD that's connected to a microcontroller.
Can you do a rough sketch showing a labeled button for example.
At least then I can see the size and position of the button.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin,
This is the setup of the screen of the cell phone. The top "UPF"is just a fixed text. The 1024 is the variable (16bits) send by the microchip. And the "Start" buttom must start a microchip process.
Perhaps later on, the viarable will be a string instead of an integer.
I hope this clearifies what I want to do.
Kind regards
Jan
This is the setup of the screen of the cell phone. The top "UPF"is just a fixed text. The 1024 is the variable (16bits) send by the microchip. And the "Start" buttom must start a microchip process.
Perhaps later on, the viarable will be a string instead of an integer.
I hope this clearifies what I want to do.
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
I have just created the app and flowchart for you: I have kept then both simple so you can edit them.
The Bluetooth can transmit and receive.
With what you want to do, it's only receiving.
Therefore only a direct connection from BT TX to microcontroller RX is all that's necessary.
All you need to to is change the target device and what you want to do with the variable, once its received.
I have just created the app and flowchart for you: I have kept then both simple so you can edit them.
The Bluetooth can transmit and receive.
With what you want to do, it's only receiving.
Therefore only a direct connection from BT TX to microcontroller RX is all that's necessary.
All you need to to is change the target device and what you want to do with the variable, once its received.
- Attachments
-
- UPF1a.zip
- (2.6 MiB) Downloaded 140 times
-
- BT RX for Jan.fcfx
- (11.9 KiB) Downloaded 170 times
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin
I understand the flowcode. Although I wanted the other way round, the string from the microchip to the cell phone and the start puls from the cell phone to the microchip (to get it out of the sleep mode).
The other zip file is not clear to me. Is it correct that you use the MIT App inventor 2?
http://appinventor.mit.edu/explore/get-started.html
But as far as I see the only conencting is Wifi and not bluetooth. And how do I use use UFP1a.apk file?
Kind regards
Jan
I understand the flowcode. Although I wanted the other way round, the string from the microchip to the cell phone and the start puls from the cell phone to the microchip (to get it out of the sleep mode).
The other zip file is not clear to me. Is it correct that you use the MIT App inventor 2?
http://appinventor.mit.edu/explore/get-started.html
But as far as I see the only conencting is Wifi and not bluetooth. And how do I use use UFP1a.apk file?
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
Sorry I misread.
I will change it when I get a chance.
The apk file is installed on your mobile.
It's an Android installation extension for apps, just like .exe is for PC's
Wifi is only used for app development only.
The app is then installed on your phone.
Then the app connects to Bluetooth to transmit or receive commands.
I will post the code that was created in MIT AI2 when you are happy with the functionality.
Sorry I misread.
I will change it when I get a chance.
The apk file is installed on your mobile.
It's an Android installation extension for apps, just like .exe is for PC's
Wifi is only used for app development only.
The app is then installed on your phone.
Then the app connects to Bluetooth to transmit or receive commands.
I will post the code that was created in MIT AI2 when you are happy with the functionality.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin
I copied the apk file to the cell phone in the download directory. Clicking on this file results in a pop-up saying that Google does not know this extension and installed a text editor. How do I get started your app?
Kind regards
Jan
I copied the apk file to the cell phone in the download directory. Clicking on this file results in a pop-up saying that Google does not know this extension and installed a text editor. How do I get started your app?
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
It is an Android mobile you have?
apk is an Android Package file.
If you have unzipped the attached apk file before copying to your mobile,
Then use a file manager to install.
That is what I do.
It is an Android mobile you have?
apk is an Android Package file.
If you have unzipped the attached apk file before copying to your mobile,
Then use a file manager to install.
That is what I do.
Martin
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Bluetooth interaction with mobile phone
You may need to put your phone into developer mode to allow apps (apk) files to be installed from sources other than Google Play.
This will vary from phone to phone so you might need to ask Google. For me I go into the settings. Then click on About Phone. Then Software information. Then click on the Build Number 7 times.
This will vary from phone to phone so you might need to ask Google. For me I go into the settings. Then click on About Phone. Then Software information. Then click on the Build Number 7 times.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Ben,
What concerns me is that Android should know what apk extension is whether in developers mode or not?
So either the apk file was not extracted first or the phone has a windows or apple operating system.
One for Jan to answer?
I will wait for an answer before creating an app that will be able to receive an int value and display it.
What concerns me is that Android should know what apk extension is whether in developers mode or not?
So either the apk file was not extracted first or the phone has a windows or apple operating system.
One for Jan to answer?
I will wait for an answer before creating an app that will be able to receive an int value and display it.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin
The installation is succesfull. The problem is that I started with the app "Computer", which is the android equivalent of windows explorer. Clicking on the .apk file does not install this file. Then I used the app "File Manager" and click on the .apk file succeed in installation of the UPF1a.apk app.
Is it posisble that you shortly describe how you made the .apk files?
Kind regards
Jan
The installation is succesfull. The problem is that I started with the app "Computer", which is the android equivalent of windows explorer. Clicking on the .apk file does not install this file. Then I used the app "File Manager" and click on the .apk file succeed in installation of the UPF1a.apk app.
Is it posisble that you shortly describe how you made the .apk files?
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
I used MIT App Inventor to develop apk file.
As you can now install apk files, I will modify the app so it will display an Int variable from an ADC channel as a demo.
If you have any icon images(you can select to run app)/ images for the app background (instead of plain white, then I can add them for you.
As you can now install apk files, I will modify the app so it will display an Int variable from an ADC channel as a demo.
If you have any icon images(you can select to run app)/ images for the app background (instead of plain white, then I can add them for you.
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
Attached is more what you was after.
I have included the apk and source file .aia which is opened with MIT ai2 via browser
The microcontroller transmits the updated ADC value of a pot via Bluetooth only when you press the start button on the app.
If the start has not been pressed but ADC value changes, the app will not display the changed value until Start is pressed again.
IMPORTANT:
The RX of Bluetooth is not 5V tolerant.
There for you will require a couple of resistors to act as a level shifter.
Connected a 3K3 to the microcontroller TX ,then the other end of the resistor to RX of Bluetooth. Then connected a 5K6 resistor from RX of Bluetooth to 0V.
I find they are ideal values, especially if the RX of Bluetooth also connects to ICSP Data or clock connections!
TX of Bluetooth can be directly connected to RX of microcontroller.
Attached is more what you was after.
I have included the apk and source file .aia which is opened with MIT ai2 via browser
The microcontroller transmits the updated ADC value of a pot via Bluetooth only when you press the start button on the app.
If the start has not been pressed but ADC value changes, the app will not display the changed value until Start is pressed again.
IMPORTANT:
The RX of Bluetooth is not 5V tolerant.
There for you will require a couple of resistors to act as a level shifter.
Connected a 3K3 to the microcontroller TX ,then the other end of the resistor to RX of Bluetooth. Then connected a 5K6 resistor from RX of Bluetooth to 0V.
I find they are ideal values, especially if the RX of Bluetooth also connects to ICSP Data or clock connections!
TX of Bluetooth can be directly connected to RX of microcontroller.
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Martin
IT WORKS WONDERFUL !!!!!!!!
I'm very happy with it.
I used the PICLF1847 which has been powered with 3V3. No voltage change problems.
Now I will start understanding to develop the MIT files. Thanks for the .aia file.
Kind regards
Jan
IT WORKS WONDERFUL !!!!!!!!
I'm very happy with it.
I used the PICLF1847 which has been powered with 3V3. No voltage change problems.
Now I will start understanding to develop the MIT files. Thanks for the .aia file.
Kind regards
Jan
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Bluetooth interaction with mobile phone
Hi Jan,
You're welcome & thanks for keeping me updated.
I'm glad it's working the way you want it to.
I have kept all as simple as possible for the single Int display.
It's possible to do multi Int display, but starts to get more complex.
If you get stuck with getting started with App AI2 then let me know.
It's better to mention resistors and not require them, rather than not mention them and the Bluetooth gets destroyed!
I like your prototyping PCB.
You're welcome & thanks for keeping me updated.
I'm glad it's working the way you want it to.
I have kept all as simple as possible for the single Int display.
It's possible to do multi Int display, but starts to get more complex.
If you get stuck with getting started with App AI2 then let me know.
Yes that's correct, the resistors are only if microcontroller is running at 5V.Jan Lichtenbelt wrote:I used the PICLF1847 which has been powered with 3V3. No voltage change problems.
It's better to mention resistors and not require them, rather than not mention them and the Bluetooth gets destroyed!
I like your prototyping PCB.
Martin