I have the Lynxmotion 4WD1 rover kit with PS2 controller, Sabertooth and BotBoarduino. I checked the git hub repositories of Lynxmotion and Bill Porter but I could not find any suitable Arduino code for controlling the rover with the PS2 controller.
The codes recommended in the tutorials are just for controlling the gripper or arm (for the 4WD1 rover). Can you please provide a code for just controlling the rover itself (driving motors) ?
@Barkin The Rover code samples can be found here, including PS2 code:
Note that even if you don’t have an arm connected to the rover, the arm+rover code will still work for the rover itself.
Suggested code is found at the bottom of the guide here:
Bill Porter’s PS2 library:
Thank you for posting the links. I have already checked these links and tested the “Rover_2WD_PS2.ino” with my rover. However, this Arduino code considers the motors as servo motors and it only drives the right side or left side motors at a time (the rover only turns left or right). Does this mean that I need to modify the code and adapt it for the dc motors ?
That’s a setting with the remote control and / or the Sabetooth. Yes, the easiest way to send commands to the Sabertooth motor controller is through RC PWM commands. Can’t find an order using your email to know which model of Sabertooth you have, so will have to generalize:
- Put the rover on a base so the wheels are free spinning.
- Ensure using the current method that the wheels on the left both spin in the same direction, and same for the right.
- Look at the Sabertooth’s DIP configuration (reference the Sabertooth manual). One setting should be “mixing mode”. Try this.
- On your remote control, you may also have several modes which allow for this.
You’ll reach a setting where you only need one joystick (normally the left) to control motion.
Thank you. It has been ordered from a different mail address but the Sabertooth is “2X10 R/C Regenerative Dual Channel Motor Controller” which comes with the rover kit.
It’s likely the 2x12 RC. This is the DIP switch guide for that product. The one at the top is mixed mode.
Mixing Mode: With switch 1 in the UP position, the controller is in mixed mode. In this mode the signal sent to the FWD channel controls the forward/back motion of both motors, while the Turn channel controls the difference in speed between the two motors. Switch 1 in the DOWN position (shown) allows control of the motors independently.
A point to note: the Sabertooth PROVIDES 5V via the red (center) wire to the RC receiver, so be sure not to use another battery.