Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
App keeps dropping bluetooth connection to arduino
#1
Star 
I've put together some really simple code on a Teensy 3.2 and connected via an HC-06 to the touchDRO app.  First time it connected and worked OK for a few minutes. Then it kept dropping the BT connection. It would reconnect and then drop again straight away.  I've tried it on two phones, same happens. Tried a different HC-06, same issue. It will connect to a serial port terminal on the phone and hold the connection.

Any ideas what I'm doing wrong?
My code just outputs via Serial1.print withe the ; delimiter  I'm not using CR or new line, should I?
Reply
#2
What exactly are you printing? It looks like the app is not getting data in a correct format and drops the connection.
Reply
#3
This is the output

X666;Y0;Z0;X665;Y0;Z0;X664;Y0;Z0;X663;Y0;Z0;

or this if it goes negative

X-866;Y0;Z0;X-865;Y0;Z0;X-864;Y0;Z0;

I'm forcing Y and Z to 0 as I've only mocked this up with a single scale at the moment.

Could it be that I'm sending updates too quickly? I notice RysiuM's Arduino code contains some sort of trigger (tickTimerFlag), I just send the entire XYZ data string every time I receive a changed value.
Reply
#4
I think I may have solved my problem, it looks like the connection drops off if no data is sent for approx 30 seconds. Once it drops it won't reconnect and stay reconnected. I have to shut the app down and restart it. I've now changed the code on my Teensy (fast and cheap micro controller) to send an update every second even if the scale hasn't moved. This seems to have fixed the issue.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)