Teensy 4.0 Serial Plotter not displaying Data we see in Serial Monitor

mbusa200

New member
This is first day with Teensy, first day programming, so apologies. I am RC guy making a project with my 11yr son and following code and build instructions best we can. We are complete a VTOL project https://github.com/nickrehm/dRehmFlight-F-35 and interest him in coding and computers and not just flying! Today he built the board and connected to Tx/Rx and uploaded the code and all appears to be working. We have data into the Teensy from Tx, have calibracted and set all end points and see expected outputs. Now we are analysing Gyro data from MPU6050 and we seem to have a good flow of data visible on the serial monitor but that same data will not show graphically on the serial plotter. We have been pokng around settings and restarted PC, but for whatever reason the serial plotter will not show the data we are able to see on the monitor? Bear in mind neither of us touched Arduino or Teensy before today.. we are plane builders not programmers at all.

Hope that make sense, we have attached a screenshot to try and show what we are seeing. In attached video https://www.youtube.com/watch?v=pi4PiBFPt70 at timeline 2.12 you can see the visualisation we am talking about. Everything to this point looks good, and it looks like the Teensy, the programming and all hardware are good, but for some reason just the plotter function is not wanting to display the data stream we are seeing in serial monitor. We see the data in serial monitor is live and is changing as expected when gyro is moving .. would be nice to see this visually!

Hope you are able to help!
 

Attachments

  • Screenshot (53).jpg
    Screenshot (53).jpg
    87.9 KB · Views: 57
Tested with their example and it works where this is between the items:

Serial.print(",");

And commenting that line out then generated no plotting.
 
According to the tutorial that @defragster pointed to:
Further, you can also use \t(tab) or (space) as a delimiter instead of ,(comma) in the above example.

But with that said I did find that with the example I had to open the Serial window first to start the sketch outputting then switch to the plotter window to see the data
 
Must admit, struggling to understand how to open serial window first. Also whether or not you thought the code from dRehme needs to be changed slightly for me to use the serial plotter function in the latest version of Arduino 2.0.4

Remember we never touched coding, arduino or FC boards of any description before the weekend, so we are on a bit of a steep learning curve! (sorry for that). We speak English, German and Chinese in our household but unfortunatly we only start to learn Arduino a couple of days ago!

I contacted dRehme (code writed for VTOL) and he suggested setting plotter to baud rate 500000 (you see in his video clip), however as you see from short video clip, I can select baud but cannnot change.

You can see the live data I am receiving from the IMU in Monitor but also the blank "plotter". Have attached a super short clip from dRheme of what I should be seeing, I noted he is using older version of Arduino. What I am seeing is https://www.youtube.com/watch?v=bZ5HkgNzh6Q what I should be seeing is https://www.youtube.com/watch?v=G0fnZWd5F8U

Hope this helps you help me... if nothing else we are learning something new ...
 
No need to adjust or worry with the baud rate, Teensy runs at full USB speed, it doesn't use an intermediate chip requiring that to be set.

Using something like this in the sketch will wait for USB for a second or so giving time to open Serial Monitor and the computer to complete the connection:
Code:
void setup() {
  Serial.begin(9600);
}
There also the baud rate does not matter as it is ignored on Teensy as well. It will automatically begin waiting for the computer to connect which can happen as fast as 300 or so milliseconds - perhaps 500 to 900 depending on the computer.

If the Serial monitor (or plotter) in IDE was open to the Teensy before building it should reconnect after upload is complete.

The one thing noted as missing was the character between the set of output values: Serial.print(",");
Ideally a \t TAB character can also work and perhaps a space - but the example shows a comma that worked here in the linked example.
 
Must admit, struggling to understand how to open serial window first. Also whether or not you thought the code from dRehme needs to be changed slightly for me to use the serial plotter function in the latest version of Arduino 2.0.4

Remember we never touched coding, arduino or FC boards of any description before the weekend, so we are on a bit of a steep learning curve! (sorry for that). We speak English, German and Chinese in our household but unfortunatly we only start to learn Arduino a couple of days ago!

I contacted dRehme (code writed for VTOL) and he suggested setting plotter to baud rate 500000 (you see in his video clip), however as you see from short video clip, I can select baud but cannnot change.

You can see the live data I am receiving from the IMU in Monitor but also the blank "plotter". Have attached a super short clip from dRheme of what I should be seeing, I noted he is using older version of Arduino. What I am seeing is https://www.youtube.com/watch?v=bZ5HkgNzh6Q what I should be seeing is https://www.youtube.com/watch?v=G0fnZWd5F8U

Hope this helps you help me... if nothing else we are learning something new ...

Ok.. Just loaded up the dRehmFlight software and used a MPU6050 and did verify that the SerialPlotter isn't plotting any data. Did manage to trace down the problem, which is kind of strange because it doesn't happen if using 1.8.19 with 1.58.

Ok right now the printGyroData function looks like:
Code:
void printGyroData() {
    if (current_time - print_counter > 10000) {
    print_counter = micros();
    Serial.print(F("GyroX: "));
    Serial.print(GyroX);
    Serial.print(F(" GyroY: "));
    Serial.print(GyroY);
    Serial.print(F(" GyroZ: "));
    Serial.println(GyroZ);
  }
}
if you remove the extra space after the semicolon's the plotter will work
Code:
void printGyroData() {
    if (current_time - print_counter > 10000) {
    print_counter = micros();
    Serial.print(F("GyroX:"));
    Serial.print(GyroX);
    Serial.print(F(" GyroY:"));
    Serial.print(GyroY);
    Serial.print(F(" GyroZ:"));
    Serial.println(GyroZ);
  }
}
If you want to plot the others you will have to remove that space in the other print funtions.

EDIT> this is what I am seeing after those edits:
Capture.PNG
 
WOW... I am really so grateful for your help. I was experimenting last night with a short piece of code from another contributor to see if I could get to grips with the coding language... and although I managed to get the serial plotter working https://www.youtube.com/watch?v=l6QI7YljYxg for this short code, every time I looked at dRehmFlight I was truly struggling to see where the changes needed to be made. Not really surprising maybe as we are only playing with Arduino a few days!! SO to have you work on this and help out is really amazing for us and we are so thankful for your time. I will mess with the code after the kids are in bed and fingers crossed have the same success. I let you know!
 
Yes, good follow up sketch @mjs513 ... didn't get to doing more here to see the poste-colon space as an issue.
 
WOW... I am really so grateful for your help. I was experimenting last night with a short piece of code from another contributor to see if I could get to grips with the coding language... and although I managed to get the serial plotter working https://www.youtube.com/watch?v=l6QI7YljYxg for this short code, every time I looked at dRehmFlight I was truly struggling to see where the changes needed to be made. Not really surprising maybe as we are only playing with Arduino a few days!! SO to have you work on this and help out is really amazing for us and we are so thankful for your time. I will mess with the code after the kids are in bed and fingers crossed have the same success. I let you know!

defragster said:
Yes, good follow up sketch @mjs513 ... didn't get to doing more here to see the poste-colon space as an issue.

Took me a while to find the issue. The really interesting thing is if you use 1.8.19 there is no problem with the extra space, problem only exists with IDE2
 
Took me a while to find the issue. The really interesting thing is if you use 1.8.19 there is no problem with the extra space, problem only exists with IDE2

Wonder if there is an Issue against it up on Arduino?
 
Wonder if there is an Issue against it up on Arduino?

Good question - I never checked

EDIT
Here is the answer: Serial plotter does not plot #1597. Looks like the changed the behaviour:
I've had a look at your code. You will have to remove the space after the label i.e change it to Serial.print("A1:");.

Please have a look at the Serial Protocol. The Label and Value message format does not have a space after the colon :.
 
Back
Top