Zeo Mobile Data Access

English

I want to buy a Zeo. Being a hacker, I mostly want access to the data so I can correlate with other data I record. I know with the Zeo Bedside, I can access the data on the SD card. I know I can make a USB/Serial cable and access the data in real time (really cool). However, I really prefer to get the Zeo Mobile instead. I called Zeo today and they said the data stored on the phone is not in the same format as the Zeo Bedside.

Is the data format on the Zeo Mobile published anywhere? Is the data comparable. Also, what about the bluetooth headband protocol? Would it be possible to write other software to record the data directly from the headband?

 

I would too love a Zeo mobile, but I would definitely need the bluetooth headband protocol to be able to interface it with my custom alarm system. Please could you publish the protocol for it, so that it can be used in realtime just like the bedside version can be?

The answer to this question determines whether I also will purchase Zeo Mobile. Access to the raw data (128hz, average of left and right trodes?) is essential. Does the raw data get to the phone, unencrypted? Either the bluetooth protocol (if unencrypted) or an API on the phone side would be great. If the raw data doesn't reach the phone, I can forget Zeo... anyone poked around and looked on the Android side to see what the app is working with?

It would be awesome to use the mobile zeo with live streaming data of the brain waves.  I 'm a good sleeper and would like to use the zeo more for observing brainwaves while meditating.  Will it be possible to use the mobile zeo android version with http://www.sleepstreamonline.com/ ?  

Hi all,

Zeo Mobile does not yet have any open libraries. We are definitely looking into implementing some.

So far the only open library I know will be possible is an android library that will allow you to write your own apps to read the Zeo data from the Zeo app.

I am not sure if we will release the bluetooth protocol or not.

Our main constraint right now is battery life and the fact that bluetooth is a lot more power hungry than what we used on Zeo Bedside. Currently the Zeo Mobile headband does not send any of the raw data to the smart phone. This allows us to send less data less often so we can get some huge power savings. I would love to see a Raw Data Library set up so you could use your Zeo Mobile for brainwaves on any bluetooth device. Unfortunately, I just don't know yet if this will be possible given battery life constraints.

I'm thrilled to see others asking for the open libraries on Zeo Mobile. Rest assured that we are pushing for it and definitely want you to have control over your data!

Best,

Brian

Getting data off the phone, a few thoughts:

1) How much delay is there between data sends? I would be happy to have even 5mn data insteda of 30 second data.
2) because all our phones have wifi, while having an API to get data to another android app on the phone would be great, allowing for the phone to http post its data to a URL/server of your choice would be the easiest interface: for every update, it http posts its data (current sleep state, etc...) and people can retrieve this from any language on any OS.
3) you *could* also have the phone run a super basic http server that allows http get of all the sleep data at the time interval of choosing from the requesting client. If http is too much, it could just be a tcp port that automatically outputs all the data in ASCII when you telnet to it, and closes the connection.
(yes, I know this means you have to set a static mapping for the IP of your phone on your DHCP server, but hopefully anyone wanting to write code to interface can setup a static dhcp entry :)

Either way, any data access, even if it's only 5mn data, or in the worst case access to the nightly data would be accessible after the night is over (again either with an http get/telnet dump or the phone app would allow or auto upload to a target device in addition to your website).

Either way, please make sure the data is trivial to get off the phone, not just available to another android app (actually access to the data from another android app is a non goal for me).

Thanks,
Marc

Brian- I received the mobile app as a gift. Started using on my iphone. So, I am not as technically inclined as some of these posters, but I sense that the only read out that I can obtain is the one that appears on my phone. Is that correct? If so, I am disappointed and perhaps need the beside version. It sounds as though advances are being made on Android platform......any chance Apple platform might be used, especially since they represent a large segment of the market? I will try to take this offline and call the company but could really use some assistance.

If you did publish your Bluetooth protocol....

The National Center for Telehealth and Technology released an open source Bluetooth Sensor Processing framework for Android. The framework sets a stable foundation for connecting non-programmable Bluetooth enabled sensors such as your BodyMedia Link Armband device with Android.

The framework is completely open source and can be used in commercial applications.

We have successfully paired, received and stored sensor data on Android devices over Bluetooth with: NeuroSky's Mindset Headset; Shimmer (GSR, accelerometer, timestamp, and range so far); and the Zephyr BioHarness.

We have the framework completed you just need to fork the project and add your Bluetooth protocol.

To access the code, details and documents see: https://github.com/t2health/BSPAN---Bluetooth-Sensor-Processing-for-Android.

For me the BT raw data would be very interesting, too. Or of course a nice and handy mobile SDK. Then we could create all that lucid dreaming and sleep hacking apps we ever wanted and tinkered together with lots of adapter cables and microcontrollers around old stuff or the bedside just with a little objective-c or java with the mobile version. Sounds great? Open the specs! ;-)

P.S. I own the bedside and the mobile already. And I love both. But had no time to take a closer reversing look at the mobile, yet.
I will post progress at my blog www.schlafhacking.de/blog

I'd love to have access to the raw data on the mobile as well for hacking around. +1!

Hi! I'd also love access to an open BT protocol. Let me know when it happens!

"Currently the Zeo Mobile headband does not send any of the raw data to the smart phone. This allows us to send less data less often so we can get some huge power savings. I would love to see a Raw Data Library set up so you could use your Zeo Mobile for brainwaves on any bluetooth device. Unfortunately, I just don't know yet if this will be possible given battery life constraints."

So the smart phone is polling the sensor over bluetooth then... We would need to know (or sniff) the secret handshake that the phone sends to the Zeo to get the data back.

I'm very interested in getting a Zeo, but I want the ability to get the raw data out wirelessly and I can wait till there's a viable solution for it... ultimately, I'd like to feed the data into monitoring software (maybe zabbix) and trigger events off of it (i.e. alarm after 3 sleep cycles).

Currently, there's no way to get that raw data... the bluetooth protocol is undocumented, and I don't know if it would be possible (if you had the gear) to sniff the bedside unit's 2.4GHz signal. :(

Have you looked into:

 - implementing the new bluetooth 4.0 low energy protocols

 - reduce the transmitter output (and range) to 10-15 ft.

 - instead of a steady stream of data, burst the data in intervals, then go into the low power state - hearbeat still reponds to the phone but no data is tranmitted. May

 - transmit the regular sleep data as it, but for the raw data, store it locally, then only transmitt when the device is back in the dock.

I'm looking forward to a real-time API for the Zeo Mobile too!

I have 2 apps developed for lucid dream induction for the mobile devices, both iPhone and Android: http://luciddreamingapp.com/ All I would need is 5 minute YES/NO answer to the question of whether the user is in REM or not to significantly improve the quality of the app and open a whole new market for Zeo. There's no reason to stream live data over bluetooth due to power consumption issues. There are various mode of bluetooth operaion, including deep sleep. From the sound of it, the current bluetooth version just streams data once over to an iPhone.

Would Zeo ever consider publishing your Bluetooth protocol?
 
There is an open source Bluetooth Sensor Processing framework for Android.  The framework sets a stable foundation for connecting non-programmable Bluetooth enabled sensors.
 
We have successfully paired, received and stored sensor data on Android devices over Bluetooth with: NeuroSky's Mindset Headset; Shimmer (GSR, accelerometer, timestamp, and range so far); and the Zephyr BioHarness.
 
With only the codec Zeo could do it too.
 
 
Or if someone really wants to do this they could get the Bluetooth protocol by  reverse engineering the byte steam.

I'm interested in seeing the Zeo mobile be more useful to me and would also like to see open access to the data. As of now I'm losing interest in the device because the only thing it's good for is the smart wake feature. I don't really learn much new from the nightly report. I'm sure you guys are busy but it would be nice to hear more from the company on this issue, we're your fanboys. Oh, and fix your forums! They're full of spammers!

Brandon@Zeo's picture

Its finished and posted. A notice as to its existence is posted at:

http://developers.myzeo.com/

and the actual API lives at:

https://github.com/zeoeng/zeo-android-api

 

Feel free to fork it; add fixes or examples; and issue pull requests. All of the API software is licensed same as Android; MIT.

