Mundarija:

Qanday qilib qadam taymerini yasash mumkin?: 3 qadam (rasmlar bilan)
Qanday qilib qadam taymerini yasash mumkin?: 3 qadam (rasmlar bilan)

Video: Qanday qilib qadam taymerini yasash mumkin?: 3 qadam (rasmlar bilan)

Video: Qanday qilib qadam taymerini yasash mumkin?: 3 qadam (rasmlar bilan)
Video: Redmi Bosh Ekran Lifehack 2024, Noyabr
Anonim
Image
Image
Blynk loyihasini yarating
Blynk loyihasini yarating

Men ko'plab sport turlarida yaxshi qatnashardim: yurish, yugurish, velosiped haydash, badminton o'ynash va boshqalar.

Ko'p o'tmay sayohat qilishni yaxshi ko'raman. Xo'sh, qorin qornimga qara …….

Yaxshiyamki, men mashq qilishni boshlashga qaror qildim. Qanday uskunani tayyorlashim kerak? Sport inshootlaridan tashqari, ha! Menga asbob kerak! Ishonamanki, men kerakli miqdordagi mashqlarni bajaraman. Bu erda asbob vujudga keladi. Videodan boshlaylik ~

Qurilma nafaqat qadamlarni (va kaloriyalarni) real vaqtda yozibgina qolmay, balki vaqtni ham ko'rsatishi mumkin. O'ziga xosligi shundaki, ko'rsatuv formati ko'rsatgich ~ juda zo'r! Menga, albatta, yoqadi!

Siz o'z yozuvlaringizni Internetga yuklashingiz mumkin

faqat bir marta bosish bilan. Barcha yozuvlar Blynk (ilgari taqdim etilgan aqlli telefon dasturi) orqali ko'rsatilishi mumkin. Kiyiladigan aqlli soat kabi, asbob ham o'z vaqtida ishlaydi (shuning uchun siz kuch va vaqtni yangilashdan qo'rqmasligingiz kerak).

Uskunalar:

FireBeetle taxtasi-ESP32

FireBeetle qopqoqlari-Proto taxtasi

OLED12864 displeyli displey

Tezlashtirish moduli

3.7V batareya (Internetda sotib olingan, hajmi 600 mA / soat atrofida)

3 shisha (Internetda sotib olingan.

Bu loyihani Blybk tomonidan qurish juda qulay.

1 -qadam: Blynk loyihasini yarating

Ikkita boshqaruv elementini qo'shing:

Qiymatni ko'rsatish * 1

Haqiqiy vaqtda soat * 1

Qiymatni ko'rsatish nomi qadamlarga o'rnatilishi kerak, lekin real vaqtda soat xususiyatlarini sozlash kerak emas. Quyida ko'rsatilgan boshqaruv elementlarining tartibini o'zgartirish uchun kirish pimi sifatida V1 ni tanlang.

2-qadam: Dasturlarni FireBeetle-ESP32-ga yuklab oling

Manba kodini esp32 ga yuklab olish uchun shu erni bosing. Manba kodi kutubxona fayllari va 3D bosib chiqarish fayllaridan iborat. Kutubxona faylini arduino lib -ga saqlashingiz kerak. Va 3D fayllar qobiqlarni to'g'ridan -to'g'ri bosib chiqarishi mumkin.

Quyida asosiy dastur

#include #include // Faqat Arduino 1.6.5 va undan oldingi versiyalar uchun kerak #include "SSD1306.h" // taxalluslar "#include" SSD1306Wire.h "" #include "OLEDDisplayUi.h" #include "images.h" # o'z ichiga #include #include #include #include #deinni belgilang POWER_KEY 1 #MENU_KEY ni belgilang 2 #yuklashni_KEYINI yuklang 3 boolean yuklash = noto'g'ri; SSD1306 displeyi (0x3c, 18, 0); OLEDDisplayUi interfeysi (va ko'rsatish); SimpleTimer taymeri; WidgetRTC rtc; int ekranW = 128; int ekranH = 64; int clockCenterX = ekranW/2; int clockCenterY = ((ekranH-16)/2) +16; // yuqori sariq qismi 16 px balandlikda int clockRadius = 23; #devine DEVICE (0x53) // ADXL345 qurilma manzili #define TO_READ (6) // har safar o'qiladigan baytlar soni (har bir o'q uchun ikki bayt) bayt buff [TO_READ]; // qurilmadan o'qilgan ma'lumotlarni saqlash uchun 6 baytli bufer char str [100]; // satr portiga yuborishdan oldin ma'lumotlarni aylantirish uchun string bufer int regAddress = 0x32; // ADXL345 int xx, yy, zz bo'yicha birinchi o'q-tezlashtirish-ma'lumotlar registri; // uch o'qli tezlashtirish ma'lumotlari statik int currentValue = 0; statik belgisiz uzun qadamlarSum = 0; char auth = "YourAuthToken"; // Wi -Fi ma'lumotlari. // Ochiq tarmoqlar uchun parolni "" ga o'rnating. char ssid = "Sizning tarmoq nomingiz"; char pass = "Sizning parolingiz"; const char running_Logo_bits PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x03, 0x00, 0x00 0xF8, 0x01, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0x00, 0xFC, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 0xFC, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x60, 0xF1, 0x20, 0xF8, 0x17, 0x00, 0x00, 0xC0, 0xF8, 0x0F, 0x00, 0x00, 0xE0, 0xFB, 0x17, 0x00, 0x00, 0xC0, 0xFF, 0x13, 0x00, 0x00, 0x00, 0xFF, 0x00 0xFE, 0x03, 0x00, 0x00, 0x00, 0xF9, 0x03, 0x00, 0x00, 0x00, 0xFA, 0x03, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07 0xF4, 0x07, 0x00, 0x00, 0x00, 0xF4, 0x0F, 0x00, 0x00, 0x00, 0xF9, 0x0F, 0x00, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0x80, 0xFE, 0x1F 0xFF, 0x1F, 0x00, 0x00, 0xA0, 0xFF, 0x5F, 0x00, 0x00, 0xC0, 0x3F, 0x3F, 0x00, 0x0 0, 0xE8, 0x1F, 0x3F, 0x00, 0x00, 0xE8, 0xA7, 0x3E, 0x00, 0x00, 0xF0, 0x03, 0x7C, 0x00, 0x00, 0xE0, 0x05, 0x7C, 0x00, 0x00, 0x00, 0x00 0x00, 0xC0, 0x01, 0xF0, 0x03, 0x00, 0xC0, 0x03, 0xE8, 0x07, 0x00, 0xC0, 0x03, 0x88, 0x6F, 0x00, 0x80, 0x03, 0x40, 0x1, 0x1, 0x00, 0x03 0x00, 0x80, 0x03, 0x00, 0xF8, 0x01, 0x00, 0x07, 0x00, 0xF4, 0x00, 0x00, 0x07, 0x00, 0xE8, 0x00, 0x80, 0x0F, 0x00, 0xE8, 0x00, 0x90. 0x00, 0xE8, 0x0F, 0x00, 0xE8, 0x00, 0xF0, 0x09, 0x00, 0x60, 0x01, 0xF0, 0x04, 0x00, 0x00, 0x00,}; // Raqamli soatni ko'rsatish uchun yordamchi funktsiya: oldingi 0 String twoDigits (int raqamlari) {if (raqamlari <10) {String i = '0'+String (raqamlar); qaytish i; } else {return String (raqamlar); }} void clockOverlay (OLEDDisplay * displeyi, OLEDDisplayUiState * holati) {if ((soat () == 0) && (daqiqa () == 0) && (ikkinchi () == 0)) qadamlarSum = 0; } bekor analogClockFrame (OLEDDisplay * displeyi, OLEDDisplayUiState * holati, int16_t x, int16_t y) {display-> drawCircle (clockCenterX + x, clockCenterY + y, 2); // soat shomillari (int z = 0; z drawLine (x2 + x, y2 + y, x3 + x, y3 + y);} // ikkinchi qo'l suzish burchagi = sekund () * 6; burchak = (burchak / 57.29577951); // darajalarni radianlarga aylantirish int x3 = (clockCenterX + (sin (burchak) * (clockRadius - (clockRadius / 5)))))); int y3 = (clockCenterY - (cos (burchak) * * (clockRadius - (clockRadius / 5)))); display-> drawLine (clockCenterX + x, clockCenterY + y, x3 + x, y3 + y); // ko'rsatish daqiqali qo'l burchagi = minut () * 6; burchak = (burchak / 57.29577951); // darajalarni radianlarga aylantiring x3 = (clockCenterX + (sin (burchak) * (clockRadius - (clockRadius / 4))))); y3 = (clockCenterY - (cos (burchak) * * (clockRadius - (clockRadius / 4)) displey-> drawLine (clockCenterX + x, clockCenterY + y, x3 + x, y3 + y);; burchak = (burchak / 57.29577951); // darajalarni radianlarga aylantirish x3 = (clockCenterX + (sin (burchak) * (clockRadius - (clockRadius / 2))))); y3 = (clockCenterY - (cos (burchak) *) soat radiusi - (soatRa dius / 2)))); display-> drawLine (clockCenterX + x, clockCenterY + y, x3 + x, y3 + y); } void digitalClockFrame (OLEDDisplay * displeyi, OLEDDisplayUiState * holati, int16_t x, int16_t y) {String date = String (year ())+"/"+twoDigits (month ())+"/"+twoDigits (day ()); String timenow = String (hour ())+":"+twoDigits (minutes ())+":"+twoDigits (second ()); ko'rsatish-> setTextAlignment (TEXT_ALIGN_CENTER); ko'rsatish-> setFont (ArialMT_Plain_24); display-> drawString (clockCenterX + x, 20, timenow); ko'rsatish-> setFont (ArialMT_Plain_16); display-> drawString (60, 45, sana); } void writeTo (int qurilma, bayt manzili, bayt val) {Wire.beginTransmission (qurilma); // Wire.write qurilmasiga uzatishni boshlang (manzil); // Wire.write (val) ro'yxatga olish manzilini yuborish; // Wire.endTransmission () ni yozish uchun qiymat yuboring; // uzatishni tugatish} // raqamli baytlarni qurilmadagi manzillar ro'yxatidan boshlab, o'qishni bekor qilish qatoriga o'qishni bekor qiladi. // Wire.write qurilmasiga uzatishni boshlang (manzil); // manzilni Wire.endTransmission () dan o'qishga yuboradi; // uzatishni tugatish Wire.beginTransmission (qurilma); // Wire.requestFrom qurilmasiga uzatishni boshlash (qurilma, raqam); // int i = 0 qurilmasidan 6 bayt so'rash; while (Wire.available ()) // qurilma talab qilinganidan kamroq yuborishi mumkin (g'ayritabiiy) {buff = Wire.read (); // i ++ baytini olish; } Wire.endTransmission (); // uzatishni tugatish} void runningFrame (OLEDDisplay*displeyi, OLEDDisplayUiState*holati, int16_t x, int16_t y) {float calValue = stepsSum*0.4487; ko'rsatish-> setTextAlignment (TEXT_ALIGN_CENTER); ko'rsatish-> setFont (ArialMT_Plain_24); display-> drawString (clockCenterX, clockCenterY, str); sprintf (str, "%.2fcal", calValue); ko'rsatish-> setTextAlignment (TEXT_ALIGN_CENTER); ko'rsatish-> setFont (ArialMT_Plain_10); display-> drawString (100, 20, str); display-> drawXbm (10, 14, 34, 50, running_Logo_bits); } void uploadFrame (OLEDDisplay * displeyi, OLEDDisplayUiState * holati, int16_t x, int16_t y) {display-> setFont (ArialMT_Plain_16); display-> drawString (60, 45, "ma'lumotlarni yuklash …"); } // Bu qator funktsiya ko'rsatgichlarini barcha kadrlarga saqlaydi // ramkalar - bu FrameCallback freymlarida siljigan yagona ko'rinishlar = {analogClockFrame, digitalClockFrame, runningFrame, uploadFrame}; // nechta ramka bor? int frameCount = 4; // Qatlamlar statik ravishda ramka ustiga chiziladi, masalan. soat OverlayCallback qoplamalar = {clockOverlay}; int overlaysCount = 1; void uploadToBlynk (void) {if (upload == true) {Blynk.virtualWrite (V0, stepsSum); Blynk.virtualWrite (V1, stepsSum); }} bo'sh uiInit (void) {ui.setTargetFPS (30); //ui.setActiveSymbol(aktivSimbol); //ui.setInactiveSymbol(inactiveSymbol); ui.setIndicatorPosition (TOP); ui.setIndicatorDirection (LEFT_RIGHT); ui.setFrameAnimation (SLIDE_LEFT); ui.setFrames (ramkalar, frameCount); ui.setOverlays (overlays, overlaysCount); ui.disableAutoTransition (); ui.switchToFrame (2); ui.init (); display.flipScreenVertically (); } void adxl345Init (void) {writeTo (DEVICE, 0x2D, 0); writeTo (QURILMA, 0x2D, 16); writeTo (QURILMA, 0x2D, 8); } void updateAdxl345 (void) {readFrom (DEVICE, regAddress, TO_READ, buff); // ADXL345 dan tezlashtirish ma'lumotlarini o'qing xx = ((((int) buff [1]) << 8) | buff [0]; yy = (((int) buff [3]) << 8) | buff [2]; zz = (((int) buff [5]) << 8) | buff [4]; if (xx 80) {if (xx <currentValue) {stepsSum ++; } joriyValue = xx; } sprintf (str, "%d", stepsSum); } int getKeys (void) {if (digitalRead (D2) == LOW) {kechiktirish (5); if (digitalRead (D2) == LOW) {while (digitalRead (D2) == LOW); POWER_KEY -ni qaytarish; }} if (digitalRead (D3) == LOW) {kechiktirish (5); if (digitalRead (D3) == LOW) {while (digitalRead (D3) == LOW); qaytarish MENU_KEY; }} if (digitalRead (D4) == LOW) {kechiktirish (5); if (digitalRead (D4) == LOW) {while (digitalRead (D4) == LOW); UPLOAD_KEY -ni qaytarish; }} qaytarish 0; } void doKeysFunction (void) {static int uiFrameIndex = 2; int tugmachalari = getKeys (); agar (kalitlar == POWER_KEY) {statik char i = 0; agar (i) {ui.init (); display.flipScreenVertically (); display.displayOn (); } boshqa {display.displayOff (); } i = ~ i; } if (kalitlari == MENU_KEY) {if (yuklash == noto'g'ri) {uiFrameIndex ++; agar (uiFrameIndex == 3) uiFrameIndex = 0; ui.switchToFrame (uiFrameIndex); } boshqa {ui.switchToFrame (3); }} if (kalitlari == UPLOAD_KEY) {if (yuklash == rost) {yuklash = noto'g'ri; ui.switchToFrame (uiFrameIndex); } boshqa {yuklash = rost; ui.switchToFrame (3); }}} void setup () {pinMode (D2, INPUT); pinMode (D3, INPUT); pinMode (D4, INPUT); Blynk.begin (auth, ssid, pass); rtc.begin (); uiInit (); adxl345Init (); timer.setInterval (30, updateAdxl345); timer.setInterval (100, uploadToBlynk); } void loop () {int kalanTimeBudget = ui.update (); statik int testSum = 0; if ((testSum 0) {kechikish (kalanTimeBudget);} doKeysFunction (); timer.run ();}

Diqqat: Wi-Fi sozlamalarini, pasportni va AUTHTOKENSni o'zingiz o'zgartirishingiz kerak.

char auth = "YourAuthToken"; // Wi -Fi ma'lumotlari. // Ochiq tarmoqlar uchun parolni "" ga o'rnating. char ssid = "Sizning tarmog'ingiz nomi"; char pass = "Sizning parolingiz";

3 -qadam: Uskuna ulanishi

Uskuna ulanishi
Uskuna ulanishi
Uskuna ulanishi
Uskuna ulanishi
Uskuna ulanishi
Uskuna ulanishi

OLED12864 va tezlashtirish modulini I2C ga, pastki qismini D2, D3, D4 ga ulang. Bundan tashqari, quyida ko'rsatilgan 3.3V ga erishish uchun 51k tortish rezistorlarini taglikka qo'shing.

E'tibor bering: tortish rezistorlarini AREF-ga ulash noto'g'ri, to'g'ri 3.3V

Uskuna lehimining tasviri, quyida ko'rsatilgan:

Lehimdan so'ng, apparat modulini qobiqqa yig'ish, quyida ko'rsatilgan:

Keng qamrovli effektli tasvir ~

Tavsiya: