I am working on a homemade vending machine project that serves milk and cookies, using arduino and some basic servos and stuff.

The problem is: I really have no clue on how to protect the milk to last long, or how to even know if the milk is still ok to drink.. All I really know is that air is bad for the milk (and the cookies), so here is what I came up with:

enter image description here

Two solenoids that activates at the same time, to allow air in, and milk out. All of this should be inside a "slightly" colder place.

I'm sure this design might sound stupid to some of you, but this is where I need your help please, do you think this design can work ? (Would that solenoid on top make any difference to protect milk?) How to improve it to make the milk last as long as possible ?

I'v heard about the big guys making machines that keep milk fresh for weeks even months, while i'm probably sure my milk won't stand a couple of hours..

Any idea or any information, link, or clue would be greatly appreciated. Thank you.

  • 3
    $\begingroup$ This question may be slightly offtopic for this site. Regarding the milk itself, industrial (i.e. cafeteria-style) milk dispensation is done by putting the milk in bags, and letting the bag collapse as the milk drains -- no air is introduced. For example, look at this product manual. $\endgroup$
    – Ian
    Jul 26, 2013 at 19:04
  • 1
    $\begingroup$ Maybe you could use some powdered milk and add water just before serving. Water could come right from the tap, and you would only have to care about the powder's expiration date. $\endgroup$
    – mimipc
    Jul 26, 2013 at 19:37
  • $\begingroup$ try Parmalat shelf-stable milk. doesn't require refrigeration. $\endgroup$
    – user1718
    Jul 26, 2013 at 19:41

2 Answers 2


If you are concerned about the milk coming in contact with the air. I'd suggest using a plastic bag which the air from the first solenoid pours into. On expansion, the plastic bag(filled with air) will force the milk in the container to push out through the second solenoid. This way doesn't come in contact with milk. The only problem I see, which would compromise the milk, is any leaks in the bag itself. And another problem would that you'll have to find a way to drain that air in the plastic bag once all the milk is out.

  • $\begingroup$ Or use two bags that push against each other. $\endgroup$
    – Octopus
    Aug 1, 2013 at 18:54

Milk is readily available in plastic bags inside cardboard boxes, as illustrated in the picture below of part of a cafeteria-style milk dispenser. Flow of milk is controlled by pinching off the white plastic tube that comes out of the bottom front edge of the box. To resupply the machine, you get a new box of milk from a larger refrigerator, rip open a tab and pull out the white tube, put the box into the dispenser, thread the tube through the pinch-off, then cut off the seal at the bottom end of the tube.

Using a readily available commercial product like this probably would be a better approach than having to clean and refill a tank like that shown in your picture.

Picture source: hurstgreenplastics.com

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.