Ks0202 keyestudio Balance Car Shield: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
<br>[[File:ks0202-1.png|500px|frameless|thumb]]<br>
<br>[[File:ks0202-1.png|500px|frameless|thumb]]<br>


<br>
==Introduction==
==Introduction==
This keyestudio shield is particularly developed for balance car based on Arduino development board. It mainly use the driver chip L298P produced by LGS Electronics which is specially applied to large power motors. So the shield can drive two DC motors, and the driven current is up to 2A.  
This keyestudio shield is particularly developed for balance car based on Arduino development board. It mainly use the driver chip L298P produced by LGS Electronics, which is specially applied to large power motors. So the shield can drive two DC motors, and the driven current is up to 2A. <br>
It adopts the MPU6050 chip, and uses the built-in data management platform DMP to output the processing data through IIC interface.
It adopts the MPU6050 chip, and uses the built-in data management platform DMP to output the processing data through IIC interface.
<br>[[File:KS0202-2.jpg|500px|frameless|thumb]]<br>
<br>[[File:KS0202-2.jpg|500px|frameless|thumb]]<br>


<br>
==Features==
==Features==
1. Working Voltage: DC 12V
* 1. Working Voltage: DC 12V
 
* 2. Working Current in driver: ≤ 2 A
2. Working Current in driver: ≤ 2 A
* 3. Working Temperature: 0℃ to 80℃
 
* 4. Coming with xbee/Bluetooth Bee wireless interface
3. Working Temperature: 0℃ to 80℃
* 5. On-board buzzer(D6) used as alarming  
 
* 6. D11 as PWM pin 1 of motor 1, D9 as PWM pin 2 of motor 2, D 10 and D12 as output pin of motor 1, D8 and D7 as output pin of motor 2
4. Coming with xbee/Bluetooth Bee wireless interface
* 7. With two PH2.0-6P motor interfaces
 
5. On-board buzzer(D6) used as alarming  
 
6. D11 as PWM pin 1 of motor 1, D9 as PWM pin 2 of motor 2, D 10 and D12 as output pin of motor 1, D8 and D7 as output pin of motor 2
 
7. With two PH2.0-6P motor interfaces
 


<br>
== Technical Details ==
== Technical Details ==
* Dimensions: 77mmx 55mmx 25mm
* Dimensions: 77mmx 55mmx 25mm
* Weight: 31g
* Weight: 31g
<br>[[File:图片1- ks0249.png|600px|frameless|thumb]]<br
<br>[[File:图片1- ks0249.png|600px|frameless|thumb]]<br
 
<br>
==Connection Diagram==
==Connection Diagram==
Stack it onto the board
Simply stack it onto the UNO board
<br>[[File:ks0202-2.png|500px|frameless|thumb]]<br>
<br>[[File:ks0202-2.png|500px|frameless|thumb]]<br>


<br>
==Sample Code==
==Sample Code==
Get the libraries of Wire: [http://www.keyestudio.com/files/index/download/id/1506755872/] <br>
*[https://drive.google.com/open?id=10e6rKkKaSpV_Thoe7dz2ZqoOp_XvPEM-  Get the libraries ''Wire.h''] <br>
Get the libraries of MPU6050: [http://www.keyestudio.com/files/index/download/id/1506755871/]  <br>
*[https://drive.google.com/open?id=1hhzfuT0svXpU9bf1Q22QpEhEfaGkPa6Z  Get the libraries ''MPU6050'']  <br>
Get the Code: [http://www.keyestudio.com/files/index/download/id/1506756045/] <br>
*[  Get the Code] <br>
Or you can directly copy the code as below:
Or you can directly copy the code as below:
<pre>
<pre>
Line 183: Line 180:
</pre>
</pre>


<br>
== Documents ==
== Documents ==
 
'''Download the PDF:'''
'''PDF:'''
 
https://drive.google.com/open?id=13AiPQpHPVIGNGdiq7w6BMvr6-JXFRli5
https://drive.google.com/open?id=13AiPQpHPVIGNGdiq7w6BMvr6-JXFRli5


'''Download the Libraries of MPU6050:'''
'''Download the libraries MPU6050:'''
 
https://drive.google.com/open?id=1hhzfuT0svXpU9bf1Q22QpEhEfaGkPa6Z
https://drive.google.com/open?id=1hhzfuT0svXpU9bf1Q22QpEhEfaGkPa6Z


'''Download the Libraries of Wire:'''
'''Download the libraries Wire:'''
 
https://drive.google.com/open?id=10e6rKkKaSpV_Thoe7dz2ZqoOp_XvPEM-
https://drive.google.com/open?id=10e6rKkKaSpV_Thoe7dz2ZqoOp_XvPEM-


'''Download the Code:'''
<br>
 
== Buy From ==
https://drive.google.com/open?id=19ImbFnkGphDNZZt50xMLbZC7dsb-g3oH
'''Official Website:'''
http://www.keyestudio.com/keyestudio-balance-car-shield.html


== Buy From ==
'''Official Website'''


http://www.keyestudio.com/keyestudio-balance-car-shield.html


[[Category:Module]]
[[Category:Shield]]

Revision as of 08:43, 26 September 2018

keyestudio Balance Car Shield


thumb


Introduction

This keyestudio shield is particularly developed for balance car based on Arduino development board. It mainly use the driver chip L298P produced by LGS Electronics, which is specially applied to large power motors. So the shield can drive two DC motors, and the driven current is up to 2A.
It adopts the MPU6050 chip, and uses the built-in data management platform DMP to output the processing data through IIC interface.
thumb


Features

  • 1. Working Voltage: DC 12V
  • 2. Working Current in driver: ≤ 2 A
  • 3. Working Temperature: 0℃ to 80℃
  • 4. Coming with xbee/Bluetooth Bee wireless interface
  • 5. On-board buzzer(D6) used as alarming
  • 6. D11 as PWM pin 1 of motor 1, D9 as PWM pin 2 of motor 2, D 10 and D12 as output pin of motor 1, D8 and D7 as output pin of motor 2
  • 7. With two PH2.0-6P motor interfaces


Technical Details

  • Dimensions: 77mmx 55mmx 25mm
  • Weight: 31g


thumb<br

Connection Diagram

Simply stack it onto the UNO board
thumb


Sample Code

Or you can directly copy the code as below:

/*
    MPU6050 Triple Axis Gyroscope & Accelerometer. Free fall detection.
    Read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/3-osiowy-zyroskop-i-akcelerometr-mpu6050.html
    GIT: https://github.com/jarzebski/Arduino-MPU6050
    Web: http://www.jarzebski.pl
    (c) 2014 by Korneliusz Jarzebski
*/

#include <Wire.h>
#include <MPU6050.h>

MPU6050 mpu;

boolean ledState = false;
boolean freefallDetected = false;
int freefallBlinkCount = 0;

void setup() 
{
  Serial.begin(115200);

  Serial.println("Initialize MPU6050");

  while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_16G))
  {
    Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
    delay(500);
  }

  mpu.setAccelPowerOnDelay(MPU6050_DELAY_3MS);
  
  mpu.setIntFreeFallEnabled(true);
  mpu.setIntZeroMotionEnabled(false);
  mpu.setIntMotionEnabled(false);
  
  mpu.setDHPFMode(MPU6050_DHPF_5HZ);

  mpu.setFreeFallDetectionThreshold(17);
  mpu.setFreeFallDetectionDuration(2);	
  
  checkSettings();

  pinMode(4, OUTPUT);
  digitalWrite(4, LOW);
  
  attachInterrupt(0, doInt, RISING);
}

void doInt()
{
  freefallBlinkCount = 0;
  freefallDetected = true;  
}

void checkSettings()
{
  Serial.println();
  
  Serial.print(" * Sleep Mode:                ");
  Serial.println(mpu.getSleepEnabled() ? "Enabled" : "Disabled");

  Serial.print(" * Motion Interrupt:     ");
  Serial.println(mpu.getIntMotionEnabled() ? "Enabled" : "Disabled");

  Serial.print(" * Zero Motion Interrupt:     ");
  Serial.println(mpu.getIntZeroMotionEnabled() ? "Enabled" : "Disabled");

  Serial.print(" * Free Fall Interrupt:       ");
  Serial.println(mpu.getIntFreeFallEnabled() ? "Enabled" : "Disabled");

  Serial.print(" * Free Fal Threshold:          ");
  Serial.println(mpu.getFreeFallDetectionThreshold());

  Serial.print(" * Free FallDuration:           ");
  Serial.println(mpu.getFreeFallDetectionDuration());
  
  Serial.print(" * Clock Source:              ");
  switch(mpu.getClockSource())
  {
    case MPU6050_CLOCK_KEEP_RESET:     Serial.println("Stops the clock and keeps the timing generator in reset"); break;
    case MPU6050_CLOCK_EXTERNAL_19MHZ: Serial.println("PLL with external 19.2MHz reference"); break;
    case MPU6050_CLOCK_EXTERNAL_32KHZ: Serial.println("PLL with external 32.768kHz reference"); break;
    case MPU6050_CLOCK_PLL_ZGYRO:      Serial.println("PLL with Z axis gyroscope reference"); break;
    case MPU6050_CLOCK_PLL_YGYRO:      Serial.println("PLL with Y axis gyroscope reference"); break;
    case MPU6050_CLOCK_PLL_XGYRO:      Serial.println("PLL with X axis gyroscope reference"); break;
    case MPU6050_CLOCK_INTERNAL_8MHZ:  Serial.println("Internal 8MHz oscillator"); break;
  }
  
  Serial.print(" * Accelerometer:             ");
  switch(mpu.getRange())
  {
    case MPU6050_RANGE_16G:            Serial.println("+/- 16 g"); break;
    case MPU6050_RANGE_8G:             Serial.println("+/- 8 g"); break;
    case MPU6050_RANGE_4G:             Serial.println("+/- 4 g"); break;
    case MPU6050_RANGE_2G:             Serial.println("+/- 2 g"); break;
  }  

  Serial.print(" * Accelerometer offsets:     ");
  Serial.print(mpu.getAccelOffsetX());
  Serial.print(" / ");
  Serial.print(mpu.getAccelOffsetY());
  Serial.print(" / ");
  Serial.println(mpu.getAccelOffsetZ());

  Serial.print(" * Accelerometer power delay: ");
  switch(mpu.getAccelPowerOnDelay())
  {
    case MPU6050_DELAY_3MS:            Serial.println("3ms"); break;
    case MPU6050_DELAY_2MS:            Serial.println("2ms"); break;
    case MPU6050_DELAY_1MS:            Serial.println("1ms"); break;
    case MPU6050_NO_DELAY:             Serial.println("0ms"); break;
  }  
  
  Serial.println();
}

void loop()
{
  Vector rawAccel = mpu.readRawAccel();
  Activites act = mpu.readActivites();

  Serial.print(act.isFreeFall);
  Serial.print("\n");
  
  if (freefallDetected)
  {
    ledState = !ledState;

    digitalWrite(4, ledState);

    freefallBlinkCount++;

    if (freefallBlinkCount == 20)
    {
      freefallDetected = false;
      ledState = false;
      digitalWrite(4, ledState);
    }
  }
  
  delay(100);
  
}


Documents

Download the PDF: https://drive.google.com/open?id=13AiPQpHPVIGNGdiq7w6BMvr6-JXFRli5

Download the libraries MPU6050: https://drive.google.com/open?id=1hhzfuT0svXpU9bf1Q22QpEhEfaGkPa6Z

Download the libraries Wire: https://drive.google.com/open?id=10e6rKkKaSpV_Thoe7dz2ZqoOp_XvPEM-


Buy From

Official Website: http://www.keyestudio.com/keyestudio-balance-car-shield.html