Close

App Creation

A project log for Toy Claw Machine

Full size Claw machine made from misc. parts.

willbadenwillbaden 12/31/2014 at 01:260 Comments

In the prior log I shortly stated that the app was going to be made from scratch. This would be a deeper look into the app programming structure that I don't have the time for. Fortunately, MIT's App Inventor 2 is available for use. With this program, app creation was a lot easier than I was expecting.

The app only uses a single screen as I had read that the same bluetooth client was not accessible from multiple screens. So a scrollable screen was made with hiding and showing the buttons/labels/sliders. Here is a snap shot after the user has linked up with the claw machines HC06:

The user will first see the "Select Bluetooth Module" button. After tapping on it and selecting from a list of known bluetooth devices, the other buttons, labels, and slider appear. To move the machine, the Forward, Left, Drop Claw, Right, and Back buttons are utilized. The "App Command Timer Interval" slider adjusts the speed at which the movement commands are sent (IJKL<spacebar>). This was to smooth out the start/stop tranisition when the commands were sent. Unfortunately, at around 40 (mS) there appeared to not be a difference when the claw machine would start/stop movement.

So the settings were added and could be adjusted by tapping on the "Claw Setup" button. This expanded the screen out to include the X Axis Speed, Y Axis Speed, Z Axis Speed:

Scrolling down, X Axis Serial Port Timeout, Y Axis Serial Port Timeout, and Claw Drop Time are adjustable. The modes can also be switched from Test, Pop can, and Claw Machine (Mode is cut off and needs to be cleaned up):

To download new slider values, the slider will have to be adjusted. This is done via a flag for each slide that monitors if they have changed. If they have and the "Download Settings" button is pushed, then the changed values will download omitting the unchanged data. The bottom two buttons are to either Save the data to the EEPROM so power cycles will still retain the values, or just Exiting the program and keeping the values for only the current power cycle.

To help out with the start/stop pulsing that was seen when the direction controls were sent, the Serial Port Timeouts were adjusted to 100. This would force the axis to move longer lowering resolution of positioning, but at least it smoothed up the movement of the x and y axis.

The next step is to clean up the look of it so it looks more appealing. Prior to that though, the claw will have to be slightly modified to grab onto smaller cans (orange juice and apple juice cans), the table will need a grid of holes to locate the cans, and the back panel will need a door to allow for easier access into the play area.

The App Inventor 2 .aia file for the claw machine can be found here:

https://github.com/baden0001/Claw_Machine/tree/master/Software/Android%20App%20Files

Discussions