bullet sizer control program code

hi my first post here i have zero experience in coding and need some guidance here

i have built this bullet sizer to size thousands of bullets without the need to do it by hand and it does work as you might be able to see if i can upload the video

i used 12v relays to control the cylinders and used on way flow control valves to limit the speed of the cylinders this works however is very basic and has draw backs.

id like to control this machine using Arduino controller so i can have some other functions as well and gain some control over the machine to prevent it crashing or damaging itself.

Hardware i have is

Arduino R3
Extension board
Display 2 row
8 relay board
programmable time delay relays

the machine is already fitted with 12v micro switches and the DA cylinders
it has 3 way 5 port DCV solenoid operated valves 12v

I would like to have
Functions:
Push button on / off
Push button one cycle
Push button Bullet feeder on / off
Push button Air pressure on / off
Push button Reset

Display:
bullet count
Air on/off
Faulted micro switch A+
Faulted micro switch A-
Faulted micro switch B+
Faulted micro switch B-

Interlocks :
Micro switch cyl A retracted
Micro switch cyl A extended
Micro switch cyl B retracted
Micro switch cyl B extended

(Cylinder start / stop position) =
Cylinder A retracted (micro switch Cyl A - = (1)
Cylinder B retracted (micro switch Cyl B - = (1)

Outputs:
Display
Relay 1
Relay 2
Relay 3
Relay 4
Relay 5
Relay 6
Relay 7
Relay 8

I need help writing the code for this machine so please if you could help get me started id appreciate it
dont bash me here if this makes no sense i dont know how to write the code guys just having a crack here

Sequence / loop

If Cyl B - micro switch = ( 1 ) Cyl A + millis 1.000 sec (relay 1) ;
Else = return to start position ( Cyl A - (relay 2) millis 1.000 (display (Faulted micro switch reset push button required ;

If Cyl A + micro switch = (1) Cyl A - millis 1.600 sec (relay 2)
Else = return to start position ( Cyl A - (relay 2) millis 1.000 (display (Faulted micro switch A) reset push button required ;

If Cyl A - micro switch = (1) Cyl B + millis 1.600 sec (relay 3)
Else = return to start position ( Cyl B - (relay 2) millis 1.000 (display (Faulted micro switch A-) reset push button required ;

If Cyl B + micro switch = (1) Cyl B - millis 0.3000 sec (relay 4)
Else = return to start position ( Cyl B- (relay 4) millis 1.000 (display (Faulted micro switch B + ) reset push button required ;

You can start yourself, programming. First of all, do you have the hardware in front of you? If it's not hooked up, do so. Then begin learning how to do the basics. You'll need that for the final project anyway. So, things like, operate a relay. Read a micro switch. Then come back here with the real code for the real machine, and we can help with the code (no matter how clumsy it is). That is really the best way to learn, and also makes the project tangible enough that someone might actually jump in with some code snippets.

After thought - you have a fair amount of hardware there. You should really provide a connection diagram. Also it's not clear how the machine is laid out. If you can, you should produce drawings of that as well.

"if i can upload the video " You can't here. Put it on youtube and post the resulting link here.

I agree with @aarg (start yourself programming) but take his approach to an extreme he may have only hinted at.

Rather than hook up all the hardware and start battling it out, I would get most of the control flow functioning using pushbuttons and LEDs as stand-ins for the hardware. It is probable that you will think of things you overlooked and/or realize how easy it is to expand the functionality.

I would write small programs that demonstrate and exercise pieces of the real hardware independently.

Once all that is workimg plausibly, combine the hardware and software and you’ll have a final set of problems. It is just a divide and conquer kind of thing: I’ll cop to having a very narrow ability to focus and prefer having a small territory when looking for problems.

I don’t always follow my own advices, haha. I would bet that the tortoise usually beats the hare, but I appreciate the temptation to hook everything up and get it working before lunch. Patience pays…

a7

Also, I know you said sort of, "be kind, I'm a newbie", but you need to know how bad things are or you can't improve.

Your attempt at pseudocode isn't useful at all. I doubt that anyone at all could make any sense out of it:

If Cyl B - micro switch = ( 1 ) Cyl A + millis 1.000 sec (relay 1) ;

That is (sorry, man!, but it is!) pure gobbledy gook. This is partly why I requested drawings - to bypass this completely. You should try to write that again, but in plain English (or whatever your native language is).

Yeah, we waiting to see the video.

Also a graphical representation of time versus various events coming and going.

Things that seem obvious to you are just intriguing mysteries to us.

So far, however, it certainly seems like a perfect place for a microcontroller. In particular your idea that the machinery can be made safer from itself.

a7

After thought - you have a fair amount of hardware there. You should really provide a connection diagram. Also it's not clear how the machine is laid out. If you can, you should produce drawings of that as well.

+1

The Arduino has twenty I/O available and two of those are commonly dedicated to the serial connection to the IDE, leaving eighteen. I count seventeen digital I/O not including pins for what the display will require.

There are multiple options on both input and output sides, you just need to decide which way you want to go.

Do NOT try talking in COMPUTER at this point!

Do all your thinking/talking/writing/explanations in HUMAN.

Later, you can just teach your processor (your subset of) human so you can build your code in what you already understand.

This may sound bizarre, but believe me it works!

-jim lee

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.