Cov txheej txheem:

Stepper Pomodoro Timer: 3 Kauj Ruam (nrog Duab)
Stepper Pomodoro Timer: 3 Kauj Ruam (nrog Duab)

Video: Stepper Pomodoro Timer: 3 Kauj Ruam (nrog Duab)

Video: Stepper Pomodoro Timer: 3 Kauj Ruam (nrog Duab)
Video: getting 10k steps a day has been so easy #fitness #fitnessjourney #homegym 2024, Kaum ib hlis
Anonim
Image
Image
Kauj Ruam 1: Kev Siv Hluav Taws Xob thiab Txuas Hluav Taws Xob Sab Nraud ntawm Thawv
Kauj Ruam 1: Kev Siv Hluav Taws Xob thiab Txuas Hluav Taws Xob Sab Nraud ntawm Thawv

Stepper Pomodoro yog lub sijhawm teem sijhawm los pab ib tus tswj hwm lawv cov npe haujlwm txhua hnub los ntawm kev rhuav txhua lub sijhawm ua haujlwm mus rau 30 feeb ntu. Txawm li cas los xij, tsis zoo li lub sijhawm Pomodoro ib txwm, nws tsis ua rau koj ntxhov siab los ntawm kev qhia lub sijhawm tshuav. Hloov chaw, nws qhia lub sijhawm kwv yees li ntawm qhov ntawm peb qhov kev hu xov tooj. Los ntawm tsis qhia lub sijhawm tseeb nws tso cai rau koj kom mob siab rau txoj haujlwm ntawm tes, theej tas li los tshuaj xyuas koj lub sijhawm sab laug. Pomodoro no zoo tshaj rau cov uas xav tau lub teeb pom kev thiab tsis cuam tshuam rau lawv txoj haujlwm tswj hwm.

Cov cuab yeej

• Soldering hlau

• Cov hlua hluav taws xob

• Laser txiav (los yog sander nyob ntawm seb koj xav tsim lub dials ntawm timer li cas)

• Laum (Kuv siv lub laum xovxwm los xuas qhov loj txaus rau lub xovtooj)

Khoom siv

• 1 Arduino Uno

• 1 daim ntawv me me ib nrab ntawv

• 3 H txuas hniav (Kuv siv DRV8833, lub cev muaj zog tiv thaiv wold tau cawm kuv qee lub sijhawm thiab mob taub hau)

• 3 Stepper motors (Kuv siv NEMA 17 steppers)

• 1 Khawm

• 1 220-1K ohm resistor (ib qho hauv ntau qhov zoo)

• AC/DC adapter (Kuv siv 12V, tej zaum yuav loj heev rau tus nqi ntawm cov steppers)

• Fais fab splitter

• USB A-B xaim

• Cov xaim hluav taws xob

• Solder

• Cov ntaub ntawv rau ntim lub sijhawm

• Acrylic rau cov xov tooj

• Cov ntsia hlau lossis tus pas hlau los ua tus tes tuav ntawm lub sijhawm

Kauj Ruam 1: Kauj Ruam 1: Kev Siv Hluav Taws Xob thiab Txuas Hluav Taws Xob Sab Nraud ntawm Thawv

Rau cov kauj ruam no kuv pib los ntawm kev sib dhos ua ke tag nrho kuv tus H choj (yog tias koj yuav lub cav thaiv koj yuav tsum tsis tas yuav tsum tau siv cov laug li no. Thaum koj muaj tus choj H rau txhua tus stepper koj tuaj yeem tshawb xyuas seb koj cov steppers muaj hlua li cas.

NEMA 17s yog dab tsi hu ua bipolar stepper motors, lub ntsiab lus tias lawv muaj ob (ntau dua ib qho) txheej coils hauv lub cev muaj zog uas hloov pauv polarity kom tso cai kom txav mus los ntawm lub cev muaj zog. Bipolar steppers ib txwm muaj plaub lub xov hlau thiab Polar steppers ib txwm muaj rau, qhov no nyuab cov lus qhia online me ntsis. Txawm li cas los xij koj tuaj yeem txuas ntau lub ntsuas mus rau ob lub xov hlau thiab pom tias lawv tau txuas nrog lossis yog tias lawv tsis yog. NEMA 17 cov neeg tsav tsheb muaj lawv cov xaim xaj hauv RED, YELLOW, GRAY, GREEN xim xaj, nrog liab thiab grey yog thawj khub ncov qaumteb thiab daj thiab ntsuab yog ob khub ncov qaumteb. Yog tias ntawm ib qho twg tus stepper pib ntswj ntau dua li ua tiav qhov kev txav mus los, qhov txawv yog tias koj cov xov hlau qee zaum tsis raug polarized rau lawv ntxaib lossis ib qho raug txuas. Txhua tus stepper yog tswj ntawm plaub tus pin pins uas txuas rau DRV8833 H txuas hniav. Kev xaj xaj rau cov tswv yim rau DRV8833 yog: IN1, IN2, Hwj chim, Hauv av, IN3, IN4. Rau lub hom phiaj tso tawm NEMA tsuas yog txuas rau nruab nrab plaub ntawm rau rau tus pin raws li: RED, GRAY, YELLOW, GREEN. Tam sim no cia txuas lub zog. Kuv muaj kuv NEMAs ntawm cov chaw nres nkoj digital 2-13.

Txhawm rau lub zog no kuv tau yuav 12V AC/DC adapter nrog lub tshuab hluav taws xob kom muaj peev xwm ua tau ob qho tib si Arduino, thiab txhua tus steppers. CEEB TOOM: Tsis txhob txuas koj lub zog thiab cov xov hlau hauv av los ntawm Arduino twb tau txais lub zog los ntawm qhov chaw nres nkoj mus rau lub khob cij tau txais ncaj qha los ntawm AC/DC. Nws yuav kib koj lub rooj tsavxwm. Los ntawm 12V adapter ntsaws rau hauv phab ntsa ib feem ntawm lub splitter tau ncaj nraim mus rau Arduino qhov chaw nres nkoj thiab lwm qhov mus rau qhov zoo thiab tsis zoo ntawm lub khob cij.

Qhov kawg, nws yog lub sijhawm los khawm lub pob. Ib sab ntawm lub pob yuav xav tau ob lub zog (nrog peb cov resistor spliced nyob rau hauv) nrog rau cov zis pin soldered rau (qhov no tseem tuaj yeem ua tau los ntawm lub khob cij). Lwm tus pin yuav yog peb qhov av. Peb cov xov hlau no yuav tsum tau txuas rau: Lub zog nrog tus tiv thaiv rau 5V, tso tawm rau A0, thiab hauv av rau hauv av tag nrho ntawm Arduino Uno board nws tus kheej.

Los ntawm no peb yuav tsum muaj peev xwm sim tswj cov steppers siv qhov yooj yim stepper xeem code pom ntawm no. Qhov kev piav qhia ntawm Arduino.cc no tseem piav qhia ntxaws ntxaws ntawm cov steppers bi/unipolar yog tias koj xav tau. Tom ntej no cia nkag mus rau txoj cai rau Pomodoro!

Kauj Ruam 2: Kauj Ruam 2: Tshaj Tawm Txoj Cai thiab Kho Nws Raws Li Koj Xav Tau

Kauj Ruam 2: Tshaj Tawm Txoj Cai thiab Kho Nws Raws Li Koj Xav Tau
Kauj Ruam 2: Tshaj Tawm Txoj Cai thiab Kho Nws Raws Li Koj Xav Tau

Hauv qab no yog tus lej rau kuv Pomodoro nrog khawm, txhawm rau kho nws rau koj teeb tsa ua raws nrog cov kauj ruam no:

1. Teev pes tsawg kauj ruam ntawm kev hloov pauv koj tus kheej hom stepper muaj (NEMA 17s muaj 200 thiab nws tau teev nyob rau hauv qhov tsis tu ncua hu ua stepsPerRevolution).

2. Teeb qhov twg koj lub pob tau nkag mus rau hauv qhov tas mus li hu xov tooj buttonPin.

3. Teeb qhov twg koj cov arduino yuav tsum tawm los ntawm kev hais kom cov steppers (cov ntu no yuav sib txawv ntau ntawm H hom txuas raws li muaj ntau lub tsev qiv ntawv sib txawv uas lawv siv).

4. Txhua tus stepper ceev hauv RPMs hauv.setSpeed (Kuv tau teeb tsa kuv li 1 rpm thaum tig lub moos thiab 30 rpm thaum tig lub moos)

5. Teev pes tsawg zaus koj xav kom txhua tus ntawm koj cov steppers tig ua ntej nws txav mus (kuv cov steppers suav kaum feeb, yog li lawv tig kaum zaug ntawm 1 RPM).

6 Teeb sijhawm ntev npaum li cas koj xav kom nws tig rov qab.

#suav nrog

const int stepsPerRevolution = 200; // teeb tsa tas li pes tsawg kauj ruam nyob hauv txhua qhov kev hloov pauv ntawm kuv lub cav tsheb kauj vab

const int buttonPin = A0; // teeb tsa qhov tsis tu ncua ntawm kuv cov tswv yim khawm

Stepper thawj Stepper (cov kauj ruamPerRevolution, 2, 3, 4, 5); // pib lub tsev qiv ntawv stepper ntawm qee tus pin

Stepper thib ob Stepper (cov kauj ruamPerRevolution, 6, 7, 8, 9); Stepper thib peb Stepper (cov kauj ruamPerRevolution, 10, 11, 12, 13); Stepper thawj StepperBack (stepsPerRevolution, 2, 3, 4, 5); // rov pib dua lub tsev qiv ntawv stepper ntawm cov pins no tuaj yeem rov pib dua rpm rau thaum ceeb toom lub sijhawm ntawd tas sijhawm Stepper thib ob StepperBack (stepsPerRevolution, 6, 7, 8, 9); Stepper thib peb StepperBack (cov kauj ruamPerRevolution, 10, 11, 12, 13);

int feebCounter = 0; // int suav puv revolutions ntawm steppers

int timerState = LOW; // lub xeev tam sim no ntawm pomodoro timer (HIGH = on, LOW = off/reset) int buttonState; // kev nyeem ntawv tam sim no los ntawm tus lej nkag mus int lastButtonState = HIGH; // nyeem ntawv dhau los ntawm tus lej nkag

// qhov hloov pauv hauv qab no tsis tau kos npe ntev vim tias lub sijhawm, ntsuas hauv vib nas this, // yuav dhau los ua tus lej loj dua tuaj yeem khaws cia rau hauv int. unsigned ntev lastDebounceTime = 0; // lub sijhawm kawg tus pin tso tawm tau toggled unsigned ntev debounceDelay = 50; // lub sij hawm debounce; nce yog tias cov zis flickers

void teeb tsa () {

pinMode (buttonPin, INPUT_PULLUP); // teeb tsa qhov tsis tu ncua ntawm pob raws li kev nkag

thawjStepper.setSpeed (1); // teeb tsa qhov nrawm ntawm 1 rpm rau suav 10 feeb rau ib tus stepper thib ob Stepper.setSpeed (1); thib pebStepper.setSpeed (1); thawjStepperBack.setSpeed (30); // teeb tsa nrawm ntawm 30 rpm rau ceeb toom tias lub sijhawm tau tas sijhawm tom qab Pomodoro tau ua tiav thib obStepperBack.setSpeed (30); thib pebStepperBack.setSpeed (30);

Serial.begin (9600); // pib saib xyuas nrog 9600 baud tus nqi

}

void voj () {

// nyeem lub xeev ntawm qhov hloov mus rau qhov sib txawv hauv zos: int nyeem ntawv = digitalRead (buttonPin);

// txheeb xyuas seb koj nyuam qhuav nias lub pob

// (piv txwv li cov tswv yim mus los ntawm LOW mus rau HIGH), thiab koj tau tos // ntev txaus txij li qhov kawg nias kom tsis quav ntsej txog lub suab nrov:

// Yog tias qhov hloov pauv, vim muaj suab nrov lossis nias:

yog (nyeem ntawv! = lastButtonState) {// rov pib lub debouncing timer lastDebounceTime = millis (); } yog ((millis () - lastDebounceTime)> debounceDelay) {// xijpeem nyeem ntawv yog, nws tau nyob ntawd ntev dua // tshaj li qhov kev ncua deb, yog li coj nws raws li lub xeev tam sim no:

// yog tias lub xeev khawm tau hloov pauv:

yog (nyeem ntawv! = buttonState) {buttonState = nyeem ntawv;

// tsuas yog toggle lub timer activaton yog tias lub xeev khawm tshiab qhia tias nws raug nias

// nias ib zaug kom qhib, nias dua kom tua yog (buttonState == LOW) {timerState =! timerState; Serial.print ("Timer State yog"); Serial.println (timerState); }}}

yog (timerState == HIGH) {

Serial.println ("Pomodoro timer tau pib"); yog (feebCounter <11) {// yog tias tus nqi thib ob tam sim no txawv dua li tus nqi yav dhau los ces firstStepper.step (stepsPerRevolution); // tig stepper 200 cov kauj ruam/1 rev feebCounter ++; Serial.print ("feeb feeb yog"); Serial.println (feeb suav) }

yog (11 <= feebCounter && feebCounter <21) {// yog tias tus nqi thib ob tam sim no txawv dua li tus nqi yav dhau los ces secondStepper.step (stepsPerRevolution); // tig stepper 200 cov kauj ruam/1 rev feebCounter ++; Serial.print ("feeb feeb yog"); Serial.println (feeb suav) }

yog (21 <= feebCounter && feebCounter <31) {// yog tias tus nqi thib ob tam sim no txawv dua li tus nqi yav dhau los ces pebStepper.step (stepsPerRevolution); // tig stepper 200 kauj ruam/1 rev feebCounter ++; Serial.print ("feeb feeb yog"); Serial.println (feeb suav) }

yog (31 <= feebCounter && feebCounter <1031) {// yog tias tus nqi thib ob tam sim no txawv dua li tus nqi yav dhau los ces firstStepperBack.step (-1); // tig stepper rov qab 1 kauj ruam ua ntu zus kom zoo li txhua yam tau khiav ib txhij thib obStepperBack.step (-1); thib peb StepperBack.step (-1); feebCounter ++; Serial.print ("feeb feeb yog"); Serial.println (feeb suav) }} lwm {Serial.println ("Pomodoro timer is off"); } // txuag nyeem ntawv. Lwm lub sijhawm dhau los ntawm lub voj, // nws yuav yog qhov kawgButtonState: lastButtonState = nyeem ntawv; }

Kauj Ruam 3: Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau

Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau
Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau
Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau
Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau
Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau
Kauj Ruam 3: Muaj Steppers thiab Arduino Yog Koj Xav Tau

Kuv xaiv los tsim daim ntawv parallelogramic rau kuv lub moos. Daim ntawv no thiab cov khoom siv xaiv ntawm cov ntoo qhib liab tau tshoov siab los ntawm cov rooj tog niaj hnub ib nrab xyoo. Ib feem uas kuv muaj qhov nyuaj tshaj plaws yog ua kom haum cov steppers nrog kev hu los ntawm lawv lub qhov taub kom pom los ntawm.

Pom zoo: