Vending Machine (Entire Machine)

GoForSmoke:
Are you familiar with Blink Without Delay, or "do many things at the same time" coding?

I do assume that you will buy a coin/bill/card unit that sends your controller pulses on payment. The usual ones give 1 pulse fort every 5 cents.

You have many things that can happen but none of them happens at high frequency or needs instant response. Events happen over time and the Arduino has 16000000 cycles per second to take each on and wait for the next.

A Nano or Uno has 32K flash to store code and data. The compiler does a good job of making small code, 32K flash is more space than you may ever fill with program. Don't let the small RAM fool you, that code space has room to fit many varied routines to do many varied things and you don't need a lot of RAM for what you're doing, an Uno or Nano is probably overkill.

8 sensors.. digital or analog? A button is a digital sensor, BTW. 8 buttons + 8 sensors could take 8 pins as 4x4.

If you want to run multi-processing you will need to learn/do more that really you don't.

Your machine must run tasks.

Watching the money box task always runs, right? That task should keep a running total credit.

Maybe the lights always run some kind of pattern? Make a task.

Watching buttons and sensors is always an always run, but only check 1 in any pass through loop and still be checking all more than 1000x a second. The task that watches keeps a status value for each one that other tasks can read and act upon.

Button and sensor states can trigger motor motions in a motor task, when the right combination of inputs happens you open a hatch and deliver the product. The state machine technique can get you through all this easier than you think, honest, and there are beginner/intermediate level tutorials on ALL of this on the next and on this forum.

You may not need to go to shift registers at all. That's less to wire.

No not familiar with "Blink Without Delay, or "do many things at the same time" coding" but I am going to look it up now and find out what I can as it seems like a very helpful way of coding.

Yes I will be buying a credit card terminal for vending that uses pulse. The great thing is the terminal can run on any standard vending stuff to so if I run into major issues with my design I can still use it if I just have to buy a machine. The credit card pulse can be setup to do any value for its pulse. 5 cents is probably fine depending how long it takes to add up.

8 sensors would probably be digital, but I may be able to get away with a few analog? Such as the end stops for the motors? Not sure if they can be analog, the other sensors will probably be laser to detect when something breaks the laser and I may find other solutions for that. Laser would be good I think as it could span accross the drop area just above the opening and have all the items fall into one bin to be collected.

I am going to look into some of the suggestions you made tonight and see if that seems like something I can do. Which with some work I am sure I can.

Thanks so much for your suggestions, this is why I decided to post my thoughts as I new you guys would have better ways of doing things.