Yes, you are missing the PS2X library by Bill Porter. Lynxmotion has a fork of it up on their github as do I (github.com/KurtE/Arduino-PS2X) I thought I had something about this in my readme for the project, but maybe I need to make it clearer.
Recently made changes to my fork of it as to make it work better with the Rev3 of the PS2 controller.
Great!! The code was able to compile and be uploaded onto the Arduino. However, the problem now is that it seems like not enough power is going into the servos of the hexapod. The sound that the servos make is not as loud as it should be, and the servos move very slowly, if at all. In addition to this, the hexapod keeps turning off after a few seconds… I am using an Arduino UNO as the microcontroller rather than a Botboarduino, but I assume that the pin connections labelled in the code should be the same.
What version of the code are you running. What battery are you using? How are you powering the servos versus the UNO. Is there a voltage turn off configured into the robot, if so is it configured for your battery? Might help if you posted zip file with code including .ino and the HEX_CFG.h file.
Just a few more quick thoughts: As I mentioned, when I hear things like this the first things that come to my mind is power issues. As you were saying a Botboarduino and Uno are both compatible with each other.
But one of the nice things about the Botboarduino is that when it was in development, we knew that most of the Lynxmotion robots run using RC servos that typically run on 6v NIMH batteries, so the voltage regulator choosen was a VLDO that had a voltage drop of only .4v, whereas I believe the one in the UNO I believe has a drop off of something like 1.2v, which is why the UNO the recommended voltage starts at 7V. But even with the lower drop out voltage of the Botboarduino, heavy servo demand can drop the voltage low enough that the processor could reset, which is why the board is setup with two voltage connections, whereas you can separate the logic voltage from the servo voltage.
Another issue with voltages is the wiring. What gauge is the wiring? Again what type of battery (voltage/capacity). If it is some battery pack, the connections in these are not usually sufficient to handle the amperage needed for servos.
I believe that I am using the most recent version of the code - I downloaded it a couple of weeks ago. To power the Arduino, I am using a 9VDC battery and to power the hexapod, I am using the 6V battery pack that is sold on the Lynxmotion website. I am not sure if there is a voltage turn off that is configured into the robot. All I did was download the code, put the proper files into their proper places, and compiled/uploaded the code onto the Arduino. I connected the pins for the PS2 controller onto the Arduino based on what the code specified. The only difference that there is between the wireless PS2 controller module and the Arduino code that is provided is that pin 8 is defined as PS2_SEL and there is no such pin on the PS2 wireless module. Thus, I connected the only free pin there was, which was ATT.
In the previous post, I said that all the connections were the same as those declared in the Arduino code. These are shown below:
//[Botboarduino Pin Numbers] #define SOUND_PIN 5 // Botboarduino JR pin number #define PS2_DAT 6 #define PS2_CMD 7 #define PS2_SEL 8 #define PS2_CLK 9
// If we are using a SSC-32 then:
// If were are running on an Arduino Mega we will use one of the hardware serial port, default to Serial1 above.
// If on Non mega, if the IO pins are set to 0, we will overload the hardware Serial port
// Else we will user SoftwareSerial to talk to the SSC-32 #define cSSC_OUT 12 //Output pin for (SSC32 RX) on BotBoard (Yellow) #define cSSC_IN 13 //Input pin for (SSC32 TX) on BotBoard (Blue)
The only thing is that pin 8 was connected to ATT on the PS2 wireless controller module rather than SEL because there is no SEL pin on the wireless module.
The gauge of the wires that I am using is 22. Should that work?
Also, does the amount of power going into the Arduino and SSC32 (with the 9V battery) affect the power of the servos?
No, this battery check code stops the move commands from being issued. It “TURNS OFF” a bunch of stuff it looks like. cTurnOffVol variable can be set to 0 (I think) to kill this function. Or remove the code.
You probably saw the message "Voltage went low, turn off robot ".
Alan KM6VV
[code]
//[CHECK VOLTAGE]
boolean CheckVoltage() { #ifdef cTurnOffVol
// Moved to Servo Driver - BUGBUG: Need to do when I merge back…
// Voltage = analogRead(cVoltagePin); // Battery voltage
// Voltage = ((long)Voltage*1955)/1000;
Voltage = g_ServoDriver.GetBatteryVoltage();
// BUGBUG:: if voltage is 0 it failed to retrieve don’t hang program…
// if (!Voltage)
// return;
if (!g_fLowVoltageShutdown) {
if ((Voltage < cTurnOffVol) || (Voltage >= 1999)) { #ifdef DBGSerial
DBGSerial.print("Voltage went low, turn off robot ");
DBGSerial.println(Voltage, DEC); #endif
//Turn off
g_InControlState.BodyPos.x = 0;
g_InControlState.BodyPos.y = 0;
g_InControlState.BodyPos.z = 0;
g_InControlState.BodyRot1.x = 0;
g_InControlState.BodyRot1.y = 0;
g_InControlState.BodyRot1.z = 0;
g_InControlState.TravelLength.x = 0;
g_InControlState.TravelLength.z = 0;
g_InControlState.TravelLength.y = 0;
g_InControlState.SelectedLeg = 255;
g_fLowVoltageShutdown = 1;
s_bLVBeepCnt = 0; // how many times we beeped…
g_InControlState.fRobotOn = false;
}[/code]