Close
0%
0%

Toy Claw Machine

Full size Claw machine made from misc. parts.

Similar projects worth following
This claw machine is based on the claw machines that one would see in a shopping mall. It has two rigid axis for the x and y movement and a wire for the z axis for raising/lowering the claw.

The idea behind this project was for my sons birthday party. He wanted a robot themed party, so I figured this would be the easiest to build.

Similar to the commercial claw machines, the idea is to grab a toy and successfully get it transferred over to the prize box (corner with a cutout). Unlike the commercial claws, this does not have a "decreased" power state of the claw mechanism, to hopefully allow for an easier chance to win a prize.

Overall it was an interesting and fun project to build, hacking it together using what I had on hand for motors/controls and building the frame work to contain it.


Via the serial port on the main board the following functions can be changed/modified.

Port Settings: 9600,8,N,1

prog
Enter into programming mode. Game play will be suspended after push button routine is finished (normal claw machine mode) or the button is released in test mode.
Response: ">"

spdx
Change speed of X axis. Can range from 1 - 255.
Response: "ENTER: "
User Response: <enter value from 1-255>
Response: "DONE" value was set
Response: "FAIL" value was discarded

spdy
Change speed of Y axis. Can range from 1 - 255.
Response: "ENTER: "
User Response: <enter value from 1-255>
Response: "DONE" value was set
Response: "FAIL" value was discarded

spdz
Change speed of Z axis. Can range from 1 - 255.
Response: "ENTER: "
User Response: <enter value from 1-255>
Response: "DONE" value was set
Response: "FAIL" value was discarded

timz
Change the amount of time that the claw will drop down while in "claw" or "pop" modes. Can range from 1 - 255.
Response: "ENTER: "
User Response: <enter value from 1-255>
Response: "DONE" value was set
Response: "FAIL" value was discarded

srtmrx
Change the timeout time for the x axis movement from serial port quick commands. Can range from 1 - 255.
Response: "ENTER: "
User Response: <enter value from 1-255>
Response: "DONE" value was set
Response: "FAIL" value was discarded

srtmry
Change the timeout time for the y axis movement from serial port quick commands. Can range from 1 - 255.
Response: "ENTER: "
User Response: <enter value from 1-255>
Response: "DONE" value was set
Response: "FAIL" value was discarded

test
Switch claw machine into test mode. In this mode, the push button acts as a "shift" key. Press and holding the button with the following inputs wil respond with the corresponding action:
Forward: Lower Claw
Back: Raise Claw
Left: Open Claw
Right: Close Claw
Response: "DONE" setting was accepted
Response: "FAIL" setting was discarded

claw
Switch claw machine into claw mode. In this mode, the claw machine will play normally.
Response: "DONE" setting was accepted
Response: "FAIL" setting was discarded

pop
Switch claw machine into pop mode. In this mode, the claw machine will lower the claw in the prize retrieval box prior to opening the claw. This will prevent the pop can from being dropped from above.
Response: "DONE" setting was accepted
Response: "FAIL" setting was discarded

exit
Exit out of menu and resume play.

exits
Save the settings to the EEPROM, exit out of menu and resume play.


Via the serial port, the claw machine can also take in quick commands. This will allow for the claw machine to be controlled by outside devices:

I
Move the claw machine forward (away from user). Every time this command is seen by the claw machine it will move the machine forward for the time set in "srtmry"

K
Move the claw machine backward (toward user). Every time this command is seen by the claw machine it will move the machine backward for the time set in "srtmry"

L
Move the claw machine right. Every time this command is seen by the claw machine it will move the machine right for the time set in "srtmrx"

J
Move the claw machine left. Every time this command is seen by the claw machine it will move the machine left for the time set in "srtmrx"

<spacebar>
If the claw machine is in "claw" or "pop" mode, the claw drop (prize retrieval) routine will run and lockout all user inputs (serial and joystick)

  • 1 × PIC16F870 Content/Electronic Components/Semiconductors and Integrated Circuits/Microprocessors, Microcontrollers, DSPs/ARM, RISC-Based Microcontrollers
  • 3 × A4988 Stepper Driver Purchased from Pololu
  • 1 × 24V power supply Pulled from old Copy machine
  • 2 × 5V power supply Pulled from old Copy machine
  • 1 × Printer chassis for X axis Commercial printer used in printing of books. Used stepper and belt drive mechanism

View all 16 components

  • Bluetooth Module Mounting

    willbaden01/17/2015 at 22:34 0 comments

    Got around to mounting the Bluetooth module inside of the controller box. The board was soldered up (as seen in a prior log) and the HC06 was only mechanically held to the main board via its electrical connections. This proved to be too flimsy. So an angled aluminum bracket was made to support the HC06. This can be seen below:

    Here is an overview of where the Bluetooth module is located within the controller box:

  • Claw Machine App

    willbaden01/09/2015 at 01:50 0 comments

    Here is a video showing the claw machine app being used:


    The blue circle for controlling the movement of the claw has been replaced with an image of the claw.

  • Ideas to improve Claw Machine Control Options

    willbaden01/08/2015 at 12:20 0 comments

    The way the app is built, will allow for an analog style of control of the claw machine. This would allow for a varying speed of the claw according to that control input. Right now the claw machine is incapable of taking in different speeds in a real time fashion. Instead a user would have to go into program mode to change the speed which would stop all movement.

    So some more options for the I,J,K,L commands is wanted. The thought now is to add a single byte prior to the control command (I,J,K,L) that would contain the speed. This will range from 0 - 255. Similar to changing the speed of the claw machine in program mode only now it will be byte instead of ASCII. This way I will not have to use the ASCII to byte converter that is currently used.

    The thought is to use the following format:

    <begin byte speed input><byte speed><direction command>

    Where:

    <begin byte speed input> Single byte that will signal the claw machine that a speed/command string will be sent

    <byte speed> Single byte containing the speed ranging from 0 - 255

    <direction command> Currently used claw control commands I, J, K, and L.

    This would be integrated into the serial interrupt routine. Currently the interrupt detects the I, J, K and L characters and fills a step count down timer and does not fill the receive buffer with the control character.

    To sense the speed, the receive buffer will need to be used to remember the speed input. The speed will be placed into the buffer only if it sees the begin byte speed input. After it sees the speed it will adjust the stepper speed timer to the speed requested.

    This opens up an issue where the with the current stepper speed timer. If this value is changed with the claw machine app, then the physical joystick will be forced to use that value for its control. It could be setup to allow for separate timers, one for the app control and one for the joystick control.

    Along with creating speed adjust, it would be nice to include an accel decel feature. The abrupt starting and stopping of the claw movement would then be a nice transition.

    This would have to be implemented into the stepping routine and would require another counter for the length of time to accel/decel. Which would be nice to be able to control in the menu structure.

    As this is developing into more control and features, I would like to explore common protocols that are used in machine movement/control along a serial communications path. This might require a rewrite of the program which would force a spin off of this project with a completely different controller.

  • Claw Control App Change

    willbaden01/08/2015 at 03:18 0 comments

    Trying to make a cleaner look for the controls, I ended up switching to an image sprite on a canvas. The image is a blue dot and the user will move it up/down/left/right to control the claw machine forward/backward/left/right respectively.

    To cause the claw pickup routine to initiate, the user will flick the phone.

    What would be nice is to add an image of the claw instead of a blue dot, but this will do for now.

    Also added to this is the capability to disconnect from the Bluetooth connection and a button to close out the application altogether.

  • Bluetooth Module/3.3V Power Regulator

    willbaden01/04/2015 at 01:50 0 comments

    To finalize the Bluetooth added feature, a small 3.3V regulator board was needed. Along with this, it was designed to also carry the voltage level shift and HC06 as a plugin.

    The voltage regulator is an LM317 adjustable supply. This allows for an adjusable voltage output via a 10K pot (blue component in picture below). On the top of the picture is the header to attach the data/power cable from the Claw Machine board. Below that is a TXB0104 voltage level shift. This allows the 3.3V signal to translate to 5V and vice versa. Along the bottom of the picture is the header to attach the HC06.

    And here is the board rotate 180 and the data/power cable and HC06 attached:

    Next is to find a location to attach fix the board permanently to the back plate of the claw machine control box.

  • App Creation

    willbaden12/31/2014 at 01:26 0 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

  • Bluetooth Capable

    willbaden12/25/2014 at 16:05 0 comments

    Still wanting to add the capability of using android apps to control the claw machine, I am making progress on this feature. Adding an HC06 made adding Bluetooth relatively easy. This is a serial Bluetooth device that is pretty straightforward to use. Supply 3.3V power and hook up the serial port to the claw machine serial port via a voltage level converter (the PIC that controls the claw machine is 5V) and Bluetooth capability is now available. Albeit I currently have it connected in a round about way. I do not have 3.3V power available inside the control box so I am supplying 3.3V power from an UNO.

    Below is a picture of the setup. Starting with the upper left red oval, this is the serial/power connection between the PIC control board and voltage level converter. To the right of this is the HC06 device. Below left is the voltage level converter. And finally on the bottom is the UNO acting as a 3.3V power supply.

    I then installed BlueTerm app to see if the PIC would respond to the interfacing. With the trials of getting the RX/TX lines correctly connected, the interface did work:

    I could setup the different modes, change the speed and exit out of the command structure. Testing the quick controls, the machine would move. The only problem is causing a pulse of control commands as BlueTerm will only output a single character at a time and not send out multiple letters if the letter is held.

    Next up is to build the app to control the claw machine. I have been looking through android code examples, but it will take some time to get a handle on how/what needs to be done.

    Course of action is to keep looking for a generic robot control app that is easy to modify and to keep looking in creating the app from scratch.

  • Program Update

    willbaden12/17/2014 at 03:46 0 comments

    In the process of getting the claw machine ready to pick up pop cans, the program has been updated to allow for serial commands to control. I, J, K, L, and spacebar will control forward, left, back, right and push button respectively.

    This is in preparation to allow an app to control the claw machine. The details to the update can be seen in the release notes of the code as seen on the github page (address on prior project log).

    Also, there is a new pop can mode. This will use the same main control code stages up to stage 5 of the toy pick up routine. This will bring the claw to the home position with the can stick grappled. The claw will then lower down to the bottom, open the claws, and then retract up. This will prevent the pop cans from being dropped from above.

    The claw itself is also getting prepared to pick up pop cans. Not the full size cans, but instead the narrow cans. As time allows I will continue with the mechanics and post it on the "anatomy of a claw" page.

  • Code Release

    willbaden11/23/2014 at 13:50 0 comments

    The code for the Claw machine can be seen at:

    https://github.com/baden0001/Claw_Machine/tree/master/Software

    This is written in assembly but is commented to explain simple functions. If there are questions, shoot me a message.

  • Updated firmware

    willbaden10/03/2014 at 02:48 0 comments

    Added some more features into the program:


    Added saving/retrieving settings from EEPROM
    Added TimeZ variable being saved/retrieved
    TimeZ adjusts the time that the claw drops in claw machine mode
    This value is multiplied by 5

    Shifting gears, I am planning on working on the claw next. It will be designed to pick up pop cans. This can either be a quick changing of the fingers of the claw or a complete redesign of the claw.

View all 22 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates