PLC Logic for Coffee Machine

PLC Logic for Coffee Machine

I’m just starting to learn Ladder Logic Programming. I’m using Allen Bradley RSLogix 5000.

I’ve been tasked with developing a ‘Simple’ Coffee Machine which operates like so:

  • Toggle Push Button to Start
  • Drop Cup (for 10 seconds)
  • Feed Hot Water (for 10 seconds)
  • If required, Add Milk (for 10 seconds)
  • If required, Add Sugar (for 10 seconds)
  • Procedure Complete - Illuminate Complete Light (for 10 seconds)

I have implemented everything except the OPTIONAL add Milk & OPTIONAL add Sugar.

Options are:

  • To have a Coffee without either Milk or Sugar.
  • Or have a Coffee with Milk and Not Sugar.
  • Or have a Coffee with Sugar & Not Milk.
  • Or have a Coffee with BOTH Sugar & Milk.

2 Likes

Here is how I’ll do it:

Step 1. Define all Actions: - Drop Cup, - Feed Hot Water, - Add Milk - Add Sugar. For these, make a dedicated routine or AddOnInstruction. If you think is too simple and not necessary, just think that you will have to write a diagnostics for each, and maybe you are gonna reuse Drop Cup in another project. What happens if you Drop Cup, and you are out of cups, or dropping device is defective, and so on?

Step 2. Now that you have isolated these, make the graph as everything is needed, even if not.

Step 3. Create recipe format, putting parameters for Ingredients - for Add Milk, put as parameters: requiredOrNot, numberOfSeconds

Step 4. Create as many recipes as you wish. You will never modify the software based on recipe.

Step 5. Create a recipe management. This will be very useful for all your future projects. It’s a one time task.

This is how I made a cocktail bar for my wedding. I gave to my friends about 20 recipes, and by the end of the day, I found about 50 in recipe list.

P.S. I know that seems too complicated for given task, but if you step away from your particular task and analyze my example, you’ll realize that you can write any program without reinventing the wheel every time.

I would also recommend creating steps so that things don’t happen at unexpected times. Here is how I would set it up (Note: I wrote this very quickly, buyer beware)

2 Likes