5 volt Pressure Transducer

I used 0.1875 because the test program I found to read the ads1115 aux3 used it. In your ino. file the WAS bit shifts by three. What exactly does that mean?

//get steering position       
if (aogSettings.SingleInputWAS)   //Single Input ADS
{
  steeringPosition = ads.readADC_SingleEnded(0);    //ADS1115 Single Mode 
  steeringPosition = (steeringPosition >> 3); //bit shift by 3  0 to 3320 is 0 to 5v

I have button selected and sent that to the arduino.

I will try using raw data and change the byte to a int since it doesn’t need decimal places like a long would give.

The >> is called a bit shift operator. 16 >> 1 would result in 8, 16 >>2 would be 4. Its like really efficient division where the bits are shifted over either left or right.

So in the ADS code for WAS, value >> 3 is the same as value/8.

Remember int goes from -32768 to +32767 whereas uint goes from 0 to 65535.

Sounds like I have more google searching for tonight to learn about what you just said haha.

cheers :slight_smile:

ITs a learning process for sure - it never ends

I guess the real question is if I go with raw data on aux 3 of the ads1115 with 0 to 5 volts coming in will it be 0 to 3320 still? That’s what I am after with the 2000 I had.

if you do the value >> 3 like the WAS, then it should be around there. 15 bits is 32,000 divided by 4 is around 4000 full scale

I’ll see what this does tomorrow.

Thanks for the quick replies!

//--------------------------------------------------------------------------------------------------------------------
  //Modified by Slimfarmer on 3-25-2020        <----------------------------------------------------------------------------------------- MODIFIED
  //To add 5 volt pressure transducer capability vs a rotory encoder
  if (aogSettings.ShaftEncoder)
  { 
    SteeringWheelPressureReading = ads.readADC_SingleEnded(3);
    SteeringWheelPressureReading = (SteeringWheelPressureReading >> 3); //bit shift by 3  0 to 3320 is 0 to 5v
    
    if (SteeringWheelPressureReading >= SteeringWheelPressureReadingLimit)
    {
      steerSwitch = 1; // from Steeringwheel pressure transducer sensor
      currentState = 1;
      previous = HIGH;
    }
  }
   
  //--------------------------------------------------------------------------------------------------------------------

You might have to play around with your limit value to match what is coming out for a reading - but you should be much closer now.

After watching a youtube video on bit shifting it looks like bits can get lost off the end if you don’t use decimals. Is that why you have to use an unsigned long to prevent that issue?

I think i just used unsigned long but could have used an uint as well. Yes, the bits just fall off the end. All you are “losing” is whether the real answer is 2345.5678 or just 2345.

2345 is good enough resolution

1 Like

I had to lower my SteeringWheelPressureReadingLimit value down to 1300 and now it works beautifully. The button works now to!

Thanks again for the help!

2 Likes

Awesome blossom

I have a similar setup with a 5volt pressure transducer on valve, is this code working with your setup now? How is it wired into your PCB board. Thanks

Yes, I have it working. I tweaked the trigger amount a little lower to make it work better. I have it coming into the ads1115 marked aux 2 on the side of the PCBV2. In the code it has to be ads.readADC_SingleEnded(3) however since that’s where it actually ends up on the ads1115.

This is the INO I currently use.

Autosteer_USB_for_V4_–_Modified_By_Slimfarmer_on_3-25-2020.ino (20.4 KB)

1 Like

I modified your code to this to be able to adjust the sensibility of the steering disengagement by the pressure transducer with the encoder setting in Aog is this correct
//modif le 22/03/21 ====================================================

if (aogSettings.ShaftEncoder)
{
SteeringWheelPressureReading = ads.readADC_SingleEnded(3);
SteeringWheelPressureReading = (SteeringWheelPressureReading >> 3); //bit shift by 3 0 to 3320 is 0 to 5v
if ((pulseCount >= aogSettings.PulseCountMax)||(SteeringWheelPressureReading >=(aogSettings.PulseCountMax*100)))
{
steerSwitch = 1;
currentState = 1;
previous = HIGH;
}
}

2 Likes

looks promising. When version 4.6 comes out ill have to try it out. 1300 or 13 with the conversion in your code seemed to be a good amount for my setup. I look forward to trying it.

Cheers

Hello, I got some questions on this 5 volt pressure sender . I got the V2 board running on UDP V5.6 software in a nano. I am steering a old hydraulic cat challenger I can’t find and info on what pin the signal go’s to to reference the pressure in AOG , I got one set up with a simple pressure switch ( it trips the switch when you turn ) but it works very poorly on the encoder input as when you grab the wheel it closes the switch , it is not a pulse till you let off the wheel. So AOG just keeps steering, but humans tend to keep steering and not let off the wheel . I tried to look through the Adruio ino code to determine what pin could do this or that but I am still lost . My other plan was to use a 555 timer to drive the encoder input so it would see a pulse instead of a constant voltage. But it seem like a lot of stuff to add if this sensor input works. By the way I got a Tennsy driving PANDA over UDP also. Any advice would be greatly appreciated

As far as I remember, you set the number to zero, instead of 1

Well maybe I should try 0 I will see what that dose

I probably remember wrong, if you can connect to other side of the pressure switch. Also read the answers in this thread.