# Need help with an electro-pneumatic circuit

#### NikolaJP

Joined Nov 6, 2018
22
I need to have 2 pistons, and one pistons works if I put 1 metal ball in the machine, the other piston works if I put 2 balls into the machine.
The detection of the number of balls is done in the electrical part and the piston is pneumatics.
Also, I think I can't use a button since there is only one slot and it won't detect the number of balls.
The pneumatics scheme is easy since it will be controlled usind solenoids, but I have no clue about the electrical part.
Thought about using a sensor, but have no idea how to use one without a microcontroller.

#### pmd34

Joined Feb 22, 2014
520
Hi NikolaJP, can you explain a little be more about "putting [your] balls into the machine"!!
The simplest method would be to use a "proximity sensor" which can detect proximity to metal objects, these could activate your pneumatic solenoid valves directly, you can also get optical ones such as "beam break" detectors which may also be suitable but we need a clearer idea of how your machine works to be able to suggest how you might distinguish between one and two balls.

#### NikolaJP

Joined Nov 6, 2018
22
Hi NikolaJP, can you explain a little be more about "putting [your] balls into the machine"!!
The simplest method would be to use a "proximity sensor" which can detect proximity to metal objects, these could activate your pneumatic solenoid valves directly, you can also get optical ones such as "beam break" detectors which may also be suitable but we need a clearer idea of how your machine works to be able to suggest how you might distinguish between one and two balls.
I was also thinking about using a proximity or metal detecting sensor, but I don't know how to add and use them in a circuit without a microcontroller, I don't even know their symbols.
What i wanted to do is to put a sensor and then if it detects that one metal ball has been inserted, it activates piston 1, and if it detects that 2 metal balls have been inserted, it activates piston 2.

#### pmd34

Joined Feb 22, 2014
520
This explains a little the wiring for the 2 main "flavors" of proximity detector:
https://www3.panasonic.biz/ac/e/fasys/sensor/proximity/gx-8/circuit/index.jsp

You could manage without a microctontroller, but you would need to use a couple of timing relays.
Something like this:
https://www.aliexpress.com/item/AC-...lgo_pvid=f4e0eb9b-61d3-45aa-a644-062a086ac074

So.. Ball one goes in- activates the first timing relay, (which now connects / allows the same sensor to activate timing relay 2). If ball 2 goes in before the time runs out, this will activate relay 2 and the second pneumatic piston.) If 1 finishes its delay and relay 2 is not active, then it switches pneumatic piston 1.

#### NikolaJP

Joined Nov 6, 2018
22
This explains a little the wiring for the 2 main "flavors" of proximity detector:
https://www3.panasonic.biz/ac/e/fasys/sensor/proximity/gx-8/circuit/index.jsp

You could manage without a microctontroller, but you would need to use a couple of timing relays.
Something like this:
https://www.aliexpress.com/item/AC-...lgo_pvid=f4e0eb9b-61d3-45aa-a644-062a086ac074

So.. Ball one goes in- activates the first timing relay, (which now connects / allows the same sensor to activate timing relay 2). If ball 2 goes in before the time runs out, this will activate relay 2 and the second pneumatic piston.) If 1 finishes its delay and relay 2 is not active, then it switches pneumatic piston 1.
Thanks, is there a simpler solution, or can you give me an example? I have to finish it today.

#### NikolaJP

Joined Nov 6, 2018
22
I am also thinking about using the weight of the balls, since 2 are obviously heavier than 1, but Idk if there is any element or button that can do that

#### pmd34

Joined Feb 22, 2014
520
You would need to explain a bit about where the balls are in the machine for me to get an idea of how to detect them. If they are on top of each other then you can just use 2 sensors.

#### djsfantasi

Joined Apr 11, 2010
7,749
What do you mean by this statement?

Also, I think I can't use a button since there is only one slot and it won't detect the number of balls.
Depending on the chute where the balls are inserted, why couldn’t you use a microswitch to detect the balls?

The switch contacts could be used to provide the logic (along with a timer relay) using the technique @pmd34 outlined in his post.

If you think this will work, I can provide more detail.

#### NikolaJP

Joined Nov 6, 2018
22
You would need to explain a bit about where the balls are in the machine for me to get an idea of how to detect them. If they are on top of each other then you can just use 2 sensors.
What do you mean by this statement?

Depending on the chute where the balls are inserted, why couldn’t you use a microswitch to detect the balls?

