Cov txheej txheem:
Video: Arduino RGB LED Sawb Controller: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Feem ntau thaum tib neeg xav tswj lawv cov RGB LED sawb nrog Arduino, peb lub zog ntsuas tau siv los sib xyaw xim liab, ntsuab thiab xiav. Qhov no ua haujlwm thiab tuaj yeem ua tiav zoo rau koj cov kev xav tau, tab sis kuv xav ua qee yam kom nkag siab zoo dua, qee yam zoo li lub log xim.
Txoj haujlwm no zoo li yog daim ntawv thov zoo tshaj plaws rau tus lej nkag teb chaws. Nov yog lub cuab yeej uas hloov cov lus tsa suab ntawm nws cov ncej mus rau cov khoom siv digital. Thaum lub taub hau tig, tus xa ntawv xa tawm lub teeb liab (mem tes) uas tuaj yeem ntsuas los ntawm Arduino. Yog xav paub ntau ntxiv txog cov teb encoders, koj tuaj yeem saib cov vis dis aus no uas piav qhia nws ntau zuj zus.
Hauv Cov Lus Qhia no kuv yuav qhia koj yuav ua li cas thiaj ua tau Arduino RGB LED sawb tswj los ntawm kev siv lub cav nkag teb chaws. Cov lus qhia no suav nrog kev tsim cov phiaj xwm hluav taws xob ntawm lub khob cij. Txawm li cas los xij koj tuaj yeem tsim koj tus kheej PCB thiaj li tsim tau daim thaiv npog Arduino!
Kauj Ruam 1: Qhov Chaw
Rau RGB LED sawb tswj koj yuav xav tau cov ntaub ntawv hauv qab no:
- 1 x Arduino Nano
- 3x IRLB8721PBF, ib qho N-channel logic qib MOSFET yuav ua ntev npaum li nws tau ntsuas qis kawg ntawm 12V thiab tam sim no koj cov hlua LED tau siv.
- 1 x Rotary encoder
- 1x 12V 2A fais fab mov, tam sim no lub zog xa khoom yuav tsum xa tuaj yuav nyob ntawm qhov ntev ntawm kev siv LED sawb.
- 16x Txiv neej rau txiv neej jumper xov hlau
- 1x Solderless breadboard, txhua lub khob cij yuav ua ntev npaum li nws loj txaus.
Kauj ruam 2: Circuit Court
Txuas Arduino mus rau 12V thiab GND txoj kev tsheb nqaj hlau. Tom qab ntawd txuas rau lwm qhov raws li hauv qab no:
Teb encoder
Pin A - D4
Pin B - D3
GND - NCO
MOSFET Liab
Rooj vag - GND
Ntws - LED sawb liab hlau
Tau qhov twg los - D11
MOSFET GreenGate - GND
Ntws - LED sawb ntsuab xaim
Tau qhov twg los - D9
MOSFET BlueGate - GND
Ntws - LED sawb xiav hlau
Tau qhov twg los - D6
Kauj ruam 3: Code
// Arduino PWM pin
int redPin = 11; int greenPin = 6; int bluePin = 9; // Arduino encoder pins int encoderPinA = 3; int encoderPinB = 4; // Xim hloov xim int colorVal; koj redVal; koj greenVal; koj blueVal; // Encoder hloov pauv int encoderPos; int encoderPinACurrent; int encoderPinALast = HIGH; // Lwm int txee; teeb tsa tsis muaj dab tsi () {pinMode (encoderPinA, INPUT_PULLUP); pinMode (encoderPinB, INPUT_PULLUP); } void loop () {readEncoder (); encoder2rgb (txee); analogWrite (redPin, redVal); analogWrite (greenPin, ntsuabVal); analogWrite (bluePin, blueVal); } int readEncoder () {encoderPinACurrent = digitalRead (encoderPinA); yog ((encoderPinALast == LOW) && (encoderPinACurrent == HIGH)) {yog (digitalRead (encoderPinB) == LOW) {encoderPos = encoderPos - 1; } lwm {encoderPos = encoderPos + 1; }} encoderPinALast = encoderPinACurrent; txee = encoderPos*8; yog (txee 1535) {txee = 0; } rov qab txee; } int encoder2rgb (int counterVal) {// Liab rau daj yog (counterVal <= 255) {colorVal = counterVal; redVal = 255; ntsuabVal = colorVal; blueVal = 0; } // Daj rau ntsuab dua yog tias (counterVal <= 511) {colorVal = counterVal - 256; redVal = 255 - colorVal; greenVal = 255; blueVal = 0; } // Ntsuab mus rau lwm yam xim yog (counterVal <= 767) {colorVal = counterVal - 512; redVal = 0; greenVal = 255; blueVal = ximVal; } // Cyan rau xiav lwm tus yog (counterVal <= 1023) {colorVal = counterVal - 768; redVal = 0; ntsuabVal = 255 - colorVal; blueVal = 255; } // Xiav rau magenta lwm yog (counterVal <= 1279) {colorVal = counterVal - 1024; redVal = ximVal; ntsuabVal = 0; blueVal = 255; } // Magenta rau liab ntxiv {colorVal = counterVal - 1280; redVal = 255; ntsuabVal = 0; blueVal = 255 - colorVal; } rov redVal, ntsuabVal, blueVal; }
Pom zoo:
RGB Led Sawb Bluetooth Controller V3 + Music Sync + Ambient Light Control: 6 Cov Kauj Ruam (nrog Duab)
RGB Led Sawb Bluetooth Controller V3 + Music Sync + Ambient Light Control: Txoj haujlwm no siv arduino los tswj RGB coj sawb nrog koj lub xov tooj ntawm bluetooth. Koj tuaj yeem hloov xim, ua teeb sib txuas nrog suab paj nruag lossis ua rau lawv pib kho rau lub teeb pom kev ib puag ncig
DIY LED Sawb: Yuav Txiav Li Cas, Txuas, Cuam Tshuam thiab Hwjchim LED Sawb: 3 Kauj Ruam (nrog Duab)
DIY LED Sawb: Yuav Ua Li Cas Txiav, Txuas, Cuam Tshuam thiab Lub Hwj Huam LED Sawb: Pib qhia rau koj tus kheej lub teeb pom kev zoo siv LED sawb.Flexible ntseeg tau thiab siv tau yooj yim, LED strips yog qhov kev xaiv zoo tshaj plaws rau ntau yam kev thov.Kuv yuav npog cov hauv paus ntawm kev txhim kho yooj yim sab hauv tsev 60 LED's/m LED sawb, tab sis
LED Sawb Brightness Controller: 4 Cov Kauj Ruam
LED Sawb Brightness Controller: LED Strips muaj npe thoob plaws ntiaj teb rau nws kev siv hluav taws xob qis thiab nws qhov ci ci. kaj
ESP8266 RGB LED Sawb WIFI Tswj - NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi - RGB LED Sawb Smartphone Tswj: 4 Cov Kauj Ruam
ESP8266 RGB LED Sawb WIFI Tswj | NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi | RGB LED Sawb Smartphone Tswj: Nyob zoo cov neeg hauv qhov kev qhia no peb yuav kawm paub siv nodemcu lossis esp8266 li IR chaw taws teeb los tswj RGB LED sawb thiab Nodemcu yuav raug tswj los ntawm smartphone dhau wifi. Yog li hauv paus koj tuaj yeem tswj RGB LED Sawb nrog koj lub xov tooj
Arduino DIY Bluetooth Controller LED RGB Sawb: 4 Cov Kauj Ruam
Arduino DIY Bluetooth Controller LED RGB Sawb: Nyob zoo txhua tus, qhov no yog qhov haujlwm thib ob kuv xav qhia rau koj! Hnub no kuv yuav qhia koj yuav ua li cas txuas Arduino thiab Bluetooth module thiab tom qab siv nws los tswj LED RGB Sawb. yuav siv HC-06 Bluetooth Module, vim nws yog