INTELLIGENT SERVO MODULE Help

Hello all,

Is there a General Code for custom servos?

I am trying to retrofit the ISM from a W221 Sclass onto an older car.
So far i have the Module shifting through all the gears with the shifter.

Basically I need help with developing a custom servo control. I can read the position of the motor with a
pot attached to the shaft, but it needs to move to specific angles based on input from the shifter.

Here is my current code.

void setup() {
// put your setup code here, to run once:
pinMode(1, OUTPUT); // D Reverse
pinMode(2, OUTPUT);// d Turn Signal
pinMode(5, OUTPUT);// N

pinMode(3, OUTPUT); // left <--- r Brake Light
pinMode(0, OUTPUT);// right --> R Tail Light

}

void loop() {
// put your main code here, to run repeatedly:
int P1 = 0;
int P2 = 0;
int P3 = 0;
P1 = analogRead(3);
P2=analogRead(2);
P3=analogRead(1);
if(P2 >750 && P2 < 1024) { digitalWrite(0, HIGH) ;} // Reverse Module right ===>
else digitalWrite(0, LOW) ;

if (P3 >650 && P3 < 749) { digitalWrite(1, HIGH) ;} //reverse 1
else digitalWrite(1, LOW) ;

//if (P2 >500 && P2 < 749) { digitalWrite(1, HIGH) ;} //Neutral
//else digitalWrite(1, LOW) ;

if (P2 >250 && P2 < 499) { digitalWrite(2, HIGH) ;} //D Drive 1
else digitalWrite(2, LOW) ;

if(P2 >1 && P2 < 170) digitalWrite(3, HIGH) ; //D Drive Module <=== Left
else digitalWrite(3, LOW) ;

}

The shift selector acts as a pot as well, giving redundant signals through P1, P2, & P3.

The Module Works off of 12v, about 30A. I tried to implement a custom servo Sketch i fond on here with no luck :frowning:

Any guidance is appreciated :slight_smile:

Don't see any servo control statements in your code, can you post schematics, drawings, pictures, more info?

Hi,

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thnaks.. Tom... :slight_smile:

I have included 2 Drawings of the current circuit. Basically when P2 >750 && P2 < 1024, it needs to send signals for the motor to turn until the POT on the motor reads 100-250. And when P2 >1 && P2 < 170, it needs to move the motor so that the pot reads 350-450. I have another code where it has 4 different lights and lights them up based on the position of the servo. If it is in the Park Position, one light turns on, Reverse, another light and so on.

void setup() {
  // put your setup code here, to run once:
  pinMode(1, OUTPUT);  //                                     D  Reverse
  pinMode(2, OUTPUT);//                                       d  Turn Signal
  pinMode(5, OUTPUT);//                           N

  pinMode(3, OUTPUT);  //    left <---                      r Brake Light
  pinMode(0, OUTPUT);//     right  -->                      R Tail Light

  
  

}

void loop() {
  // put your main code here, to run repeatedly:
  int P1 = 0;
  int P2 = 0;
  int P3 = 0;  
P1 = analogRead(3);
P2=analogRead(2);
P3=analogRead(1);
if(P2 >750 && P2 < 1024) {  digitalWrite(0, HIGH) ;}    //  Reverse   Module right ===>
else digitalWrite(0, LOW) ;

if  (P3 >650 && P3 < 749) {  digitalWrite(1, HIGH) ;}    //reverse 1
else digitalWrite(1, LOW) ; 

//if  (P2 >500 && P2 < 749) {  digitalWrite(1, HIGH) ;}    //Neutral
//else digitalWrite(1, LOW) ;  

if  (P2 >250 && P2 < 499) {  digitalWrite(2, HIGH) ;}    //D  Drive 1
else digitalWrite(2, LOW) ;

if(P2 >1 && P2 < 170)   digitalWrite(3, HIGH) ;    //D   Drive    Module <=== Left
else digitalWrite(3, LOW) ; 

 




}

Hi,
Forget the fritzy picture, concentrate on the circuit schematic you have.

You are using I/O pins 0 and 1, these are the comms pins Tx/Rx that are used when programming the UNO and when running any debugging, it will cause some problems with how your project performs.
You will be better off to leave these pins vacant.
Tom..... :slight_smile: