Author Topic: Best way to select a drink for an automated bar  (Read 7018 times)

wimsettj

  • Newbie
  • *
  • Posts: 16
    • View Profile
Best way to select a drink for an automated bar
« on: April 24, 2014, 01:54:00 AM »
Archie, Thanks for this amazing HMI! It's great to see a good quality usable HMI that doesn't cost your first born child. I came across your software while looking for an HMI to use in an automated bar I am building. I am programming a SLC503 to control the drink dispensing and I am attempting to use your HMI to facilitate the drink selections.

I am new to AdvancedHMI and Visual Basic but have been working with RSLogix/Panelveiw and Wonderware HMIs for several years. I am still trying to figure out the capabilities of your HMI and VB but I am making progress. I have a question I hope you can help me with. My current plan is to use a form change button as the means to select a drink. Each drink would have its own button with the drink name on it. I've already built this much on my own.

My question is: Is it possible to use a single form as a "Drink Start/Stop" page and have each different drink selection button open this single form and transfer the drink name and some other info such as ingredients to Basic Labels and change the PLC address for the Start button to the selected drink's start bit? I know I could do this with a SuperTag in WonderWare but I'm not sure where to start with this software. How can I do this, or is there a better way?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Best way to select a drink for an automated bar
« Reply #1 on: April 24, 2014, 08:03:12 AM »
There are a number of ways you can do this and some can get fairly complex. Here is an short example of one of the ways without getting too complicated.

- On your main form add a standard Windows Buttons for each drink
- Add a second form (Right click AdvancedHMI in Solution Explorer and select Add Windows Form) and name it DrinkStartStop
- Add the com component to the second form and set it's properties acordingly
- Add a BasicButton to the form, then add a standard Windows Label
- On the MainForm, double click the button to get back to the code
- Enter this code:
Code: [Select]
DrinkStartStop.BasicButton1.PLCAddressClick="B3/0"
DrinkStartStop.Label1.Text="Drink 1"
DrinkStartStop.Show

This sounds like an interesting project, you'll have to keep us posted on how it turns out.

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #2 on: April 24, 2014, 09:31:44 AM »
Little more complex but if something like this would work could make adding drinks debugging etc a bit easier in the long run

Main Form

Public Class MainForm
    Private DrinkName As String

    Private Sub Drink1_Click(sender As System.Object, e As System.EventArgs) Handles Drink1.Click
        DrinkName = "Drink 1"
        LoadStartStop(DrinkName)
    End Sub

    Private Sub Drink2_Click(sender As System.Object, e As System.EventArgs) Handles Drink2.Click
        DrinkName = "Drink 2"
        LoadStartStop(DrinkName)
    End Sub

    Private Sub Drink3_Click(sender As System.Object, e As System.EventArgs) Handles Drink3.Click
        DrinkName = "Drink 3"
        LoadStartStop(DrinkName)
    End Sub

    Private Sub LoadStartStop(ByVal DrinkName As String)
        Dim oForm As New StartStop
        oForm.SetDrinkName = DrinkName
        oForm.Label1.Text = DrinkName
        oForm.ShowDialog()
    End Sub
End Class

StartStop Form

Public Class StartStop
    Private DrinkName As String = ""

    Public WriteOnly Property SetDrinkName As String
        Set(value As String)
            DrinkName = value
        End Set
    End Property

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Select Case DrinkName
            Case "Drink 1"
                'bit address here
            Case "Drink 2"
                'bit address here
            Case "Drink 3"
                'bit address here
        End Select
    End Sub
End Class

Im not on a computer with AdvancedHMI at the moment thats why its just a VB button on the startstop form.

wimsettj

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #3 on: April 26, 2014, 01:39:54 AM »
Thank you both for the suggestions. I will give them a shot and see which way works best for me. I am picking up a book on VB so maybe I can understand the mechanics a little better. I will keep you updated on the progress of this project.

So far I've got most of the ladder logic done. I have 16 small pumps to dispense drink ingredients from individual spouts on a rail over the bar. The cup will be placed on a small platform mounted to a linear rail which will move to each ingredient used in the drink then return to the start position when the drink is completed. When i get a bit further in the build I will try and post some pics.

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #4 on: April 26, 2014, 10:12:28 AM »
Sounds cool!!

wimsettj

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #5 on: May 20, 2014, 09:51:48 PM »
@ Mikefly95, I took your idea and ran with it. It is working really well. In the Select Case routine is there a limit to the amount of cases you can use? I've got about 50 mixed drinks and 20 shots I want to make available. I didn't know if I would need to break them up into several Select Case routines or if I could put them all together.

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #6 on: May 21, 2014, 08:19:32 AM »
i have never hit a limit and i have some pretty large select case statements floating around!!! Glad my suggestion worked and let me know when i can get a Capt. N Coke :).
Now if you ever want to really make it easy to maintain i would suggest adding a database to the system in the future that will make everything a lot easier to add drinks modify drinks etc with out having to alter your code. Let me know if you ever want to go that route i would be happy to help!!!
« Last Edit: May 21, 2014, 08:37:07 AM by Mikefly95 »

wimsettj

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #7 on: May 22, 2014, 01:42:46 AM »
I'm intrigued by the data base idea. It would be nice to be able to add or delete recipes without having to rewrite the code. I might take you up on your offer to help after I get this prototype up and running. The HMI is done except for an error message or 2 & I'm streamlining the PLC program now. My first attempt was too bulky and hard to navigate. Should have it up and working in a month or so. I would like to have it done sooner but my real job always gets in the way of the fun stuff.

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #8 on: May 22, 2014, 08:16:13 AM »
I hear ya on the Real Job thing!!! Give me a shout when you want to try.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #9 on: May 27, 2014, 12:24:17 PM »
I know this is something really way off PLC's, but have you seen automated beer dispenser using the Rasberry Pi? The advantage is that for HMI you only need an HDMI screen and just program the interfase.

http://www.raspberrypi.org/kegerface-for-all-your-beer-stocking-needs/

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #10 on: May 27, 2014, 01:34:10 PM »
There is no automation from what i see to the Kegerface. Just a web page is all.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #11 on: May 28, 2014, 12:04:05 PM »
Well you are almost correct, it is mostly a display of "what you are drinking". This is more suitable to wimsettj project:

http://www.ecnmag.com/blogs/2013/03/robotic-bartender-uses-raspberry-pi-dispense-perfect-drinks

Mikefly95

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #12 on: May 28, 2014, 01:45:48 PM »
Nice Linux and Python!!!

wimsettj

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #13 on: May 29, 2014, 09:37:44 AM »
Bartendro as similar to my design but I added in a bit of this...           http://youtu.be/hJIkJ9x0-JQ

Quick Question, I'm trying to use a Select case routine to set a bit address, but when I try to build the project I end up with an error. Here is a bit of the code:

 Private Sub BasicButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BasicButton1.Click
        Select Case DrinkName
            Case "Tequila"
                B3:1/0
            Case "Gin"
                B3:1/1

Here is the error message:
Error   1   Syntax error.
Error   2   Label 'B3' is already defined in the current method/multiline lambda.
Error   3   Syntax error.
Error   4   Label 'B3' is already defined in the current method/multiline lambda.
Error   5   Syntax error.

What am I doing wrong?

dmroeder

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Best way to select a drink for an automated bar
« Reply #14 on: May 29, 2014, 11:03:17 AM »
You're probably going to want to do something like this:

Code: [Select]
        Select Case DrinkName
            Case "Tequila"
                DriverName.Write("B3:1/0", 1)
            Case "Gin"
                DriverName.Write("B3:1/1", 1)