Cov txheej txheem:

Kev Cuam Tshuam Tswj Wireless Tsheb: 7 Kauj Ruam
Kev Cuam Tshuam Tswj Wireless Tsheb: 7 Kauj Ruam

Video: Kev Cuam Tshuam Tswj Wireless Tsheb: 7 Kauj Ruam

Video: Kev Cuam Tshuam Tswj Wireless Tsheb: 7 Kauj Ruam
Video: yuav coj li cas kom luag nyiam 2024, Kaum ib hlis
Anonim
Piav tes piav taw Tswj Wireless Tsheb
Piav tes piav taw Tswj Wireless Tsheb

Hauv qhov kev qhia no peb yuav kawm, yuav ua li cas thiaj tswj tau lub tsheb los yog ib tus neeg hlau. Txoj haujlwm no muaj ob ntu, ib feem yog chav xa khoom thiab lwm qhov yog chav txais. Lub chaw xa xov hluav taws xob tau teeb tsa ntawm lub hnab looj tes thiab lub chaw txais khoom tau muab tso rau hauv tsheb lossis ib tus neeg hlau. Tam sim no nws yog lub sijhawm los ua lub tsheb zoo. Cia mus!

Kauj ruam 1: Cov khoom siv

Chav Nyob

1. Arduino Nano.

2. MPU6050 Sensor Module.

3. RF 433 MHz Transmitter.

4. Txhua yam ntawm 3 cell, 11.1 volt Roj teeb (Ntawm no kuv tau siv npib cell).

5. Vero-Board.

6. Hnab looj tes.

Chav Txais

1. Arduino Nano lossis Arduino Uno.

2. L298N Tsav Tsav Tsheb Tsav Tsheb.

3. 4 lub log neeg hlau thav duab nrog rau lub cav.

4. RF 433 RF Txais.

5. 3 cell, 11.1 volt Li-po Roj teeb.

6. Vero-board.

Lwm tus

1. Cov nplaum nplaum thiab rab phom.

2. Jumper xov hlau.

3. Ntsia Hlau Tsav

4. Cov Khoom Siv Soldering.

lwm yam.

Kauj Ruam 2: Daim Duab Daim Duab Daim Duab

Circuit Diagram Duab Cov Ntaub Ntawv
Circuit Diagram Duab Cov Ntaub Ntawv

Kauj Ruam 3: Fritzing Cov Ntaub Ntawv ntawm Circuit Diagram

Kauj Ruam 4: Tus Kws Tshaj Tawm

#suav nrog

#suav nrog

#suav nrog

MPU6050 mpu6050 (Hlau);

ntev timer = 0;

char *maub los;

void teeb tsa ()

{Serial.begin (9600); Hlau.begin (); mpu6050.begin (); mpu6050.calcGyroOffsets (muaj tseeb); vw_set_ptt_inverted (muaj tseeb); // vw_set_tx_pin (10); vw_setup (4000); // nrawm ntawm cov ntaub ntawv hloov pauv Kbps

}

void lub voj ()

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

mpu6050.update ();

yog tias (millis () - timer> 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 "); timer = millis (); }

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

yog (mpu6050.getAccAngleX () 30) {maub los = "X2"; vw_send ((uint8_t *) maub los, strlen (maub los)); vw_wait_tx (); // Tos kom txog thaum tag nrho cov lus tau ploj mus Serial.println ("FORWARD"); } lwm tus yog (mpu6050.getAccAngleY ()> 40) {controller = "Y1"; vw_send ((uint8_t *) maub los, strlen (maub los)); vw_wait_tx (); // Tos kom txog thaum tag nrho cov lus tau ploj mus Serial.println ("LEFT"); } lwm tus yog (mpu6050.getAccAngleY () <-40) {maub los = "Y2"; vw_send ((uint8_t *) maub los, strlen (maub los)); vw_wait_tx (); // Tos kom txog thaum tag nrho cov lus ploj mus Serial.println ("RIGHT"); } lwm tus yog (mpu6050.getAccAngleX ()-10 && mpu6050.getAccAngleY ()-10) {controller = "A1"; vw_send ((uint8_t *) maub los, strlen (maub los)); vw_wait_tx (); // Tos kom txog thaum tag nrho cov lus tau ploj mus Serial.println ("STOP"); }}

Kauj Ruam 5: Tus Neeg Tau Txais Txoj Cai

#suav nrog

int LA = 3;

int LB = 11; int RA = 5; int RB = 6; teeb tsa tsis muaj dab tsi () {Serial.begin (9600); vw_set_ptt_inverted (muaj tseeb); // Yuav tsum tau rau DR3100 vw_set_rx_pin (12); vw_setup (4000); // Cov khoom me me ib sec pinMode (13, OUTPUT); tus pinMode (LA, OUTPUT); pinMode (LB, OUTPUT); tus pinMode (RA, OUTPUT); tus pinMode (RB, OUTPUT); vw_rx_start (); // Pib tus txais PLL khiav Serial.println ("Txhua Qhov Zoo");

}

void loop () {uint8_t buf [VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN;

yog (vw_get_message (buf, & buflen)) // Tsis-thaiv

{yog ((buf [0] == 'X') && (buf [1] == '1')) {Serial.println ("BACKWARD"); rov qab (); ncua (100); // tawm (); } lwm tus yog ((buf [0] == 'X') && (buf [1] == '2')) {Serial.println ("FORWARD"); rau pem hauv ntej (); ncua (100); // tawm (); }

lwm yog ((buf [0] == 'Y') && (buf [1] == '1'))

{Serial.println ("LEFT"); sab laug (); ncua (100); // tawm (); }

lwm yog ((buf [0] == 'Y') && (buf [1] == '2'))

{Serial.println ("RIGHT"); txoj cai (); ncua (100); // tawm (); } lwm tus yog ((buf [0] == 'A') && (buf [1] == '1')) {Serial.println ("STOP"); tawm (); ncua (100); }} lwm {Serial.println ("Tsis Tau Txais Lub Teeb"); }}

void rau pem hauv ntej ()

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

void rov qab ()

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

void sab laug ()

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

void txoj cai ()

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

void tawm ()

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

Kauj Ruam 6: INO Cov Ntaub Ntawv

Kauj Ruam 7: Txuas ntawm Cov Tsev Qiv Ntawv

Virtual Wire Library:

MPU6050_tockn Libraby:

Wire Library:

Pom zoo: