Go to Post Just goes to show that you don't need to be like everyone else to make it to Einstein. - O'Sancheski [more]
Home
Go Back   Chief Delphi > Technical > Motors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 05-04-2016, 15:05
Arrow93 Arrow93 is offline
Registered User
no team
 
Join Date: Apr 2016
Location: Canada
Posts: 2
Arrow93 is an unknown quantity at this point
Arduino + Jaguar Speed Controller + CIM Motor

I have connected a CIM motor to a Jaguar speed controller, powered by 12V battery. The jaguar is connected to an Arduino UNO via the signal and ground. Also, I have two switches connected to the Arduino, for forward and reverse of the motor.

In the code, for speed of the motor, I have set 90 as the mid point and 100 for forward and 80 for reverse. When I push the reverse button, the motor runs smoothly in the reverse direction at the set speed. However, the problem is, when I press the forward button, the motor runs seemingly slower in the forward direction than the set speed. My logic here was, if I have set speeds in forward and reverse at +/- 10 from the mid-point, the motor should run at the same speed in the forward and reverse direction, but this is not happening.

I am pasting my code below. Any help would be much appreciated. Thank you!


Code:
#include <Servo.h> 

int forwardPin = 2;
int reversePin = 4;
int motorPin = 10;
int fwdReading = 0;
int revReading = 0;

Servo myservo;

void setup() 
{ 
  TCCR1B = TCCR1B & 0b11111000 | 0x04; // PWM Freq. at 122Hz
  
  pinMode (forwardPin, INPUT);
  pinMode (reversePin, INPUT);
  myservo.attach(motorPin);
  myservo.write(90);  // set servo to mid-point
} 

void loop() 
{
  fwdReading = digitalRead(forwardPin);
  revReading = digitalRead(reversePin);
  
  if (fwdReading == HIGH)
  {
    myservo.write(100); // forward
  }  
   else if (revReading == HIGH)
  {
    myservo.write(80); // reverse
  }
  else
  myservo.write(90); // neutral
}
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:49.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi