• HOME

New Project: Air Hockey Robot (a 3D printer hack)

[Version en español aqui]

This project is now hosted here: http://jjrobots.com/air-hockey-robot-a-3d-printer-hack/
JJROBOTS (http://jjrobots.com) is the new website for this projects: blog, online shop, build instructions, "how it work", forums... more info here

After the last B-ROBOT project, this is what I've been doing the last months...really fun...



  Everything started when I built my 3D printer. First, the posibility to design and build my own parts and second, how could I hack the components of a 3D printer to make something different? 
  I have seen several interesting projects of robots that paint or manufacture PCBs, etc ... but I was looking for something different... 
  My daughter loves the Air Hockey game and I love robotics so one day an idea born in my mind... can I construct...??... Mmmmm .... it seemed very complicated and with many unresolved questions (puck detection??, robot speed??), but that is also part of the fun...


  Based on the idea of use standard RepRap 3D printer parts : NEMA17 stepper motors, drivers, Arduino Mega, RAMPS, belts , bearings, rods, printed pieces ... I started to develop the project. The main advantage of use these parts is that they are cheap and easily available. First I started with the construction of the air hockey table. I choose a medium size (my house is small, ;-)) I wanted something easily transportable but comfortable to play. The final dimensions are 100x60cm. 
  I Bought some wood boards and wood slats and began to mount the table. First I started to build and airless version but it really lacks the feeling so I decided to make a table with air. I tried different possibilities until I test a very simple combination with 2 old PC fans that works very well. I made the table holes (it seemed a hard work but it was not so hard) and I now I had a fully playable Air Hockey table! Time to enjoy it an play!! 



  Meanwhile I was designing the robot parts. I think two defferent designs, one H-Bot and another with 3 motors. Finally I decided to use the 3 motor design (2 for the Y axis and one for the X axis). After several design iterations of the pieces, and some material changes to minimize the weight and inertia (and thus increase the accelerations of the robot) I got a fairly operational design. One of the most important change is the replace of the X axis rods with carbon tubes ones (from kites) that works very well on PLA printed bushings and save a lot of weight.



  The code: I started studying the code of Marlin ( typical RepRap firmware) software but I decided to start from scratch, first because I don´t need a gcode interpreter and second because the software of a 3D printer have a motion planning algorithm and this is not the way the Air Hockey robot must work. 3D printers plans movements for smooth paths through all the points. The Air Hockey Robot should move inmediately with every new command canceling the previous one, because what we need is that the robot moves as quickly as possible to the new position. 
  I began developing the driver for Steppers motors using Arduino interruptions and making the code as efficient as possible. I implemented position, velocity and acceleration control, using an acceleration ramp with a simplified S-profile. The interrupts can generate pulses up to 25Khz which is the maximum speed that I can achieve with the steppers. The position control works at 1 kHz.



  For the puck detection problem I decided to use a computer vision system. Initially I planned to use the CMUCAM5 (Pixy) sensor that fits very well in this project (and in near future I will prepare a version for this sensor), but the camera is not available yet, so I started a new route: Use the PS3 EYE camera with a PC to develop the vision system. I developed the vision system in C lenguaje using OpenCV libraries for capturing, thresholding, filtering and segmentation. 
  The system detects the puck (must have a special color) and the result is sent to the Arduino by serial port.   The vision system sends information packets containing the position of the puck and the robot in pixels within the image. The camera is running at 60Hz at a resolution of 320x240. Fortunately the camera has very little distortion and I don´t need to implement a lens distortion correction. The software records a video on the PC which is very useful for debugging.



  One of the main problems I've had is that the power of the NEMA17 motors are pretty fair for this project and the disadvantage of using stepper motors is that if we lose steps (which can easily happen, for example when the robot hits the puck against the wall) and we do not take into account the missing steps we lose the position of the robot. To fix this, what I've done is to use the vision system to detect also the robot (with a different color) so we can detect when the robot has lost steps and fix it. 
  What remained was the implementation (in the Arduino) of the trajectory prediction system and the strategy of the robot. Once we have detected the puck in two consecutive frames we can calculate the trajectory (equation of the line through two points, this is college math!). The trajectory prediction takes into acount that the puck could bounce in a side wall. All these calculations are accesible to the strategy subsystem that decides what the robot will do: defense, defense+attack of prepare a new attack



  A nice part of this project is that the Strategy subsystem is fully insulated and is very easy for everyone to modify this part and program their own strategy algorithms isolated from the complexities of motor control, vision system and prediction code. The strategy is what makes the robot wins or lose! so in the future we could see Air Hockey robot competitions?

Although it can seems a complex project, it´s an affordable and doable project.

  • Code repository, 3D designs, documentation link: GitHub
  • Detailed build Instructions link: Build manual
(*) The build manual contains high detailed photos of the project

Some other considerations that have been taken during into account in this projectt (and the future):

  • The project is reproducible: Easy to get materials, documentation, open source code and open hardware ... 
  • The robot is removed completely from table with only 6 screws. So it can be removed for play or transport 
  • It's very easy to adjust the level of the robot, for example to play with children, just turn down the acceleration and maximum speed of the robot (this could be improved in the future) 
  • Currently the robot is not able to detect goals but we could improve this in future. 
  • In future the robot can self-calibrating the camera using predefined movement at beginning (to avoid the camera calibration). 
  • We could mount two robots per table, one on each side. Competitions between robots?? Compare different strategies in a tournament? ... 
  • It's a great and fun project to teach science specially for childrens: 
    • Concepts of Physics: Friction, continuous and uniform motion, rebounds, concepts of position, speed and acceleration
    • Mathematical Concepts: Equation of the line through two points, prediction, XY Cartesian System
    • Robotics: Motors, Machine Vision, Control, Arduino
    • DIY Philosophy: Build your own Air Hockey table
    • Hacking: Using 3D printer parts to build something completely different. 

  What is the current robot skill? Well, now the robot could easily beat a child. An adult with some experience (myself, lol) can still win the robot, but I am sure that with some more small improvements it is going to be really hard to beat ... 
  The project is fully alive with undergoing improvements, both in code and the robot ... all contribution to the project are welcome ...


Remember, future improvementes will be hosted on JJROBOTS (http://jjrobots.com)

 Science & fun
   Jose Julio (@ jjdrones) JJROBOTS.COM (@jjrobots)
Anda baru saja membaca artikel yang berkategori dengan judul New Project: Air Hockey Robot (a 3D printer hack). Jika kamu suka, jangan lupa like dan bagikan keteman-temanmu ya... By : MOTOR MODIFIKASI
Ditulis oleh: motor - Monday, February 3, 2014

Belum ada komentar untuk "New Project: Air Hockey Robot (a 3D printer hack)"

Post a Comment