element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
element14 presents
  • Challenges & Projects
  • More
element14 presents
element14 presents Forum esp32 C3 with mpu6050
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join element14 presents to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 10 replies
  • Answers 2 answers
  • Subscribers 106 subscribers
  • Views 4136 views
  • Users 0 members are here
  • projects
  • mpu6050
  • Embedded Systems
  • ESP32C3
Related

esp32 C3 with mpu6050

alen10
alen10 over 1 year ago

Hi , i saw this video : www.youtube.com/watch . I want to know if i could use esp32 c3 instead of what you are using in the video . In this case , can you specify the pin diagram in order to connect to mpu6050 ?.

Below is the image of my connection (esp32 C3) with MPU6050 

Code is :

#include <MPU6050_light.h>
MPU6050 mpu(Wire);
unsigned long timer = 0;
#include <BleMouse.h>

BleMouse bleMouse;

#define btnL 2
#define btnR 1
#define btnM 3


#include <Wire.h>
#define SDA 9
#define SCL 10

#define AD0 11
#define INT 12
void setup() {

pinMode(btnR,INPUT);
pinMode(btnL,INPUT);
pinMode(btnM,INPUT);

pinMode(INT, INPUT); //int goes high when activity is detected(wakeup?)
pinMode(AD0, OUTPUT);
digitalWrite(AD0, LOW);//sets I2C adress
delay(50);
Serial.begin(115200);
Wire.begin(SDA,SCL);

Serial.println("Starting BLE work!");
bleMouse.begin();
byte status = mpu.begin();
Serial.print(F("MPU6050 status: "));
Serial.println(status);
while(status!=0){ } // stop everything if could not connect to MPU6050

Serial.println(F("Calculating offsets, do not move MPU6050"));
delay(2000);
// mpu.upsideDownMounting = true; // uncomment this line if the MPU6050 is mounted upside-down
mpu.calcOffsets(); // gyro and accelero
Serial.println("Done!\n");
}

void loop() {
if(bleMouse.isConnected()) {
clicking();
mpu.update();
int x = map(mpu.getAngleX(),-90,90,10,-10);
int y = map(mpu.getAngleY(),-90,90,-10,10);
int z = map(mpu.getAngleZ(),-90,90,-10,10);

bleMouse.move(x,y);


if((millis()-timer)>10){ // print data every 10ms
Serial.print("X : ");
Serial.print(mpu.getAngleX());
Serial.print(x);
Serial.print("\tY : ");
Serial.print(mpu.getAngleY());
Serial.print(y);
Serial.print("\tZ : ");
Serial.println(mpu.getAngleZ());
Serial.print(z);

timer = millis();
}
}


}
void clicking(){

bool Lclick = digitalRead(btnL);
bool Mclick = digitalRead(btnM);
bool Rclick = digitalRead(btnR);
if (Lclick == 0){
bleMouse.click(MOUSE_LEFT);
}

if (Rclick == 0){
bleMouse.click(MOUSE_RIGHT);
}


if (Mclick == 0){
bleMouse.click(MOUSE_MIDDLE);
}

}



image                                     image

  • Sign in to reply
  • Cancel

Top Replies

  • cstanton
    cstanton over 1 year ago in reply to alen10 +1 suggested
    alen10 said: esp32 c3 mini development kit .Even shared the picture of it Hey alen10 , Looks like you have one of these? https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/hw-reference/esp32c3…
Parents
  • mayermakes
    0 mayermakes over 1 year ago

    there is no requirement to use the s3 like in the video it will also work with a C3, you only need to specify and connect the right pins for i2C.
    so either use the pinmux to define which pins are used for SDA&SCL by the wire library or look up the default i2c pins for your particular board(which appears to be some random clone board so that might be not the simplest to find out.) and connect to these.
    also check if the breakout board you are using has the pullop resistors for i2c fitted, if not you nalso need to add them in your config/physically.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • alen10
    0 alen10 over 1 year ago in reply to mayermakes

    Can u tell me the pin used for connecting to esp32 c3 for scl and sda communication. I willl attach the esp32 c3 mini 1 pin out diagram(u can see at the bottom) .can u check and let me know as i am confused 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mayermakes
    0 mayermakes over 1 year ago in reply to alen10

    YOU have to find that out for YOUR particular board, I have no information about whatever hardware you are using. Look in the manual or ask the manufacturer.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • alen10
    0 alen10 over 1 year ago in reply to mayermakes

    Ok what about AD0 and int ? Where is it conneceted to ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mayermakes
    0 mayermakes over 1 year ago in reply to alen10

    Nobody here can tell you that, this is dependent on your Board and how its wired inside the module AND how it is set up in Firmwar, Arduino Core and your Code.
    YOU either find these infos in the manual of your Device or you need to ask the actual manufacturer, neither me nor anyone else but them knows how the device is wirde and configured, since you did not even bother to provide or look up the actual name of the device your have I can only assume you did not even look in the manual.

    THIS if literally the first google result: https://esp32.com/viewtopic.php?t=22655

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • alen10
    0 alen10 over 1 year ago in reply to mayermakes

    I had stated to you the name of the device :esp32 c3 mini development kit .Even shared the picture of it . From the datasheet i dint find , thats why i asked you if you could find the pin since tutorials available in the net belongs  to s3 or other versions with mpu6050 except c3 . 

    docs.espressif.com/.../user-guide-devkitm-1.html

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • cstanton
    0 cstanton over 1 year ago in reply to alen10
    alen10 said:
    esp32 c3 mini development kit .Even shared the picture of it

    Hey alen10 ,

    Looks like you have one of these? https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html I found this by simply searching online for "esp32 c3 mini development kit".

    If you check out the website and ask espressif you'll probably get the answers you're looking for about what's connected to where. They have a pinout diagram and all sorts.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • cstanton
    0 cstanton over 1 year ago in reply to alen10
    alen10 said:
    esp32 c3 mini development kit .Even shared the picture of it

    Hey alen10 ,

    Looks like you have one of these? https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html I found this by simply searching online for "esp32 c3 mini development kit".

    If you check out the website and ask espressif you'll probably get the answers you're looking for about what's connected to where. They have a pinout diagram and all sorts.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube