Gyro cal - ESP32-S2-TFT compile issue

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
clarkj
 
Posts: 119
Joined: Thu Aug 08, 2013 12:34 pm

Gyro cal - ESP32-S2-TFT compile issue

Post by clarkj »

I'm trying to use "gyro_zerorate_simplecal" to calibrate an MPU-6050 attached to a Feather ESP32-S2 TFT, but am getting a compile error. I did manage to track down and eliminate one -- apparently a "legacy" library that had a time stamp from 2019...

Code: Select all

Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Feather ESP32-S2 TFT, Enabled, Disabled, Disabled, Enabled, TinyUF2 4MB (1.3MB APP/960KB FFAT), 240MHz (WiFi), QIO, 80MHz, 4MB (32Mb), 921600, None"

/Users/clarkjones/Documents/Arduino/libraries/Adafruit_Sensor_Lab/examples/calibration/gyro_zerorate_simplecal/gyro_zerorate_simplecal.ino: In function 'void setup()':
gyro_zerorate_simplecal:35:9: error: 'class Adafruit_Sensor' has no member named 'printSensorDetails'
   gyro->printSensorDetails();
         ^~~~~~~~~~~~~~~~~~
Multiple libraries were found for "Adafruit_Sensor.h"
 Used: /Users/clarkjones/Documents/Arduino/libraries/Adafruit_Sensor-master
 Not used: /Users/clarkjones/Documents/Arduino/libraries/Adafruit_Unified_Sensor
exit status 1
'class Adafruit_Sensor' has no member named 'printSensorDetails'


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
After reading the above error messages in detail, I finally got THAT error to go away. Simply renaming Adafruit_Sensor-master wasn't good enough, I had to move it to ~/Downloads to get rid of the error.

But then I started getting this error:

Code: Select all

Arduino: 1.8.19 (Mac OS X), Board: "Adafruit Feather ESP32-S2 TFT, Enabled, Disabled, Disabled, Enabled, TinyUF2 4MB (1.3MB APP/960KB FFAT), 240MHz (WiFi), QIO, 80MHz, 4MB (32Mb), 921600, None"

[96363] Error loading Python lib '/var/folders/z8/4nv7zsqj70b2ln148yhxr3n80000gn/T/_MEIQYu3oA/libpython3.8.dylib': dlopen: dlopen(/var/folders/z8/4nv7zsqj70b2ln148yhxr3n80000gn/T/_MEIQYu3oA/libpython3.8.dylib, 10): Symbol not found: ____chkstk_darwin
  Referenced from: /var/folders/z8/4nv7zsqj70b2ln148yhxr3n80000gn/T/_MEIQYu3oA/libintl.8.dylib (which was built for Mac OS X 11.0)
  Expected in: /usr/lib/libSystem.B.dylib
 in /var/folders/z8/4nv7zsqj70b2ln148yhxr3n80000gn/T/_MEIQYu3oA/libintl.8.dylib
exit status 255
/Applications/Arduino 1p8p19.app/Contents/Java/arduino-builder returned 255
Error compiling for board Adafruit Feather ESP32-S2 TFT.


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Tranking down the "verbose" message, since the message is WRONG because I'm on a Mac -- (a) "File -> Preferences" doesn't exist, (b) "Arduino -> Preferences" doesn't have that option but does say that /Users/clarkjones/Library/Arduino15/preferences.txt doesn't have an entry for "compiler.verbose" but does have an entry for "build.verbose" which I changed from "false" to "true" I got the same messages as before, so tried adding "compiler.verbose=true", but that didn't seem to help either.

So at the moment, I can't get cal values for my MPU-6050...

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Gyro cal - ESP32-S2-TFT compile issue

Post by mikeysklar »

Before we get into calibration lets make sure the following is true:

1) Can you compile and run the Basic Reading Example?

https://learn.adafruit.com/mpu6050-6-do ... le-3044805

2) When installing the libraries rather than using github version can you install the current releases through the Arduino IDE Manage Libraries?

* Adafruit MPU6050
* Adafruit BusIO
* Adafruit Unified Sensor

https://learn.adafruit.com/mpu6050-6-do ... on-3044792

3) Does the 'gyro_zerorate_simplecal.ino' compile when these are in place?

User avatar
clarkj
 
Posts: 119
Joined: Thu Aug 08, 2013 12:34 pm

Re: Gyro cal - ESP32-S2-TFT compile issue

Post by clarkj »

Since I'm not planning on doing anything else on this particular project using the Arduino interface, I decided to write a "special-purpose" code in CircuitPython to get some cal values for the MPU-6050. This took me less time than writing the Forums posting, and seems to be returning reasonable values.

Just in case someone else wants to use it, here's the code:

Code: Select all

# Got fed up with trying to get the Arduino-based "gyro_zerorate_simplecal", so
# decided to implement it specificallly for the MPU6050 using Circuit Python

# Put into the public domain by Clark Jones, Sep. 8, 2022.
# No guarantees express or implied about the accuracy or merchantability.  Use
# is strictly at your own risk.

# It may not be exactly the same as gyro_zerorate_simplecal, but seems to produce
# reasonable results.

import time
import board
import adafruit_mpu6050

i2c = board.I2C()  # uses board.SCL and board.SDA
mpu = adafruit_mpu6050.MPU6050(i2c)

sum_x = 0.0
sum_y = 0.0
sum_z = 0.0
for idx in range(1500):
    curr_read = mpu.gyro
    sum_x += curr_read[0]
    sum_y += curr_read[1]
    sum_z += curr_read[2]
    time.sleep(0.002)  # Wait 2 mS

print(f"x_correction = {(sum_x/1500):.3f}")
print(f"y_correction = {(sum_y/1500):.3f}")
print(f"z_correction = {(sum_z/1500):.3f}")
print("Note that the correction factors will need to be SUBTRACTED from the values")
print("Correction factors are in radians/sec")
print("Also note that the Earth rotates at about 7.27E-5 radians/sec")
BTW, the comment at the end comes from a friend who worked in the satellite industry, and several years ago they'd gotten a new gyro unit in (one that had physical spinning gyros), and when they left it running on the bench for 24 hours they were at first a bit confused by the fact that it said it had rotated 360 degrees -- at least until one of them realized that the Earth, and the bench along with it, had rotated 360 degrees in space!

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”