કોડ શોધો

આર્ડુનોનો ઉપયોગ કરીને 30V DC મોટર સ્પીડ અથવા લોડને નિયંત્રિત કરવા માટે Mosfet Optocoupled HW-532 નો ઉપયોગ કેવી રીતે કરવો

આર્ડુનોનો ઉપયોગ કરીને 30V DC મોટર સ્પીડ અથવા લોડને નિયંત્રિત કરવા માટે Mosfet Optocoupled HW-532 નો ઉપયોગ કેવી રીતે કરવો

આ પ્રોજેક્ટ માર્ગદર્શિકા દર્શાવે છે કે કેવી રીતે Arduino અને HW-532 ઓપ્ટોકપલ્ડ MOSFET મોડ્યુલનો ઉપયોગ કરીને બહુમુખી DC મોટર સ્પીડ કંટ્રોલર બનાવવું. MOSFET FR120N , LR7843 અથવા D4184 હોઈ શકે છે. આ તમને 30V સુધીના વોલ્ટેજવાળી DC મોટરની ગતિ અને ચાલુ/બંધ સ્થિતિ નિયંત્રિત કરવાની મંજૂરી આપે છે. HW-532 મોડ્યુલ રક્ષણ અને અલગતા પ્રદાન કરે છે, જે મોટરને સીધી રીતે Arduino સાથે જોડવા કરતાં તેને વધુ સુરક્ષિત અને વિશ્વસનીય બનાવે છે.

આ પ્રોજેક્ટ વિવિધ એપ્લિકેશનો માટે મૂલ્યવાન છે. અહીં કેટલાક ઉદાહરણો છે:

  • રોબોટિક હાથની ગતિને ચોક્કસ રીતે નિયંત્રિત કરવી
  • કૂલિંગ સિસ્ટમ માટે ચલ-ગતિવાળો પંખો બનાવવો
  • સમાયોજિત હિલચાલ સાથે સ્વચાલિત મશીનરી બનાવવી
  • પ્રવાહી સિસ્ટમો માટે મોટરચાલિત વાલ્વ નિયંત્રણ વિકસાવવું

હાર્ડવેર/ઘટકો

મુખ્ય ઘટકો છે Arduino, HW-532 ઓપ્ટોકપલ્ડ MOSFET મોડ્યુલ (D4184, LR7843, અથવા FR120N જેવા MOSFET વિકલ્પો સાથે), એક DC મોટર (વોલ્ટેજ રેટિંગ ≤ 30V), કનેક્ટિંગ વાયર, અને વૈકલ્પિક રીતે, અદ્યતન નિયંત્રણ માટે પોટેન્શિયોમીટર અને પુશ-બટન સ્વિચ (વિડિયોમાં 19:34 પર).

HW-532 મોડ્યુલમાં MOSFET ની પસંદગી તમારી વર્તમાન જરૂરિયાતો પર આધારિત છે (વિડિયોમાં 01:24 પર). વિડિયો વિવિધ MOSFET ની વિગતવાર સરખામણી (વિડિયોમાં 06:50 પર) અને વિવિધ એપ્લિકેશનો માટે તેમની યોગ્યતા (વિડિયોમાં 09:45 પર) પ્રદાન કરે છે. મોડ્યુલને સુરક્ષિત રાખવા માટે DC મોટર જેવા ઇન્ડક્ટિવ લોડ માટે ડાયોડ શામેલ કરવાનું યાદ રાખો (વિડિયોમાં 06:00 અને 22:02 પર).

વાયરિંગ માર્ગદર્શિકા

મૂળભૂત વાયરિંગ મોટરના પોઝિટિવ ટર્મિનલને HW-532 ના આઉટપુટ સાથે, મોટરના નેગેટિવ ટર્મિનલને HW-532 ના ગ્રાઉન્ડ સાથે, અને HW-532 ના કંટ્રોલ પિનને Arduino ડિજિટલ પિન સાથે જોડે છે (વિડિયોમાં 11:16 પર).

Arduino wriing for HW-532 MOFET motor driver
પોટેન્શિયોમીટર અને પુશ બટનનો ઉપયોગ કરીને વધુ અદ્યતન નિયંત્રણ માટે, વિગતવાર વાયરિંગ ડાયાગ્રામ વિડિયોમાં બતાવવામાં આવ્યો છે (વિડિયોમાં 19:44 પર).

કોડ સમજૂતી

પ્રદાન કરેલ કોડ નિયંત્રણના ત્રણ સ્તરો પ્રદાન કરે છે:

Schematic for HW-532 using FR120N MOSFET
  1. ચાલુ/બંધ નિયંત્રણ: આ સરળ કોડ (વિડિયોમાં 15:05 પર) મોટરને ચાલુ અને બંધ કરવા માટે ડિજિટલ પિનનો ઉપયોગ કરે છે. વપરાશકર્તા-રૂપરેખાંકિત ભાગ MOTOR_OUT_PIN સ્થિરાંક છે, જે વ્યાખ્યાયિત કરે છે કે કયો Arduino પિન HW-532 મોડ્યુલને નિયંત્રિત કરે છે.
  2. PWM સ્પીડ નિયંત્રણ: આ કોડ (વિડિયોમાં 15:39 પર) મોટરની ગતિ નિયંત્રિત કરવા માટે પલ્સ વિડ્થ મોડ્યુલેશન (PWM) નો ઉપયોગ કરે છે. વપરાશકર્તા સ્પીડ નિયંત્રણની ઉપલી અને નીચલી મર્યાદા સેટ કરવા માટે SPEED_MAX અને SPEED_MIN સમાયોજિત કરી શકે છે, અને motorControl() અને stopMotor() ફંક્શનનો ઉપયોગ અનુક્રમે મોટરને નિયંત્રિત કરવા અને તેને રોકવા માટે થાય છે.
  3. પોટેન્શિયોમીટર અને પુશ-બટન નિયંત્રણ: આ કોડ (વિડિયોમાં 22:12 પર) પોટેન્શિયોમીટરથી મોટરની ગતિ નિયંત્રિત કરવા અને પુશ બટનથી તેને શરૂ/બંધ કરવાની મંજૂરી આપે છે. વપરાશકર્તા-રૂપરેખાંકિત ભાગોમાં POT_PIN (પોટેન્શિયોમીટર પિન), MOTOR_OUT_PIN (PWM કંટ્રોલ પિન), START_STOP_PIN (પુશ બટન પિન), SPEED_MAX, અને SPEED_MIN શામેલ છે.

લાઇવ પ્રોજેક્ટ/પ્રદર્શન

વિડિયો ત્રણેય કોડ ઉદાહરણોની કામગીરી દર્શાવે છે. ચાલુ/બંધ નિયંત્રણ બતાવવામાં આવ્યું છે (વિડિયોમાં 11:41 પર), ત્યારબાદ PWM સ્પીડ નિયંત્રણ (વિડિયોમાં 16:53 પર), અને છેલ્લે, પોટેન્શિયોમીટર અને પુશ-બટન નિયંત્રણ (વિડિયોમાં 23:02 પર).

પ્રકરણો

  • [00:00] પરિચય અને પ્રોજેક્ટ ઝાંખી
  • [01:24] HW-532 મોડ્યુલ અને MOSFET વિકલ્પો
  • [03:23] સર્કિટ સ્કીમેટિક અને સમજૂતી
  • [05:11] ઘટક વિગતો
  • [06:50] MOSFET ડેટાશીટ વિશ્લેષણ
  • [11:16] મૂળભૂત વાયરિંગ અને ચાલુ/બંધ પ્રદર્શન
  • [15:05] ચાલુ/બંધ નિયંત્રણ માટે Arduino કોડ
  • [15:39] PWM સ્પીડ નિયંત્રણ માટે Arduino કોડ
  • [19:34] પોટેન્શિયોમીટર અને પુશ બટન સાથે વાયરિંગ
  • [22:12] પોટેન્શિયોમીટર અને પુશ બટન સાથે Arduino કોડ

છબીઓ

Schematic for HW-532 using FR120N MOSFET
Schematic for HW-532 using FR120N MOSFET
HW-532_driver_module-1
HW-532_driver_module-1
HW-532_driver_module-2
HW-532_driver_module-2
HW-532_driver_module-4
HW-532_driver_module-4
HW-532_driver_module-5
HW-532_driver_module-5
Arduino wriing for HW-532 MOFET motor driver
Arduino wriing for HW-532 MOFET motor driver
792-Code 1- Switch: Optocoupled HW-532 to control using MOSFET FR120N , LR7843
ભાષા: C++
/* 
* Lesson 108-1: In this lesson we learn how to use  the module with FR120N , LR7843 and D4184 MOSFET to turn ON/OFF DC load up to up to 10A. HW-532 optically isolated from 5V to 30V load up to 10A depending on the module. Schematic shown, wiring diagram explained, different 
method of wiring with push button and potentiometer also shown. 
Video https://youtu.be/eqXaqRFAWrA
 
Written by Ahmad Shamshiri for RoboJax.com
// Published on Aug 25, 2022 in Aajx, ON, Canada.

 
  Project 1: Turning ON/OFF a motor or load (this project)
  Project 2: Controllign Speed using Arduino code
  Project 3: Controllign Speed using potentiometer and a push button

  * Watch Video instrution for this code: https://youtu.be/eqXaqRFAWrA
  * 
  * This code is part of Arduino Step by Step Course which starts here:  https://youtu.be/-6qSrDUA5a8
  * 
  * for library of this code visit http://robojax.com/
  * 
 If you found this tutorial helpful, please support me so I can continue creating 
 content like this. Make a donation using PayPal by credit card https://bit.ly/donate-robojax 
 

 
  *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
  * This code has been download from Robojax.com
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <https://www.gnu.org/licenses/>.

 */