We'll see what we can do about the forums. I would have mentioned something sooner but took me a moment to find this thread. I was poking around in the "Other" section thinking thats where I saw these messages.

I'll try to post a few more samples soon; especially one that uses CursorLoaders to monitor for incoming data changes.

Something that would be fairly easy to add to the iPhone would be a way for the iPhone to offload data in real time to a computer on the local network via WiFi (Bonjour), or for that matter via cell data if the target is accessible from the internet. This could be implemented as an unlockable part of the iPhone app, a separate iPhone app, or a hidden/secret feature within the standard app.

I find it somewhat frustrating that iPhone/Zeo Mobile is the only combination that DOESN'T give me this ability right now.

I am also interested in accessing the data from the Zeo mobile. Are there any updates available as to the progress on making this happen? Also, please stop the spam!

I am also very interested in accessing the raw data from the Zeo mobile..

I also have a Zeo Mobile and I'm also a hacker.

Couldn't Zeo just write the data to a log file and apps can read the log file?

I want to play too :)
No simple API for iOS is what refrains me from buying. A logfile would allow super simple and fast development of 3rd-party apps. I really don't need more. My goal is not to replace the Zeo Sleep Manager app. I don't care if it needs to run in the background.
@zeo: it should not take more than one hour for one of your developer to implement this feature, and you would make us hackers happy :) And I'm sure that more 3rd-party apps will also draw more buyers...

Argh... I forgot about the filesystem sandboxing. Accessing the logfile from another app will be impossible on non-jailbreaked iOS devices. But there still is a simple solution: custom url schemes. My app would register a scheme like myapp://. Then I would simply need to enter this scheme on the setting page of the Zeo Sleep Manager app, and events would be sent (near) realtime to this url.

Alright... It seems that custom url won't be that useful for background streaming... :( Sorry for the noise!

So... I guess the best solution would be for the Zeo app to send data to a simple TCP socket (default host would be 127.0.0.1, but ideally configurable).
https://github.com/robbiehanson/CocoaAsyncSocket

I've been experimenting with biofeedback and entrainment for 20 odd years would also to lave to experiment with the mobiles raw data.

The Bluetooth stream sends packets every 5 minutes containing total sleep, sleep in each phase, wakes, times woken, and the phase you were in each 30sec for the last 10 hours. No waveforms. Making your own replacement Zeo app is simple if you want to be able to stream the data out. Perhaps a Tasker plugin?

Not sure why my email is appearing as my username... figured I'd better disclaimer it - It's a honeypot; no, I don't work for Zeo.

## requires rooted android with sl4a and python

import android, os, time, sqlite3 
droid = android.Android() 

def track_sleep(): 
  time.sleep(120) ## settling time (seconds) 
  droid.setMediaVolume(5) ## (max volume 10) 
  while True: 
    time.sleep(30) ## time between zeo database checks 
    os.system('su -c "chmod 777 /data/data/com.myzeo.android/databases/zeo.db"') 
    os.system('su -c "chmod 777 /data/data/com.myzeo.android/databases/zeo.db-journal"') 
    conn = sqlite3.connect('/data/data/com.myzeo.android/databases/zeo.db') 
    cmnd = "SELECT base_hypnogram FROM sleep_records order by sleep_event_id desc limit 1" 
    for row in conn.execute(cmnd).fetchone(): 
      stages = repr(str(row)) 
      l = len(stages) 
      s_state = stages[l-2:l-1]  ## latest sleep state from headband 
      if str(s_state) == '2':  ## headband state 2 means rem sleep 
        droid.wakeLockAcquireBright()
        droid.mediaPlay('file:///sdcard/recordings/dreaming.mp3') 
        time.sleep(10) ## play YOUR recording for 10 seconds 
        droid.mediaPlayClose('file:///sdcard/recordings/dreaming.mp3') 
        droid.wakeLockAcquirePartial()
        time.sleep(100) ## wait a while before continuing 

if __name__ == '__main__': 
  os.system('su -c "exit"')
  droid.wakeLockAcquirePartial()
  track_sleep()