Image Image Image Image Image Image Image Image Image Image
Scroll to top


Design of an Adaptive Vending Machine

Design of an Adaptive Liquid Vending Machine

| On 07, Jul 2008

By Muhammad Ali Yousuf

The new paradigm in engineering education demands hands-on training using technology-oriented projects. The roots of this approach can be traced back to the work of mathematicianSeymour Papert in 1970s, when he built a programmable turtle with a reflective light sensor.1 His ideas ultimately led to the educational theory of constructionism.2,3 According to this theory, students learn effectively when they are involved in the creation of an external object that lives in the real world. Learners use this object to think with and to relate ideas of their subject of inquiry.4 From an educational point of view, the theory of Papert can be linked to the constructivist theory of Swiss philosopher Jean Piaget, in which learning comes from an active process of knowledge construction. This knowledge can be gained through real life experiences and linked to a learner’s previous knowledge.5

The concept of the programmable turtle evolved further at MIT and became the famous programmable brick by professor Fred Martin, who also developed new learning environments and methodologies based on this concept.6,7 The unusual idea put forward with the brick, at least at the time of its invention, was the incorporation of the “design” work into the learning process. Students were not only users in this case, but were actively involved in the design process while solving their problems.8 This gave birth to the type of learning methodology we promote in our courses. The active learning methodology uses this philosophy of involving students in their own learning through class discussions and projects.9

Many researches have tried to include a project-oriented approach to the teaching of engineering subjects. This approach has the benefit of allowing students to seek information on their own while developing a well defined product

The Vending Machine Project

This project initiated from a desire I had for a vending machine that could dispense an amount of coffee proportional to the coins inserted. On many occasions, especially while working late night in the office, I have been irritated to discover that I was a few cents shy of a cup of coffee and therefore could not get my caffeine fix from the department coffee machine.

I gave the fifth and sixth semester students taking the course “Mechatronics Design Methodologies” the task of designing and building a new machine that was adaptable. Students were given some training in the Theory of Inventive Problem Solving (TRIZ) and to a lesser extent axiomatic design, but were allowed to innovate and come up with their own solution.10,11 Our experience shows that students find it easier to use the “And suddenly the inventor appeared” approach rather than the more formal and structured approaches of TRIZ and axiomatic design. To increase the pressure and create an atmosphere of innovation and competition, the six students were divided into two groups, each working independently and competing for the best design.

The history of vending machines can actually be traced back more than 2,200 years. According to Vending Machine, “the first documented vending machine dates from about 215 B.C., when the mathematician Hero invented a device that accepted bronze coins and dispensed holy water in the temples of Alexandria, Egypt.”12 Later,in A.D. 1076, “Chinese inventors developed a coin-operated pencil vendor. Coin-activated tobacco boxes appeared in English taverns during the 1700s. The U.S. government began granting patents for coin-operated vendors in 1896.” Finally, in 1888, with the introduction of penny gum machines on New York City train platforms, vending machines became a viable market.

Currently the global market is around 900,000 vending machines per year. Virtually anything legal, from clothing to cameras, pizza to iPods, can be sold via vending machines. The hot beverage vending machine market is a sub-group of the general market with some special requirements. Requirements include the ability to heat the product, keep it fresh and keep it hygienic throughout the selling time. (References 13-17 in the biography have further details and statistics.)

Learning Objectives

The projects generally given to advanced students in the field of mechatronics have one major focus: synergetic integration of engineering knowledge. For the coffee vending machine project, which was to last a semester, we set various learning objectives, as shown in Table 1 (along with some words of caution for instructors wishing to develop this type of project for their own curriculums).

Table 1: Learning Objects for the Coffee Vending Machine Project
ObjectivePurposeCaution for Instructors
Patent searchLearn the value of pre-project research by searching through the patent databases to find out what is available (and has been patented) and the types of documents needed to apply for a patent application.Students find this step to be boring and unrelated to “real” work. The professor must perform a patent search before asking students to do so.
Market researchLearn the basics of market research to find out what percentage of the population would be interested in a product of this type.Engineering students neither know nor appreciate the value of this type of work. They typically generate false data to support their project. The instructor must keep an eye on this part of the project.
Norms and laws for engineered goodsInvestigate and understand the local laws governing such (electrical-mechanical) appliances.Generally, there is an enormous amount of regulatory literature available; the instructor must guide the students in the right direction.
Environmental lawsUnderstand the environmental laws governing the use of various materials (construction materials, paints, electrical devices, etc.).These are becoming increasingly important in the ISO 14000 world and must be given due consideration. Let the students enjoy their creative skills by supporting all the ideas, even if they appear unfeasible.
“And suddenly the inventor appears”Use the “And suddenly the inventor appears” approach to come up with an overall design for the machine.Let the students enjoy their creative skills by supporting all the ideas, even if they appear unfeasible.
Subdivision of workDivide the design into smaller parts and provide complete design details on how each part will work, both mechanically and electrically.Divide the group work evenly among team members.Students generally find it difficult to divide the problem into self-contained sub-parts and need help. Also, they must be asked to commit to a design at this stage and will be given negative points if they detour too far from their designs. Otherwise they tend to design funny and useless systems.
TRIZification of the problemLearn the basics of TRIZ methodology and apply it to solve design problems present in sub-systems.Generally a three- to five-hour introduction to TRIZ is sufficient to give the students a good start. They are not required to follow the strict methodology.
“Proof of concept”Demonstrate that each sub-part functions the way it is supposed to. Change/modify the design if necessary.Detailed feedback from the instructor is vital at this point. Comments from outsiders (professors who are not part of the team but are otherwise qualified to comment on engineering projects) help a lot, as they give a fresh look to the problem.
Pack-upPut everything together and test the system under real conditions.Detailed feedback from the instructor is vital at this point.
Convert to a high quality “engineered” prototype and give the final presentationMake sure the system functions under extreme conditions, looks attractive and is easy to operate by a new operator.Non-engineering majors and professors are helpful at this point in giving the project the consumer/product outlook. Students also learn to present their work to a critical audience.

The Proposed Design

To guide and motivate the students towards a final solution, the problem was divided into smaller parts and each part was discussed in the class with strong student participation. The major sub-systems discussed encompassed:

  • The coin entry and value measurement system
  • The liquid dispensing system
  • The retractable tray system
  • The integrative micro-controller circuitry

One solution offered for the coin entry and value measurement system was to create an inclined path behind the coin entrance with a small opening on the base for the smallest coin and a detector directly below. The coins that did not drop at this point must be bigger in size and hence would fall in the next hole. The process would continue until the biggest coin in size drops, as shown in Figure 1.

Figure 1: The Coin Reservoir

This design, however,was quickly rejected due to the difficulty in programming the microcontroller for all the various combinations possible with different sizes of coins. Another solution – using different holes for different coins – was adopted by both groups as the simplest possible solution. (More on that later.)

The first major problem encountered in this part of the project was that of fixed costs. A machine cannot give away coffee for any price because of the fixed costs of the cup, electricity and maintenance, which cannot be reduced arbitrarily. Implicitly, in the words of TRIZ, we wanted to make the amount of coffee proportional to the amount of money inserted, but the fixed costs would not allow us to do so. Thus, participants suggested that the machine request the user to use his or her own cup, and the minimum amount of money inserted would have a cut-off based on estimates of the remaining fixed costs. This minimum was fixed at five Mexican pesos (about US$0.50).

The next step was designing a liquid dispensing system whose valve could be opened for a time proportional to the money inserted into the system. The initial idea, inspired by TRIZ, was to use the potential energy of the water to fill the cup and to build an electronic valve for this purpose that could be switched on and off – proportional to the money inserted. At this stage both groups opted for a ready-made water pump, simply because it was a readily available resource. The winning group decided to put the drum in an upright position behind the machine, whereas the other opted for an inverted drum on top of the machine. There was no obvious reason to do that since the water was being sucked by the pump anyway. It turned out to be that team’s biggest mistake too, as the water spilled out of the drum due to a lack of proper sealing. That leakage destroyed the electronics of their machine on the day of the final presentation.

Another important sub-system was the retractable tray to put the cup on. It was supposed to open after coin insertion and close manually. After filling the cup, the tray had to come out automatically. Neither group achieved that, but they did make a manual system for this purpose with a switch to bring the tray out and then to send it back. In the model presented here, there were only three modes (it is not yet completely flexible, a desire in the project). The user can have a small cup, a medium cup or a large cup filled, depending on the amounts of money inserted:

  • Small: One five-cent coin
  • Medium: Three one-cent coins followed by one five-cent
  • Large: One 10-cent coin

This leaves some other possibilities in local currency, two-peso and 20-peso coins, both of which are common. The coins with value less than one peso are also available, but their monetary value is much less than desired and so they were ignored. The winning group used an old CD drive for this purpose with some minor adjustments. The other group made their own tray system using a servo motor. Both were initially functional, except that the winning group’s system kept working throughout the final presentation whereas the other’s system stopped working (with the micro-controller burnt) after the water spill.

The vending machine design is shown in Figures 3 and 4. Depending upon the amount inserted, the microcontroller PIC 16F84A (one of the most commonly used microcontrollers in the hobby electronics marketplace), starts the liquid dispenser motor for a specific amount of time and stops after that.18 The basic architecture of the chip is shown in Figure 2. The inputs to the microcontroller are on ports RB4 to RB6. These ports represent the input of money corresponding to MXN $1, $5 and $10. The liquid drops via a tube into a cup placed on an old CD drive.

Figure 2: The Architecture of the
Vendor Machine Micro-controller

Figure 3: Machine’s Retractable Tray

The vending machine with a retractable tray (a used CD drive) is shown in Figure 3. On the right side there are three vertical slots, each for a different coin. Due to darkness, the transparent tube that fills the glass is barely visible inside the middle of the opening. The water drum is behind the box and the transparent tube coming out from the left top is bending behind the white box, toward the drum. The white plastic on the right side hides the electronic circuitry shown in Figure 4 and is kept separate to avoid damages due to water spillage.

The electronic circuitry that controls the system. The circuits used for controlling the electric water valve and the CD drive motor were standard and were derived from published material.18

Figure 4: Machine’s Circuitry

Future Improvements

The present design definitely needs some improvements, which we are now working on and hope to report on soon.

  1. The machine dispenses only cold fluids (water or coffee) at room temperature and cannot provide hot coffee. A heating system is needed for this purpose.
  2. Either machine can handle three different money sizes/amounts (2, 5 or 10), though based on local currency, we need to offer six possibilities (0.5, 1, 2, 5, 10 and 20 Mexican cents). This has to be incorporated both at the level of programming and in the electronic design.
  3. Different sized coins need different openings, creating confusion for an ordinary user as he or she has to understand where to insert the coin depending upon the size. It would be better to have one coin entry point that can take into account different sizes of coins.
  4. There is no way to get the money back in case the user inserts more money than the cup size can accommodate. The cup may overflow with water or coffee in such a case.
  5. The machine may provide cold, black coffee without sugar. Adding sugar proportional to the amount of coffee requires an additional (though identical in structure) mechatronic system.

Still, with all these limitations, the machine offers a good prototype for small offices where people consume coffee and always face the problem of not having the right amount of money. The project abstract was submitted to the NASA Tech Briefs Create the Future Design Contest 2007.19


Projects like this one help students understand the whole product development lifecycle and to come up with their own designs to solve real-world problems. The faculty member’s role becomes more challenging, because we need to monitor and provide feedback to the students constantly. What won’t we do for a cup of coffee?


I thank Tec de Monterrey, Santa Fe Campus, and the GIRATE group for providing the resources needed to complete this work. I also wish to thank students Luis Alberto Martínez Cabrera, Jose Ricardo Juncal Tapia, Luis Carlos Albiztegui Coello, Francisco Enrique Barrios, Martinez Gabriel Olivera Mejia and Veronica Marcela Gomez Medina for their contributions to this project.


  1. Papert, S. (1971), “Teaching Children Thinking,” MIT Artificial Laboratory Memo no. 247, Massachusetts Institute of Technology,
  2. Papert, S. (1986), “Constructionism: A New Opportunity for Elementary Science Education,” proposal to the National Science Foundation. MIT Media Laboratory.
  3. Harel, I. and Papert, S. (eds) (1991), “Situating Constructionism,” from Constructionism, Norwood, NJ: Ablex Publishing,
  4. Bourgoin, M.O (1990), “Children Using LEGO Robots to Explore Dynamics,” from Constructionist Learning, MIT Media Laboratory.
  5. Piaget, J. (1972), Principles of Genetic Epistemology, Basic Books.
  6. Martin, F. G. (1988), “Children, cybernetics, and programmable turtles,” Massachusetts Institute of Technology. Dept. of Mechanical Engineering Laboratory,
  7. Martin, F. G. (1994), “Circuits to Control: Learning Engineering by Designing LEGO Robots,” Ph.D. thesis, Massachusetts Institute of Technology,
  8. Martin, F. (1996a), “Kids Learning Engineering Science Using LEGO and the Programmable Brick,”
  9. Harmin, M. and M. Toth, (2006) Inspiring Active Learning: A Complete Handbook for Today’s Teachers, Association for Supervision & Curriculum Development.
  10. Altshuller, G. (1994), And Suddenly the Inventor Appeared: TRIZ, the Theory of Inventive Problem Solving, English translation by Lev Shulyak, Technical Innovation Center, Inc.
  11. Suh, N (2001), Axiomatic Design: Advances and Applications, Oxford University Press.
  12. Roberts, J., “Vending Machine,” from How Products are Made,
  13. “Coca-Cola Customers to Buy Vending Machine Drinks Using Marconi’s GSM Dial-a-Coke Solution,” Wireless Internet 3, no. 5 (May 2001),;col1.
  14. Prince, G., “100 Years of Vending Innovation,” Beverage World 117, no. 1651 (January 1998).
  15. Somheil, Timothy, “Vending Innovation,” Appliance 55, no. 1 (January 1998).
  16. Vending Times Online,
  17. National Automatic Merchandising Association (NAMA),
  18. Microchip Technology,
  19. NASA Tech Briefs and SolidWorks, “Create The Future” Design Contest, 2007,