Introduction: Auto Drinkdispenser

Wouldn't it be awesome if every time you walked in to your room, you would get offered a drink?

YES! of course that would be awesome. Well then you're in the right spot, because this tutorial is gonna show you in great detail how to make your very own automatic drink dispenser.

It wil be able to serve you any of your favourite drinks,

It wil know when your cup is full,

And it wil always be ready to serve you your drink!

Step 1: All the Things You'll Need:

- arduino uno

- pump

- transistor

- ultrasone sensor 2x

- wires

- cups/glass

- housing (i used wood)

- your favourite drink

Step 2: Step 2: Visualise Your Idea

Whenever you're doing a big project it is a good idea to first visualise your idea, make a paper prototype, draw your electrical circuit or make at least a sketch of your plans so you'll be sure not to forget anything!

Step 3: Step 3: Drawing the Circuit

After you've made a good visual of the outside its time to make a good visual for the inside, you can either use a pen and paper or you could use a programme like Fritzing, which I used.

Step 4: Step 4: Lazer Cutting the Housing

The easiest way to make a housing for your drink dispenser is probable lazer cutting it, but if this is not an option, making one with a shaw is also a possibility, its only a lot less cool ;)

The dimensions of the box I made are 100 mm by 100 mm by 150 mm, but I recommend to make a bigger box, because I didn't have a lot of space to work with.

Step 5: Step 5: Programming

The programme you're about to make is quite simple, all it has to do is: check if there is a cup or glass waiting to be filled and if there is someone waiting for it to be filled.

The first thing that has to be done is setting the variables, a nice way to keep your code clean and easy to understand is making variables with the names of your sensor pins and as valuable the pin number.

After that is done you need to set the pinmodes, where you can use the appropriate names for your sensors if you've did that in the last step.

If thats al done your "void setup" should be complete. Now you're gonna start working in your "void loop", this is the part which your arduino will do over and over again.

The first thing you'll be doing here is create the basic function of an ultrasone sensor, that will scan the distance between itself and an object, put the answer in the float "cm" and turn the sensor output in centimeters.

Now that the first sensor can do its thing, you'll basically need to do the exact same thing for the other sensor, but with the right pins. You do need to make two separate functions for this, it won't work if you let them measure at the same time.

To check if everything goes to plan its a handy idea to output your data to the console, that way you can see what the measurements are and fix any problems you might find.

Now that you know what the sensors are outputting, you can make an if statement that checks if you're nearby, depending on where you place your "person sensor" and when you want you machine to react, you should fill in a number, I used 10 centimeters.

If that if statement is true it needs to check if there's is cup, by looking at small differences when its there and when its not there.

And if that statement is also true the pump needs to be turned on, then a delay that last as long as it takes the pump to fill your cup as much as you want to. After that the pump should turn off and to give yourself some time to get the cup, its a good idea to add an extra delay after that.

Step 6: Step 6: Drinking!

NOW THAT YOUR DONE ITS TIME TO TEST YOUR CREATION!

Thanks for reading, CHEERS!

Step 7: