<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>esp32 C3 with mpu6050</title><link>https://community.element14.com/challenges-projects/element14-presents/f/forum/54534/esp32-c3-with-mpu6050</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><lastBuildDate>Fri, 19 Apr 2024 10:15:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://community.element14.com/challenges-projects/element14-presents/f/forum/54534/esp32-c3-with-mpu6050" /><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220945?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 10:15:58 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f9e51542-4d67-479d-9086-5fdf0866f041</guid><dc:creator>alen10</dc:creator><description>&lt;p&gt;Hi , The SDA and SCL connection had been solved .&lt;/p&gt;
&lt;p&gt;I got the virtual mouse working with my smartphone .&lt;/p&gt;
&lt;p&gt;I am doing a&amp;nbsp; project . The Project is based on Finger module that has esp32 C3 and mpu6050 attached to my Index Finger&amp;nbsp; .In the prototype , I do not need button to click the screen . It will be done using my finger movement along the Z direction .I can&amp;nbsp; move the mouse cursor&amp;nbsp; along (X-Y direction )&amp;nbsp; and scrolling too with my finger module attached to my finger&amp;nbsp; .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will attach my code , Can you tell me if the code is correct or not ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Secondly i used&amp;nbsp; &amp;quot;&lt;span&gt;int&lt;/span&gt;&lt;span&gt; x = &lt;/span&gt;&lt;span&gt;map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;mpu&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;getAngleX&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;,-&lt;/span&gt;&lt;span&gt;90&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;90&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;255&lt;/span&gt;&lt;span&gt;&lt;span&gt;)&amp;quot; instead of &amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt; x = &lt;/span&gt;&lt;span&gt;map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;mpu&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;getAngleX&lt;/span&gt;&lt;span&gt;()&lt;/span&gt;&lt;span&gt;,-&lt;/span&gt;&lt;span&gt;90&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt;90&lt;/span&gt;&lt;span&gt;,-10&lt;/span&gt;&lt;span&gt;,10&lt;/span&gt;&lt;span&gt;)&amp;quot; , Can you tell me which one is good for precise cursor control and without timelag . If timelag shows up , how can i avoid it by either using hardware /Software ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;#include &amp;lt;MPU6050_light.h&amp;gt;
MPU6050 mpu(Wire);
unsigned long timer = 0;
#include &amp;lt;BleMouse.h&amp;gt;
#define MPU_ADDR 0x68 
 
BleMouse bleMouse;


int prevX = 0, prevY = 0, prevZ = 0; // Previous sensor readings for movement detection
// Thresholds for click and scroll detection (adjust as needed)
#define CLICK_THRESHOLD 1000


#include &amp;lt;Wire.h&amp;gt;
int SDA_pin= 6;
int Scl_pin= 7;

//#define AD0 11 
//#define INT 12
void setup() {
  //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.setPins(SDA_pin ,Scl_pin);
    pinMode(SDA_pin,INPUT_PULLUP );
 
   pinMode(Scl_pin,INPUT_PULLUP );
  Wire.begin();

  Serial.println(&amp;quot;Starting BLE work!&amp;quot;);
  bleMouse.begin();
  byte status = mpu.begin();
  Serial.print(F(&amp;quot;MPU6050 status: &amp;quot;));
  Serial.println(status);
  while(status!=0){ } // stop everything if could not connect to MPU6050
  
  Serial.println(F(&amp;quot;Calculating offsets, do not move MPU6050&amp;quot;));
  delay(2000);
  // mpu.upsideDownMounting = true; // uncomment this line if the MPU6050 is mounted upside-down
  mpu.calcOffsets(); // gyro and accelero
  Serial.println(&amp;quot;Done!\n&amp;quot;);
  }
  

void loop() {
  if(bleMouse.isConnected()) {
    Wire.write(0x3B); 
    Wire.write(0x43); 
 
  mpu.update();
  int x = map(mpu.getAngleX(),-90,90,0,255);
  int y = map(mpu.getAngleY(),-90,90,0,255);
  int z =abs(mpu.getAngleZ());
  prevX = x;
  prevY =y;
  
   bleMouse.move(x,y);
    // Click detection based on Z-axis acceleration change
    if (z &amp;gt; CLICK_THRESHOLD &amp;amp;&amp;amp; prevZ &amp;lt; CLICK_THRESHOLD) {
     bleMouse.click();
      delay(10); // Debounce (optional)
     
    }
    prevZ = z;
    // Scrolling 
         Serial.println(&amp;quot;Scroll up&amp;quot;);
         unsigned long startTime;
  startTime = millis();
    while(millis()&amp;lt;startTime+2000) {
      bleMouse.move(0,0,1);
      delay(100);
    }
    delay(500);

    Serial.println(&amp;quot;Scroll down&amp;quot;);
    startTime = millis();
    while(millis()&amp;lt;startTime+2000) {
      bleMouse.move(0,0,-1);
      delay(100);
    }
    delay(500);

    Serial.println(&amp;quot;Scroll left&amp;quot;);
    startTime = millis();
    while(millis()&amp;lt;startTime+2000) {
      bleMouse.move(0,0,0,-1);
      delay(100);
    }
    delay(500);

    Serial.println(&amp;quot;Scroll right&amp;quot;);
    startTime = millis();
    while(millis()&amp;lt;startTime+2000) {
      bleMouse.move(0,0,0,1);
      delay(100);
    }
    delay(500);


  
  
  if((millis()-timer)&amp;gt;10){ // print data every 10ms
  Serial.print(&amp;quot;X : &amp;quot;);
  Serial.print(mpu.getAngleX());
  Serial.print(x);
  Serial.print(&amp;quot;\tY : &amp;quot;);
  Serial.print(mpu.getAngleY());
  Serial.print(y);
  Serial.print(&amp;quot;\tZ : &amp;quot;);
  Serial.println(mpu.getAngleZ());
  Serial.print(z);
  
  timer = millis();  
  }
  }}







  
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220941?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 02:02:03 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:6b3a4025-14a1-45f6-a693-79c353e075ce</guid><dc:creator>balajivan1995</dc:creator><description>&lt;p&gt;Hi, I have done a project using ESP32C3 and MPU6050 for one of my ML project. You can find the details and the code here,&amp;nbsp;&lt;a href="https://community.element14.com/members-area/b/blog/posts/activity-recognition-using-ml-on-edge-with-esp32-and-mpu6050-sensor" data-e14adj="t"&gt;/members-area/b/blog/posts/activity-recognition-using-ml-on-edge-with-esp32-and-mpu6050-sensor&amp;nbsp;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I believe the SDA and SCL pins are 6 &amp;amp;7.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220927?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 09:25:01 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:4f35790e-623d-4a5c-8c82-2d7c4581f982</guid><dc:creator>cstanton</dc:creator><description>[quote userid="500216" url="~/challenges-projects/element14-presents/f/forum/54534/esp32-c3-with-mpu6050/220901"]esp32 c3 mini development kit .Even shared the picture of it [/quote]
&lt;p&gt;Hey &lt;a href="https://community.element14.com/members/alen10"&gt;alen10&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;Looks like you have one of these?&amp;nbsp;&lt;a id="" href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html"&gt;https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html&lt;/a&gt;&amp;nbsp;I found this by simply searching online for &amp;quot;esp32 c3 mini development kit&amp;quot;.&lt;/p&gt;
&lt;p&gt;If you check out the website and ask espressif you&amp;#39;ll probably get the answers you&amp;#39;re looking for about what&amp;#39;s connected to where. They have a pinout diagram and all sorts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220903?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 10:39:56 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:a53f7935-6b01-4a0f-ae3c-ab0912bf5ec5</guid><dc:creator>mayermakes</dc:creator><description>[quote userid="21154" url="~/challenges-projects/element14-presents/f/forum/54534/esp32-c3-with-mpu6050/220896"]so either use the pinmux to define which pins are used for SDA&amp;amp;SCL by the wire library[/quote]
&lt;pre&gt;&lt;code&gt;Wire.begin(SDA, SCL);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220901?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 10:28:10 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:89ec1589-c142-4b20-b873-f5ccbca1204b</guid><dc:creator>alen10</dc:creator><description>&lt;p&gt;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&amp;nbsp; to s3 or other versions with mpu6050 except c3 .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.espressif.com/projects/esp-idf/en/stable/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html"&gt;docs.espressif.com/.../user-guide-devkitm-1.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220900?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 10:19:09 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7a5f6dd0-9d8e-4fc2-b850-7f407bfbb47a</guid><dc:creator>mayermakes</dc:creator><description>&lt;p&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;THIS if literally the first google result: &lt;a href="https://esp32.com/viewtopic.php?t=22655"&gt;https://esp32.com/viewtopic.php?t=22655&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220899?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 10:14:12 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:ad3fb712-45aa-472f-960b-a012ed67ba9f</guid><dc:creator>alen10</dc:creator><description>&lt;p&gt;Ok what about AD0 and int ? Where is it conneceted to ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220898?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 10:05:18 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:248d45d6-8cb0-4409-ba5a-d0ac469bb751</guid><dc:creator>mayermakes</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220897?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 10:03:15 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:f47deb54-ebb1-463e-b7c5-d02cb4742d22</guid><dc:creator>alen10</dc:creator><description>&lt;p&gt;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&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: esp32 C3 with mpu6050</title><link>https://community.element14.com/thread/220896?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2024 09:55:41 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7b53c8b7-75ef-470e-8b24-d0fa42c0ed85</guid><dc:creator>mayermakes</dc:creator><description>&lt;p&gt;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.&lt;br /&gt;so either use the pinmux to define which pins are used for SDA&amp;amp;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.&lt;br /&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>