Wiper motor module project

Hi again, I'm tinkering on tinkercad on a project. I amazed myself on how far I think i got, but cannot google my way out of this.

Hopefully the link to the tinker cad works?

the button and switch on the far left do the same thing, one is momentary, one is manual to test.
center board, left is LOW speed. other is HIGH Speed, potentiometer reads, doesnt do anything :frowning:

here is a link to the tinkercad public version
[public]()

It sems to read read correctly, Low speed, high speed, and Park, all display correctly and circuit operates exactly as I think it would.

I cant google the answer, the question is how would I incorporate the delay string, or function.
The switch is a 2 wire, most likely a rheostat. Ohm range is not linear as to be expected, but range is about 0-4k ohms

In tinker cad the displayed value for:
100 ohm is a value of 2
4000 ohm is a value of 76

I don't know how to incorporate a command to make this operate as intended.
I don't know how to map it, I seen one thread that showed a setup for a potentiometer 1024 / # which would divide the value by # and have # of outputs from the potentiometer, but again, the thread didnt say how to apply it.

for range, in this case 2 - 76........ 76/2 (2 being the # of speeds within the potentiometer range) would be 38... from what i understood range 2-38 would be one state and range 39-76 would be other state? again, don't know how to apply the code

Also, will the arduinoUno be ok with multiple input_PULLUP pins?

trying to see if the code is displayed correctly below




const int ParkPin = 11;       //park
const int HighPin = 2;		//high
const int LowPin = 4;		//low
const int DelayPin = A1;		//delay
int analogINPUT(A1);

bool ParkState = 0;
bool HighState = 0;
bool LowState = 0;
int DelayState = 0;

int PosVal = 0;
int OldPosVal = 0;
const int LowOutputPin =  13;      // Low out
const int HighOutputPin =  12;          // High out




void setup()
{
  Serial.begin(115200);
  Serial.println("+++++WiperSelectionExample+++++");
  // initialize the pins as an output:
  pinMode(LowOutputPin, OUTPUT);
  pinMode(HighOutputPin, OUTPUT);


  // initialize the pins as an input:
  pinMode(ParkPin, INPUT_PULLUP); // value 1
  pinMode(HighPin, INPUT_PULLUP); // value 2
  pinMode(LowPin, INPUT_PULLUP); // value 4
  pinMode(DelayPin, INPUT_PULLUP); // value 8

}


void loop()
{
  ParkState = digitalRead(ParkPin);
  HighState = digitalRead(HighPin);
  LowState = digitalRead(LowPin);
  DelayState = analogRead(DelayPin);

  PosVal = (ParkState * 1) + (HighState * 2) + (LowState * 4);// + (DelayState);  // calculate Position selected
  if (PosVal != OldPosVal) // Check to see if new Position selected.
  {
    Serial.print("Park Signal = ");
    Serial.print(ParkState);
    Serial.print("  High Signal = ");
    Serial.print(HighState);
    Serial.print("  Low Signal = ");
    Serial.print(LowState);
    Serial.print("  Delay = ");
    Serial.print(DelayState);
    Serial.print(" PosVal = ");
    Serial.println(PosVal);
   
    switch (PosVal)
    {   digitalWrite(LowOutputPin, HIGH);
      case 0:
        Serial.println("HIGH + Park Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;      
     case 1:
        Serial.println("HIGH Selected");
        digitalWrite(HighOutputPin, HIGH);
        digitalWrite(LowOutputPin, HIGH);
        break;
      case 2:
        Serial.println("LOW + Park Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;     
      case 3:
        Serial.println("LOW Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;
      case 6:
        Serial.println("PARK Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, LOW);
        break;
      case 7:
        Serial.println("OFF Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;
      default:
      Serial.println("Invalid Selection");
      //digitalWrite(HighOutputPin, LOW);
      //digitalWrite(LowOutputPin, LOW);
      break;
    }
    OldPosVal = PosVal;
  }
}


thanks for links or input,
Clint

1 Like

Hello modularfox
Post the current schematic of your project.

1 Like

Sure. You could set every pin to INPUT_PULLUP and it would be OK. Even the analog inputs because they are digital pins with analog input as a special function.

1 Like

I cant use tinkercad without logging in.

1 Like

Hi, @modularfox

Can you explain your application and post a schematic of your project?

You should be able to EXPORT an image from KiCad and post it into your next post.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

1 Like

Thank you for your replies,

Copy of Wiper Controler.pdf (9.6 KB)

schematic uploaded.

picture of sketch uploaded

low switch stays on if high speed is turned on

I think if i its possible map the rheostat, from the displayed values 2-76 and have it divided by 2 (2 speeds with a time delay... example 2-36 would be? 10 seconds, and 38-76 would be 5 seconds delay. If thats possible, I can just make 2 more cases to fit the new value?

Once that bridge gets crossed, i will see if its possible to make a delay function within a case and loop it till new value is read ..

Thanks,
Clint

Hi,
OP schematic.

Much better than a Fritzy image.

Tom... :smiley: :+1: :coffee: :australia:

2 Likes

I tried adding if else commands to map the A1 input, it seemed to read correctly and output as written, but it only displayed or changed the motor output but, only if the low high switch was operated, not sure... maybe because the if else was before the case ?
still tinkering with it.. I'm going to try to see if i can google a way to add delay and loop within the if else statements untill a change of state is read..

Clint

for sure, actually i hit the button on the website by accident and it populated the schematic lol...
as far as the fritz, I just wanted to point out the 2 "park" signals, the switch and momentary button and also just realized it didn't populate as a picture, rather than link. Thank you for taking the time to link the picture.
clint

Hi,
What is your battery voltage? Bat2+
If it is 9V, why are you feeding it into 5V pin of the UNO.

If it is 9V then you will not be able to turn T1 and T2 on or off properly.
You are high side switching with NPN transistors, you need to low side switch with the NPN transisitors.

Also you have no back EMF diode on the KLW_SPEED.

Tom.. :smiley: :+1: :coffee: :australia:

Arduino module will probably get a converter for it to run from the 12v -13.5 battery.
Relays will be powered from the cars 12v-13.5vsupply. I will change the tinkercad 9v to a power supply of 13v supply.
As far as the npn transistor config.. it was a google or YouTube search. I will re research how to do that part.
Thanks for your tips and help with this project,
Clint

Hi,
What does RPOT1 do?

If you are trying to get a variable voltage at A1 you need to wire the potentiometer as a potential divider, between and 5V.
The potentiometer needs to be 10K, 400R is too low and will cause extra current to be drawn from your poer supply.

Tom... :smiley: :+1: :coffee: :australia:

Hi, you actually helped me on my last project, and I used the code from it get this far with this project.... Just wanted to take a second to say Thank you again.

The RPOT1 is wired to be like a rehostat, that's what the factory wiper switch is... or I think it is, its only 2 wires in the factory schematic. It has a ohm value of 0 - 4000ish.. It is a place holder for me to understand how to incorporate the function of delay based on its input range (range that is read and understood by Arduino pin).

Ultimately, the Rpot1 will be active (with low active) in 2 speeds if i can get it to function, Delay_low...say 10 second delay, and Delay_high for example of 5 seconds, then once switch is in low speed, it will ignore and operate like in the sketch. From interpreting the wiper motor wiring diagram, I imagine the factory module timing the low speed relay. That is what this project is.

As far as power supply, I was just placing the 9v battery there just to get the project to operate... clearly not correctly.

I changed the schematic, separated Arduino and its input to 5v supply, and the relay load side to a separate power supply (car battery power) and connected grounds together. I will add the schematic below. It still operates, low, high, off when off and park switch is on/active.

as far as the EMF flyback diode, It is wired like the factory schematic... maybe i put the diodes in backwards, but I googled direction of diode and placed them accordingly. I will add the factory relay diagram too.

Thanks again,
Clint


arrow points to the 2 diodes from the factory (modifed for input to relay) diagram.
after research update: you mean i should add a diode across pin 85 and 86 correct?

new sketch with seperate power supplies and removed extra momentary park switch

Hi,

Which means the part of the original controller it was connected to has the other half of the potentiometer circuit.
Using it the way you have it with the Arduino, you will not see any voltage change at A1.

Where in the first image in post #13 is the pot located?
What does the pot do?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Attached is the stock wiper switch that I will be using:

It has what I think is a rheostat in in the steering column switch.. the entire current goes through it to the wiper motor.. (old technology)

the "modern" wiper motor I am trying to retrofit and wire like factory, where the Arduino (the K9 Body control module in diagram) will read high, low, park and delay and output to the relays:

Factory modern switch has detents and each detent has a resistor value.
My factory switch and others ive tested has no detent, just smooth operation between off and low speed... why I'm not looking to "map" anything other than the 2 "intermittent speed times"

clint

playing around more, if i add if else before the case switch code, and added a print line of the if else to see if it displays correctly. It displays correctly, but doesnt update or refresh the print screen.. only if the case switch is changed, also tried to add delay () to it and it seemed to freeze in tinkercad.

The if else code will read the pot value in tinkercad as expected, but seems like it should be in the case switch somehow (for the delay A1 input) without having ton of case#'s for all inputs from A1

cant figure out how to add delay in the code though.

current code:




const int ParkPin = 11;     //park
const int HighPin = 2;		//high
const int LowPin = 4;		//low
const int DelayPin = A1;	//delay

bool ParkState = 0;
bool HighState = 0;
bool LowState = 0;
int DelayState = 0;

//int DelayState2 = (DelayPin > 38 && DelayPin <= 76);

int PosVal = 0;
int OldPosVal = 0;
const int LowOutputPin =  13;      // Low out
const int HighOutputPin =  12;     // High out




void setup()
{
  Serial.begin(115200);
  Serial.println("+++++ Wiper Selection +++++");
  // initialize the pins as an output:
  pinMode(LowOutputPin, OUTPUT);
  pinMode(HighOutputPin, OUTPUT);


  // initialize the pins as an input:
  pinMode(ParkPin, INPUT_PULLUP);  // value 1
  pinMode(HighPin, INPUT_PULLUP);  // value 2
  pinMode(LowPin, INPUT_PULLUP);   // value 4
  pinMode(DelayPin, INPUT_PULLUP); // value 8

}


void loop()
{
  ParkState = digitalRead(ParkPin);
  HighState = digitalRead(HighPin);
  LowState = digitalRead(LowPin);
  DelayState = analogRead(DelayPin);

  PosVal = (ParkState * 1) + (HighState * 2) + (LowState * 4);// + (DelayState * 8);  // calculate Position selected
  if (PosVal != OldPosVal) // Check to see if new Position selected.
  {
    Serial.print("Park Signal = ");
    Serial.print(ParkState);
    Serial.print("  High Signal = ");
    Serial.print(HighState);
    Serial.print("  Low Signal = ");
    Serial.print(LowState);
    Serial.print("  Delay = ");
    Serial.print(DelayState);
    Serial.print(" PosVal = ");
    Serial.println(PosVal);
  
    if(DelayState <= 2){
        Serial.println("Delay n/a");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, LOW);
    }
    else if(DelayState > 2 && DelayState <= 36){
        Serial.println("Low Delay");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
//        delay(1000); 
 //       digitalWrite(LowOutputPin, LOW);
  //      delay(1000);
   //     digitalWrite(LowOutputPin, HIGH);    //didnt work 
      
    }
    else if(DelayState > 38 && DelayState <= 76){
        Serial.println("High Delay");
        digitalWrite(HighOutputPin, HIGH);
        digitalWrite(LowOutputPin, HIGH);
    }
    else { 
              digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, LOW);
    }
    
    
    switch (PosVal)
    {   digitalWrite(LowOutputPin, HIGH);
      case 0:
        Serial.println("HIGH + Park Selected");
        digitalWrite(HighOutputPin, HIGH);
        digitalWrite(LowOutputPin, HIGH);
        break;      
     case 1:
        Serial.println("HIGH Selected");
        digitalWrite(HighOutputPin, HIGH);
        digitalWrite(LowOutputPin, HIGH);
        break;
      case 2:
        Serial.println("LOW + Park Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;     
      case 3:
        Serial.println("LOW Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;
      case 6:
        Serial.println("PARK Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, LOW);
        break;
      case 7:
        Serial.println("OFF Selected");
        digitalWrite(HighOutputPin, LOW);
        digitalWrite(LowOutputPin, HIGH);
        break;
      default:
      Serial.println("Invalid Selection");
      //digitalWrite(HighOutputPin, LOW);
      //digitalWrite(LowOutputPin, LOW);
      break;
    }
    OldPosVal = PosVal;
  }
}

Ill try googling more tomorrow, today was about 1.5 hours... and no joy .... learning curve.
clint

Hi,
Where in the OEM circuits is the pot?

Tom... :smiley: :+1: :coffee: :australia:

1st picture/schematic circut pins 96 in post 15. Pins A and G

2nd picture/schematic is modern with fixed resistors in the detents.

Clint

I think you will find it is the heater element for the bimetallic strip delay timer, it is not adjustable, fixed delay I would say for the wiper dwell.

Tom.. :+1: :coffee: :australia:

This is an interesting project, however I expect you will have problems with reliability with your project if you actually install it. many cars are designed to run at about 6-8V and above to about 18V. They can be as high as 24V with a double battery jump. Also things get connected backwards and it should also withstand a negative voltage as well. The next thing is loadump, that can be from about 40V to 80V depending on the make and model. Your module should also survive that. The temperature will also be a problem, I believe the body is from -40 to +80C and the engine can go from 125C to well over 150C depending on location. Be sure you have a backup strategy as if this fails in a storm it could be very painful.