This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question on using an SPX Tiller Drive using a Simple H Bridge /PyPilot
#1
I have an old SPX tiller pilot drive, but no functional controller.  I have an old 25A Rated  H Bridge, that I tested with my own Arduino code with a Simple Fwd/Reverse button.  I have an Adruino Uno I'm playing around with and an old Raspberry Pi 3B+


I'm trying to control this  in  Openplotter/Pypilot .

But looking at the Motor.ino sketch the logic of the H bridge mode seems a little different ( eg a single PWM and two enable lines?) .  

THe controller I have requires 3 control wires. (apart from the motor/power supply wiring itself) 

1) Motor Enable (EA) ( set to 5v)  Any Digital out ( I use pin 6)  from the Arduino set to high will enable the motor
2) PWM Input Channel A (PA) I set connect this from a PWM (Pin3)  on the Arduino.  
3) PWM Input Channel B (PB) I also connect this to an Arduino PWM (pin 5)  output.

To make the motor run forwards :

        digitalWrite(MotorEnablePIN,HIGH);
        analogWrite(FwdPWMPin,255);
        analogWrite(RevPWMPin,0);

To make it run backwards 
      digitalWrite(MotorEnablePIN,HIGH);
     analogWrite(FwdPWMPin,0);
     analogWrite(RevPWMPin,255);

IF you vary the 255, that will control the speed of the motor.  Hooked it all up with two push buttons and it worked fine.  eg I can move the ram forward and backwards by pushing the fwd/reverse buttons.  THe motor is runs at full speed when I hold a button down. 


I'll try to follow and rewire my setup to suit the pinout of the Motor.ino sketch which will mean modifying the pins I've used in my test set-up.  

But it uses Pin9 only for the PWM if im correct.   So wondering what code to modify to make the Motor.ino sketch work with my H bridge?  And Which pins to wire up using this controller with the motor.ino sketch? 


PS attached some info on how I connected it all together to test the Ram works from 12v which it does via two simple push buttons. 

sketch info copied below as it wont allow me to add a .ino file? 

*****************************************************************


int FwdPWMPin =3;

int RevPWMPin = 5;
int MotorEnable = 6;
int mspeed=255;

int FwdButtonIP= 12;
int RevButtonIP=13;

int buttonStateFwd = 0;
int buttonStateRev = 0;

//06/05/21  This Sketch makes the Linear A/p function 
//THe Motor Enable set at 5v was the key step in making this H bridge work
// You use a PWM Digital IO via Analgue write to set the speed of the motor, which also serves as the input. One must be low=0 the other highish with 255 being max speed.


void setup() {
 
pinMode ( FwdPWMPin,OUTPUT);
pinMode ( RevPWMPin,OUTPUT);
pinMode( MotorEnable,OUTPUT);

pinMode( FwdButtonIP,INPUT);
pinMode( RevButtonIP,INPUT);

Serial.begin(9600);

}

void loop() {
 
  
 buttonStateFwd= digitalRead(FwdButtonIP);
 buttonStateRev= digitalRead(RevButtonIP);

   if (buttonStateFwd== HIGH)
     {
      //Fwd first
      //Serial.print("Forward Pressed");
      //Serial.println();
        buttonStateRev=0 ;//avoid both buttons being pressed
        digitalWrite(MotorEnable,HIGH);
        analogWrite(FwdPWMPin,255);
        analogWrite(RevPWMPin,0);
     }
   else if(buttonStateRev==HIGH)
     {
      
        buttonStateFwd=0;
       digitalWrite(MotorEnable,HIGH);
       //then reverse
      //Serial.print("Reverse Pressed");
      //Serial.println();    
      analogWrite(FwdPWMPin,0);
      analogWrite(RevPWMPin,255);
     }
    else
     {
        digitalWrite(MotorEnable,LOW);
        analogWrite(FwdPWMPin,0);
        analogWrite(RevPWMPin,0);
     }             
  
 
}
Reply
#2
you will want to operate in hbridge mode then, and use d9 and d10 for pwm outputs for each direction. If you ground D6, hbridge mode is used
Reply
#3
(2021-05-08, 02:50 AM)seandepagnier Wrote: you will want to operate in hbridge mode then, and use d9 and d10 for pwm outputs for each direction.   If you ground D6, hbridge mode is used

Thanks. Ok will use pins 9 & 10 and H bridge mode. I also need an enable pin set to 5v. Is there one in the std motor.ino or should I define a new one ?
Reply
#4
yes, you can use the clutch pin 11
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)