Cov txheej txheem:

FinduCar: Lub Ntsej Muag Tsheb Ntsuas Qhia Cov Neeg rau Qhov Chaw Lub Tsheb Nres Tsheb: 11 Cov Kauj Ruam (nrog Duab)
FinduCar: Lub Ntsej Muag Tsheb Ntsuas Qhia Cov Neeg rau Qhov Chaw Lub Tsheb Nres Tsheb: 11 Cov Kauj Ruam (nrog Duab)

Video: FinduCar: Lub Ntsej Muag Tsheb Ntsuas Qhia Cov Neeg rau Qhov Chaw Lub Tsheb Nres Tsheb: 11 Cov Kauj Ruam (nrog Duab)

Video: FinduCar: Lub Ntsej Muag Tsheb Ntsuas Qhia Cov Neeg rau Qhov Chaw Lub Tsheb Nres Tsheb: 11 Cov Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Hlis ntuj nqeg
Anonim
FinduCar: Lub Ntse Ntse Tsheb Tseem Ceeb Qhia Cov Neeg Rau Qhov Chaw Lub Tsheb Nres Tsheb
FinduCar: Lub Ntse Ntse Tsheb Tseem Ceeb Qhia Cov Neeg Rau Qhov Chaw Lub Tsheb Nres Tsheb

Txhawm rau daws cov teeb meem saum toj no, txoj haujlwm no thov tsim kho lub tsheb ntse uas tuaj yeem coj tib neeg mus rau qhov chaw lawv nres tsheb. Thiab kuv txoj kev npaj koom nrog GPS rau hauv lub tsheb tseem ceeb. Tsis tas yuav siv lub smartphone app txhawm rau taug qab lub tsheb, txhua qhov kev qhia yuav tsuas yog qhia ntawm tus yuam sij hauv lub tsheb.

Kauj Ruam 1: Daim Duab Sketch

Daim Duab Sketch
Daim Duab Sketch

Thaum tib neeg nias lub pob kom xauv lub tsheb, cov ntaub ntawv qhia chaw yuav raug kaw hauv lub microcontroller txiav. Tom qab ntawd, thaum tib neeg pib taug kev mus rau lub tsheb, qhov sib txawv LED tau teeb tsa kom ncaj qha mus rau txoj haujlwm ntawm lub tsheb thiab ntsais ntsais zaus qhia qhov deb ntawm lub tsheb. Lawv tuaj yeem yooj yim ua raws qhov ntsais ntsais LED thiab pom lub tsheb sai.

Kauj Ruam 2: Sau Cov Khoom Kho Vajtse

Cov Khoom Kho Mob
Cov Khoom Kho Mob

Cov no yog cov khoom siv hauv txoj haujlwm no. Qee qhov yog los ntawm cov khoom siv me me (cov ntawv ntim khoom, khawm, lub taub hau), lwm tus tau yuav los ntawm Adafruit lub vev xaib raug cai (Adafruit Feather M0, Adafruit Ultimate GPS module, Lpoly Battery and Coin Cell Battery) thiab Amazon (NeoPixel Ring - 12 RGB LED).

Kauj Ruam 3: Tsim Circuit Court

Tsim Circuit Court
Tsim Circuit Court

Neopixel_LED txuas nrog tus PIN 6 ntawm Feather M0

Button_Unlock txuas nrog tus PIN 12 ntawm Feather M0

Button_Lock txuas nrog tus PIN 13 ntawm Feather M0

Kauj Ruam 4: Kev Kho Vajtse Txuas

Kho vajtse txuas
Kho vajtse txuas
Kho vajtse txuas
Kho vajtse txuas
Kho vajtse txuas
Kho vajtse txuas

Muab cov taub hau tso nrog Adafruit M0 Feather, Adafruit Ultimate GPS Featherwing. Muab ob lub laug cam tso ua ke. GPS FeatherWing ntsaws ncaj rau hauv koj lub rooj plaub M0 yam tsis muaj xov hlau ntxiv.

Kauj Ruam 5: Tsim Software

Tsim Software
Tsim Software

Xeem Cheeb Tsam

Nyeem FIX

