ElectricMotorcycleForum.com

  • November 25, 2024, 08:50:32 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Electric Motorcycle Forum is live!

Pages: [1] 2 3 4

Author Topic: Android-App 'ZeroSpy'  (Read 5595 times)

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Android-App 'ZeroSpy'
« on: June 06, 2019, 02:05:56 AM »

Hi everybody!

I'm new to this forum and to the Zero world, so let me do a quick introduction: End of 2018 I bought a new Zero SR 2018. I use it mainly for commuting and of course for some nice after-work tours. I very much enjoy this bike and until now everything works fine  8)

In my free time, I like to program Android apps, so I thought it would be a great idea to create an app for my Zero. What is the app about? It's about monitoring the charging state (remotely) and raise some triggers at some state of charge to carry out some kind of actions.

The name of the app is ZeroSpy and you can find a beta version here:
https://play.google.com/store/apps/details?id=com.bsc101.zerospy

How to use:
  • Install the app on an Android mobile, open the app and connect it to your Zero (not SR/F) via Bluetooth. This device should already be paired with your bike. You should now see some values like state of charge and so on.
  • Remember the AppID of this first installation, see screenshots.
  • Install the app on a second device, navigate to the remote page and enter the AppID of your first installation. You are now able to remotely monitor the charging state of your Zero. The first installation sends the data to a cloud database from where the second installation reads.
  • Triggers: You can define triggers (on the device connected to your bike) which execute when a specified SoC is reached. You can specify some URL which will be called. I use it this way: While charging, my Zero is plugged into a switchable power outlet, so I defined a trigger which turns off this power outlet at some SoC, for example 80% or whatever. So I can load to some level and automatically switch off the Zero. A second trigger calls a IFTTT webhook and this results in some notifications on my remote device. So while my Zero is charging in the garage, I do get notifications on another mobile phone.

Please note: This app is still beta, so there are probably still some bugs.

I would be glad if some of you would give it a try and provide some feedback! Thank you!

Boris



Logged
Zero SR 2018

MrBlc

  • Full Member
  • ***
  • Posts: 129
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #1 on: June 06, 2019, 11:43:27 AM »

Wouldn't this require the bike to be connected to a android device at all times to make it work?
meaning.. if i want to have access to check status of the bike whenever/wherever i would need 2 android units with a internet connection as well as one of them having a constant BT link to the bike..
Logged

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #2 on: June 06, 2019, 12:35:01 PM »

Exactly. As long as you want to use the remote feature, you'll have to connect one device to your bike and one device to check the charging status. When you don't need remote access anymore, just disconnect.

This is my use case:
I have an old Android mobile (which I do not need anymore for anything else) connected to my bike while it is charging in the garage. Then I use my 'everyday life mobile' to check the charging status from somewhere in the house or whereever. After charging, I just disconnect the old mobile.
Logged
Zero SR 2018

Moto7575

  • City rider
  • Sr. Member
  • ****
  • Posts: 436
  • Zero XU2012-Zero S2013-Zero FXS2017-Zero SRF2022
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #3 on: June 06, 2019, 05:10:09 PM »

Interesting. Now here is a challenge : can you change the max speed to a lower level than what the official app proposes ? Super bonus : can you increase max torque higher ?
Logged
Zero XU2012-Zero S2013-Zero FXS2017-Zero SRF2022

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #4 on: June 06, 2019, 06:08:55 PM »

Good idea ;) I will have a look, but I would assume that these values are limited by the bike and not by the app...
Logged
Zero SR 2018

BrianTRice@gmail.com

  • Unofficial Zero Manual Editor
  • Hero Member
  • *****
  • Posts: 4014
  • Nerdy Adventurer
    • View Profile
    • Personal site
Re: Android-App 'ZeroSpy'
« Reply #5 on: June 07, 2019, 06:11:19 AM »

Nice work.

There are definitely caps that the MBB implements through the settings, but the official bluetooth interface might have further limitations. Or not!

Can you speak to how you worked out how to talk to the bike? I'm hopeful that some basic documentation can be had for the protocol - efforts in past apps have often used some shorthand to get their work done.
Logged
Current: 2020 DSR, 2012 Suzuki V-Strom
Former: 2016 DSR, 2013 DS

togo

  • It's like flying. But with more traction.
  • Hero Member
  • *****
  • Posts: 1639
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #6 on: June 07, 2019, 12:50:29 PM »

Thanks for creating this, Boris. I look forward to trying it out.

Can it run on Android tablets as well? I have an old Nexus 7 with GSM slot...
Logged
our knowledge about Zeros collects here: https://zeromanual.com/

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #7 on: June 07, 2019, 01:20:52 PM »

Thanks for creating this, Boris. I look forward to trying it out.

Can it run on Android tablets as well? I have an old Nexus 7 with GSM slot...

Hi togo,

