As of right now, most of this is up in the air since I have hit a roadblock in just graphing the data coming in on the server end since the data being uploaded is not in a form that the server likes. I have seen the idea of Fusion Tables being thrown around but I do not have enough experience yet into how I would be able to implement that.
I assume you need csv... if we could figure out how to parse your data stream of the \r and \n and get it into csv, would that help?
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
double ekg[] = {0.19136,0.19136,0.27337,0.41006,0.54675,0.74282,2.0672,4.8761,9.1102,13.701,18.291,22.881,27.472,30.226,29.92,26.554,21.963,17.373,12.782,8.1921,4.2015,1.7103,0.7185,0.62638,0.53427,0.44215,0.35004,0.25792,0.16581,-0.9667,-6.2608,-14.335,-14.306,-1.4965,22.712,48.475,71.736,76.651,60.719,26.441,-10.339,-44.249,-57.116,-46.071,-20.956,-4.5927,0.149,0.24213,0.33526,0.42839,0.52151,0.61464,0.70777,0.80089,0.89402,0.98715,1.0803,1.1734,1.2665,1.3597,1.4528,1.5459,1.9248,3.0181,4.8258,7.0621,9.2985,11.535,13.771,15.65,16.097,15.053,12.877,10.64,8.404,6.1676,4.0046,2.3792,1.3647,0.88781,0.48964,0.1937,0.032284,0};
int input = 0;
int lastinput = 0;
void setup() // run once, when the sketch starts
{
mySerial.begin(9600); // set up Serial library at 9600 bps
}
void loop() // run over and over again
{
for(int k = 0;k<100;k++)
{
mySerial.println(ekg[k],2);
delay(50);
}
}
0.00
0.00
0.52
0.61
0.71
0.80
0.89
0.99
1.08
1.17
1.27
1.36
1.45
1.55
1.92
3.02
4.83
7.06
9.30
11.53
13.77
Just to recap. I went ahead and redid everything step by step.
1) Captured the data from the Arduino using Bluetooth. OK
2) Saved the data to a Label and watched the data populate on the Android screen. OK
3) Saved the Label text string to a TinyDB. almost OK. I think you missed a huge opportunity here in your code to 1)label each point (1, ,2,14 or what ever) which may or may not be useful and 2) to tag each data point with the time it was collected. Not, 12.3 but 1, 08:15:21 , 12.3 ; 08:15:22, 3.41 ; in your label. Do it that way and you already have two options for your x axis later stored in your DB.
4) Created a Fusion Table and sent the stored data to it. Fusion table needs BOTH rows and columns to plot, you have a voltage column (y axis), where is your x axis column?
5) IN PROGRESS: plot the data in the fusion table. Yes, but much easier if you get all the data to the table in its proper place
The good news is, I am not losing any data (THIS is the GREAT news) and I am able to capture enough data points for a clear picture of an ECG waveform. Unfortunately, now I am at a new hurdle. After some troubleshooting, I was finally able to send the data to the fusion table but they all collect in one row of the column
How to use Fusion tables is actually part of the tutorial called Pizza Party. Have you done the MIT Fusion table tutorial? .... It shows how to separate stuff in bins.
Yes, the data goes to exactly where your app told it to go in the Fusion table. How did you create the table? The table already should have columns for ID#, Time, Value. You just created a table of values.
I can not see what was posted to the Android screen, so I assume the data looks exactly like the row in the Fusion table.
Do you use Skype? Would you like to talk about this?
You are making significant progress. I have two wishes, you would do this in AI2 instead of AI (so we could share blocks) and I had an Arduino. I have more ideas,
but difficult to explain because we can not interact in real time.
18:22:23 PM,
13.70
18:22:24 PM,
18.29
18:22:25 PM,
22.88
18:22:26 PM,
27.47
18:22:23 PM, 13.70
18:22:24 PM, 18.29
18:22:25 PM, 22.88
18:22:26 PM, 27.47
There has been a transmission error. 400 Bad Request. Invalid query: Expected 2 values, but got 1 for 'Time','Number' Please try again.
I was pulling my hair out trying to figure out why my data kept bunching up in one row. I attempted to split the data inside a list but failed horribly. I then realized that I needed to adjust the clock cycle along with the Bytes coming in and I was able to get a consistent flow of time joined with a data point. I did the whole "join text" blocks to get predetermined X and Y axes. Once I ran the program, Label 3 is displaying the data on the app in the following manner:18:22:23 PM,
13.70
18:22:24 PM,
18.29
18:22:25 PM,
22.88
18:22:26 PM,
27.47
so on and so forth...This is not quite what I expected since I want:18:22:23 PM, 13.70
18:22:24 PM, 18.29
18:22:25 PM, 22.88
18:22:26 PM, 27.47
Now assuming that the way I joined the text would mimic how I would make the values for the query:
(Time, Number) along with the quotify blocks, I should be able to send the data to the Fusion Table in consecutive rows for each specified column. Unfortunately, what I am now experiencing is my error notifier stating:There has been a transmission error. 400 Bad Request. Invalid query: Expected 2 values, but got 1 for 'Time','Number' Please try again.
I'm assuming this basically means that I'm not coding the proper syntax for the query.