arduino Lilypad cant receive data

293 views
Skip to first unread message

tony wu

unread,
May 16, 2012, 7:52:18 AM5/16/12
to Amarino Toolkit
i use arduino lilypad ...mega/168 + Bluetooth Mate
code like :
/*
Multicolor Lamp (works with Amarino and the MultiColorLamp Android
app)

- based on the Amarino Multicolor Lamp tutorial
- receives custom events from Amarino changing color accordingly

author: Bonifaz Kaufmann - December 2009
*/

#include <MeetAndroid.h>

// declare MeetAndroid so that you can call functions with it
MeetAndroid meetAndroid;

// we need 3 PWM pins to control the leds
int redLed = 9;
int greenLed = 10;
int blueLed = 11;

void setup()
{
Serial.begin(115200);

// register callback functions, which will be called when an
associated event occurs.
meetAndroid.registerFunction(red, 'o');
meetAndroid.registerFunction(green, 'p');
meetAndroid.registerFunction(blue, 'q');

// set all color leds as output pins
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(blueLed, OUTPUT);

// just set all leds to high so that we see they are working well
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, HIGH);
digitalWrite(blueLed, HIGH);

}

void loop()
{
meetAndroid.receive(); // you need to keep this in your loop() to
receive events
//meetAndroid.send(random());
}

/*
* Whenever the multicolor lamp app changes the red value
* this function will be called
*/
void red(byte flag, byte numOfValues)
{
meetAndroid.send(numOfValues);
//analogWrite(redLed, meetAndroid.getInt());
meetAndroid.send("red");
}

/*
* Whenever the multicolor lamp app changes the green value
* this function will be called
*/
void green(byte flag, byte numOfValues)
{
meetAndroid.send(numOfValues);
//analogWrite(greenLed, meetAndroid.getInt());
meetAndroid.send("green");
}

/*
* Whenever the multicolor lamp app changes the blue value
* this function will be called
*/
void blue(byte flag, byte numOfValues)
{
meetAndroid.send(numOfValues);
//analogWrite(blueLed, meetAndroid.getInt());
meetAndroid.send("blue");
}

i use android phone Amarino 2.0 software ,
it good to connect,
when i send value to device,
it cannot work.
when i change board to mini board, it cannot work, too.
but when i use Arduino Duemilanove
it can work.

what the problem? can someone help me,please?

Free Beachler

unread,
May 16, 2012, 9:46:36 PM5/16/12
to amarino...@googlegroups.com

Tony,
Do you know what voltage the bt mate runs on, and the voltages of the arduinos you're using?

Free

tony wu

unread,
May 17, 2012, 2:47:08 AM5/17/12
to Amarino Toolkit
hello Free:
thakns for your response.

my bt mate runs on 3.3v - 6v
my lilypab runs on 2.7v - 5.5v

my input battery is 3.88v (3 number 3 battery)
i check my output to bt mate is 3.88v


On 5月17日, 上午9時46分, Free Beachler <fbeach...@gmail.com> wrote:
> Tony,
> Do you know what voltage the bt mate runs on, and the voltages of the
> arduinos you're using?
>
> Free

Free Beachler

unread,
May 17, 2012, 4:29:49 PM5/17/12
to amarino...@googlegroups.com
It's difficult to say what the problem is without richer information about the hardware.  You might want to consider these points:
1)  You've verified that your sketch has the baud rate set to the same baud rate that's set on the BT Mate, right?  This is by far the most common problem when using BT + Arduino.
2)  I assume normal rs232 serial communication works on the board.  If it doesn't you won't be able to program the Arduino.  That works, right?
3)  The operating voltage of the BT module matters, in general, because the RX/TX lines are digital I/O lines on both the Arduino and BT module and the voltage should match (current matters but we can ignore it here).  For example, if the BT module runs at 3.3V TTL and the Arduino runs at 5V you can damage the RX line on the BT module.  It sounds like you're running Lilypad and BT module on the same battery so you wouldn't expect damage.  But, a reasonable question you might ask about your circuit could be, "what if I run this system at 5V, do the results change?"
4)  Is the BT module is malfunctioning?  You can rule this out on a BT Mate (silver or gold) by entering command mode from a computer.  See the datasheet on how to enter command mode.  Perhaps you've already ruled this out with the Duemilanove.

Also you're saying that:
Lilypad:  doesn't work;  voltage range=OK for both
Pro Mini:  doesn't work; voltage range=?
Duemilanove:  works;  voltage range=?

That list should cover it.  If you've described the problem accurately and make it through that list you should know where the problem lies.

Cheers,
Free

Ryan H.

unread,
Sep 3, 2012, 3:09:44 AM9/3/12
to amarino...@googlegroups.com
Actually, I seem to have a similar setup with a similar problem. I have the Lillypad Powered by 3xAA batteries, with a Bluetooth Mate Silver. I can run applications which do echo tests connected via my laptop or my phone via SENA BTerm, as well as enter into the command mode for the radio. However, I cannot get the MeetAduino/Amarino Toolkit to work properly. I have tested with different Android devices, with the same results; but I do not have a readily available Arduino device of a different model to test with.

-Ryan H.

Free Beachler

unread,
Sep 3, 2012, 2:42:11 PM9/3/12
to amarino...@googlegroups.com
Have you checked out http://tamuchi-fall2011.blogspot.com/2011/10/guide-3-android-amarino-arduino.html ?  Are you sure RX/TX are connected properly; and baud rate in the firmware is set to what Bluesmirf expects?

Perhaps it's just semantics but the test you want might be better called a "loop test" than an "echo test".  With one endpoint I've only been able to verify connectivity to the BT module on the Arduino (Amarino).  Usually all I can do is enter command mode or watch the BT's LED change status.  For a full test I've always needed two (2+) endpoints and Amarino running in the middle, though exactly what firmware I run on the Arduino for a test depends on the situation.

I'd like to help troubleshoot more, and it's most likely a documentation or setup problem.  First I'm confused by these statements:
"applications which do echo tests connected via my laptop or my phone via SENA BTerm" - what applications do what echo tests?  The BlueSmirf doesn't echo back characters unless we set that in command mode, right?  That is...if that setting exists in command mode...I forget exactly.

"have tested with different Android devices, with the same results" -- what results?


Regards,
Free


--
 
 
 

Alper Sarikaya

unread,
Dec 8, 2013, 4:16:05 PM12/8/13
to amarino...@googlegroups.com
I know this might be very late in response to this thread, but I have been struggling with this toolkit, a bluetooth mate silver, and a lilypad simple (328) for a couple weeks now.

I believe I have a (very simple) solution, basically to turn down the baud rate of the bluetooth mate.  You need to connect to the Mate using the default baudrate (115200 for the mate) either through the lilypad or even remotely after hooking the dongle up to 5v, enter command mode ("$$$"), change the baudrate to something slower (e.g. "SU,57" will change to 57600), then restart the dongle ("R,1").  Although 115200 works with the bluetooth and lilypad in other simple scenarios, I suspect that the clock speed simply isn't quick enough for this toolkit.

We discovered this solution after seeing that the MultiColorLamp solution worked perfectly with the Arduino Uno, but not with the Lilypad.  After changing the baudrate to 57600, the lilypad worked as well.

Another caveat (I'll throw this in for free!); the Bluetooth Mate Silver/Gold require at least 4.5V to run.  The included 3.7V Li-Po battery with the Lilypad Simple will not power the bluetooth.  Some sort of external power needs to be hooked up to the Lilypad via +/-.

Hope that helps someone :)
-Alper
Reply all
Reply to author
Forward
0 new messages