Hi,
I am doing a project on stress analysis of a patient using 2 modules.
Module 1 comprises of Arduino Lilypad, Galvanic skin response (GSR) sensor and ESP8266 WiFi module
Module 2 : Arduino Uno , ADS1292R ECG / Respiration shield for Arduino and ESP8266 WiFi module.
Project Idea :
Each module will collect the respective sensor data and update the enabled fields of a channel in an IoT platform 'THINGSPEAK' for every second. This is done using WiFi modules.
ie; field 1 (GSR Value) by module 1 and field 2 (Heart Rate) by module 2.
Matlab Visualization is performed on the data in the fields for finding the stress level of the patient.
Issue:
I am able to update the data in the respective fields while checking each module.
But for my matlab analysis it is necessary to update both the fields at the same time.
While enabling both the modules for measurement I am not able to update both field1 and field2 simultaneousy. I also have a thingspeak license, hence there will be no 15 sec delay.
For eg : I enabled both the modules and found that at 08:35:12 field1 gets updated with GSR value but field2 was not getting updated at this time. Field2 got updated a few seconds later.
Can somebody please suggest a solution for this problem. How can I update multiple fields of a channel in thingspeak using 2 modules where each module has a sensor , an arduino and an esp8266 module.
Appreciate your help on this.
sreedevideepak91:
Each module will collect the respective sensor data and update the enabled fields of a channel in an IoT platform 'THINGSPEAK' for every second. This is done using WiFi modules.
ie; field 1 (GSR Value) by module 1 and field 2 (Heart Rate) by module 2.
The first thing to do is check that Thingspeak will accept data at one second intervals.
You might then contemplate the rationale of monitoring the heartbeat at one second intervals anyway.
No comment on the GSR, I don't know anything about them, but I imagine that proposal is just as silly.
The data transmission stuff is simple enough, but I imagine the Arduinos themselves are probably redundant.
Hi Nick,
Thanks for your response. The actual issue i face is not about sending data but sending them simultaneously. When GSR data is passed heart rate data does not get passed and vice versa. So when matlab visualization is created the values come up as below:
GSR Heart Rate
558 NaN
NaN 57
Since in my algorithm i remove the missing data, i never get a row where GSR and HeartRate has values in the same row. The above scenario nullifies because of NaN and does not output any values in visualization. Please find the attachment (GSR_HR_Val.jpg) for more details on these values.
I am looking for a solution where i am able to send both GSR and HeartRate values to THINGSPEAK at the same time (essentially i need values in the same row for both GSR and HR) so that my visualization works.
![GSR_HR_Val.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/4/9/5/4957173effcada34b929e3f5af78ac4e9030a09e.jpeg)
sreedevideepak91:
The actual issue i face is not about sending data
In the light of your previous, I think it is, or will be, and that probably applies even after some sanity prevails about your real needs.
When GSR data is passed heart rate data does not get passed and vice versa. So when matlab visualization is created the values come up as below:
GSR Heart Rate
558 NaN
NaN 57
Since in my algorithm i remove the missing data, i never get a row where GSR and HeartRate has values in the same row..
I don't know anything about MatLab, but I can't believe it cannot do what you want. It is probably just a matter of slack formatting of your output.
I am looking for a solution where i am able to send both GSR and HeartRate values to THINGSPEAK at the same time (essentially i need values in the same row for both GSR and HR) so that my visualization works
I believe all IoT facilities work the same. Each time round the loop, you assemble a char from the aquired data in the approved format and manner, and send it off, along with your passkey - no more frequently than the allowed interval. The datastream assembly and despatch commands will be in the Thingspeak examples.
I see two possible solutions.
-
you tell MatLab to not care about 3-5 seconds difference between times, and consolidate those into a single row. May be good enough for your application. Problem solved.
-
send both pieces of data in a single package. That can be done by having the two modules communicate with one another, after which one of the two does the communication to Thinkspeak.
That comes to a whole different question: assuming both GSR and the heartbeat are from the same patient, why are you even using two ESP modules? I'm sure one of them is enough for this workload (80 MHz, 4 MB memory - should do the job just fine for two sensors with very low data rates). Using a single module would make your programming simpler and also assure both data points are transmitted at the same time.
Hi wvmarle,
Thank you for your suggestion. I have tried the first solution by replacing the NaN values with the previous values in my MATLAB code. That really helped.
The reason why i am using two different ESP modules is because i just wanted two separate modules : one is a band equipped with GSR sensor which is designed to be worn over the wrist collecting GSR data and the other an ECG module on a belt to be worn around the chest providing Heart rate. Both will independently send the sensed parameter value to my Thingspeak channel.