If you haven't already, make sure to go through the Geekduino Getting Started Guide to get your libraries and hardware setup.
Let's get moving with the RobotGeek Linear Actuator Experimenter's Kit! This guide will be covering the setup and usage of the RobotGeek Linear Actuator Experimenter's Kit Test Code. The test code we have prepared lets you make sure your RobotGeek sensors and your linear actuator are working as expected, while covering some of the things you can do with some basic coding in Arduino. Be sure to read the //comments in the code so you can learn about what's going on behind the scenes!
Are you ready to dive even deeper into the world of Arduino? Then take a look at Robotgeek 101! RobotGeek 101 is a step by step guide that will teach you how to build, wire, and program your Geekduino/Arduino. Through RobotGeek 101 you will learn the basics of Arduino like digital input and output, and move on to more advanced topics like PWM and servo control. By the end of RobotGeek 101 you'll be well equipped to start modifying our demo code and creating your own custom applications.
1. Hardware Required
Note: All the hardware necessary to build this kit is included in the RobotGeek Linear Actuator Experimenter's Kit, but can be purchased separately.
- 1x RobotGeek Large Workbench
- 1x Geekduino Mount / Hardware
- 1x RobotGeek Geekduino
- 1x RobotGeek Sensor Shield V2
- 1x USB To Micro USB Cable
- 1x 6v2a Power Supply
- 10x 300mm 3-pin Sensor Cables
- 25x 3pin Couplers
- 8x Rubber Bumper / Feet for the Workbench
- 1x Linear actuator, (100:100), (100:210), (50:100), or (50:210)
- 1x RobotGeek Rotation Knob
- 1x RobotGeek Joystick
- 3x RobotGeek Pushbutton
- 1x RobotGeek Slider
If you have not already set up your Geekduino/ Arduino compatible board, please see the Geekduino Getting Started Guide. This guide will assist you in getting set up with the Arduino software as well as install libraries and test sketches for this guide, which will be installed as part of the
If you have already set up your geekduino according to the geekduino getting started guide, you have all the necessary software to continue with this guide.
- Connect your components as shown here.
Device Sensor Shield Port Linear Actuator (white/red/black cable) Digital 6
Option: Preset Position - Button
Linear Actuator (white/red/black cable) Digital 9
Option: Analog Direct - Rotation Knob
Linear Actuator (white/red/black cable) Digital 10
Option: Analog Direct - Slider
Linear Actuator (white/red/black cable) Digital 11
Option: Incremental Control - Joystick
Push Button 1 Digital 2 Push Button 2 Digital 4 Push Button 3 Digital 7 Rotation Knob Analog 0 Joystick (Vertical) Analog 1 Slider Analog 2 PWM Voltage Jumpers on Sensor Shield Both set to VIN
Notice that you'll have to physically plug the linear actuator into different ports in order to move it with the different controls. If you have multiple linear actuators, you can control up to 4 simultaneously with this code.
linearActuatorExpDemoin the Arduino IDE. You can find this sketch under
File > Sketchbook > RobotGeek sketches > Demos > LinearActuator > linearActuatorExpDemo
- Connect a micro USB cable from your computer to your Geekduino
linearActuatorExpDemoonto your board using the upload button in the Arduino IDE.
- Once loaded, disconnect the USB cable from your computer and power the Geekduino using a 6 Volt 2 Amp Power Supply.
There are good reasons to use a power supply, and there is a purpose for those little jumpers in the middle of the PWM pins column. In this demonstration, the 5 volts from the Geekduino's regulator from a USB power source can run the linear actuator we have connected, but you won't get the full performance out of it. This is where the jumpers and a power supply come in.
Pay close attention to the jumpers. For this demo code, we have both jumpers set to VIN. Make sure you have both jumpers set to VIN before connecting the power supply, or your linear actuator may act sluggish, or not work entirely.
5. Running the Code
- Analog Direct Control
- To use the Rotation Knob, plug your Linear Actuator into
Digital Pin 9
- To use the Slider, plug your Linear Actuator into
Digital Pin 10
Want to see some nonsense? Plug your Joystick into
Analog Pin 0, and your Linear Actuator into
Digital Pin 9. The joystick always returns to center position, causing the linear actuator to match and return to its center value. Not really all that useful if you wanted to use the joystick to move the linear actuator to a position other than center, which leads us to our next section. Make sure to return your sensors to their original pins before moving on.
- To use the Joystick, plug your Linear Actuator into
Digital Pin 11
So what's going on here? This time, instead of mapping directly to the value of the joystick, we are using the joystick to increment the position of the linear actuator, allowing us to let go of the joystick and have the linear actuator stay where we put it last.
- To use the Buttons, plug your Linear Actuator into
Digital Pin 6
So what's going on here? In this part, we are using button presses that send the linear actuator to pre-defined positions. This is simple and incredibly useful for when you know what position you'd like the linear actuator to be in under a circumstance defined by an input.
This code is just an example of a limited set of things you can do with your Linear Actuator. It is recommended that you not only look at the code, but make alterations to it. Experiment! Can you think of projects that would benefit from this? Do you have a box that you'd like to automatically open? How would you use a linear actuator to do that? All the muscles in the human body are biological linear actuators. Could you make a robotic arm that mimics this? What about making a table that can tilt, or a solar panel that tracks the sun? We'd love to hear about your project! Go forth and create!
6. More Linear Actuator Demos
The content below is covered by the code used in this getting started guide, however, if you would like to see the code for one specific section and see a video of the functionality of a section of the code, you can check out these demos.