Drink IT

by Bapti5te in Circuits > Raspberry Pi

129 Views, 0 Favorites, 0 Comments

Drink IT

koelkast_uitzicht.jpg

Hello, I wanted to get rid of change when purchasing a drink. So I made a refrigerator that knows when someone takes a drink out of it. Using an RFID scanner, I can see who took something out. This is then forwarded to a database. This way you don't have to pay immediately. To me this seems the ideal solution for the office. The person in charge can then retrieve the drinks of the various employees on a monthly basis. They can then choose whether to invoice them or deduct them from their salary. You can also choose for anther type of payment but those seems obvious for me. I hope you can use this as well. Enjoy!

Supplies

  • Raspberry Pi 4 Model B (2GB ram)
  • GPIO Extension Board
  • Compatible Power Supply + Breadbord Power Unit
  • Jumper Cables
  • Breadbord

In a kit, as you can find it on amazon, you find most of the items. When I bought it, amazon suggested the breadboards and sweater cabels as this is often bought together.

  • 4 ultrasonic distance sensors (I bought those in a pack of 2)
  • DS18B20 (or another temperature sensor)
  • Hall Sensor
  • RFID Reader
  • Servo Motor (found those only in a pack of 5, I bought it in an local electronics shop)
  • MDF (for the construction, can you buy in most DIY stores)
  • Fridge (you will find one in an electronics store)
  • White paint (or any other colour according to your wishes)
  • Set of paintbrushes
  • Paint roller for the finishing roller

It may also be another pi, but to easily visit the web page I suggest using one with a wireless internet connection.

Structure for the Drinks

IMG_0269.jpg

I used MDF instead of wood to keep the price down, as the result is the same. It's only a little less sturdy than solid wood but fine for the project. I used a saw to cut the structure to size. I stuck everything together, using screws, nails and glue. For a soft finish, I used sandpaper. After all, I prefer deflected edges to sharp ones. You have to do this according to your wishes of course.

After we have made everything around the refrigerator, we also need to make our internal structure. I used real wood for this as it is a bit stronger. You can of course choose other materials here but to keep the link with the casing I chose similar materials. Again I used screws, nails and glue to connect everything together. Now we can start painting the structure.

Painting the Structure

painting.jpg

To get a better view, I chose to paint everything white. For best results, it's best to paint a few layers. A single coat will not give the clean and desired result. Of course you can choose to paint it in a different colour but since my fridge is already white, I chose to paint the whole thing white as well.

Electronics

schema.png
breadbord.png
instructable_3.jpg

Now it's time to make the circuit. It is difficult to take an orderly photo of this. Therefore I have added a fritzing diagram for clarification.

I could have used an Arduino Uno but for convenience I connected them directly to the RPi. That way I did have a problem, a shortage of GPIO. Problems are there to be solved and so I chose to connect the LCD display to the RPI using the I2C bus.

The DS18B20 or in other words the temperature sensor I connected via the One Wire bus. With the instruction 'cat w1_master_slave_count' you can get the number of One Wire slaves with their data. Is the DS18B20 not listed? Then you have connected the sensor incorrectly.

I connected the RFID-Reader using the SPI bus. This is the only way to connect such a sensor to the RPI. The easiest way to program it is to use a library. If the scan is successful, you can use a buzzer to make a sound so the customer knows it was successful. You can also display this on the LCD display. I will then also trigger the servo motor to open the refrigerator.

The Hall Sensor is much easier to connect. With a callback function a change is triggered. In that function you can then easily capture and display the status of the sensor. So you can easily store the status in a variable and call it when needed.

As with the Hall Sensor, you can easily connect an ultrasonic distance sensor to the RPI. There is still a distinct difference between the two sensors though. With the distance sensor you don't need a callback function but a function that retrieves the distance when you need it.

The Programming

I have placed the code in a github repository. I'm not an experienced programmer so my code isn't perfect, but the basic code works. If you have any questions or if there were any confusions, please leave a message.

Database

Screenshot_6.png

Since it was a school project, I also had to create a database. I made the database according to my own wishes. you can always choose a different structure. A database is entirely personal and can be built differently with the same result. This depends on your wishes.