Orodha ya maudhui:

Gari isiyo na waya iliyodhibitiwa na ishara: Hatua 7
Gari isiyo na waya iliyodhibitiwa na ishara: Hatua 7

Video: Gari isiyo na waya iliyodhibitiwa na ishara: Hatua 7

Video: Gari isiyo na waya iliyodhibitiwa na ishara: Hatua 7
Video: ДЕТИ ЛЕДИБАГ И СУПЕР-КОТА 😱 Сказки на ночь от Маринетт Miraculous Ladybug & Cat Noir in real life 2024, Novemba
Anonim
Gari Iliyodhibitiwa isiyo na waya
Gari Iliyodhibitiwa isiyo na waya

Katika mafunzo haya tutajifunza, jinsi ya kutengeneza gari inayodhibitiwa na ishara au roboti yoyote. Mradi huu una sehemu mbili, sehemu moja ni kitengo cha kusambaza na sehemu nyingine ni kitengo cha mpokeaji. Kitengo cha kusafirisha kimewekwa kwenye glavu za mkono na kitengo cha mpokeaji kinawekwa ndani ya gari au roboti yoyote. Sasa ni wakati wake wa kutengeneza gari nzuri. Acha tuende!

Hatua ya 1: Vifaa

Kitengo cha Kusambaza

1. Arduino Nano.

2. Moduli ya Sensorer ya MPU6050.

3. Transmitter ya RF 433 MHz.

4. Aina yoyote ya seli 3, Batri ya voliti 11.1 (Hapa nimetumia seli ya sarafu).

5. Vero-Bodi.

6. Kinga za mkono.

Kitengo cha Mpokeaji

1. Arduino Nano au Arduino Uno.

2. Moduli ya Dereva wa Magari ya L298N.

3. Sura ya magurudumu 4 pamoja na motors.

4. Mpokeaji wa RF 433 RF.

5. Kiini 3, 11.1 volt Li-po Betri.

6. Vero-bodi.

Wengine

1. Vijiti vya gundi na bunduki.

2. nyaya za jumper.

3. Madereva ya Parafujo

4. Kitanda cha Soldering.

na kadhalika.

Hatua ya 2: Picha ya Mchoro wa Mzunguko

Picha ya Mchoro wa Mzunguko
Picha ya Mchoro wa Mzunguko

Hatua ya 3: Faili ya Fritzing ya Mchoro wa Mzunguko

Hatua ya 4: Nambari ya Kusambaza

# pamoja

# pamoja

# pamoja

MPU6050 mpu6050 (Waya);

muda mrefu = 0;

mdhibiti wa char *;

kuanzisha batili ()

{Serial.begin (9600); Wire.begin (); mpu6050. anza (); mpu6050.calcGyroOffsets (kweli); vw_set_ptt_inverted (kweli); // vw_set_tx_pin (10); vw_setup (4000); // kasi ya uhamishaji wa data Kbps

}

kitanzi batili ()