void teeb tsa () {

Serial.println ("GPS echo test"); Serial.begin (9600); Serial1.begin (9600); // default NMEA GPS baud}

void voj () {

yog (Serial.available ()) {char c = Serial.read (); Serial1.write (c); } yog (Serial1.available ()) {char c = Serial1.read (); Serial.write (c); }}

Blink LED Nplhaib

Saib Adafruit NeoPixel Piv txwv.

GPS suav ua haujlwm

Xam lub Azimuth

// Suav Azimuth

ob azimuth (ob lat_a, ob lon_a, ob lat_b, ob lon_b) {

ob d = 0; lat_a = lat_a*PI/180; lon_a = lon_a*PI/180; lat_b = lat_b*PI/180; lon_b = lon_b*PI/180; d = sin (lat_a)*sin (lat_b)+cos (lat_a)*cos (lat_b)*cos (lon_b-lon_a); d = sqrt (1-d*d); d = cos (lat_b)*sin (lon_b-lon_a)/d; d = asin (d)*180/PI; rov d; }

Xam lub sijhawm ntawm lub moos LED, uas tseem yog kev qhia ntawm lub tsheb

// Xam lub sijhawm ntawm LED moos

int led_time (kaum ob lub kaum) {

tus chij = 0; yog (kaum sab xis = 15) {kaum_ sij hawm = kaum_ sij hawm + 1; } yog (chij == 1) {angle_time = 12 - angle_time; } rov qab angle_time; }

Xam qhov nrug ntawm tus neeg thiab nws lub tsheb

// Xam qhov deb

ob nrug (ob lat_a, ob lon_a, ob lat_b, ob lon_b) {

ob npaug EARTH_RADIUS = 6378137.0; ob npaug radLat1 = (lat_a * PI / 180.0); ob radLat2 = (lat_b * PI / 180.0); ob npaug a = radLat1 - radLat2; ob b = (lon_a - lon_b) * PI / 180.0; ob s = 2 * asin (sqrt (pow (sin (a / 2), 2) + cos (radLat1) * cos (radLat2) * pow (sin (b / 2), 2)))); s = s * EARTH_RADIUS / 10000000; rov s; }

LED Zaub Ua Haujlwm

Teeb LEDs hauv lub voj voog qhia tias nws pib taug kev

// LED ntiv nplhaib teeb pom kev ib ntawm ib qho qhia tias kev pib pib

void colorWipe (uint32_t c, uint8_t tos) {

rau (uint16_t kuv = 0; kuv strip.setPixelColor (i, c); strip.show (); ncua (tos);}}

Tau txais LED zaus raws qhov deb

// Tau Txais Zaus LED

int zaus (ob npaug nrug) {

int f = (int) nrug * 20; rov f; }

Tsau qhov tseeb ntawm LED qhia txog kev taw qhia ntawm lub tsheb

// Zaub ntawm LED

strip.clear ();

strip.show (); ncua (zaus (tsheb_ neeg_distance)); // ncua (500); strip.setPixelColor (angle_time, strip. Color (0, 0, 255)); strip.show (); ncua (zaus (tsheb_ neeg_distance)); // ncua (500);

// Disable LED

yog (button_flag == 1 && car_person_distance <5.0) {button_flag = 0; led_flag = 1; strip.clear (); strip.show (); }

Lub ntsiab

#suav nrog Adafruit_GPS.h #suav nrog Adafruit_NeoPixel.h #suav nrog HardwareSerial.h #include Button.h #suav nrog lej.h

#define Neopixel_LED_PIN 6

#define Neopixel_LED_NUM 12 #define Button_Lock_PIN 13 #define Button_Unlock_PIN 12 #define GPSSerial Serial1

#define GPSECHO tsis tseeb

Adafruit_GPS GPS (& GPSSerial); Adafruit_NeoPixel strip = Adafruit_NeoPixel (Neopixel_LED_NUM, Neopixel_LED_PIN, NEO_GRB + NEO_KHZ800); Khawm khawm_lock (Khawm_Lock_PIN); Khawm button_unlock (Khawm_Unlock_PIN); int khawm_flag = 0; int led_flag = 1; uint32_t timer = millis (); ob chav car_lat, car_lon; ob chav car_person_distance; ob npaug txav_direction; ob chav car_azimuth; ob chav car_person_angle; int lub sij hawm_ sijhawm;

void teeb tsa () {

Serial.begin (115200); // Serial1.begin (9600); GPS.begin (9600); // default NMEA GPS baud strip.begin (); // tsis pom zoo cov kab no kom qhib rau RMC (pom zoo yam tsawg kawg nkaus) thiab GGA (kho cov ntaub ntawv) suav nrog qhov siab GPS.sendCommand (PMTK_SET_NMEA_OUTPUT_RMCGGA); // Teeb tsa tus nqi hloov tshiab GPS.sendCommand (PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz hloov tus nqi // Thov hloov tshiab ntawm tus kav hlau txais xov xwm, tawm tswv yim kom nyob ntsiag to // GPS.sendCommand (PGCMD_ANTENNA); ncua (1000);}

void loop () {// yog (Serial.available ()) {

// char c = Serial.read (); // Serial1.write (c); //} // yog (Serial1.available ()) {char c = GPS.read (); yog (GPSECHO) yog (c) Serial.print (c); // yog tias tau txais kab lus, peb tuaj yeem tshawb xyuas cov ntawv txheeb xyuas, txheeb xyuas nws… ntes lwm cov kab lus! // yog li yuav ceev faj heev yog tias siv OUTPUT_ALLDATA thiab sim ua kom luam tawm cov ntaub ntawv Serial.println (GPS.lastNMEA ()); // qhov no kuj teeb tsa tus tshiabNMEAreceived () chij rau cuav yog (! // peb tuaj yeem tsis tuaj yeem txheeb xyuas kab lus hauv qhov xwm txheej twg peb yuav tsum tos lwm qhov} // yog millis () lossis timer qhwv ncig, peb yuav cia li rov pib dua yog tias (timer> millis ()) timer = millis (); yog (millis () - timer> 2000) {timer = millis (); // rov teem caij timer.print ("\ nTime:"); Serial.print (GPS.hour, DEC); Serial.print (':'); Serial.print (GPS.minute, DEC); Serial.print (':'); Serial.print (GPS.seconds, DEC); Serial.print ('.'); Serial.println (GPS.milliseconds); Serial.print ("Hnub tim:"); Serial.print (GPS hnub, DEC); Serial.print ('/'); Serial.print (GPS.month, DEC); Serial.print ("/20"); Serial.println (GPS.year, DEC); Serial.print ("Kho:"); Serial.print ((int) GPS.fix); Serial.print ("zoo:"); Serial.println ((int) GPS.fixquality); yog (GPS.fix) {Serial.print ("Qhov chaw:"); Serial.print (GPS.latitude, 4); Serial.print (GPS.lat); Serial.print (","); Serial.print (GPS.longitude, 4); Serial.println (GPS.lon); Serial.print ("Qhov chaw (hauv qib, ua haujlwm nrog Google Maps):"); Serial.print (GPS.latitudeDegrees, 4); Serial.print (","); Serial.println (GPS.longitudeDegrees, 4); Serial.print ("Ceev (pob):"); Serial.println (GPS.speed); Serial.print ("Lub:"); Serial.println (GPS.angle); Serial.print ("Qhov siab:"); Serial.println (GPS.altitude); Serial.print ("Satellites:"); Serial.println ((int) GPS.satellites); // Txuag GPS ntawm lub tsheb yog (button_lock.read ()) {car_lat = GPS.latitudeDegrees; car_lon = GPS.longitudeDegrees; // rau debug Serial.print ("carLatitude:"); Serial.println (car_lat); Serial.print ("carLongitude:"); Serial.println (car_lon); } // Pib nrhiav lub tsheb yog (button_flag == 0) {button_flag = button_unlock.read (); } yog (button_flag == 1 && led_flag == 1) {colorWipe (strip. Color (0, 255, 0), 500); led_flag = 0; } yog (button_flag == 1) {car_person_distance = nrug (GPS.latitudeDegrees, GPS.longitudeDegrees, car_lat, car_lon); // Xam qhov deb // car_person_distance = nrug (100.0005, 100.0005, 100.0, 100.0); // rau debug Serial.println (car_person_distance); txav_direction = GPS.angle; // Sau cov lus qhia txav (kaum sab xis) // txav_direction = 100.0; // Sau Azimuth (kaum) car_azimuth = azimuth (GPS.latitudeDegrees, GPS.longitudeDegrees, car_lat, car_lon); // car_azimuth = azimuth (100.0005, 100.0005, 100.0, 100.0); // Xam lub sijhawm ntawm LED moos car_person_angle = car_azimuth - txav_direction; angle_time = coj_time (car_person_angle); // Zaub ntawm LED strip.clear (); strip.show (); // ncua (zaus (tsheb_ neeg_distance)); ncua (500); strip.setPixelColor (angle_time, strip. Color (0, 0, 255)); strip.show (); // ncua (zaus (tus neeg_ neeg_distance)); ncua (500); // Lov tes taw LED yog (button_flag == 1 && car_person_distance <5.0) {button_flag = 0; led_flag = 1; strip.clear (); strip.show (); }}} // //}}}

Kauj Ruam 6: Debug ntawm Breadboard

Debug ntawm Breadboard
Debug ntawm Breadboard
Debug ntawm Breadboard
Debug ntawm Breadboard
Debug ntawm Breadboard
Debug ntawm Breadboard

Kauj ruam 7: Khoos phis tawj sib dhos

Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos
Khoos phis tawj sib dhos

Kauj Ruam 8: Tsim Vaj Tsev Khoom Siv Hluav Taws Xob hauv Adobe Illustrator

Kev Tsim Vaj Tsev Siv Hluav Taws Xob hauv Adobe Illustrator
Kev Tsim Vaj Tsev Siv Hluav Taws Xob hauv Adobe Illustrator

Kauj Ruam 9: Daim Duab Qhia Txog Tus Qauv

Cardboard Prototype
Cardboard Prototype
Cardboard Prototype
Cardboard Prototype

Cov kauj ruam no yog siv los txheeb xyuas qhov loj ntawm lub tsev thiab txhua daim ntawm tus qauv, ua kom ntseeg tau tias lub thawv loj, thiab khawm txoj haujlwm, thiab txoj haujlwm LED haum rau cov khoom siv hluav taws xob sib dhos.

Kauj Ruam 10: Birch Plywood Prototype

Birch Plywood Prototype
Birch Plywood Prototype
Birch Plywood Prototype
Birch Plywood Prototype

Nov yog thawj tsab ntawv. Ib lub xwmfab qhov rau ntsaws rau hauv lub charger tau ntxiv rau ib qho ntawm daim ntawv thaum kawg.

Pom zoo: