About SprocketR

SprocketR is a web application for optimizing and generating pairs of custom sprockets. It allows the users to input broad parameters in order to generate a variety of options which allow for customization, fine tuning, or even just further information. The user can then preview and generate the STL files before printing them on a 3D printer. This is all done through a WordPress page which runs PHP that calls the Blender script running on our server. Check out the details and history of its inner workings below.

SprocketR Collage Project Lead: Chase Probst
Contributors:

Date Completed: December 2015
Link to Project: SprocketR Application
Link to Code: GitHub repository
Tags:

  • Software
    • Python
    • Blender
  • Hardware
    • 3D printing

The Math

Math Collage When Chase first had the idea to make a program to generate sprockets, he had to figure out the math behind it first. He began by using nested cosine and sine functions, adjusting and adding values to learn which numbers influenced what aspect of the sprocket. Using online graphing utilities and various mechanical engineering reference books, he gradually developed the complex equation that we use today.

Working with Blender

To create the files of the sprockets themselves, we turned to Blender, an open source software for creating “3D content”. In retrospect, we probably should’ve gone with OpenSCAD, but Chase wanted to learn Python, so here we are. While Blender wasn’t quite meant for scripted 3D modeling, we made it work and learned a lot in the process. Chase worked with Blender on his laptop, painstakingly working out all of the kinks in the generation of sprockets using his preliminary formula. Blender Collage

Server Integration

Server Integration Collage With the proof of concept running properly on Blender, we needed a way to run Blender on our Linux server. This ended up being significantly harder than we had first anticipated. Blender is a free and open source software made primarily for digital animation or drawing, so it didn’t work well without the graphical interface. It took an entire day just to figure out how to properly run it in the background using just a python script. After all that work, we had one line of code: “blender -P -b blend.blend sprocketr.py”. To pass values to the script, we had to simply send them in order, devising a series of placeholders and special cases as necessary. We then used JSON to read in the information returned by the blender script.

User Interface

After getting the Blender script working with the server, we then began building the interface around it. Working within WordPress (which was also perhaps a poor choice), we created the form and final display to match the Blender script. Using PHP to call the Python script running on Blender on the server, we crafted the pages of tuning options, carefully working out the myriad of bugs in form validation, session variables etc. This interface went through several iterations as we tried to make the options more and more intuitive, as well as allow for more user refinement of the sprockets themselves. UI Collage

Reflections

Throughout this (unexpectedly long) process, we’ve learned a ridiculous amount about Python, Blender, PHP and sprockets. However, we also gained new insight into how teams operate, leading to several new Chap Research policies (such as verified project charters, milestone presentations and digital status updates). We hope the SprocketR application is a useful tool for robotics teams and hobbyists across the world!