Author Topic: Squat counter help  (Read 2261 times)

ryclegman

  • Newbie
  • *
  • Posts: 4
    • View Profile
Squat counter help
« on: October 08, 2015, 11:14:45 AM »
Okay, essentially for my senior design project, at the University i attend, my group is designing a Squat rep counter. Squats as in working out.  :D 

I have the whole HMI view set up the way we want, im just not sure how to change the numerical value of some of the gauges.

We will have a sensor connected to an arduino board and then to a tablet with VB on it.
The sensor will signal a count up or down based on the button picked. I also need to pass the variable from a number entered by the user to the numerical gauge for the sensor to count down from if the user so decides.

Thanks for the help guys!

here is a link to drop box with the project in it. you can build it if you would like

https://www.dropbox.com/sh/cc6dl3xo7bg6eez/AAD74J8QrLWaZmrTfJJRlo9ka?dl=0

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Squat counter help
« Reply #1 on: October 08, 2015, 08:48:51 PM »
How are you communicating with the Arduino? Are you using a Modbus library with the AdvancedHMI ModbusRTUCom driver?

ryclegman

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Squat counter help
« Reply #2 on: October 09, 2015, 09:29:45 AM »
The Modbus library is what i planned on.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Squat counter help
« Reply #3 on: October 09, 2015, 12:32:24 PM »
I can't offer much help on the Arduino library, but this is how you would go about setting up AdvancedHMI:

- Add a ModbusRTU driver from the ToolBox to the form
- Set the ComPort, BaudRate, etc. to match that of the Arduino
- Add a BasicLabel to the form
- Set the PLCAddressValue property to the Modbus address that will be used in the Arduino, such as 40001

Run the application and if everything is setup properly with the communcations, you should see the value that is mapped to the 40001 register.

ryclegman

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Squat counter help
« Reply #4 on: October 09, 2015, 01:11:26 PM »
I need to add some actual programming to the advanced HMI though. Like for example, the user can set how many reps they want to do. the program needs to see that variable and count up to it or down from it. Once i figure this out ill be golden

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Squat counter help
« Reply #5 on: October 09, 2015, 02:06:41 PM »
The counting would typically be done in the Arduino programming. Then in AdvancedHMI you would use the PLCAddressKeypad property of the control to let the user enter a value that writes to the Arduino

ryclegman

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Squat counter help
« Reply #6 on: October 09, 2015, 05:26:21 PM »
Do you have a simple example at all? if i saw it, i think id understand how to pass back and forth better

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Squat counter help
« Reply #7 on: October 09, 2015, 05:55:34 PM »
So let's say in your Arduino you have 3 variables. One is the count target and the other is the current count. When the current count equals the count target, you have a third boolean value that will be set true. Let's name these variables:

CurrentCount
ActualCount
CountReached

So now map these to Modbus registers:

CurrentCount : 40001
ActualCount : 40002
Count Reached : 00001


Now to make an AdvancedHMI application:

- Add a ModBusRTU driver and set the properties accordingly
- Add a DigitalPanelMeter and set PLCAddressValue to 40001
- Set the Text property to "Current Count"
- Add a second DigitalPanelMeter and set both PLCAddressValue and PLCAddressKeyapd to 40002
- Set the Text property to "Target Count"
- Add a BasicIndicator and set PLCAddressSelectColor2 to 00001
- Run the application
- Click on the second DigitalPanelMeter to get a pop keypad, enter the target

When your Arduino program increases the count, you should see it on the first DigitalPanelMeter

If you need more details on writing an Arduino program, you will need to go to Arduino forums for help.