My arduino seems to be sending different data to my PC than it is sending to my phone app made in MIT app inventor

I'm working on a project that involves taking data from sensors. The data are readings for pulse and temperature. The goal of the project is to take the data from the Arduino, and output it to the serial for my app to read, and then it outputs the data to a google sheet depending on what prefix was printed to the serial.

The format for the data is the letter T or P, followed by some numbers cast into a string. When using the serial monitor to check the data that the Arduino is outputting, it seems to be formatted fine.

When I hook up the Arduino to my phone and use the app I made it generates nonsense data in the textbox I put into the app for debugging purposes. In the screenshot below for example it shows the first character being an N with an invalid character afterwords.

Why would the app change the strings that are being printed properly in the PC Arduino serial monitor into nonsense data?

cap

Any help would be greatly appreciated. I can post the source code for the Arduino or mobile app if needed.

Is the Serial component running at the same baudrate as your arduino?

When I initially developed the phone app the band rate was 9600 because that was the band the code for the Arduino used. After struggling with the old Arduino code I switched to using someone else's code, and that code prints to the 115200 band. I changed the proprieties of the serial1 component in my app to 115200 after that. Could it be something a bout the buffer-size property?

The only other thing that I can think of is that the Arduino code opens a serial at 9600 and 115200. I don't understand why the Arduino code opens the serial at 9600, as it doesn't seem to do anything.

finalsensortest.ino (14.2 KB)

From my old BBS-surfing days, I remember there being some other parameters that need to match to receive serial data:

  • number of bits per byte (7/8)
  • parity (N/E/?)

In the code for arduino, set both Serial speeds to 115200, or 9600 in Seriar in AppInventor. You have created two serial ports. One for the Serial Port Monitor and arduino programming, and the other for the BT module. Now for BT you have set 9600 in the arduino code.

My device doesn't use BT.

Yes, I got it wrong BT. It's a USB connection. Either in arduino change to 115200 or in AI2 to 9600.