資料介紹
描述
此 Arduino 線性致動(dòng)器教程展示了如何使用 Arduino 兼容板和各種輸入傳感器控制Firgelli 小型線性致動(dòng)器,包括用于直接控制的滑塊和旋轉(zhuǎn)旋鈕、用于增量移動(dòng)的操縱桿以及具有預(yù)設(shè)位置的三個(gè)按鈕(在代碼中預(yù)設(shè))每個(gè)位置都分配給一個(gè)按鈕,因此當(dāng)用戶按下按鈕時(shí),小型線性執(zhí)行器會(huì)移動(dòng)到該位置)。
對于 Arduino 線性執(zhí)行器項(xiàng)目,F(xiàn)irgelli 的小型線性執(zhí)行器非常出色。這些線性執(zhí)行器有一個(gè)內(nèi)部控制器,允許它們像伺服一樣操作。通過使用 Arduino 伺服庫,我們可以簡單地向執(zhí)行器發(fā)送所需的位置,然后它移動(dòng)到該位置。

所有部件都可以在RobotGeek Arduino 線性執(zhí)行器實(shí)驗(yàn)者套件中一起找到,或者單獨(dú)獲得。
第 1 步:接線

?

請注意,您必須將線性致動(dòng)器物理插入不同的端口才能使用不同的控件移動(dòng)它。如果您有多個(gè)線性執(zhí)行器,您可以使用此代碼同時(shí)控制多達(dá) 4 個(gè)。
第 2 步:將代碼上傳到您的 Arduino
您可以在RobotGeek 庫和工具中的以下位置找到此演示代碼:
RobotGeekSketches -> Demos -> LinearActuator -> linearActuatorExpDemo -> linearActuatorExpDemo.ino
		這段代碼將幫助我們完成接下來的三個(gè)部分。根據(jù)您正在學(xué)習(xí)的教程部分,您將被要求將線性致動(dòng)器插入不同的引腳。
/***********************************************************************************
 *           RobotGeek Linear Actuator Experimenter's Kit Demo   
 *        ________   
 *       |        \---------\___________________________
 *     __|                  |                          ||--------------------|__
 *    (o |  FIRGELLI        |                        o ||____________________| o)
 *       |__________________/--------------------------||                   
 * 
 *
 *  The following sketch will allow you to control a Firgelli Linear actuator using
 *  the RobotGeek Slider, RobotGeek Knob, RobotGeek Joystick, and RobotGeek Pushbuttons
 *
 *  http://www.robotgeek.com/robotgeek-experimenters-kit-linear-actuator
 *  
 *    
 *  Wiring
 *    Linear Actuator - Digital Pin 6, 9, 10, and/or 11
 *
 *    Knob            - Analog Pin 0
 *    Joystick        - Analog Pin 1 
 *    Slider          - Analog Pin 2
 *    
 *    Pushbutton      - Digital Pin 2
 *    Pushbutton      - Digital Pin 4
 *    Pushbutton      - Digital Pin 7
 *    
 *    Jumpers for pins 3/5/6 and 9/10/11 should be set to 'VIN'
 *  
 *
 *  Control Behavior:
 *    Moving the slider or knob will move the linear actuator keeping absolute position.
 *    Moving the joystick will move the linear actuator incrementally.
 *    Pressing one of the buttons will move the linear actuator to a predetermined position.
 *
 ***********************************************************************************/
//Includes
#include  //Servo Library can be used for Firgelli Mini Linear Actuators
//Linear Actuator Pins
const int LINEARPIN_BUTTON = 6;        //Linear Actuator on Digital Pin 6
const int LINEARPIN_KNOB = 9;          //Linear Actuator on Digital Pin 9
const int LINEARPIN_SLIDER = 10;       //Linear Actuator on Digital Pin 10
const int LINEARPIN_JOYSTICK = 11;     //Linear Actuator on Digital Pin 11
//Analog Input Pins
const int KNOB_PIN = 0;       //Knob on Analog Pin 0
const int JOYSTICK_PIN = 1;   //Joystick (vertical) on Analog Pin 1
const int SLIDER_PIN = 2;     //Slider on Analog Pin 2
//Digital Input Pins 
const int BUTTON1_PIN = 2;     //Button 1 on Digital Pin 2
const int BUTTON2_PIN = 4;     //Button 2 on Digital Pin 4
const int BUTTON3_PIN = 7;     //Button 3 on Digital Pin 7
//Generic deadband limits - not all joystics will center at 512, so these limits remove 'drift' from joysticks that are off-center.
const int DEADBAND_LOW = 482;   //decrease this value if drift occurs, increase it to increase sensitivity around the center position
const int DEADBAND_HIGH = 542;  //increase this value if drift occurs, decrease it to increase sensitivity around the center position
//Max/min pulse values in microseconds for the linear actuators
const int LINEAR_MIN = 1050;        
const int LINEAR_MAX = 2000;         
// variables will change:
int button1State = 0;         // variable for reading the pushbutton status
int button2State = 0;         // variable for reading the pushbutton status
int button3State = 0;         // variable for reading the pushbutton status
Servo linearKnob, linearSlider, linearButton, linearJoystick;  // create servo objects to control the linear actuators
int knobValue, sliderValue, joystickValue;                     //variables to hold the last reading from the analog pins. The value will be between 0 and 1023
int valueMapped;                                               // the joystick values will be changed (or 'mapped') to new values to be sent to the linear actuator.
//variables for current positional value being sent to the linear actuator. 
int linearValue_Knob = 1500;                                   
int linearValue_Slider = 1500;    
int linearValue_Button = 1500;
int linearValue_Joystick = 1500; 
int speed = 2;
void setup() 
{ 
  //initialize linear actuators as servo objects
  linearKnob.attach(LINEARPIN_KNOB);      // attaches/activates the linear actuator as a servo object 
  linearSlider.attach(LINEARPIN_SLIDER);  // attaches/activates the linear actuator as a servo object 
  linearButton.attach(LINEARPIN_BUTTON);  // attaches/activates the linear actuator as a servo object 
  linearJoystick.attach(LINEARPIN_JOYSTICK);  // attaches/activates the linear actuator as a servo object 
  //Analog pins do not need to be initialized
  
  //use the writeMicroseconds to set the linear actuators to their default positions
  linearKnob.writeMicroseconds(linearValue_Knob); 
  linearSlider.writeMicroseconds(linearValue_Slider);
  linearButton.writeMicroseconds(linearValue_Button);
  linearJoystick.writeMicroseconds(linearValue_Joystick);
} 
void loop() 
{ 
//Preset Positions for Button Control
  // if the pushbutton is pressed set the linear value
  button1State = digitalRead(BUTTON1_PIN);
  if (button1State == HIGH) {    
    // set the position value  
    linearValue_Button = 1300;  
  } 
  button2State = digitalRead(BUTTON2_PIN);
  if (button2State == HIGH) {     
    // set the position value   
    linearValue_Button = 1500;  
  } 
  button3State = digitalRead(BUTTON3_PIN);  
  if (button3State == HIGH) {     
    // set the position value   
    linearValue_Button = 1700;  
  }   
//Analog Direct Control 
  //read the values from the analog sensors
  knobValue = analogRead(KNOB_PIN);
  sliderValue = analogRead(SLIDER_PIN);
  linearValue_Knob = map(knobValue, 0, 1023, LINEAR_MAX, LINEAR_MIN); //Map analog value from the sensor to the linear actuator
  linearValue_Slider = map(sliderValue, 0, 1023, LINEAR_MAX, LINEAR_MIN); //Map analog value from the sensor to the linear actuator
//Incremental Joystick Control
  joystickValue = analogRead(JOYSTICK_PIN); //read the values from the joystick
  //only update if the joystick is outside the deadzone (i.e. moved oustide the center position)
   if(joystickValue > DEADBAND_HIGH || joystickValue < DEADBAND_LOW)
   {
     valueMapped = map(joystickValue, 0, 1023, speed, -speed); //Map analog value from native joystick value (0 to 1023) to incremental change (speed to -speed).
     linearValue_Joystick = linearValue_Joystick + valueMapped; //add mapped joystick value to present Value
     
     linearValue_Joystick = constrain(linearValue_Joystick, LINEAR_MIN, LINEAR_MAX);  //
   }
//Use the writeMicroseconds to set the linear actuator to its new position
  linearKnob.writeMicroseconds(linearValue_Knob); 
  linearSlider.writeMicroseconds(linearValue_Slider);
  linearButton.writeMicroseconds(linearValue_Button);
  linearJoystick.writeMicroseconds(linearValue_Joystick);
  delay(10);
} 
		第 3 步:模擬直接控制
對于本節(jié):
			要使用旋轉(zhuǎn)旋鈕,請將線性執(zhí)行器插入Digital Pin 9
			要使用滑塊,請將線性執(zhí)行器插入Digital Pin 10
那么這是怎么回事?我們正在將模擬傳感器的絕對位置映射到執(zhí)行器位置。這是有道理的,您將旋轉(zhuǎn)旋鈕或滑塊移動(dòng)到一個(gè)位置,并且線性執(zhí)行器與該位置匹配。
			想看廢話嗎?將操縱桿插入Analog Pin 0 ,將線性執(zhí)行器插入Digital Pin 9 。操縱桿始終返回到中心位置,導(dǎo)致線性執(zhí)行器匹配并返回到其中心值。如果您想使用操縱桿將線性致動(dòng)器移動(dòng)到中心以外的位置,那么這并不是那么有用,這將我們帶到下一節(jié)。在繼續(xù)之前,請確保將傳感器恢復(fù)到原來的引腳。
如果您想要僅涵蓋本教程這一部分的草圖,可以在此處找到它。
第 4 步:增量控制
對于本節(jié):
			要使用操縱桿,請將線性執(zhí)行器插入Digital Pin 11
那么這是怎么回事?這一次,我們不是直接映射到操縱桿的值,而是使用操縱桿來增加線性致動(dòng)器的位置,這樣我們就可以放開操縱桿,讓線性致動(dòng)器保持在上次放置的位置。
如果您想要僅涵蓋本教程這一部分的草圖,可以在此處找到它。
第 5 步:預(yù)設(shè)控件
對于本節(jié):
			要使用按鈕,請將線性執(zhí)行器插入Digital Pin 6
那么這是怎么回事?在這一部分中,我們使用按鈕按下將線性執(zhí)行器發(fā)送到預(yù)定義的位置。當(dāng)您知道在輸入定義的情況下您希望線性致動(dòng)器處于什么位置時(shí),這非常簡單且非常有用。
如果您想要僅涵蓋本教程這一部分的草圖,可以在此處找到它。
第 6 步:下一步是什么?
現(xiàn)在您知道了三種控制直線推桿的方法。你能想到可以從中受益的項(xiàng)目嗎?您有想要自動(dòng)打開的盒子嗎?您將如何使用線性致動(dòng)器來做到這一點(diǎn)?人體的所有肌肉都是生物線性致動(dòng)器。你能做一個(gè)模仿這個(gè)的機(jī)械臂嗎?做一張可以傾斜的桌子怎么樣?我們很想聽聽您的項(xiàng)目!去創(chuàng)造吧!
- BeagleBone Black Wireless、MotorCape和線性執(zhí)行器
 - 從單個(gè)Arduino輸出引腳控制多個(gè)繼電器或其他執(zhí)行器
 - 怎么樣設(shè)計(jì)機(jī)器人的末端執(zhí)行器 6次下載
 - 汽車控制系統(tǒng)的基本介紹,包括傳感器輸入,控制器及執(zhí)行器詳細(xì)概述 32次下載
 - 歐瑪部分回轉(zhuǎn)電動(dòng)執(zhí)行器SG05.1–SG12.1使用說明 22次下載
 - 電動(dòng)執(zhí)行器的功能及應(yīng)用 19次下載
 - 具有執(zhí)行器飽和與隨機(jī)非線性擾動(dòng)的離散系統(tǒng)模型預(yù)測控制_石宇靜 0次下載
 - 控制儀表及計(jì)算機(jī)控制裝置--執(zhí)行器理論知識(shí) 0次下載
 - 基于LPC2132的電動(dòng)執(zhí)行器雙核控制系統(tǒng)的設(shè)計(jì) 49次下載
 - 執(zhí)行器的選擇
 - 基于HART協(xié)議的智能執(zhí)行器接口卡的開發(fā)
 - 基于神經(jīng)網(wǎng)絡(luò)的電動(dòng)執(zhí)行器狀態(tài)診斷
 - 基于現(xiàn)場總線的智能執(zhí)行器控制網(wǎng)絡(luò)
 - 基于單片機(jī)的電動(dòng)執(zhí)行器控制系統(tǒng)的開發(fā)
 - 全數(shù)字電動(dòng)執(zhí)行器的開發(fā)與應(yīng)用
 
- 機(jī)電執(zhí)行器概述和演變 948次閱讀
 - 智能變頻電動(dòng)執(zhí)行器的電流檢測電路介紹 3970次閱讀
 - 多層壓電執(zhí)行器的應(yīng)用 1499次閱讀
 - 使用DAC精確控制線性執(zhí)行器 2017次閱讀
 - 電動(dòng)執(zhí)行器的結(jié)構(gòu)原理和常見故障分析 1.6w次閱讀
 - 觸覺反饋設(shè)計(jì)中常用的執(zhí)行器 2333次閱讀
 - 如何使用Arduino控制大型線性執(zhí)行器 2166次閱讀
 - 氣動(dòng)執(zhí)行器的組成_氣動(dòng)執(zhí)行器選型 4072次閱讀
 - 氣動(dòng)執(zhí)行器的常見故障和解決方法 7540次閱讀
 - 執(zhí)行器故障原因及檢修 1w次閱讀
 - 執(zhí)行器由什么組成_執(zhí)行器的工作原理 1.1w次閱讀
 - 執(zhí)行器是什么_執(zhí)行器的主要作用 1.7w次閱讀
 - 電熱執(zhí)行器的作用 1.3w次閱讀
 - 電熱執(zhí)行器是什么_電熱執(zhí)行器工作原理 1.9w次閱讀
 - 汽車控制系統(tǒng)中的電子控制單元和傳感器以及執(zhí)行器 9069次閱讀
 
下載排行
本周
- 1PFC電路與BOOST電路設(shè)計(jì)實(shí)例分享
 - 1.83 MB | 12次下載 | 4 積分
 - 2世平基于靈動(dòng)微 SPIN560C 的低壓無刷電機(jī)應(yīng)用方案
 - 10.93 MB | 11次下載 | 免費(fèi)
 - 3電源測試報(bào)告-基于 國民技術(shù) N32L406 和杰華特 JW3376+3330 的 BMS 方案
 - 6.47 MB | 11次下載 | 免費(fèi)
 - 4PWM控制器的控制方法
 - 0.39 MB | 3次下載 | 4 積分
 - 5電流檢測芯片F(xiàn)P135應(yīng)用說明
 - 1.24 MB | 3次下載 | 免費(fèi)
 - 6全面解讀被動(dòng)式與主動(dòng)式PFC電路
 - 1.27 MB | 1次下載 | 4 積分
 - 7HC88L051F4低功耗芯片規(guī)格書
 - 4.76 MB | 1次下載 | 免費(fèi)
 - 8CIU32D655x5數(shù)據(jù)手冊
 - 2.14 MB | 1次下載 | 免費(fèi)
 
本月
- 1常用電子元器件使用手冊
 - 2.40 MB | 52次下載 | 免費(fèi)
 - 2高功率密度碳化硅MOSFET軟開關(guān)三相逆變器損耗分析
 - 2.27 MB | 33次下載 | 10 積分
 - 3PFC電路與BOOST電路設(shè)計(jì)實(shí)例分享
 - 1.83 MB | 12次下載 | 4 積分
 - 4世平基于靈動(dòng)微 SPIN560C 的低壓無刷電機(jī)應(yīng)用方案
 - 10.93 MB | 11次下載 | 免費(fèi)
 - 5電源測試報(bào)告-基于 國民技術(shù) N32L406 和杰華特 JW3376+3330 的 BMS 方案
 - 6.47 MB | 11次下載 | 免費(fèi)
 - 6USB拓展塢PCB圖資料
 - 0.57 MB | 11次下載 | 免費(fèi)
 - 7MS1826 HDMI 多功能視頻處理器數(shù)據(jù)手冊
 - 4.51 MB | 9次下載 | 免費(fèi)
 - 8HAL9303線性霍爾效應(yīng)傳感器技術(shù)手冊
 - 0.70 MB | 9次下載 | 免費(fèi)
 
總榜
- 1matlab軟件下載入口
 - 未知 | 935134次下載 | 10 積分
 - 2開源硬件-PMP21529.1-4 開關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設(shè)計(jì)
 - 1.48MB | 420064次下載 | 10 積分
 - 3Altium DXP2002下載入口
 - 未知 | 233089次下載 | 10 積分
 - 4電路仿真軟件multisim 10.0免費(fèi)下載
 - 340992 | 191424次下載 | 10 積分
 - 5十天學(xué)會(huì)AVR單片機(jī)與C語言視頻教程 下載
 - 158M | 183352次下載 | 10 積分
 - 6labview8.5下載
 - 未知 | 81600次下載 | 10 積分
 - 7Keil工具M(jìn)DK-Arm免費(fèi)下載
 - 0.02 MB | 73818次下載 | 10 積分
 - 8LabVIEW 8.6下載
 - 未知 | 65991次下載 | 10 積分
 
	                電子發(fā)燒友App
	            
	        
	        
          
        
        
	                    
                        
                        
                        
                        
                        


創(chuàng)作
發(fā)文章
發(fā)帖  
提問  
發(fā)資料
發(fā)視頻
上傳資料賺積分
           
            
            
                
            
評論