The switch contacts could be used to provide the logic (along with a timer relay) using the technique @pmd34 outlined in his post.

If you think this will work, I can provide more detail.
It should work like a vending machine, where you insert metal balls instead of coins ( but it doesn't really matter since it is just in the explanation of the problem, I think it would work the same if I dropped coins or any other metal objects of standard size and weight). If You drop 1 ball into the slot, the first piston activates, if you drop 2 balls (or coins) then the second piston activates, but the first one doesn't.
@djsfantasi your idea sounds good, If there isn't a less complicated way to do this, like using the weight of the balls or the fact that they are made out of metal, then I would love to use this method, if you can explain it to me.
Thanks

#### djsfantasi

Joined Apr 11, 2010
7,749
Have to go to work. I’ll exlain later

#### NikolaJP

Joined Nov 6, 2018
22

#### NikolaJP

Joined Nov 6, 2018
22
Have to go to work. I’ll exlain later
Hi, are you free today to explain the circuit?

#### djsfantasi

Joined Apr 11, 2010
7,749
Sometime today is likely. Due to the snow storm here, they postponed the Drama Festival. I’m visiting my grandson in a couple of hours, but will take a look when I get home

#### NikolaJP

Joined Nov 6, 2018
22
Sometime today is likely. Due to the snow storm here, they postponed the Drama Festival. I’m visiting my grandson in a couple of hours, but will take a look when I get home
Ok. I need the circuit for monday so today or tomorrow is fine. It is 19h now where I live.

#### djsfantasi

Joined Apr 11, 2010
7,749
Sorry for the delay. I was prepping a theatrical production for competition this week.

#### NikolaJP

Joined Nov 6, 2018
22
Sorry for the delay. I was prepping a theatrical production for competition this week.
Np, I am asking for help, so I can wait a bit. Just hope you can find time today or tomorrow to help me with this. I need to make the simplest posible circuit for this.

#### djsfantasi

Joined Apr 11, 2010
7,749
Np, I am asking for help, so I can wait a bit. Just hope you can find time today or tomorrow to help me with this. I need to make the simplest posible circuit for this.
Can you build a 555 timer circuit!

How long between the two balls is acceptable? And how long does it take for your pneumatic cylinders to operate?

#### NikolaJP

Joined Nov 6, 2018
22
Can you build a 555 timer circuit!

How long between the two balls is acceptable? And how long does it take for your pneumatic cylinders to operate?
None of that is mentioned in the problem. The closest thing I can imagine is a vending machine. Also, the teacher said we should think how to use the weight of the balls to count them.

#### djsfantasi

Joined Apr 11, 2010
7,749
Unfortunately, the circuit I had proposed proved to be anything but simple.

The original idea used the contacts of two microswitches, to route power to the correct piston. But then the timing requirement mucks things up.

If you use the timer relays proposed earlier, it would be simplified, but require two of them. The aliexpress link is affordable, but delivery time may be weeks. DigiKey has them - at about \$50 apiece, and you need two.

Or I was toying with 555 timing circuits. There is a good tutorial here. Note that in addition to two such circuits with different time periods, you’ll need the “voltage differentiator” circuit shown in the tutorial. The tutorial shows you how to calculate the resistor and capacitors for any time you desire.

Hardly simple.

Others have proposed a microprocessor solution. I developed a solution that requires an ATTiny85, two microswitches, two MOSFETS, two 10K resistors and a programmer. I’ve attached the code below. Note, the programmer link includes excellent tutorials for using it.

I can also supply my semi-schematic/block diagram if you’d like for your reference?

C:
#define Empty HIGH

// time in ms to wait for second ball
const int WaitForBall2=1000
// time in ms for piston activation
const int WaitForPiston=500

// pin definitions
const int Ball1=0;
const int Ball2=1;
const int Piston1=2;
const int Piston2=3;

void setup() {
}

void loop() {
boolean Ball2Present;

delay_microsecond(Wa1tForBall2);

If (Ball2Present) {
digitalWrite(Piston2,HIGH);
}
else {
digitalWrite(Piston1,HIGH);
}

delay_microsecondWa1tForPiston);

digitalWrite(Piston1,LOW);
digitalWrite(Piston2,LOW);

// the code automatically repeats, for the next cycle
}

Last edited:

#### djsfantasi

Joined Apr 11, 2010
7,749
I’m outta here. My fault! Totally missed that this was homework.