chipKIT® Development Platform

Inspired by Arduino™

[Android App] PIC32BTN Free Bluetooth serial communication

Created Fri, 26 Dec 2014 03:38:56 +0000 by djgardn2


djgardn2

Fri, 26 Dec 2014 03:38:56 +0000

This application allows you to connect to your microcontroller using a serial Bluetooth module to send messages or commands to your Android smartphone. See example below for microcontroller code.

Simply send a message to the microcontroller and you can program any reaction that you would like.

PIC32BTN Features: ★Send information to a microcontroller. ★20 available buttons to save custom messages. ★Microcontroller can make your phone talk out loud.

PIC32BTN [url]https://play.google.com/store/apps/details?id=com.gardnertech.pic32btn[/url]

Video demonstration of application being used with LED dot matrix coming in the next couple of days, check back soon.

You can setup the microcontroller to react to any message that you choose with a simple tap of a button with this application.

Long press the button in order to set and save the message you would like to be sent over Bluetooth.

You can control a servo motor, LED matrix, RGB lights, LCD screen, or anything you would like using a phone or tablet.

You can have the application running in the background by tapping the home button on your device and the app will maintain a connection running in the background.

Tapping the back button within the application will close and disconnect from the Bluetooth device if it is connected.

This application was made to function with a HC-06 Bluetooth device and others may work but have not been tested.

You can also make your microcontroller have your phone talk out loud using the :TALK: or :talk: command.

For the microcontroller to have your Android phone talk out loud you must include:

:TALK:

Or

:talk:

Below is a code example that can be used with the application (delay version). If you would like to have a no delay version I recommend you checking out the link below. Majenko linked a nice article about no delay serial and then also I posted a second code version with no delay, found here [url]http://www.chipkit.net/forum/viewtopic.php?f=15&t=2983[/url]

// Microcontroller code example //Change delay times if needed String inputString =""; int incoming = 0; void setup () { delay(15); Serial1.begin(9600); delay(50); } void loop () { if(Serial1.available()>0) { while(Serial1.available()>0) delay(2); //must be exact spelling if(inputString == "Cool") { //add code here } if(inputString == "Respond") { //add code here } if(inputString == "Talk") { Serial1.println(":TALK:Hello, world."); } } inputString =""; delay(50); }

Thank you for checking out my application.

This application enables your Android smartphone (11+ OS version) to be able to communicate with your PIC microcontroller through Bluetooth (HC-06 module or similar).


Jacob Christ

Sat, 27 Dec 2014 17:32:38 +0000

Cool... What is your exact setup on the PIC32 side? Have you built your own board or are you using an off the shelf board?

Have you seen our app that uses Android ADK?

http://quick240.com/quicki/demos:androidadkpropertiesviewer

https://play.google.com/store/apps/details?id=com.pontech.propertiesviewer

The way our app works is we encode properties that are transmitted to the app as json messages that tell the app which buttons to display? The json string also encodes the type (string, int, bool) so that the app know some rules the values.

Jacob


djgardn2

Sun, 28 Dec 2014 00:07:17 +0000

I am currently using only the chipKIT Pi or its microcontroller (PIC32MX250F128B) usually transferring it to a breadboard, I have a number of the microcontrollers currently to pick and place. Although, I have developed two different boards recently in the past months (rev1 and rev2) they are the first boards I have ever made. I made them all through hole and they are very solder friendly with traces as far apart as possible at solder points as well as extra spaced ground and power plans. I believe I came across seeing the application before when I first started with the chipKIT Pi but never got a chance to look into it. I’ll have to check it out for sure, I like the idea of having the microcontroller choose what buttons or selections are shown. I haven’t looked into the Android ADK before but might have to check that out one time. I downloaded your application and will be sure to try it out when I get a chance.

This application was created using Eclipse with the ADT (Android Development Tools plugin) both PIC32BTN, PIC32BLUE, and PIC32BLUE+ (text message enabled version).

Here is an image of the board that I put together (revision 1 is green and revision 2 is black): Difference is revision 2 has a bigger voltage regulator allowing more current, power plan and ground plan, added 2 high frequency capacitors, and extra easy soldering spacing for the traces.