It should also run on tablets, but I'm not sure if it is available for tablets in the PlayStore, I will check!
Logged
Zero SR 2018

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #8 on: June 07, 2019, 01:30:43 PM »

Can you speak to how you worked out how to talk to the bike? I'm hopeful that some basic documentation can be had for the protocol - efforts in past apps have often used some shorthand to get their work done.

Hi Brian,

I had a look at the original Zero app (the apk file), luckily it is not obfuscated, so it is quite 'readable'. The protocol itself is very easy, there are some magic bytes at the head and tail of a packet, there is a checksum and a body. The body contains a tag, that describes what is in the packet like 'version' or 'batterystatus', and what data in which order is in the body can be found in the disassembled apk file.

So, it was easier then expected ;)
Logged
Zero SR 2018

BrianTRice@gmail.com

  • Unofficial Zero Manual Editor
  • Hero Member
  • *****
  • Posts: 4014
  • Nerdy Adventurer
    • View Profile
    • Personal site
Re: Android-App 'ZeroSpy'
« Reply #9 on: June 07, 2019, 08:00:08 PM »

Got it. I have performed similar inspection on the APK, but am not fluent in Android and short on time so I didn’t get far.
Logged
Current: 2020 DSR, 2012 Suzuki V-Strom
Former: 2016 DSR, 2013 DS

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #10 on: June 08, 2019, 02:35:57 AM »

I see. There was one more thing: The Zero app includes some native C libraries with functions like 'GetBatteryPaket' which return the byte array one has to send via bluetooth. I used these native libraries in an own app, so I could call those functions to get the byte arrays I have to send to the bike to get the information I want.
Logged
Zero SR 2018

I973

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #11 on: June 08, 2019, 02:47:20 AM »

Thanks for creating this, Boris. I look forward to trying it out.

Can it run on Android tablets as well? I have an old Nexus 7 with GSM slot...

Should be available for tablets in the PlayStore, please give it a try.Thanks!
Logged
Zero SR 2018

giacomo

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #12 on: June 08, 2019, 05:34:54 AM »

Do I need a wifi or bluetooth plug-switch?

Thanks,
Giacomo
Logged

BrianTRice@gmail.com

  • Unofficial Zero Manual Editor
  • Hero Member
  • *****
  • Posts: 4014
  • Nerdy Adventurer
    • View Profile
    • Personal site
Re: Android-App 'ZeroSpy'
« Reply #13 on: June 08, 2019, 05:48:03 AM »

Do I need a wifi or bluetooth plug-switch?

No. It's using Zero's official Bluetooth interface that its own app uses.

I see. There was one more thing: The Zero app includes some native C libraries with functions like 'GetBatteryPaket' which return the byte array one has to send via bluetooth. I used these native libraries in an own app, so I could call those functions to get the byte arrays I have to send to the bike to get the information I want.

Got it; that's what I was wondering. No one seems to have reverse-engineered that part, and, honestly, it seems like a grey area to re-use that library. I don't think they'll mind as long as your app behaves well (for example, try not to poll for data too frequently).
Logged
Current: 2020 DSR, 2012 Suzuki V-Strom
Former: 2016 DSR, 2013 DS

talon

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Android-App 'ZeroSpy'
« Reply #14 on: June 08, 2019, 10:06:35 AM »

Wow, thank you so much for your efforts! This is so useful to make sure that charging hasn't randomly stopped (wasting valuable time)!

I have wanted an app for quite some time that could roll everything (my favorite features) into one, but more simplified. It has been frustrating needing to go between a dozen apps just to access all the information I need when doing research. I may yet try my hand at writing it myself but I am also not *extremely* well-versed in communication protocols or android programming (but have worked with both in the past).

For my 2016 SR and my android devices:
-"Zero Voltage" does not retrieve balance and has been the only app to display Ah capacity for me
-"Zero Official" does not show anything but temperatures while riding, and was the only app to show SoC and battery temperature
-"Metrics for Zero" is sometimes unscrollable for in-app viewing of data and can crash if ran too long (no adjustment for sample rate)

Not bashing any of these, I am very grateful that I have access to the unique benefits each of these provide. But to recap, I'd love a single app that can show voltage, battery temperature, balance, estimated SoC, capacity, and the low-hanging fruit measurements of current and battery amperage WHILE the bike is armed. Just saw the screen shot, if the library supports this while armed I'll be a happy camper. Even your balance is more useful than the official app! For clarity I would not read or analyze these while riding it would just be for when I can safely do so or for screen recording it. Well done.

On second thought, after reading the CANBUS thread a few below this one I will wait for this to be vetted and safely exit beta before riding and using this. I realize with other third-party apps there is still inherent risk and I have accepted that and try to mitigate as much as possible. Personal choice.
« Last Edit: June 08, 2019, 10:31:13 AM by talon »
Logged
Pages: [1] 2 3 4