Custom Air suspension Management system

So I have a touchscreen that acts as a control panel where there are some buttons and sliders etc… overall to trigger things like relays
The project is an air suspension system on my car, with air bag struts controlled by solenoids that are operated by relays activated by an arduino. The car also will have level height sensors reading how high the car is sitting at that moment and when a “height preset” is selected on the touchscreen, the arduino will activate the correct solenoids to add/release air from the airbag struts (lifting the car up or down) all based on what values the level height sensors measure then the arduino will adjust the solenoid system until the height sensors read correctly in correspondence to the height preset selected on the touchscreen.

I’m new to the coding world so with my little knowledge I assumed I would have a small controller like an UNO or similar and that will house the code to run the touchscreen and then have a bigger controller like a MEGA or similar to trigger relays based on sensor readings etc…

So when I press a button or adjust a slider on the touchscreen, the arduino outputs a value that the second arduino will read and trigger that specific event.
So i press a button on the touchscreen and it’s arduino tells the next arduino to activate its corresponding action based on the output value from the first arduino. Then it will trigger the relay and carry out the action

Secondly I have some sensors that I want to impact what the relay does. For example…
It’s a height sensor that will tell the secondary arduino what value it’s reading in correspondence to the vehicles height then the secondary arduino will trigger the correct relay which activates a solenoid to either add air into the air bag strut, or release air from the air bag strut. All triggered initially by the “height preset” button on the touchscreen

Of course I’m not sure if this is the best and simplest route, or if it’ll all work on 1 arduino or if I’m missing out steps etc…

Any help is much much appreciated
THANK YOU!

Don't complicate things

Why use 2 Arduinos rather than just the Mega ?

TL;DR
Provide a short version.

Will the mega have enough inputs and outputs to carry this project out?

What is really interesting about your request, is that you have already begun to specify the behaviour of the system. That is really good! It is always so much better to design most of it before you touch the programming keys.

I agree that you don't need multiple Arduinos for this. You should make up a system diagram with all the major components, and a flowchart or pseudocode of how things should operate.

Will the mega have enough inputs and outputs to carry this project out?

The Mega is documented on this web site. Go look at the specifications.

Thank you! i have been thinking about it and planning it for a very long time but only just now built up the courage to jump into what for me is a huge project. okay, the thing that has me a little bit confused is that I will need a whole system of code just to run the touchscreen that will be separate to the main code that runs the actual actions system. so can it all be coded onto one microcontroller if its completely separate with the only links from the two will be the output values from the touchscreen triggering actions to be executed in the main system of code

I dont know if this makes any sense at all??

Ahem, cough. A microprocessor can easily run multiple codes almost simultaneously. You are probably unaware of the "running more than one thing at a time" solution on Arduino, which is round-robin cooperative multitasking.

There are a lot of help links for that in the reference threads.

You do not need multiple processors for the reasons you gave.

Your diagram. Well, you are confusing a flow chart with a hardware diagram. What you have there is mostly a hardware diagram so you should re-draw it that way, and then make a flow chart or programming diagram separately.

This is more asking for "Project Guidance" than it is about "Microcontrollers" so I suggest that you send a moderator request to move it to the appropriate sub forum.

yeah i get that but do you understand what I'm going for here? I'm not sure if its making sense but in my head I know how it should all be working. just struggling to put it down on paper to build onit

Yes, it's fairly obvious what you're up to. But if you want further help here, you need to refine and expand upon what you've done so far.

Please follow the suggestions in reply #9. It is timely for you, at the stage you are now at.

Why are you "struggling to put it on paper", exactly? Have you not seen some examples of a wiring or equipment connection diagram?

I hope you're not looking for reasons to skip over it.

If it is really clear in your head, drawing it shouldn't be any problem. If you can't draw it, it may be a sign that it isn't really clear in your head. But sometimes the mere act of drawing it, can help clarify it. :slight_smile:

I'm asking you to do it, not just for us, but also for you.

yes ok i will move it to the appropriate forum

yeah I understand how it will all go together I think im struggling with how to read the values from the touchscreen when a button is clicked and have the arduino control the relays by reading the values from the level height sensors

Moved topic to the Project Guidance category

Thank you, yes I now understand that a mega can do the job alone.

The initial plan was to have a touchscreen interface so i can control the system on there, but is that going to be a massive job?
Or would I find it a lot easier to just have physical push buttons?

I was looking into SquareLineStudios to build the gui but I’m not sure if I’m going to be able to access external actions triggered from the gui buttons

Please detail your struggles. Else all we can offer is sympathy. Did you look at touch library examples?

but is that going to be a massive job?

Why not just investigate?

not sure if I’m going to be able to access external actions triggered from the gui buttons

Of course you will. Why would anyone make a library that didn't permit any actions based on input? That is the whole function of a touch screen!

Or would I find it a lot easier to just have physical push buttons?

Depends completely on your application and how you want it to be. No doubt, push buttons are easier to program - but can't produce layered menus and things like that for obvious reasons. You need to imagineer your UI.

I have a touchscreen

Really? What kind?

Yeah with squarelinestudios I’m trying to build it so when the cars ignition switches on, it runs a boot up sequence showing the bmw logo for 3 seconds and lifts the car up to the standard drive height then goes to the home page where I can select what ride height I want. (For example… comfort, sport, low, slammed)
But when I’m trying to set events on the button being clicked it’s just showing options for it to run animations or take you to a different page but nothing saying output a signal that I can then use in the code to execute an action. But I guess I could be just using the wrong kind of software to build my gui

I was looking at a hyper pixel 2.1” round touchscreen display but thought it might be a bit small so am exploring other brands for maybe a 3.4” round display. I’m wanting round so it can be fitted into a custom gauge pod on the dash like you would if you had an external turbo boost gauge etc…

I’m also exploring other avenues to read what height the car is sat at. So instead of having a level height sensor on each corner with an arm connected to the upper control arm to measure it’s height.
I’m thinking maybe on the inside of the car where each air line comes out of the solenoids, have a “T” piece and a bit of air line coming off the main air line. And plumb a pressure sensor in, so it can read what air pressure is in each air bag strut in relation to the cars height

All fine and well, but if you want help here, you have to provide a lot more than verbal proposals and explanations. For example, you should provide links to any things that we would not know about. Please spend some time reading this, so you can provide what is needed and ask specific questions about your project that are possible to form specific answers to.

Perfect example of what I'm complaining about. We have no idea what software that is or how you might have modified it.

Below are the components I’m looking at…

  • air suspension system
  • 8channel relay board

8 Channel Optocoupler Relay Board High & Low Trigger Module (5V) https://amzn.eu/d/dgLIpJC

  • ride height level sensor

RQH100030 Ride Height Level Sensor for 1998-2004 Dis-covery 2, 2002-2003 Ran-ge Ro-ver RQH500451 RQH000090 https://amzn.eu/d/7SCXhMq

  • 150psi pressure sensor
  • 3.4” round touchscreen display

https://m.aliexpress.com/item/1005001265145010.html?spm=a2g0s.9042311.0.0.4ec84c4dOCQJDF&gatewayAdapt=Pc2Msite

So squarelinestudios is the software I’m trying to use to build my gui
Below is a link to their website

https://squareline.io/

1 Like

So far i have made what i assume is some amateur workflows explaining the functions and what happens when an action is carried out. i have a few more to do but this is what I have so far...