Please help with a Mixing Machine

Hey guys and gals, I need to write a little application and I do not know from where to start nor finish.

We have a very old but very good ingredient mixer in the plant but is 100% manual. Right now the operator checks the ingredient tables and the mixing times and he starts and stops the process with a push button (you push it once and starts and push it again and stops) and check the times with his watch. We are mainly producing 12 different recipes in this mixer, each recipe need certain number of ingredients and certain mixing times.

Here is the actual example of the process for one recipe:

Recipe 1

  • Pour ingredient 1 into mixer
  • Check watch and start machine (push to start/stop push-button)
  • Mix for X amount of time
  • Stop machine (push to start/stop push-button)
  • Pour ingredient 2 into mixer
  • Check watch and start machine (push to start/stop push-button)
  • Mix for Y amount of time
  • Stop machine (push to start/stop push-button)
  • Pour ingredient 3 into mixer
  • Check watch and start machine (push to start/stop push-button)
  • Mix for Z amount of time
  • Stop machine (push to start/stop push-button)

Some recipes require only 3 ingredients, but some 12 and 13. The mixing times varies too.

I wanted to use a PLC but our budget is very limited, so I decided to go with an arduino and a few electronic components that we already have.

What I would like to do is:

  • Operator select recipe from 1 to 12 using a rotary switch.
  • Pour ingredient 1 into mixer
  • Push arduino push-button to start
  • Mixer will stop automatically
  • Pour ingredient 2 into mixer
  • Push arduino push-button to start
  • Mixer will stop automatically
  • Pour ingredient 3 into mixer
  • Push arduino push-button to start
  • Mixer will stop automatically
  • LED on to indicate process completed

The Hardware I'm using a rotary switch (to select one of the 12 recipes) on A0, the push-button on input D5, the mixer control on output D6 and output D7 connected to a LED to indicate when the process finish.

Can somebody please give me a hand and show me a way to structure the body of the program.... A link or example will be welcome too...

THANKS A LOT

You can use if statements. Here is an outline of one possible solution. if(recipe==1){ if (ingredient == 1){ if (button is pressed){ turn machine on; delay(time); ingredient=2; } else if (ingredient==2){ if(button is pressed){ turn machine on; delay(2000); ingredient=3;

Then at the end of the last step you would reset 'ingredient' back to 1.

Just to recapitulate your problem:

Your mixer has one button: On/off. When it's on, it mixes, to stop it mixing you turn it off.

You have various recipes which are: Someone adds a component, then let the mixer run for a defined time. Repeat until you run out of components to add.

For the solution:

To interface with the mixed, I guess using a Relay is a good idea. To drive a relay, you're going to need a transistor to provide the necessary current and to protect your arduino. An optocoupler might be a good idea too, it doesn't add much cost if it's just one or two relays.

Input you get from your rotary switch plus the push button to start next step.

The question is how you want to communicate with the user what to do next. You could either add a nice display with 16 leds, where each led on the panel is labeled with the component to add next. If you want to be more fancy, you could also use a lcd display, but in workshop environments, small lamps probably work better.

You also might want to add a buzzer to tell the operator that it's time to do some work again. A hardware buzzer, fog horn or bell controlled by another relay allows you to go as loud as you wish.

If you want to be really fancy, add a led display to show the remaining time. As long as your mixing time is below 99 minutes, 2 digits will do. If your go in the first place with the display, use this.

A final goodie would be a small serial command interface so you can modify the recipes just by connecting with a laptop to the USB and enter commands with a terminal program. This way you don't need the Arduino environment in 5 years or more just to modify the mixing time of a recipe or add another one.

The whole thing will probably need to be packaged in a serious way so that it survives for a long time in a workshop.

The Hardware:

This one will change depending on how fancy you go, but it's mostly standard stuff. Nothing too fancy.

My guess is 2 relays, 2 transistor to drive it, 2 diodes for the protection, a button and a rotary switch.

For the display, either 16 lamps or leds and 2 7-segment digits. To drive all this 4 74hc595 or led drivers.

A bunch of resistors and similar small stuff

Some power supply.

The software:

To start out, a simple program to turn motor on for a time, turn it off again, wait for a button then restart is good enough and should be a first step.

Later on, you probably should move to a solution where the component and mixing time are stored in the EEPROM and the selector just selects the right recipe to read from the EEPROM.

After this you can add the display of the component to add via the leds.

And after that you can add the display of the remaining time if you chose to go this way.

As a final step you can add the serial management system to define the recipes. This is a bit more complex than the rest, but it will make your box very versatile and usable in the long run.

The whole thing sounds like an interesting little project. If you need more details or help, leave me a PM.

Korman

I did something a bit like this, see my post here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287629597/3.

Essentially, define your recipes using arrays. The first element might be number of ingredients (or mixing periods), the rest would be the time to run each.

A function would then take the appropriate array and start/stop mixing (and do all the other things recommended here, buzzers, lcd countdown, etc.) using values from the appropriate array, and you only need one function to do this. See code in my post for running hydrographs.

This does require changing the code if recipes change.