Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds bluetooth and wifi data collection #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

matthewfcarlson
Copy link

No description provided.

Copy link
Collaborator

@jonfroehlich jonfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, looks awesome. Seriously, so cool. Thanks for doing this.

I haven't had a chance to test this but a a few small things based on a skim of the code:

  • Do we need common.h or should this just go at the top of the LIS3DHGestureRecorder.ino? Also, if we keep common.h, should we capitalize the 'C'
  • Your comment says that we default to Serial in common.h but CURRENT_MODE is actually set to RECORDER_BLUETOOTH
  • Do we have any way of knowing or measuring drop out rates with Bluetooth and WiFi? I suppose we can see if the ~90Hz receiving rates are similar across all three transmission approaches
  • Finally, there are a lot of lines of code marked as changed in GestureRecorder.pde but aren't actually changed. Would be nice to clean this up so that it's easier to determine the new content... but not sure if this is just a poor GitHub diff engine or what's happening...

@matthewfcarlson
Copy link
Author

  1. The origional thought was to have the common file shared by processing and arduino but I realized processing is java not cpp.
  2. My bad. Left over from testing.
  3. I haven't added any sort of mechanism since so far it's been quite fast. In my testing I was seeing about 89HZ so it's possible we're dropping some samples but I don't think so.
  4. I think I hit auto-format :/

@matthewfcarlson
Copy link
Author

Okay I tried to fix some of the differences on the PDE but it's not quite fixed. There's just a lot of changes :/ What if you hit autoformat on your source and pushed a new change?

@jonfroehlich
Copy link
Collaborator

jonfroehlich commented May 17, 2020 via email

Copy link
Collaborator

@jonfroehlich jonfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the code redundancy in LIS3DHGestureRecorder.ino, it would be so much cleaner if we had a pointer (or Interface) that we set to either Serial, ESP_BT, or ESP_WIFI (depending on mode) and then printed out that way. Not sure the best way to do this in C/C++, however. @EdigaHe, any ideas?

Pseudocode.

CommProtocol getCommProtocol(){
  switch (CURRENT_MODE)
  {
    case RECORDER_SERIAL:
      return Serial;
    case RECORDER_BLUETOOTH:
      return ESP_BT;
    case RECORDER_WIFI:
      return ESP_WIFI;
  }
}

loop(){
 commProtocol = getCommProtocol();
 commProtocol .print(lis.x);
 commProtocol .print(", ");
 commProtocol .print(lis.y);
 commProtocol .print(", ");
 commProtocol .print(lis.z);
 commProtocol .print(", ");
 commProtocol .print(!buttonVal); // because pull-up
 commProtocol .println();
}

@matthewfcarlson
Copy link
Author

Since they're objects I'm not sure if it would be a virtual method lookup or not. I'll do a quick prototype

@matthewfcarlson
Copy link
Author

Disclaimer, I haven't tested this on hardware yet

@EdigaHe
Copy link

EdigaHe commented May 21, 2020

@matthewfcarlson I tested your code and the Bluetooth solution works quite well on both Mac and Windows, although I made some changes to the Bluetooth setup because I use a different BluetoothSerial library.

I have trouble getting the WiFi version work. The ESP32 can connect to my host (my laptop) and the Processing program can find the ESP32 (client). I noticed that the data started streaming and being visualized in the Processing program when I moved thread("processServer") in the draw() function. However, the streamed data seems incorrect and varies dramatically.

Can you check if this happens to you as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants