Capacity? Potentiomiters, Solenoid , Lots of Calculations, LCD Display?

Hi, I will start by saying I am new to Arduino, never coded a thing but determined to work through this, so definately need help!

I have a project where the arduino takes the reading from a potentiomiter, and then uses the info to trigger a solenoid (in this case supplying air to return the potentomiter to a certain height).

Bits that make it complex:

I want the Arduino to take an reading of the potentiomiter over a 3 second or so reference period, with any average fluctuations being outside of a tolerance resulting in a solenoid being triggered, and the process starting again.

I want to be able to adjust the potentiomiter's programme height between 3 or 4 height settings.

I want to be able to push a button and change the 3 second average to to a fraction of a second, but only when a gyroscope also provides the right feedback.

There are 4 potentiomiters, each with a solenoid.

I have ordered a Mega with a bundle of bits to get started, and an currently looking at the code writing vids on youtube. Would you knowledgable guys be able to direct me for anything specific?

Can an Arduino or a number linked together provide the above level of programming sophistication to work as I've imagined? If not, can I use an Arduino for the first phase?

I see it as a development of this: https://www.instructables.com/id/Digital-Controller-for-Air-Suspension-Using-Arduin/

Finally, thank you for your time for reading my ramblings.

Hello fran9r,
Welcome.

Can an Arduino or a number linked together provide the above level of programming sophistication to work as I've imagined?

1 Arduino, no problem. Common newbie mistake is to think that 2 or more Arduinos will make things easier, in most cases it makes things harder. Getting 2 or more processors working on one project can be considered 'advanced'.

I see it as a development of this: https://www.instructables.com/id/Digital-Controller-for-Air-Suspension-Using-Arduin/

Instructables is fine for inspiration, but useless for implementation, there is a lot of rubbish on there.

Would you knowledgeable guys be able to direct me for anything specific?

Knowledgeable? Us? :confused:

There are lots of examples on this web site and in the Arduino IDE, follow them. They form a good introduction to programming.

Common newbie mistakes to avoid:

One of the first example in the IDE shows you how to make an LED flash, which is great for giving someone new the confidence they can make something work. Unfortunately it also teaches a bad habit right from the start, which is the use of delay(). delay() means NOTHING else can happen during the delay() time, which is dreadfully bad programming*. Make sure you also do the blink without delay example and
Using millis for timing
Demonstration for several things at the same time

Using delay() for things leads to the second bad thing, which is using interrupts for button pressed. Don't, you don't need to. There are also examples of how to read button presses properly.

Those are the 2 biggies for me that I get tired of answering questions about, I'm sure other people have their own.

I found this web site C Tutorial very helpful while learning C, there are, of course, others.

Enjoy the hobby and enjoy learning.

*There is at least 1 very capable and experienced regular contributor to this forum who disagrees with me on this point...

Thank you for the fast reply.

Great, so you think I've enough capacity within a Mega to do the whole project?

Will get cracking on understanding code :slight_smile:

Mega should be enough.

This is a bit much for a novice project. Something that will make life simpler is if you do a bunch of pre projects that just use one piece of hardware each. Read a pot, read the gyro, fire a solenoid. Make sure that you read up on how to wire the solenoid first - look up snubber diode.

The little projects will be helpful for learning to code too of course.

Fantastic thank you

I'll add another; this is a "stock" explanation:

A very real danger is that the obsolete tutorials on the Arduino site and others misleadingly imply that the largely ornamental "barrel jack" and "Vin" connections to the on-board regulator allow a usable source of 5 V power. This is absolutely not the case. It is essentially only for demonstration use of the bare board back in the very beginning of the Arduino project when "9V" transformer-rectifier-capacitor power packs were common and this was a practical way to power a lone Arduino board for initial demonstration purposes. And even then it was limited because an unloaded 9 V transformer-rectifier-capacitor supply would generally provide over 12 V which the regulator could barely handle.

If you are asking this question, it is highly likely that you will wish to connect something else. In which case, the answer is regulated 5 V.

This is because the on-board regulator is essentially capable of powering only the microcontroller itself and no more than a couple of indicator LEDs. The on-board regulator might be able to power a few other things if it had a heatsink, but on the (older) Arduinos, it does not.

Powering via the "barrel jack" or "Vin" connections is asking for trouble. The "5V" pin is not by any means an output pin, if anything a "reference" pin but most certainly the preferred pin to which to supply a regulated 5 V.

The first thing you should do is a diagram that presents ALL the mechanical and electrical relationships in the project.
This is so you can discuss the ideas suggested with other people and everyone understands ‘what’s doing what’.

If the elements are identified with unique names / numbers, you can then start planning the control statements in a way that ties to the diagram, and others can understand. This will eventually define your software workflow.

This is a good time to start date stamping & versioning, because those drawings WILL change over the coming months, and everyone needs to be in sync.