Pages: 1 ... 3 4 [5] 6 7   Go Down
Author Topic: Using android mobile to control arduino  (Read 68940 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there is no need to change baud rate in the app as it automaticly uses the baud rate used by the bluetooth module

the module I got is set to 19200 by default and I was too lazy to change it... so check what's the default baud rate of your module and change arduino code accordingly
Logged

0
Offline Offline
Edison Member
*
Karma: 20
Posts: 2227
Have you mooed today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
you can use also the cheap HC-05 / HC-06 / HC-07 bt module (about 5 usd on ebay  smiley-mr-green).

More info about this kind of module:
http://forum.arduino.cc/index.php?topic=104903.msg786726#msg786726
(ok, it's in italian language smiley but there are a lot of pictures and code and i promise: i'll translate it in english  smiley-roll-sweat).
Logged

0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

UPDATE - I made a new app and a new video to show that you can use the phone as a GSM shield
enjoy

https://www.youtube.com/watch?v=_L_JyCndeKI

more details here -> http://www.instructables.com/id/Android-phone-used-as-a-GSM-shield-for-arduino/
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 11
Posts: 1309
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 Nice upgrade to your previous work! I tried to get you file as a zip but, could not figure out how. I have the pieces and will try to make them work later.


 Thanks for sharing your discovery!
Logged


0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ohh sorry
For some unknown reason the link I provided on instructables to the source file showed contents of the ZIP archive itself. I've just fixed it

try this link -> https://drive.google.com/folderview?id=0B_PfPoEotOF8N2JwT3RSX011SjQ&usp=sharing
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 11
Posts: 1309
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 That link worked, thank you!
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Kerimil,

I'm trying to expand on your app that sends temperature data to android via bluetooth, by adding two more sensor values.  On the arduino side I send the values as so:

Code:
Serial.print(SoilTemp);
Serial.print(",");
Serial.print(AirTemp);
Serial.print(",");
Serial.print(Humidity);
Serial.print(",");
Serial.println();


Assume:

SoilTemp = 15.00
AirTemp = 22.00
Humidity = 63.00


I intend this to send the following via the serial output:

15.00,22.00,63.00,

I then receive this with the blocks below:
 


The problem is; when I run my app, it comes up with the error telling me that the list index object (2) is too big for the list.  I understand that this means the list hasn't been split properly.  Do you have any tips as to how to get this working?

Thanks very much for your time.

Kind Regards,
Jimdare
Logged

0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

jimdare
It took me a while to figure it out...
You get this error because of select list item block. It crashes when there isn't item #2. Apparently something gets through serial but it isn't what you expect it to be and list index #2 doesn't exist.

How I fixed it ? Just put all your select list index number X inside an if block - and set condition to (list length = number of items you should get in the list)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Kerimil, but this doesn't seem to fix it.  I have investigated further, and it seems like the list only ever consists of one item.  I wonder why mitAI is not splitting the string properly?  Perhaps I will try using a different delimeter. 
Logged

0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm... I am just guessing here but have you tried setting the condition Bluetooth client bytes available to receive to number of bytes you expect to get through serial (probably including delimeter byte)??
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I have followed your tutorial. I have connected  android phone to my Bluetooth device (HC-06) and the TX light flashes on the Arduino when i press the led on button on my app. Although the led does not flash. Is there any way to check what byte the arduino is receiving?
Logged

0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're 100% sure that TX light is flashing ?? since you're sending stuff to the arduino board shouldn't the RX LED flash ?? I am away from my board ATM so I can't check whether RX or TX flashes when it receives but I think it should be RX not TX

Is the bluetooth module TX pin connected to RX pin on the arduino board ?? it should be. If it isn't correct that


If you want to check exactly what is being sent from the module to the board then use software serial to create another UART port on other pins and create a sketch that retrieves whatever is sent through that serial and passes it to hardware serial (and thought USB connection to the computer where it can be seen using a serial monitor)
The reason why you need to use software serial is because you can't have anything connected to hardware uart pins and use serial through USB connection.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Success!! I finally made the bloody thing work! Turns out it didn't like the first byte of the string I was sending, so I added an 'X' in front.  This made the string look like this:

X15.00,22.00,63.00,

The split by ',' block worked fine after this.  I still have issues with the length of the list, but I will just add an 'if list = 3' condition. 

Thanks kerimil.

Code:

Serial.print("X");
Serial.print(temperature);
Serial.print(",");
Serial.print(temp);
Serial.print(",");
Serial.print(humi);
Serial.print(",");
Serial.println();
delay (2000);
Logged

0
Offline Offline
Full Member
***
Karma: 5
Posts: 229
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Glad I could help even if I didn't  smiley-slim

Anyway here is my newest project that also interfaces arduino and android devices - nothing fancy really it just a wireless ignitor



more details here -> http://www.instructables.com/id/Wireless-cell-phone-igniter/
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I change the RX and TX connections and nothing flashes now. I have attached the Arduino code and the android app code.



* 2013-08-15_225635.jpg (61.92 KB, 617x562 - viewed 92 times.)

* 2013-08-15_225852.jpg (41.17 KB, 542x400 - viewed 73 times.)
Logged

Pages: 1 ... 3 4 [5] 6 7   Go Up
Jump to: