5 volt Pressure Transducer

Hello, I am still learning to code and so I thought I would ask for some help to make sure I get this right.

I have a pressure transducer in my factory hydraulic steer system. It outputs 0-5 volts when it sees pressure from me turning the wheel trying to take back control. How can I modify the .ino file to disengage auto steer when (x) amount of volts is seen on pin A2 for (x) amount of milliseconds. I know a simpler pressure transducer would of been nice but this is what my tractor came with haha.

Simple with Voltage Comparator , set threshold voltage on pot , output connect serial/parallel with button on/off autosteer. 5V 12V Hysteresis Spanningscomparator Module Drempel Verstelbare Hoge Niveau en Schakelaar Dual Output Jitter Comparator Board|Geintegreerde Schakelingen| - AliExpress

Or change software with ADC on atmel(arduino).

I want to learn how to change the .ino code to monitor Analog pin A2 for a certain voltage for a given time and if that scenario happens then kill autosteer guidance.

All you need to know!

I guess I need to reword my question.

I understand how to write the code and read an analog input for the most part. I built an auto height control circuit for the down pressure on my combine header last summer by using a potentiometer.

What i’m unsure of is where would be the best place in the agopengps .ino to add such a thing?

Ahhhh yes. Here:

if (distanceFromLine == 32020 | gpsSpeed < MinSpeed | gpsSpeed > MaxSpeed | steerSwitch == 1)

add your condition

if (distanceFromLine == 32020 | gpsSpeed < MinSpeed | gpsSpeed > MaxSpeed | steerSwitch == 1 | myPressureReading > MyPressureReadingLimit)

That would stop the valve.

But if you wanted to just kick out the autosteer button (you would have to use a momentary button not a switch) you would just overide the switch reading.

Put this line
steerSwitch = myPressureReading > MyPressureReadingLimit;

Before these lines just to override the steerswitch.

remoteSwitch = digitalRead(REMOTE_PIN); //read auto steer enable switch open = 0n closed = Off
switchByte = 0;
1 Like

Very helpful thank you!

I can’t find any documentation that explains the difference between the steer switch and the remote switch. Can someone please enlighten me haha.

The remote switch isn’t used. Steer switch turns on/off autosteer

I feel like those two terms get mixed up a lot.

My plan was to use an on/on rocker switch and have the relay switched 12 volts on one side for the hydraulic block activation shuttle and on the other side of the switch use the steer switch deactivation but I would have to reverse how it works. That way it would be like a double kill for safety sake. However if I need to use a push button to make the pressure transducer work with this that puts a wrench into my plans…

Thoughts?

The autosteer_button from coffeetrac has the ability to use an encoder (search for encapin on this forum)
Change the pinnumber from D2 to D7 in the button.ino, and set count to only 1(one input from your pressure transducer)
For your use I think it would be possible to use the IMP input (OK1 in the PCBv2 schematic) This way you still have a protected input(not directly to NANO)

Take out R13 and put 470 ohm potentiometer with one leg to leg 2 of OK1, and center of pot to your transducer which gives 0 to 5 V. Now you can adjust with potentiometer at what “overpressure” from turning steeringwheel ,there will be enough voltage on the led in OK1 to activate it (pulls D7 low) Pin 2 on IMP connector must be connected to ground also.

Or you can use the voltage comparator suggested by Grabik and connect it to D2 on the the board (pin 2 of J2 connector on PCBv2) and then leave pin numbers as is in button.ino

In Setup Zone you must set pinmapping to 1 as you have PCB

There is one thing i don´t know: Could this work in AOG ver 4? as Brian might not have encoder for hydraulic steering, in the coming setup.

The inconsistentcy comes for the differences in the files found in the support folder where:
PCBv2.ino says:
//Not Connected for Cytron, Right PWM for IBT2
#define PWM2_RPWM 9 //D9

//--------------------------- Switch Input Pins ------------------------
#define STEERSW_PIN 6 //PD6
#define WORKSW_PIN 7 //PD7
#define REMOTE_PIN 8 //PB0
And the autosteerschematic.pdf (edit: the green text) says Steer Imp and Auto
In the schematic.png we have Steer Imp and Remote
Steer goes to pin D6 via OK2
Imp goes to D7 via OK1
Auto or Remote goes to D8 (equals PB0) via OK3

Now that version 4 is out I am finally getting back into this and want to get my pressure transducer sensor working. Unlike most people that are using a rotary encoder or a pressure transducer that grounds out mine is a 0-5 volt pressure transducer system from factory.

Is it a horrible idea to use A2 input without protection? I wrote a quick program INO. to read the A2 input to serial monitor to see the output of my sensor when the steering wheel is not being touched versus when it is. When not touched it is sitting around .68 volts. When I turn the steering wheel it spikes up to 3-4 volts. Could I just tell it to cancel auto guidance when voltage on A2 is over 2.5 volts for X amount of time? I would use a momentary switch for my (steerSwitch) that kills autosteer.

The other option is to do what Larsvest said and use the IMP input. However that involves a potentiometer to set the trigger voltage and I would rather set the trigger voltage in the code for ease of changing it.

I think if you filtered it with like the ads1115 inputs on the pcb you should be just fine. You could add a zener (4.7v) across for added protection, after the filter, on the a/d input

I like the idea of using the ads1115. Ill wire it up to Aux2 pcb (aux 3 ads1115). I am definitely more of a hardware guy then a coder still… I am still wrapping my head around this INO. How should I go about changing the INO file to make it read the (ads.readADC_SingleEnded(3)) input and if the voltage is over 2.5 volts for example for more than X amount of time turn off auto steer guidance…would that be steerswitch = 0 ?

As a HW guy I would build an external comparator circuit to make the pressure transducer signal appear like the one from a button. A SW approach sounds nice but soon the SW becomes so complicated that only a SW genius can understand it.

Do you really expect signal spikes that need to be filtered with a timer? Why not put an RC low pass filter at the comparator input if needed?

My goal is to get better at coding and to do that I have to keep doing random projects and learn as I go. Doing hardware work arounds wont help me learn code. Whether I use a timed amount at the trigger voltage or not I am still unclear on how to control the steer switch state by ads1115 aux3 input.

1 Like

Slim, just duplicate the existing WAS code for the a/d conversion. Change the inputs to A1 or A2

Like you I am not a coder, but what about using the WAS coding (either the old nano input or ads1115) and when your threshold (how hard steering wheel must be turned by hand) is passed you tell the program to pass a low to the encapin part of the ino (like one count from steering encoder)
Seems like a little late :thinking:

I changed the input from the sensor from analog pin 2 to the AUX 2 on PCB which is ads3 on the ads1115.

I used this code to get a read out from each single ended input on the ads 1115.

#include <Wire.h>
#include <Adafruit_ADS1015.h>
 
Adafruit_ADS1115 ads;
const float multiplier = 0.1875F;
 
void setup(void) 
{
  digitalWrite(2,LOW);
  Serial.begin(9600);
 
  // Descomentar el que interese
  // ads.setGain(GAIN_TWOTHIRDS);  +/- 6.144V  1 bit = 0.1875mV (default)
  // ads.setGain(GAIN_ONE);        +/- 4.096V  1 bit = 0.125mV
  // ads.setGain(GAIN_TWO);        +/- 2.048V  1 bit = 0.0625mV
  // ads.setGain(GAIN_FOUR);       +/- 1.024V  1 bit = 0.03125mV
  // ads.setGain(GAIN_EIGHT);      +/- 0.512V  1 bit = 0.015625mV
  // ads.setGain(GAIN_SIXTEEN);    +/- 0.256V  1 bit = 0.0078125mV 
  ads.begin();
}
 
void loop(void) 
{
  int16_t adc0, adc1, adc2, adc3;
 
  
  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(1);
  adc2 = ads.readADC_SingleEnded(2);
  adc3 = ads.readADC_SingleEnded(3);
  Serial.print("AIN0: "); Serial.println(adc0 * multiplier);
  Serial.print("AIN1: "); Serial.println(adc1 * multiplier);
  Serial.print("AIN2: "); Serial.println(adc2 * multiplier);
  Serial.print("AIN3: "); Serial.println(adc3 * multiplier);
  Serial.println(" ");
  
  delay(1000);
}

That let me see the WAS on ads0, the DOG2 on ads2 and my steering pressure sensor on ads3.
The sensor was reading around 600 at idle and when the steering wheel was turned it spiked up to around 2400.

I tried adding this code to make it change the state of the steer switch

// Pressure Transducer sensor for manual steering wheel movement   
  long  SteeringWheelPressureReading = 0;
  byte SteeringWheelPressureReadingLimit = 2000;



  //--------------------------------------------------------------------------------------------------------------------
  //Modified by Slimfarmer on 3-25-2020   
  //To add 5 volt pressure transducer capability vs a rotory encoder
  
    SteeringWheelPressureReading = ads.readADC_SingleEnded(3);
    SteeringWheelPressureReading = (SteeringWheelPressureReading * 0.1875F); 
    
    if (SteeringWheelPressureReading >= SteeringWheelPressureReadingLimit)
    {
      steerSwitch = 1;
      currentState = 1;
      previous = HIGH;
    }
  
  //--------------------------------------------------------------------------------------------------------------------

I used the multiplier from the first bit of code because I knew the numbers it gave me.

Sadly this still doesn’t want to work for me. Any ideas? I am a rookie haha

Also I have a push button hooked up to pin 6 and when pressed I see the auto steer icon in the program shade darker but then it goes back to how it was with no change. I selected push button and sent that to the arduino in the module config menu. I can’t seem to get it to turn auto steer on or off. Is it possible to have it do that?

What is your count set to? Is it also turned on in the arduino settings page? Never mind the other settings, but is the encoder ones set like this? And send of course.

Are you using udp or USB? Looking at your code though, it really should work.

2020-03-25