Skip to first unread message

Jaime Perez

unread,
Jul 25, 2017, 6:52:11 PM7/25/17
to MIT App Inventor Forum
Hello to all. First let me start off by exlpaining what my project consists of. We are using and Easy Pulse V1.1 to attain a heartbeat signal that is generated by an infrared transmitter/receiver that is embedded in a silicon finger adapter to measure the volume difference. The sensor uses an analog signal that is transmitted to an Arduino via a jumper wire that gets digitized. Currently we are using a Bluetooth Module to transmit the data from an Arduino UNO microcontroller to a Nexus 9 Tablet. Within the Arduino code we have implemented a Finite Impulse Response (FIR) filter to reduce the motion artifact from the signal. The project purpose is to create an application on App Inventor 2 that is to display the signal in real-time. Our first app had a 54 second delay from when the signal was sent, to when it was received and displayed. We assumed buffer size was the issue but have no clue as to where the buffer is located on the MIT App Inventor 2.

We have created another app but our current issue is that the graph does not display the necessary signal, instead, it plots a straight line with random fluctuations. I would like some feedback as to where my team and I are lacking for the graph to display properly, and if some suggestions could be made that may lead us into the right direction.

Attached you will find the aia file and the arduino code (in case you need it).

System OS: Windows 10 Creators Edition
Browser: Firefox 54.0.1 (32-bit)
Device running app: Nexus 9 running Android 7.1.1 with kernel version 3.10.103-gfa2246232e8, build number N9F27F
Bluetooth Module: JY-MCU BT_BOARD V1.06
Sesor: Easy Pulse V1.1
BluetoothPart_ImprovedScreen.aia
FIR_Filter_with_Smoother_test1.ino

Abraham Getzler

unread,
Jul 25, 2017, 9:13:49 PM7/25/17
to MIT App Inventor Forum
Your .ino sends a single column of text numbers, nl delimited,
but you are not taking advantage of the delimiter when you
read chunks of text.

See attached for how to do it.

The readText should not be repeated unnecessarily, as it discards the previous reading.

(I did not look closely at the graph code.)

For more examples, see the FAQ

ABG

blocks.png
BluetoothPart_ImprovedScreen_ABG.aia

Abraham Getzler

unread,
Jul 25, 2017, 9:16:59 PM7/25/17
to MIT App Inventor Forum
I also notice your AI2 clock cycle was set at 1 millisecond.
That probably is too fast for AI2.
People with hardware experience, what do you say?

ABG

Jaime Perez

unread,
Jul 31, 2017, 4:46:17 PM7/31/17
to MIT App Inventor Forum
I made some adjustments as you recommended and have figured out what the issue turned out to be. As you stated earlier that readText was eliminating the previous reading. All I needed to do was to store the first string while using a second readText to give me the new values. On the Arduino side, I had to reduce the time it takes to calculate the final result of the FIR filter. By doing this it delays the signal enough for the app to display real-time so any changes made to the signal will be reflected immediately on the app.

Attached you will see the aia file and the Arduino file in case you may need it. If you guys have any questions please refer to the FAQ: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/mitappinventortest/2cd6Uz__xA0/cPQSiZpcDAAJ
or shoot me an email. I will explain to the best of my ability.
AI2_Blocks.jpg
BluetoothPart_ImprovedScreen.aia
FIR_Filter_with_Smoother_test1.ino

Abraham Getzler

unread,
Jul 31, 2017, 5:43:10 PM7/31/17
to MIT App Inventor Forum
I notice in the AI2 Timer event you discard every other reading,
at the bottom of the event.

ABG

Reply all
Reply to author
Forward
0 new messages