Looking for some pointers

Hey guys/girls.
Completely new to arduino, or all of this infact. Im looking to build a arduino based control system for a pneumatic print machine. Its a few moving parts that i would like to be able to control, all of them have its own pneumatic 12v switch that im thinking of control with a relayboard. At different times and different duration.
Im not new to wiring, or soldering. But the coding is not anything ive done before, so if any of you knowing guys would like to give me some tips and pointers what codes ive might use i would be extremely gratefull!
Thanks in advance!

Sounds plausible enough in the abstract. More details would help with a more specific answer. How many switches do you need to control? Are there any inputs? What controls the sequence in which the switches are activated?

Thank you for your answer!
There are 6 or 7 parts that i eould like to control. By using a switch to start and using loop to keep the cycle going. Any inputs arent necessery but maybe something to add like a pressurecontrol or a counter for how many cycles that hhasve been done.

Sounds like an arduino could probably do the job. I'd suggest you get yourself an eight relay board and an arduino starter kit and build yourself a simulation of your machine using the relays to turn leds on.

Your code is highly unlikely to be right first time so you'll want to make your mistakes on the simulation. Doubly so since you're new to coding.

Is it possible to damage the machine by switching things inappropriately? If so, do you want to take the chance with automating it with your own code?

What does the sequence and timing of switching the pneumatics look like?

A starterkit and a 8 relay board is exactly what ive got. Thought just like you suggested that i would try it leds first.

The machine can not be damaged by switching things wrong, ive tried :stuck_out_tongue: Its controled by pneumatic valves today but i would like to replace it to something that is more accurate.

The sequence im looking for is something like this

When pressing button starting this loop (Until pressed again)

Stage 1
Filler moving 2sec, At the same time i want the Raising cylinder to activare for 4 sec and a transportmotor to activate for 2sec. After those 2sec i want a puchercylinder to activate for 2sec.
Thats first stage.
Stage 2
printer moving for 2sec.

Thats about it,
and as i understand it i wont be able to use delay for this as it desables all funtions when active right?

You may find some useful ideas in Planning and Implementing a Program although it was not written for a complete beginner.

The way it controls LEDs could be adapted to your relays

...R

Actually, it looks like you could use delay since it looks like your sequence is sequential. Non delay techniques are useful if you want to check other inputs and be responsive. Since you don't have any, it doesn't matter. The machine won't immediately notice that you pressed the button to stop it, but that won't matter because you have an emergency stop button to cut the power, right?

That said, I wouldn't do it with delay. I'd make it data driven: declare an array of structs containing a pin number, desired state and a time. The array tells me which pin, what state to set it to and when. Then the loop function just iterates through the array to see if it's time to do something.

Thank you guys for the tips!

Regarding using the millis code I understand that it will at some point go back to zero? Or am i getting it wrong? Because if so, that would not work.. I was hoping in creating something that could run for several hours/day with constant timing.
Please correct me if i got it wrong!

Regarding Arrays I really need to read up, seems pretty complicated at first look, as it probably is until you learn..

reklamkakan:
Regarding using the millis code I understand that it will at some point go back to zero? Or am i getting it wrong? Because if so, that would not work.

YES it goes back to zero (after 47 days I think) and NO it does not cause a problem if you always use subtraction to work out the intervals as in my example code.

...R

Allright!!
Thanks, i will take a closer look into it, will probably understand it sometime :stuck_out_tongue: