Michael Rosario, a software developer by profession is very fond of playing with his kids. Being surrounded by Lego Wedo and Mindstorm kits, he decided to combine Lego and Arduino for his next project. The end result of the task was a Lego crane that he built for his kids. It would lift and drop some tools with the help of its Lego arm as the movement was regulated by the servos. He also intended to engage students in coding with the ideas which he used in preparing this crane.
In order to get started with the hardware section, he gathered the components like traditional and technic Lego pieces, breadboard, Arduino, wires, two Lego servo horns, continuation rotation servo, standard servo, computer and a 3D printer. In case a 3D printer is not available then the parts can be printed from shapeways.com at the cost of USD 8-10. The continuation and standard servo utilized here are ideally used in projects involving robotics or some basic movements.
First, he connected the standard servo with some Lego pieces with the help of a rubber band. This would allow the arrangement to turn left and right as per the requirement. Then he used the continuation rotation servo tied for the support of top beam so that the string could be extended or retracted as per the needs. He also put the servo horns and technic pieces in place. Then he connected this setup to the Arduino through a breadboard.
For the software part, the source code plays the role in driving the servos thus determining the movement of the crane on the whole. He used serial communication to send servo commands to the Arduino in return of the characters sent by the host computer. Then he declared the variables for the typed characters as well as the angle of the crane.
One servo was appointed to change the direction of the crane while the other would move the hook of the crane up and down. The former was wired to the Arduino Pin 9 while the latter was connected to the Pin 10. The loop function would keep repeating the code forever. Apart from this, certain characters could be sent to the Arduino for the movements. Sending a space character would stop the continuation servo.
You can check out the video of the project where the Lego crane can be clearly seen in action. First, it moves left to right then up and down while picking and dropping some paper clips made of metal with the help of a piece of magnet.
Filed Under: Reviews