const int MOTOR_OUT_PIN=2;


void setup() {
    //Robojax  MOSFET Motor driver code
  Serial.begin(9600);
  Serial.println("Robojax LR7834 ,  Arduino");

  pinMode(MOTOR_OUT_PIN, OUTPUT);
  digitalWrite(MOTOR_OUT_PIN, HIGH);

  
}

// the loop routine runs over and over again forever:
void loop() {
 

    //Robojax XY-GMOS MOSFET Motor driver code
}//loop end
793-Code 2- PWM: Optocoupled HW-532 to control using MOSFET FR120N , LR7843
ભાષા: C++
# include <Arduino_LSM6DS3.h>

/* 
* Lesson 108-2: In this lesson we learn how to use  the module with FR120N , LR7843 and D4184 MOSFET to turn ON/OFF DC load up to up to 10A. HW-532 optically isolated from 5V to 30V load up to 10A depending on the module. Schematic shown, wiring diagram explained, different 
method of wiring with push button and potentiometer also shown. 
Video https://youtu.be/eqXaqRFAWrA
Get code for this project from https://robojax.com/RJT797
 
Written by Ahmad Shamshiri for RoboJax.com
// Published on Aug 25, 2022 in Aajx, ON, Canada.

 
  Project 1: Turning ON/OFF a motor or load (this project)
  Project 2: Controlling Speed using Arduino code
  Project 3: Controlling Speed using potentiometer and a push button

  * Watch Video instruction for this code:https://youtu.be/eqXaqRFAWrA
  * 
  * This code is part of Arduino Step by Step Course which starts here:  https://youtu.be/-6qSrDUA5a8
  * 
  * for library of this code visit http://robojax.com/
  * 
 If you found this tutorial helpful, please support me so I can continue creating 
 content like this. Make a donation using PayPal by credit card https://bit.ly/donate-robojax 
 

 
  *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
  * This code has been download from Robojax.com
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <https://www.gnu.org/licenses/>.

 */


const int MOTOR_OUT_PIN = 3;

const int SPEED_MAX = 100;// in %
const int SPEED_MIN = 0;//in %

const int STOP=0;
const int RUN=1;
int motorState=RUN;//
int motorSpeed = 0;//between 0 to 100%.
//video instruction https://youtu.be/eqXaqRFAWrA


void setup() {
    //Robojax XY-GMOS MOSFET Motor driver code
  Serial.begin(9600);
  Serial.println("Robojax XY-GMOS Motor,  Arduino");

  pinMode(MOTOR_OUT_PIN, OUTPUT);

  
}//setup ends

// the loop routine runs over and over again forever:
void loop() {


//video https://youtu.be/eqXaqRFAWrA
  motorControl(50);//run motor at 50%
  delay(5000);//keep it running for 5000ms or 5 seconds
   stopMotor();//stop the motor
  delay(3000);//keep it stopped for 5000ms or 5 seconds

  for(int i=0; i<100; i++)
  {
    motorControl(i);
    delay(200);
  }
  stopMotor();//stop motor
  delay(3000);//keep it stopped for 5000ms or 5 seconds

   for(int i=100; i >0; i--)
  {
    motorControl(i);
    delay(200);
  } 

    //Robojax LR7843 MOSFET Motor driver code
}//loop end


/*
 * motorControl(int s)
 * @brief controls the motor with the value s
 * @param return nothing
 * @param "type" is character

 * on May 08, 2020 at 02:36 in Ajax, Ontario, Canada
 */
void motorControl(int s)
{
    //Robojax LR7843 MOSFET Motor driver code
    //video https://youtu.be/eqXaqRFAWrA
  int k = map(s, SPEED_MIN, SPEED_MAX, 0, 255);
  Serial.print("Speed: "); Serial.print(s);Serial.println("%");
  analogWrite(MOTOR_OUT_PIN, k);
}//motorControl


/*
 * stopMotor()
 * @brief stops the motor
 * @param return nothing
 * @param 

 * on May 08, 2020 at 02:36 in Ajax, Ontario, Canada
 */
void stopMotor(){
    //Robojax XY-GMOS MOSFET Motor driver code
  analogWrite( MOTOR_OUT_PIN, 0);
  Serial.println("STOPPED");
}//stopMotor()
794-Code 3- Potentiometer: Optocoupled HW-532 to control using MOSFET FR120N , LR7843
ભાષા: C++
/* 
 * Lesson 108-3: Controlling Speed of motor using Variable Resistor (potentiometer) and using Start/Stop push button with Arduino.
 * 
 * In this lesson we learn how to use  the module with FR120N , LR7843 and D4184 MOSFET to turn ON/OFF DC load up to up to 10A. HW-532 optically isolated from 5V to 30V load up to 10A depending on the module. Schematic shown, wiring diagram explained, different 
 method of wiring with push button and potentiometer also shown. 
 Video https://youtu.be/eqXaqRFAWrA
   Get codes for this project from https://robojax.com/RJT797
 Written by Ahmad Shamshiri for RoboJax.com
 // Published on Aug 25, 2022 in Aajx, ON, Canada.
 
  
   Project 1: Turning ON/OFF a motor or load -
   Project 2: Controlling Speed using Arduino code 
   Project 3: Controlling Speed using potentiometer and a push button (this project)
 
   * Watch Video instruction for this code:https://youtu.be/eqXaqRFAWrA
   * 
   * This code is part of Arduino Step by Step Course which starts here:  https://youtu.be/-6qSrDUA5a8
   * 
   * for library of this code visit http://robojax.com/
   * 
  If you found this tutorial helpful, please support me so I can continue creating 
  content like this. Make a donation using PayPal by credit card https://bit.ly/donate-robojax 
  
 
  
   *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
   * This code has been download from Robojax.com
      This program is free software: you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation, either version 3 of the License, or
      (at your option) any later version.
  
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
  
      You should have received a copy of the GNU General Public License
      along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
  */
 
const int POT_PIN =A0;//can change
const int MOTOR_OUT_PIN = 3;//~
const int START_STOP_PIN=2;//for push button switch

const int SPEED_MAX = 100;// in %
const int SPEED_MIN = 0;//in %
  //video instruction https://youtu.be/eqXaqRFAWrA

const int STOP=0;
const int RUN=1;
int motorState=RUN;//
int motorSpeed = 0;//between 0 to 100%.

void pushButton();
void setup() {
    //Robojax XY-GMOS MOSFET Motor driver code
  Serial.begin(9600);
  Serial.println("Robojax XY-GMOS Motor,  Arduino");
  pinMode(START_STOP_PIN, INPUT_PULLUP);
  pinMode(MOTOR_OUT_PIN, OUTPUT);
    //video instruction https://youtu.be/eqXaqRFAWrA

  
}

// the loop routine runs over and over again forever:
void loop() {

 pushButton();
 int potValue =analogRead(POT_PIN);
 int speedPercent = map(potValue, 0, 1023, 0, 100);

 if(motorState ==RUN)
 {
  motorControl(speedPercent);
 }else{
  stopMotor();
 }


  delay(500);
    //Robojax XY-GMOS MOSFET Motor driver code
      //video instruction https://youtu.be/eqXaqRFAWrA
}//loop end


/*
 * motorControl(int s)
 * @brief controls the motor with the value s
 * @param return nothing
 * @param "type" is character

 * on May 08, 2020 at 02:36 in Ajax, Ontario, Canada
 */
void motorControl(int s)
{
    //Robojax LR7843 MOSFET Motor driver code
      //video instruction https://youtu.be/eqXaqRFAWrA
  int k = map(s, SPEED_MIN, SPEED_MAX, 0, 255);
  Serial.print("Speed: "); Serial.print(s);Serial.println("%");
  analogWrite(MOTOR_OUT_PIN, k);
}//motorControl



/*
 * stopMotor()
 * @brief stops the motor
 * @param return nothing
 * @param 

 * on May 08, 2020 at 02:36 in Ajax, Ontario, Canada
 */
void stopMotor(){
    //Robojax XY-GMOS MOSFET Motor driver code
      //video instruction https://youtu.be/eqXaqRFAWrA
  analogWrite( MOTOR_OUT_PIN, 0);
  Serial.println("STOPPED");
}//stopMotor()



/*
 * pushButton()
 * @brief reads the push button
 * @param return nothing
 * @param 

 * on May 08, 2020 at 02:36 in Ajax, Ontario, Canada
 */
void pushButton()
{
  //Robojax XY-GMOS MOSFET Motor driver code
  //video instruction https://youtu.be/eqXaqRFAWrA
  if(digitalRead(START_STOP_PIN) ==LOW)
  {
    motorState =!motorState;
    delay(100);
  }
  
}//pushButton()

તમને જોઈતી વસ્તુઓ

સંસાધનો અને સંદર્ભો

હજી સુધી કોઈ સંસાધનો નથી.

ફાઇલો📁

ડેટાશીટ (pdf)

Fritzing ફાઇલ

અન્ય ફાઇલો