Bluetooth interaction with mobile phone

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

User avatar
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

Post by Jan Lichtenbelt »

The breadboard is available at viewtopic.php?f=3&t=20937

Kind regards

Jan

User avatar
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

Post by Jan Lichtenbelt »

Hi Martin

The START Button must wake up the microchip from the SLEEP mode.

After a certian while of inactivity, the microchip will go in the SLEEP mode.
1) If the START button will not been touched, will there any Rx signal on the UART from the bluetooth?
2) If negative, will a Rx signal on UART wake up the microchip from the SLEEP mode ? (interrupt?)

Kind regards

Jan

medelec35
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

Post by medelec35 »

How it works is when you press start an ASCII 's' is sent from the phone to the Bluetooth. The Bluetooth then sends ASCII s to the RX of the microcontroller. When ASCII s is detected by microcontroller it then sends the ADC value from TX into Bluetooth.etc.
If you want to wake the microcontroller up when pressing send then perhaps you can connect timer1 external input to RX?.
Martin

User avatar
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

Post by Jan Lichtenbelt »

Hi Martin

You told me to use the alternative app buider http://gold.appybuilder.com/ which works better for me. Thanks a lot.

I wanted to use 2 pages/screens with 2 languages (EN and NL). Please find attached an example.

Kind regards

Jan Lichtenbelt
UPF5.zip
(2.89 MiB) Downloaded 276 times

User avatar
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

Post by Jan Lichtenbelt »

I made a small extension to the android aia and apk file:
apk_extension.jpg
apk_extension.jpg (93.75 KiB) Viewed 5659 times
that means directly after the bluetooth has been connected a "s" character will be send to the microchip. Therefor I extended Martin's flowcode file UPF2.fcfx file into UPF_1847_V2.fcfx file with a while loop waiting for this "s"character. If it takes to long, one get a message, else the original program will be started. That means showing the ADC values if pushed on the "START" button of the cellular phone.

Kind regards

Jan
UPF2_V2.zip
aia, apk and fcfx files
(3.18 MiB) Downloaded 199 times
PS. Martin it works fine now.

medelec35
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

Post by medelec35 »

Hi Jan,
Glad it works as I could not see any issues with your flowchart.
Martin

User avatar
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

Post by Jan Lichtenbelt »

In the connections of a microchip to a cellular phone, there are two important issues:
1) Connection between the cellular phone and the Bluetooth unit. If not connected the red LED on the Bluetooth unit is flashing. If connected the red LED is continuously on.
2) the connection between the microchip and the Bluetooth unit. UART Rx and Tx is used. The proper working can be checked like shown in the previous posts.

Up to now, the tests have been performed with the 16LF1847 microchip.

But I wanted to use instead the microchip 16LF18857. But without success. What can be the reason? I really don't know.


Kind regards

Jan
UPF2_18857_V1.fcfx
(20.33 KiB) Downloaded 190 times

User avatar
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

Post by Jan Lichtenbelt »

I think I get a little bit older. I forgot to exchange the Rx and Tx pins of the microchip and the bluetooth unit. Now it works fine.

Kind regards

Jan

User avatar
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

Post by Jan Lichtenbelt »

Hi Martin,

I changed the exchange of information between the microchip and the phone. Now in principal, only data (strings) will be send from the microchip to the phone. But what I see on the phone is that strings are combined together. E.g. I send 100 and sometime later 110. That will be shown on the phone as "100 110". I far as I know the phone clock has been set to 10 (msec), so I changed the time between sending strings from 50 to 250 msec. But I still get something like "240 250" on the phone.
I even made the receiving string on the phone first " ", before reading the bluetooth string.

How can I improve this?

Kind regards

Jan
UPF2_1847_V3.zip
(3.18 MiB) Downloaded 196 times

medelec35
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

Post by medelec35 »

Hi Jan,
Sorry been on a course so have a bit less time than normal.
Hopefully will get a chance this evening to check it out.
Martin

medelec35
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

Post by medelec35 »

Hi Jan,
Had a quick look and the rapid chars is confusing it.
Does not know when the last char has been sent or the first char of the next set.
My advice would be to send an invisible end char e.g a Space.
Then when the APP sees a space it knows that the next set is being sent.
It was not set up like this originally as the spec was to display on a press of a button.
I will give it a go when I get a chance.
You could also give it a try.
Martin

User avatar
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

Post by Jan Lichtenbelt »

Hi Martin,

I will try it.

Thanks

Jan

Post Reply