TinyScreen Smartwatch

dbenwoods · 25 · 44254

amd599

  • Jr. Member
  • **
    • Posts: 5
    • View Profile
Ah, OK. Gotcha. I'd like to get the Android app working. The phone is an Galaxy S II (SGH-T989).

Sadly even though the S2 shipped with a Broadcom chipset capable of bluetooth 4.0, it was never enabled in software. Part of this is because Android had no default support for Bluetooth 4.0 till nearly 2 years later and by that time the chipset was so outdated writing software to make it work was not a priority.

The S3 was the first Android phone with software support for 4.0 and it wasn't even widely used because Samsung had to make their own support for it, a support that was entirely different from Google's own implimention nearly a year later.

Edit: Turns out Broadcom wrote their own drivers for it and it can be used in Android 4.3(The version of Android that first supported bluetooth 4.0). Only downside is that you have to root and install a newer rom for it to work. From the sounds of it CM11 should support this.

TL;DR: To the best of my knowledge there's simply no easy way to make this work with the S2 without rooting.

Source: I worked for Best Buy selling phones for 4 years.


OK. Thanks for this. I was able to get a brand new phone and the app launched. I saw BLEWatch but whenever I tried to connect it kept crashing. At the watch time is still incorrect but when I press a button on the side it now says "No Notifications" which it didn't say before.

I tried to send a text to the phone and see if it showed a notification but it still says no notifications even thought I got the text.

The phone is a Nexus 5 running 5.1


jpencausse

  • Full Member
  • ***
    • Posts: 14
    • View Profile
I install the app from codebench
https://codebender.cc/sketch:91833#TinyScreen_Smartwatch.ino

And use the copiled APK on a Nexus 5 too. The app do not see the URT advertiser and crash when clicking on an other (Shine, StickNFind, ...).


WakeArray

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
OK. Thanks for this. I was able to get a brand new phone and the app launched. I saw BLEWatch but whenever I tried to connect it kept crashing. At the watch time is still incorrect but when I press a button on the side it now says "No Notifications" which it didn't say before.

I tried to send a text to the phone and see if it showed a notification but it still says no notifications even thought I got the text.

Couple of questions: Did you compile the TinyCircuits BLE app yourself in Android Studio or use the precompiled one I provided earlier in this thread? Are you using the stock texting app on the phone or did you change it to something like Hangouts?

If you compiled it yourself, try to precompiled one I posted earlier, I've confirmed that it works on my Note 4 to send notifications from the default texting app and will notify you of phone calls from the default phone app. If you'd like I have a heavily modified version of the app that will send all notifications(for better or for worse) so you can at least know it's working for some notifications.


WakeArray

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
I install the app from codebench
https://codebender.cc/sketch:91833#TinyScreen_Smartwatch.ino

And use the copiled APK on a Nexus 5 too. The app do not see the URT advertiser and crash when clicking on an other (Shine, StickNFind, ...).

If you added the TinyScreen Smartwatch code recently, it should be advertising the name BLEWatch instead of URT, Ben Rose was kind enough to change the name to something more appropriate to its code. The Shine and StickNFind aren't compatible with the TinyCircuits app and the app doesn't currently have a graceful way of failing.

Make sure you're using the most recent version of the Smartwatch files from CodeBender and when it starts up look for BLEWatch. It should be there.


amd599

  • Jr. Member
  • **
    • Posts: 5
    • View Profile
I install the app from codebench
https://codebender.cc/sketch:91833#TinyScreen_Smartwatch.ino

And use the copiled APK on a Nexus 5 too. The app do not see the URT advertiser and crash when clicking on an other (Shine, StickNFind, ...).

If you added the TinyScreen Smartwatch code recently, it should be advertising the name BLEWatch instead of URT, Ben Rose was kind enough to change the name to something more appropriate to its code. The Shine and StickNFind aren't compatible with the TinyCircuits app and the app doesn't currently have a graceful way of failing.

Make sure you're using the most recent version of the Smartwatch files from CodeBender and when it starts up look for BLEWatch. It should be there.

I'm using your compiled one. Again, it launches fine but when I click on the BLEWatch the app just crashes.


WakeArray

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
I'm using your compiled one. Again, it launches fine but when I click on the BLEWatch the app just crashes.

I think I've realised the problem. When both you and jpencausse had the same issues on your Nexus 5's I guessed that it might be an issue with Android 5.0. I've tested this on my Nexus 4 also running Android 5. It experiences the same issue. I believe there may be some out of date APIs to blame here, I'll look into it and do some testing and get back on here when I have an answer. I'm not a SUPER experienced Android programmer though, so any help I can get on this is much appreciated.

That being said I will state what I know to anyone who might be able to help. Both the Nexus 4 I've just used for testing and the Nexus 5's are running stock Android 5. A manufacturer customized version like the one provided for the S5 and Note 4's may fair differently, if someone can test this, that'll be great. I'd test it myself, but I don't work for the next two days.
« Last Edit: March 20, 2015, 01:45:38 PM by WakeArray »


WakeArray

  • Jr. Member
  • **
    • Posts: 8
    • View Profile
So while looking for a fix for the bluetooth connection crashing I've found a filed bug report for Android 5 bluetooth issues. They aren't specific to BLE and they seem to all be coming from owners of Nexus and recent Motorola devices. All of which run a vanilla version of Android 5. Having found this and thinking that it was simply an issue with Android 5, I tried the Nordic Semiconductor's app "nRF UART v2.0" and low and behold, it works. Kind of. The watch disconnects like crazy, but I can get it to receive messages I send. The letter D followed by the time in a "yyyy MM dd h m s" format will set the time and get the counter started on the Arduino, sending a 1 followed by a message shows on the top line of the bottom of the screen and sending a 2 shows on the bottom line.

These tests prove that the phone and the OS aren't the reason the app isn't working. This is a plus. I'm just not sure what part of the app isn't working. :/

Edit: It looks like Android 5.0 had a major update to the BluetoothLE scanning API to reduce power consumption. That info is documented here: http://developer.radiusnetworks.com/2014/10/28/android-5.0-scanning.html

Far as I can tell, the older offending code lies in this block. Lines 108-146 of ScanActivity.java. Android studio is enjoying pointing out that 'startLeScan' and 'stopLeScan' are currently depreciated. I'll attempt to adjust this code tomorrow. Currently, I'm a bit too sleepy. Also, Ben Rose might be a bit better at doing this if he has time.

Code: [Select]
    private BluetoothAdapter.LeScanCallback mLeScanCallback =
            new BluetoothAdapter.LeScanCallback() {
                @Override
                public void onLeScan(final BluetoothDevice device, int rssi,
                                     byte[] scanRecord) {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {

                            mLeDeviceListAdapter.addDevice(device);
                            mLeDeviceListAdapter.notifyDataSetChanged();
                        }
                    });
                }
            };

    private void scanLeDevice(final boolean enable) {
        if (enable) {
            handler = new Handler();
            // Stops scanning after a pre-defined scan period.
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    //Debug.ShowText(getApplicationContext(),"scan timed out after " + SCAN_PERIOD/1000 + " seconds.");
                    isScanning = false;
                    mBluetoothAdapter.stopLeScan(mLeScanCallback);
                    invalidateOptionsMenu();
                }
            }, SCAN_PERIOD);

            isScanning = true;
            mBluetoothAdapter.startLeScan(mLeScanCallback);
        } else {
            isScanning = false;
            mBluetoothAdapter.stopLeScan(mLeScanCallback);
        }


    }
« Last Edit: March 21, 2015, 01:09:48 AM by WakeArray »


benjgorman

  • Newbie
  • *
    • Posts: 2
    • View Profile
Managed to get the nRF UART app and the tinyduino to talk to one another. Does anyone happen to have an empty iOS app which only does the bluetooth connection/data transmission?


ralphcrutzen

  • Newbie
  • *
    • Posts: 2
    • View Profile
I have the same problem with the BLEWatch app crashing. Sending messagas to the TinyDuino with the nRF UART v2.0 app works fine. I have a Nexus 5 with Cyanogenmod 11.

Did someone already manage to fix this?

I looked at the code of the Android App myself, but the only thing I found out is that you have to use
Code: [Select]
BluetoothLeScanner.startScan(List, ScanSettings, ScanCallback) instead of
Code: [Select]
BluetoothAdapter.startLeScan(LeScanCallback)But after that I'm stuck because I'm just not experienced enough to understand how to use those three arguments in the startScan() method...
« Last Edit: March 29, 2015, 04:12:08 PM by ralphcrutzen »


baritonehands

  • Newbie
  • *
    • Posts: 3
    • View Profile
Does anyone happen to have an empty iOS app which only does the bluetooth connection/data transmission?

I just posted my semi-working code (no connection cleanup) in Swift (which I don't plan to finish):
https://github.com/baritonehands/TinyScreen_Smartwatch_iOS

I plan to finish this one in Ionic/JS:
https://github.com/baritonehands/TinyScreen_Smartwatch_Ionic


 

SMF spam blocked by CleanTalk