{ ////////////////////////////////////////////////////////////////////////////////////////////////

mpu6050. update ();

ikiwa (millis () - kipima muda> 1000)

{Serial.println ("======================================= =========== "); Serial.print ("temp:"); Serial.println (mpu6050.getTemp ()); Serial.print ("accX:"); Serial.print (mpu6050.getAccX ()); Serial.print ("\ taccY:"); Serial.print (mpu6050.getAccY ()); Serial.print ("\ taccZ:"); Serial.println (mpu6050.getAccZ ()); Serial.print ("gyroX:"); Serial.print (mpu6050.getGyroX ()); Serial.print ("\ tgyroY:"); Serial.print (mpu6050.getGyroY ()); Serial.print ("\ tgyroZ:"); Serial.println (mpu6050.getGyroZ ()); Serial.print ("accAngleX:"); Serial.print (mpu6050.getAccAngleX ()); Serial.print ("\ taccAngleY:"); Serial.println (mpu6050.getAccAngleY ()); Serial.print ("gyroAngleX:"); Serial.print (mpu6050.getGyroAngleX ()); Serial.print ("\ tgyroAngleY:"); Serial.print (mpu6050.getGyroAngleY ()); Serial.print ("\ tgyroAngleZ:"); Serial.println (mpu6050.getGyroAngleZ ()); Serial.print ("angleX:"); Serial.print (mpu6050.getAngleX ()); Serial.print ("\ tangleY:"); Serial.print (mpu6050.getAngleY ()); Serial.print ("\ tangleZ:"); Serial.println (mpu6050.getAngleZ ()); Serial.println ("============================================= ========== / n "); kipima muda = millis (); }

/////////////////////////////////////////////////////////////////////////////////////

ikiwa (mpu6050.getAccAngleX () 30) {controller = "X2"; vw_send ((uint8_t *) mdhibiti, strlen (mdhibiti)); vw_wait_tx (); // Subiri hadi ujumbe wote utakapoondoka Serial.println ("MBELE"); } mwingine ikiwa (mpu6050.getAccAngleY ()> 40) {controller = "Y1"; vw_send ((uint8_t *) mdhibiti, strlen (mdhibiti)); vw_wait_tx (); // Subiri hadi ujumbe wote utakapoondoka Serial.println ("LEFT"); } mwingine ikiwa (mpu6050.getAccAngleY () <- 40) {controller = "Y2"; vw_send ((uint8_t *) mdhibiti, strlen (mdhibiti)); vw_wait_tx (); // Subiri hadi ujumbe wote utakapoondoka Serial.println ("HAKI"); } mwingine ikiwa (mpu6050.getAccAngleX () - 10 && mpu6050.getAccAngleY () - 10) {controller = "A1"; vw_send ((uint8_t *) mdhibiti, strlen (mdhibiti)); vw_wait_tx (); // Subiri hadi ujumbe wote utakapoondoka Serial.println ("STOP"); }}

Hatua ya 5: Msimbo wa Mpokeaji

# pamoja

int LA = 3;

int LB = 11; int RA = 5; int RB = 6; kuanzisha batili () {Serial.begin (9600); vw_set_ptt_inverted (kweli); // Inahitajika kwa DR3100 vw_set_rx_pin (12); kuanzisha (4000); // Bits kwa sekunde pinMode (13, OUTPUT); pinMode (LA, OUTPUT); pinMode (LB, OUTPUT); pinMode (RA, OUTPUT); pinMode (RB, OUTPUT); mwanzo wa (vw_rx_start); // Anzisha mpokeaji wa PLL anayeendesha Serial.println ("Sawa sawa");

}

kitanzi batili () {uint8_t buf [VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN;

ikiwa (vw_get_message (buf, & buflen)) // Isiyozuia

{ikiwa ((buf [0] == 'X') && (buf [1] == '1')) {Serial.println ("BACKWARD"); nyuma (); kuchelewesha (100); // off (); } mwingine ikiwa ((buf [0] == 'X') && (buf [1] == '2')) {Serial.println ("FORWARD"); mbele (); kuchelewesha (100); // off (); }

vinginevyo ikiwa ((buf [0] == 'Y') && (buf [1] == '1'))

{Serial.println ("KUSHOTO"); kushoto (); kuchelewesha (100); // off (); }

vinginevyo ikiwa ((buf [0] == 'Y') && (buf [1] == '2'))

{Serial.println ("HAKI"); haki(); kuchelewesha (100); // off (); } vingine ikiwa ((buf [0] == 'A') && (buf [1] == '1')) {Serial.println ("STOP"); mbali (); kuchelewesha (100); }} mwingine {Serial.println ("Hakuna Ishara Iliyopokelewa"); }}

batili mbele ()

{AnalogWrite (LA, 70); AnalogWrite (LB, 0); AnalogWrite (RA, 70); AnalogWrite (RB, 0); }

nyuma nyuma ()

{AnalogWrite (LA, 0); AnalogWrite (LB, 70); AnalogWrite (RA, 0); AnalogWrite (RB, 70); }

batili kushoto ()

{AnalogWrite (LA, 0); AnalogWrite (LB, 70); AnalogWrite (RA, 70); AnalogWrite (RB, 0); }

batili kulia ()

{AnalogWrite (LA, 70); AnalogWrite (LB, 0); AnalogWrite (RA, 0); AnalogWrite (RB, 70); }

batili ()

{AnalogWrite (LA, 0); AnalogWrite (LB, 0); AnalogWrite (RA, 0); AnalogWrite (RB, 0); }

Hatua ya 6: Faili za INO

Hatua ya 7: Kiunga cha Maktaba

Maktaba ya waya halisi:

MPU6050_tockn Libraby:

Maktaba ya waya:

Ilipendekeza: