Vehicle ride height controller

Hey there!

My name is Cory, im super green at this all! I have spent some time reading through the forums, tutorials and internet but I am still learning! To say the least. I have the uno r3 and i am trying to set up a system where i can control the ride height of my truck using 2 potentiometers. One pot in the front one in the back. Id like to have 4 programable presets to store a desired height and have the air system raise and lower the the truck to the preset height. There are others I have seen but they are not what im looking for.

Id like to have a small lcd display the current setting and a button or 4 to store the 4 presets. If the average readings of the potentiometers is not within say 5% of the preset, it calls for adjustment from the air system. I guess im asking for some knowledgeable guidance!
thanks for anything!

I would start with one end of the car and write a simple program to see if you can adjust the ride height, then move onto using stored heights. Then both ends ..
One step at a time .

Meanwhile look at some of the examples for lcd screens

Kore:
One pot in the front one in the back. Id like to have 4 programable presets to store a desired height and have the air system raise and lower the the truck to the preset height.

You have not told us how the Arduino will know what height the truck is actually at.

...R

Hey thanks for the replies! I have now written the code to turn on the green led when the potentiometer is above the set point and turn on the red led when the reading is below. This would be my first milestone. This simulates the condition of lower than or higher than a programed setpoint. Id like to get an average of 10 reading from the pot and call for the 12v signal to air up or air down until the setpoint is met.

The arduino will know the current ride height based on a 0-255 input from the pot. 0 being low and 255 being high. I guess that would be the span of the potentiometer which i will mount to the trucks suspension.

I will post might current code shortly but in the meantime id like to write code for storing a programmed setting and the leds respond to that.
I think!!

Kore:
I guess that would be the span of the potentiometer which i will mount to the trucks suspension.

Will that potentiometer move when the truck moves on its springs?

…R

Kore:
Hey there!

My name is Cory, im super green at this all! I have spent some time reading through the forums,

<>

Obviously not enough time to find the “how to use this forum” post.

Yes the potentiometers will rotate as the ride height changes with load and air loss. I have the code averaging the readings now. Ill focus on incorporating the button and storing the preset values. code to follow.

Kore:
Yes the potentiometers will rotate as the ride height changes with load and air loss.

Perhaps I did not express myself sufficiently clearly.

Will the the potentiometer rotate when the springs are compressed by a bump in the road?

...R

My bad! yes they will be constantly changing, I have put a delay in the readings but id like to put a span or a tolerance of +-the preset, that could just be a number or a %.

Kore:
My bad! yes they will be constantly changing,

I see two problems with that. Perhaps most important is that the potentiometers will wear out very quickly unless they are specially designed for that sort of continuous use. Most potentiometers are designed for the sort of occasional use needed to control the loudness of a music system.

Second, I think it will be very difficult to extract reliable data for the ride height from the sea of noise produced by the normal movement of the suspension.

Can you post a diagram that shows how the existing ride-height system works?

...R

These pots are designed for this purpose. They actually are re-purposed from a commercial unit. Im hoping by delaying the read on the potpin and then averaging those readings there will be an accurate condition.

So the idea is, the potpins front and back are read and averaged every 10 sec, the average is compared to the user preset and the system calls for air or exhaust unitl the potpin reads a value within tolerance of the preset.
System to have 4 programmable ride heights.

I imagine there is a part of the ride-height system that connects to the top of the spring and which does not move (relative to the bottom of the spring) when the suspension flexes. In my mind that part only moves relative to the truck chassis when the ride height is adjusted.

If my imagination is correct why not connect the pot to that part and then no averaging would be required.

...R

Fair enough but these pots are what is stock on many vehicle ride height control systems and work well.
ill put some thought into that suggestion for sure!
Thanks

Since you're (apparently) not trying to make an active suspension that adjusts during cornering & breaking, I think you should only change the height when you are not moving. As long as there are no air leaks, it should hold.

The arduino will know the current ride height based on a 0-255 input from the pot

The full-range of a normal pot should be 0-1024 (although some pots might not go all the way down to zero or up to 1023). But if you are getting 0-255 in your application, that's OK.

Yep, I dont need active suspension control, I am hoping to have the system auto level and store 4 preset heights. Nothing fancy. I have mapped the potPin to 0-255

Kore:
Fair enough but these pots are what is stock on many vehicle ride height control systems and work well.

My Reply #11 was not about the quality of the pots - it was about the ability to get usable data without the confusion caused by suspension movement while the truck is moving.

What @DVDoug has suggested would have the same effect.

...R

Ok , this can be avoided by reading while stopped or after power on. Im looking forward now to button controls and storing user presets and LCD displays. Thanks for the input though im open to any help.

Kore:
Thanks for the input though im open to any help.

It would be useful to re-state what you need help with now that the project is clearer.

...R

Thanks guys, ill have to do some more reading so I can post the code instead of just copy/paste!
im trying to understand button states now so i can incorporate a button to save the desired settings. I can currently read the potentiometer and have the led turn on indicating the range its in.

So Im hoping if i explain thing better maybe it will help!

//Program to monitor a front and rear potentiometer to average the vehicle ride height

  • inputs mapped 0-255
  • readings are every 10 seconds
  • every 10 readings are averaged and the mean is printed

//a button is used to cycle thru 4 programable presets (Park, Low, Cruise, High)

  • if button is pressed 1x current buttonstate (ride height 1) and pot readings are printed (220/230)
    eg: Park Fr:220 Rr: 220

  • if button pressed 2x then program cycles to next preset and loads programmed settings
    eg: Low Fr: 200 Rr: 200

... and so on for 3 and 4

  • if button pressed for 2 seconds current front and rear pot reading are stored as preset for that buttonstate

//if average of reading for either front or rear is higher or lower than saved preset then program calls for air up or down to the front or rear

Currently my code works to print the average and light an rgb

Led goes red and prints low, when reading is below 127.
Led goes green and prints level when reading is between 127-137
Led goes Blue and prints High when readings above 137

also my button with turn pin 13 on or off when pressed

I can post the code if that helps!