Orodha ya maudhui:

Roboti Inayosema Ikiwa Muuzaji wa Elektroniki Anakudanganya au La: 6 Hatua
Roboti Inayosema Ikiwa Muuzaji wa Elektroniki Anakudanganya au La: 6 Hatua

Video: Roboti Inayosema Ikiwa Muuzaji wa Elektroniki Anakudanganya au La: 6 Hatua

Video: Roboti Inayosema Ikiwa Muuzaji wa Elektroniki Anakudanganya au La: 6 Hatua
Video: Интернет-технологии - Информатика для руководителей бизнеса 2016 2024, Novemba
Anonim
Roboti Inayosema Ikiwa Muuzaji wa Elektroniki Anakudanganya au La
Roboti Inayosema Ikiwa Muuzaji wa Elektroniki Anakudanganya au La

Mwaka jana, mimi na baba yangu tulikwenda kwenye duka mpya la roboti / umeme karibu sana na mahali tunapoishi. Nilipoingia hapo, Ilikuwa imejaa umeme, serovs, sensorer, Risberry pis, na Arduinos. Siku iliyofuata, tulienda kwenye duka moja na kununua maseneta wengi na 3 Arduinos yenye thamani ya dola 150 hivi. Mara tu nilipoenda nyumbani, hakuna bidhaa nyingine iliyofanya kazi isipokuwa Arduino Mega. Tulidanganywa kwa dola 130 hivi ambazo ni nyingi.

Kwa hivyo, niliamua kuunda roboti ambayo inaweza kujaribu sensorer 12 na motors 2 (bado inafanya kazi kwenye servo) na inaweza kuamua ikiwa bidhaa hiyo ni mbaya.

Wacha tuingie moja kwa moja!

Vifaa

1. Arduino UNO

2. 2.4 onyesho la skrini ya kugusa ya TFT

3. waya kadhaa za kuruka

Sensorer na motors ili uweze kuzijaribu (hapa nilitumia - sensorer ya mwendo, sensa ya gesi ya MQ6, sensa ya Sauti, potentiometer na sensa ya kiwango cha maji)

Hatua ya 1: Jinsi inavyofanya kazi….

Image
Image

Nimepanga Arduino kuunda na kuingiliana kwa UI na onyesho la TFT. Kama tunavyojua, onyesho la TFT lina pini moja tu ya bure yaani pini ya A5. (ikiwa unatumia UNO). Kwa hivyo sensorer yoyote inayotumia pini za Analog kusoma data inaambatana na usanidi huu…

Katika UI, unaweza kubadilisha rangi ya mandharinyuma ya eneo-kazi, na unaweza kufungua programu ambayo ilitengenezwa na mimi kwa Arduino ili kupima sensorer.

Unapofungua programu, unaweza kuona chaguo 2, INPUT na OUTPUT. kwa hivyo ukibonyeza Ingizo, Inaonyesha sensorer 4 (Inaambatana na 12, lakini bado nitaipanga kwani nina mitihani inayokaribia….kuna wakati: (. Mtu yeyote yuko huru kuhariri nambari…)

Na inaweza pia kuangalia ikiwa servo motor inafanya kazi kwako kuiunganisha kwenye slot.

Angalia:

Hatua ya 2: Kupakia Nambari

Nambari ni mpango wa laini wa 600 ambao niliandika kwa uangalifu katika masaa 50. Inayo mende kadhaa kwa hivyo plz irekebishe na nitumie kwangu kwa barua yangu ([email protected]).

Pakia nambari na unganisha ngao ya TFT kwa Arduino. Ninakupendekeza ucheze karibu na UI ili upate kutegemea vizuri.

Nambari:

# pamoja

# Pamoja # Pamoja # Pamoja # define LCD_CS A3 # define LCD_CD A2 # define LCD_WR A1 # define LCD_RD A0 # define LCD_RESET A4 # define BLACK 0x0000 # define BLUE 0x001F # define NAVY 0x000F # define RED 0xF800 # define KIJANI 0x07E0 # define cyan 0x07FF #fafanua MAGENTA 0xF81F #fafanua NJANO 0xFFE0 #fasili NYEUPE 0xFFFF #fafanua NURUGIY 0xC618 #fasili PURPLE 0x780F #define OLIVE 0x7BE0 #fifine Selection #define YP A1 #dine XM A2 #Dine # AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX muda wa MZEE AU #Dine #XXXXXXX 160 #fafanua TS_MAXX 160 #fafanua TS_MAXY 970 TouchScreen ts = TouchScreen (XP, YP, XM, YM, 300); Adafruit_TFTLCD tft (LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); #fafanua BOXSIZE 40 #fasili PENRADIUS 3 #fafanua CHANZO 10 #fafanua MAXPRESSURE 1000 int sound; hali ya char = 6; kugusa = 0; rangi ya ndani = NYEUSI; int redir = 0; int ota; kuanzisha batili () {Serial.begin (9600); tft.setet (); tft.setFont (& FreeMonoBoldOblique12pt7b); tft kuanza (0x9325); tft.setRotation (45); tft.setTextSize (0.5); tft.fillScreen (NYEUPE); tft.setCursor (60, 160); tft.setTextColor (NYEUSI); tft.print ("Telezesha kidole ili uingie"); } kitanzi batili () {sensor sensorVoltage; sensor ya kuelea Thamani; TSPoint p = ts. PoPoint (); pinMode (XM, OUTPUT); pinMode (YP, OUTPUT); ikiwa (pz> MAFUNZO & pz 240 && px 130 && py 240 && px 20 && py 240 && px 20 && py 160 && px 12 && py 240 && px 20 && py 240 && px 20 && py 40 && px 15 && py 150 && px 40 && py 150 && px 80 && py 150 && px 120 && py 150 && px 170 && py 90 && px 40 && py 90 && px 80 && py 90 && px 120 && py 150 && px 170 && py 150 && px 170 && py 150 && px 170 && py 150 && px 170 && py 150 && px 170 && py 100 && px 20 && py 200 && px 100 && py 100 && px 20 && py 100 && px 20 && py 100 && px 20 && py <100) {kugusa = 26; }} ikiwa (touch == 1 && state == 6) {tft.setRotation (0); tft.fill Screen (rangi); sauti = 0; tft.fillRect (200, 180, 80, 140, NYEUPE); tft.drawRect (201, 181, 81, 141, NYEUSI); tft.fillRect (80, 30, 100, 100, CYAN); tft.drawRect (81, 31, 101, 101, NYEUSI); tft.fillRect (10, 30, 50, 100, NAVY); tft.drawRect (11, 31, 51, 101, NYEUSI); tft.fillRect (10, 180, 30, 120, PURPLE); tft.drawRect (11, 181, 31, 121, NYEUSI); tft.fillRect (45, 180, 30, 120, BLUE); tft.drawRect (46, 181, 31, 121, NYEUSI); tft.fillRect (80, 180, 30, 120, CYAN); tft.drawRect (81, 181, 31, 121, NYEUSI); tft.fillRect (115, 180, 30, 120, KIJANI); tft.drawRect (116, 181, 31, 121, NYEUSI); tft.fillRect (150, 180, 30, 120, MANJANO); tft.drawRect (151, 181, 31, 121, NYEUSI); tft.fill Triangle (210, 30, 210, 50, 220, 40, NYEUPE); tft.fillRect (200, 35, 12, 12, NYEUPE); tft.draw Triangle (210, 30, 210, 50, 220, 40, NYEUSI); tft.drawRect (200, 35, 12, 12, NYEUSI); tft.draw Mzunguko (210, 40, 14, NYEUPE); //tft.fillTriange (a1, b1, a2, b2, c1, c2, RED); tft.setRotation (45); tft.setCursor (200, 20); tft.print ("Mipangilio"); tft.fillRoundRect (45, 75, 75, 75, 4, NYEUPE); tft.drawRoundRect (45, 75, 75, 75, 4, NYEUSI); tft.fillRect (75, 75, 15, 30, NYEUSI); tft.fillRect (75, 120, 15, 30, NYEUSI); tft.fillRect (90, 105, 30, 15, NYEUSI); tft.fillRect (45, 105, 30, 15, NYEUSI); hali = 7; gusa = 0; ota = 0; } ikiwa (kugusa == 2) {tft.fillScreen (NYEUPE); tft.setRotation (0); tft.fill Triangle (210, 30, 210, 50, 220, 40, NYEUPE); tft.fillRect (200, 35, 12, 12, NYEUPE); tft.draw Triangle (210, 30, 210, 50, 220, 40, NYEUSI); tft.drawRect (200, 35, 12, 12, NYEUSI); tft.draw Mzunguko (210, 40, 14, NYEUSI); tft.setRotation (45); tft.fill Triangle (270, 40, 270, 20, 260, 30, NYEUSI); tft.drawLine (300, 30, 270, 30, NYEUSI); tft.setCursor (20, 200); tft.print ("ubinafsishaji"); tft.setCursor (20, 170); tft.print ("ondoka nje"); Mshale wa tft (20, 140); tft.print ("peripherals"); tft.setCursor (20, 110); tft.print ("Kuhusu"); kugusa = 1; hali = 2; } ikiwa (touch == 10 && state == 2) {tft.fillScreen (WHITE); tft.setCursor (10, 160); tft.setTextColor (NYEUSI); tft.print ("Imeundwa na imeendelezwa"); tft.setCursor (100, 190); tft.print ("na:"); tft.setCursor (60, 220); tft.print ("Kijana kutoka India"); tft.setRotation (0); tft.fill Triangle (210, 30, 210, 50, 220, 40, NYEUPE); tft.fillRect (200, 35, 12, 12, NYEUPE); tft.draw Triangle (210, 30, 210, 50, 220, 40, NYEUSI); tft.drawRect (200, 35, 12, 12, NYEUSI); tft.draw Mzunguko (210, 40, 14, NYEUSI); tft.setRotation (45); tft.fill Triangle (270, 40, 270, 20, 260, 30, NYEUSI); tft.drawLine (300, 30, 270, 30, NYEUSI); hali = 6; } ikiwa (touch == 11 && state == 2) {tft.fillScreen (WHITE); tft.setCursor (60, 40); tft.print ("Chagua"); tft.set Mshale (40, 60); tft.print ("rangi ya asili"); tft.fillRect (60, 180, 45, 45, RED); tft.fillRect (120, 180, 45, 45, MANJANO); tft.fillRect (180, 180, 45, 45, BLUE); tft.fillRect (240, 180, 45, 45, KIJANI); tft.fillRect (60, 130, 45, 45, MAGENTA); tft.fillRect (120, 130, 45, 45, NAVY); tft.fillRect (180, 130, 45, 45, LIGHTGREY); tft.fillRect (240, 130, 45, 45, CYAN); tft.fillRect (60, 80, 45, 45, NYEUPE); tft.drawRect (60, 80, 45, 45, NYEUSI); tft.fillRect (120, 80, 45, 45, NYEUSI); tft.fillRect (180, 80, 45, 45, OLIVE); tft.fillRect (240, 80, 45, 45, PURPLE); tft.setRotation (0); tft.fill Triangle (210, 30, 210, 50, 220, 40, NYEUPE); tft.fillRect (200, 35, 12, 12, NYEUPE); tft.draw Triangle (210, 30, 210, 50, 220, 40, NYEUSI); tft.drawRect (200, 35, 12, 12, NYEUSI); tft.draw Mzunguko (210, 40, 14, NYEUSI); tft.setRotation (45); tft.fill Triangle (270, 40, 270, 20, 260, 30, NYEUSI); tft.drawLine (300, 30, 270, 30, NYEUSI); hali = 6; ikiwa (redir == 1) {color = WHITE; } ikiwa (redir == 2) {color = BLACK; } ikiwa (redir == 3) {color = OLIVE; } ikiwa (redir == 4) {color = PURPLE; } ikiwa (redir == 5) {color = MAGENTA; } ikiwa (redir == 6) {color = NAVY; } ikiwa (redir == 7) {color = LIGHTGREY; } ikiwa (redir == 8) {color = CYAN; } ikiwa (redir == 9) {color = RED; } ikiwa (redir == 10) {color = MANJANO; } ikiwa (redir == 11) {color = BLUE; } ikiwa (redir == 12) {color = KIJANI; }} ikiwa (touch == 26) {ota = 1; tft.fillScreen (NYEUPE); tft.setRotation (0); tft.fill Triangle (210, 30, 210, 50, 220, 40, NYEUPE); tft.fillRect (200, 35, 12, 12, NYEUPE); tft.draw Triangle (210, 30, 210, 50, 220, 40, NYEUSI); tft.drawRect (200, 35, 12, 12, NYEUSI); tft.draw Mzunguko (210, 40, 14, NYEUSI); tft.setRotation (45); tft.fill Triangle (270, 40, 270, 20, 260, 30, NYEUSI); tft.drawLine (300, 30, 270, 30, NYEUSI); tft.setRotation (1); tft.setCursor (30, 80); tft.print ("Ingiza"); tft.setCursor (30, 150); tft.print ("Pato"); tft.drawRect (25, 130, 90, 30, NYEUSI); tft.drawRect (25, 60, 90, 30, NYEUSI); ikiwa (p.x> 190 && p.x 30 && p.y <90) {tft.setCursor (150, 220); tft.print ("Kiwango cha maji"); tft.setCursor (150, 170); tft.print ("Kiwango cha gesi"); tft.setCursor (150, 120); tft.print ("Umbali"); tft.setCursor (150, 70); tft.print ("Sauti"); kugusa = 1; hali = 2; }}} wakati (sauti == 1) {tft.fillScreen (WHITE); sensorValue = AnalogSoma (A5); sensorVoltage = sensorValue; tft.setCursor (60, 160); tft.print (sensorVoltage); Serial.println ("Sauti kiwango ="); Serial.println (sensorVoltage); kuchelewesha (1000); ikiwa (sauti == 0) {mapumziko; }}}}

Hatua ya 3: Maktaba Inahitajika:

  • Matunda_GFX.h
  • Matunda_TFTLCD.h
  • TouchScreen.h

Viungo vya Github sawa:

github.com/adafruit/Adafruit-GFX-Library

github.com/adafruit/TFTLCD-Library

github.com/adafruit/Adafruit_TouchScreen

Hatua ya 4: Uunganisho

Piga Kofi Pamoja
Piga Kofi Pamoja

Unahitaji waya 6 za kuruka. Wanaume 3 na wanawake 3. kuziuza moja kwa moja kwa bodi ya Arduino kama hii:

Hatua ya 5: Piga Kofi Pamoja

Bandika waya kwenye arduino (rejea picha), Tumia bunduki ya gundi ikihitajika…

Kisha Ambatanisha ngao ya TFT kisha ujaribu Sensorer zako.

Asante kwa kutembeza hadi chini. Hakikisha kunipigia kura ikiwa ulihisi mradi huu ni wa kipekee na unasaidia

Je! Unafurahiya kutengeneza na kujihadhari na watapeli wa Elektroniki?

Hatua ya 6: Maboresho zaidi:

  • Utangamano zaidi wa sensorer
  • Nambari ya motor ya Servo ililazimika kumaliza
  • Programu nyingine ambayo inaweza kuunganishwa na moduli za Bluetooth ili tuweze kudhibiti robot inayotumia Bluetooth nayo.
  • Kurekebishwa kwa hitilafu

Ilipendekeza: