Question about How Xbee is powered

Hello All!

I've read some specification and introduction about the SSC-32 and Botboarduino. I have a few following questions:
1.  For powering servos of Hexapod on the SSC-32 we need a 6V NiMh batteries (recommended by Lynxmotion), but Xbee module runs at 3.3 V. Why can we directly plug it into the SSC-32u? Is there a built-in regulator?
2. When connecting SSC-32U and botboarduino together, can we still use the pin on the botboarduino? I asked this because I saw people connected PS2 receiver to the botboarduino when connecting with SSC-32U. If we can do that, but the pin numbers on the botboarduino are still the same as the pin number on the SSC-32. 
3. I've seen every hexapod in the Lynxmotion, they are all powered from a 6V 2800mAh NiMh battery, and I read the spec of the battery and it only supplies 2.8A max. How can this amount of current be possible to power all 18 standard servos and other devices? 
4. Can I use Lipo battery and even with a voltage regulator to power the SSC-32U board when I need more current (Like in some situations I want to use my own high torque servos which will draw more current)?

Hi,

Here are answers to your questions (inline):

Yes, the SSC-32U has a on-board voltage regulator for the 3.3 V required by XBee modules. This regulator is a MCP1700 and can provide up-to 250 mA, which should be enough to power most XBee modules. It also has on-board level shifting for the XBee modules’ data lines.

We are not sure we understand your question properly. Please let us know if misunderstood your question and give us more details so we can provide better advice. If a pin is used to connect between the BotBoarduino and the SSC-32U, then it can only be used for that connection. For example, in most setup, pins 12/13 of the BotBoarduino are connected to the TX/RX of the SSC-32U (you also need to connect the GND pin from the BotBoarduino and the SSC-32U for proper communication). In this case, pins 12 & 13 of the BotBoarduino can only be used for this purpose and nothing else.

The pins on the BotBoarduino used by the PS2 receiver are not related to the SSC-32U pins (for the servomotors). For example, if you are using pins 6,7,8,9 for the PS2 receiver (default recommended pins), then you can still use all 32 channels (pins 0-31) of the SSC-32U regardless.

Actually, most NiMH we carry (ex: RB-Sta-08) have a discharge rate of at least 2C (or 2x maximum charge). Since the RB-Sta-08 has a charge of 2800 mAh (or 2.8 Ah), it can discharge at up-to 5.6 A safely / without issue. This is more than enough for the RC servomotors.

Yes, you can, but you have to be careful of a few points:

]Most RC servomotors only support 4.8-6.0 V DC whereas most suitable LiPo battery packs will be 2S or 3S, which would mean 7.4 or 11.1 V DC. This would be too high for most RC servomotors. That being said, some RC servomotors can support 7.4 V DC, but they are not the norm. We recommend that you check your servomotors’ datasheets first. The SSC-32U itself has no issue with a larger voltage on the VS1 and VS1 inputs./:m]
]If you need a very large amount of current, lets say ~10 A, you can simply place half of your servomotors on the first side of the SSC-32U (channels 0-15) and the other half of your servomotors on the other side (channels 16-31). Then, remove the jumpers VS1=VS2 (make sure to remove both). Connect one battery (such as RB-Sta-08) to VS1 and another to VS2 (you can use RB-Onl-12 or RB-Onl-16 to connect the battery to the SSC-32U). This way you can split the power requirements over 2 batteries./:m]
]Unlike NiMH, LiPo battery packs can get damaged by being over-discharged very easily (whereas NiMH can be discharged fully with no issue). The SSC-32U has no battery voltage monitoring, therefore using a LiPo battery pack runs the risk of damaging the cells of the battery pack if not careful. You could always monitor the voltage of the battery pack by connecting wires from VS1 to a voltage divider (with max battery voltage converted to ~4.5 V DC) and running that voltage divider output to the a BotBoarduino analog input pin. This would allow you to monitor the battery pack output voltage and at least turn off the servomotors / raise an alarm (the BotBoarduino has a buzzer!) when the voltage gets too low./:m]

We hope this information helps!

Sincerely,

Hello. Thanks for the reply!

For question 2, I mean when connecting the botboarduino with the SSC-32U, can I still use the pin on the botboarduino? For example, if I want to use pin 14 on the botboarduino, but pin 14 on the SSC-32U is used for a servo. Can I still use the same pin on the botboarduino? If not, can I use it in the case that pin 14 on the SSC-32U is not connected to the servo. I ask this becasue I may wanna connect a bunch of sensor to my robot in the future, like force sensor, as we know, different sensor rated at different voltage, if I connect the sensor to the SSC-32U, the voltage could be too high for them (I am not sure if SSC-32U can only be connected to servos or different devices, I haven’t receive my item yet, so don’t have time to look into this carefully), So if I cannot connect sensors to SSC-32U, can I connect them to botboarduino?

Hi,

First, here are answers your various questions and comments:

Yes, you can. The SSC-32U has its own microcontroller on it (actually, it is an ATmega328, just like in the BotBoarduino). This microcontroller has a UART serial interface that can be used to tell it how to control the servomotors connected to it and also read from its 8 inputs (A,B,C,D,E,F,G,H). The microcontroller receives commands from that serial interface and then sends signals on its 32 channels to control servomotors. It can also read results from the 8 input pins, which can be used for digital inputs (6 of them, A,B,C,D,E,F) and analog inputs (all 8 of them). The output is completely independent of the BotBoarduino since the SSC-32U has its own microcontroller to take care of things.

Since you seem to be starting out with these products, we strongly recommend that you check out the BotBoarduino manual and the SSC-32U manual. They are filled with useful information! :slight_smile:
Specifically, you may want to check out the SSC-32U manual at pages 33 (digital) and 34 (analog) for details on commands to use the inputs (for sensors) and the pages 24-26 for general commands to control servomotors. Page 34 (bottom half) also has details on changing the communication speed (baud rate) of the board’s serial interface.

The 8 input pins on the SSC-32U also have a row of “VCC” pins and a row of “GND” pins. These work at 5 V DC since there is also an on-board voltage regulator. Therefore, you can use it with compatible sensors that work at 5 V DC. That being said, going through the SSC-32U is only useful for sensors that actively output a signal (such as a switch or a analog output signal like an Sharp IR range finder). For sensors that are more complex, you are better off connecting them directly to the BotBoarduino. This will also be required if you use sensors that required special libraries, since the libraries won’t support using the sensor through the SSC-32U.

Yes, you can. The BotBoarduino is a fully Arduino-compatible and can be used as such. Just keep in mind that you will need to reserve 2 pins for communication with the SSC-32U.

We hope this helps

Sincerely,

So, if I wanna use Arduino IDE to control the servo on the SSC-32U, can I just simply type servo.write() command in the IDE and upload it to the botboarduino? or is there a special library for controlling the servo on the SSC-32U. Are all of these written on the botboarduino and SSC-32U introduction PDF?

and how much is the memory of Botboarduino? It is the same as the arduino? Could you provide me an estimation about the memory if compared to Arduino mega?

To control the SSC-32U from the BotBoarduino, you will need to do a few things. First, you will need to choose two digital pins and wire them from the BotBoarduino to the SSC-32U’s RX/TX pins (see the SSC-32U manual, page 21). Also, do not forget to connect a wire between the GND of the BotBoarduino and the SSC-32U to ensure proper communications.
Then, you will need to add to your code a SoftwareSerial object initialized to those two pins. You can see an example of code doing this here. The pins are defined here and the SoftwareSerial object is initialize here.
It is then started here and you can find an example of sending a command here (to read analog values from the inputs).

For example, if you wished to move a servomotor on channel 7 to position 1200 µs, you would write this code in this example:

SSC32U.println("#7 P1200");

All the commands to the SSC-32U are sent as ASCII strings directly. As mentioned previously, you can find all the main commands in the SSC-32U manual on pages 24-26.

The BotBoarduino also uses the ATmega328P and therefore has the same specifications as the Arduino Uno. The main difference is that the BotBoarduino uses the FTDI chip (like the Duemilanove) whereas the Arduino Uno uses an ATmega as the interface chip.

So I can only write pulse to the servo? Can I write angles to them?

and if I need more memory, can I connect arduino mega to SSC-32U? Is there a tutorial for that. And if I use arduino mega, how can I cconnect the Lynxmotion PS2 controller to interface with mega?

I wanna play around with the analog input value sent by PS2 controller, is there a tutorial for that? In the github page, I got lost for sending command section, I am not familiar with some of the syntax.

The SSC-32U protocol only allows writing in pulse width (µs). That being said, it is quite easy to convert between one and the other. Here is a short example:

[code]// RC pulse width signal
//#define CST_RC_MIN 1000 // Typical RC receiver are 1000-2000 us, 1500 center.
//#define CST_RC_MAX 2000
#define CST_RC_CENTER 1500
#define CST_RC_MIN 500 // Advanced RC receivers and microcontrollers can use extended ranges, such as the SSC-32U [RB-Lyn-850].
#define CST_RC_MAX 2500

// Angle conversion
#define CST_ANGLE_MIN -90
#define CST_ANGLE_MAX 90

// Convert integer angle into an integer pulse width (µs)
long getPulseFromAngle(long angle)
{
angle = constrain(angle, CST_ANGLE_MIN, CST_ANGLE_MAX);
long pulse = map(angle, CST_ANGLE_MIN, CST_ANGLE_MAX, CST_RC_MIN, CST_RC_MAX);
return (pulse);
}

// Convert integer pulse width into an integer angle (µs)
long getAngleFromPulse(long pulse)
{
pulse = constrain(pulse, CST_RC_MIN, CST_RC_MAX);
long angle = map(pulse, CST_RC_MIN, CST_RC_MAX, CST_ANGLE_MIN, CST_ANGLE_MAX);
return (angle);
}[/code]

Yes, you can! Actually, if you want even more memory, you can even go for any other microcontroller that can work with a 5 V DC UART TTL serial interface (and if they are only 3.3 V DC, you can use a level shifter, such as RB-Spa-879). A pretty powerful board that is Arduino compatible is the Teensy 3.6 (RB-Pjr-08). It has 1MB of Flash, 256 KB of RAM and 4K of EEPROM, which in Arduino terms is a massive amount of storage space for processing data and an incredibly powerful CPU.

The same you connect it to a BotBoarduino: connect all 4 digital lines to the proper digital pins (as defined in your code, by default they are 6,7,8,9) and the VCC & GND to the proper connections on the Arduino Mega. You can see an example we added to our library for the Arduino Mega here. It uses pins 22,23,24,25 instead.

If you mean the analog stick values for X/Y, you can get those like this:

int LSY = 128 - ps2x.Analog(PSS_LY); int LSX = ps2x.Analog(PSS_LX) - 128; int RSY = 128 - ps2x.Analog(PSS_RY); int RSX = ps2x.Analog(PSS_RX) - 128;
Sincerely,

Thanks so much for your help!! I benefit a lot!
I noticed that the Teensy board you mentioned is very small. How can it have larger memory than Uno with this kind of size? Is that just a memory extension board?
And I have read through the introduction file of SSC-32U. But I have only seen the command and command group about writing pulse to servos, it is like #(channel) P() s() T() somthing like this, it didn’t tell me what syntax I should put it in. Just like you mentioned before “SSC32U.println(”#7 P1200");" I cannot find SSC32U.println in the documentation. Where can I find all of commands about SSC32?

And, I don’t understand what do you mean by saying “It is then started here and you can find an example of sending a command here (to read analog values from the inputs).” I guess if I want to use the analog input read from PS2 and use it in SSC-32U (like writing to servos) then I should use this code? Why can’t I just use the analog value read from ps2 and directly put it in the command? Like this : int RSX = ps2x.Analog(PSS_RX) - 128; SSC32U.println ("#7 PRSX);
But PRSX is kind of confusing, can the SSC32 understand what it means? should I do it like this: P(RSX)?

Finally where can I download the SSC-32U library “SoftwareSerial.h” (I don’t quite remember the name of it so I am not sure if I am saying right, but you should know what I mean. ^ .^)

We are glad to help! :slight_smile:

Actually, the amount of memory available in devices of this size is mostly limited by cost concerns than actual space or technology. The chip used in a Teensy, if purchased in low volume (such as 1 at a time), would cost ~23-24 USD. An ATmega328P-AU (surface mount or SMD version) would cost around 3-4 USD. As you can tell, this is quite a difference in price. The ones used in cell phones are even more expensive but nonetheless are quite small and include GB of memory in one chip (they are SOC or System on Chip)!
Usually, chips used in embedded systems are chosen specifically for the task(s) they are supposed to fulfill and nothing else. Therefore, int he case of the Arduino Uno, a chip that fit the requirements was chosen and they reached a good balanced between cost and features (such as interfaces, pin count, memories, etc.).

As mentioned previously, the commands are sent to the SSC-32U as ASCII strings. Said differently, this means the commands are simply text that represents what needs to be done.

The SSC32U object is declared/created in the code a bit further up here. It is a SoftwareSerial object that is created using the SoftwareSerial library. This library is part of the official Arduino IDE and therefore you simply need to include a reference to it at the top of your code (such as here). There is no need to download anything for it if using regular Arduino boards.

The first link points to the begin() and listen functions. These are functions of the SoftwareSerial library. begin() initializes the port so it can send and receive commands. It also has one parameter (in this case 9600) to select the desired baud rate. listen() is used to activate this software serial port as the active one for receiving commands (this is only needed on SoftwareSerial ports, not for regular hardware ones).

My best recommendation at this point would be to try it out/experiment with the board. Though it seems like you may need to learn a bit more about general coding in C first. A simple way to pass the value would something like:

SSC32U.print("#7 P"); SSC32U.println(RSX, DEC); This code does two things: first, it sends the channel to be used and indicates a P command. Then, a second print (println() in this case) is used to convert the value into a string (DECimal base, or base 10) and also sends a CR character at the end, since it is a println() and not a print().

See the answer above with the example code.
We strongly recommend that you read a bit more about C programming to get a better grasp of the basics. There are many tutorial-oriented websites around, such as these (in no particular order):
learn-c.org/
cprogramming.com/tutorial/c-tutorial.html
programiz.com/c-programming
tutorialspoint.com/cprogramming/
You can easily find more of them with a quick online search. Of course, there are plenty of good books, too!

See fourth answer from the top for details.

Sincerely,

Hi again. I am experiencing a very serious issue right now!! I bought a bunch of solar servo D771 (nitroplanes.com/33p-solarservo-d771.html)
When I connect 2 of these to the board and make a command that allows them to move at the same period time, this worked!
But When I tried to move the servo in the range from 0 degrees to 30 degrees by an increment of 5 degrees, it gets weird! The servo doesn’t respond to my command. But when I increase degrees by 5 in the range from 30 degrees to 150 degrees, it would work.
To be more clear, I will give an example, if I position the servo to be 25 degrees and then position the servo to be at 30 degrees, it won’t work (actually I think it cannot rotate in the 0-30 range no matter how many degrees I choose for each increment.) I tried the same thing in a sg90 servo, it works fine! So the only issue is probably from my servo, but I tried the same thing for couple of my solar servos, it still behaves weird.
Is it because the solar servo D771 is digital servo? so I guess I probably need another way to control them?
By the way, I try them on a regular arduino mega board without interfacing wtih SSC-32U, it is still the same! So the issue must from the servo! And it is not because my servos are broken or what because I tried couple servos already and they were all the same!
I could not find the datasheet for solar servo D771. When I got the servo, I tried their rotation limit first, I gave 180 to it, it does not respond! And I give 150 to it, it responds! so originally I think the range of it is betweeen 0 to 150, but right now I tried 160 and 180, it responds to them sometimes! Anyway, it is so weird!!
I really need to fix this as soon as possible! I’ ll paste my code below:

[code]#include <SoftwareSerial.h>

#include <Servo.h>
#define SSC_32_RX 10
#define SSC_32_TX 11

Servo mys;

SoftwareSerial SSC32(SSC_32_RX, SSC_32_TX);
int abc=150;

void setup() {

Serial.begin(9600);
Serial.println("< Starting… >");

// Start the software serial interface
Serial.print("\t > Starting software serial interface to SSC-32U… “);
SSC32.begin(9600);
SSC32.listen(); // Required for the SoftwareSerial port to receive data properly. Only one SoftSerial interface can listen at any time.
if (SSC32.isListening())
{
Serial.println(“Port opened successfully.”);
}
else
{
Serial.println(”!!! Port error.");
}
delay(1000);

}

void loop() {
// put your main code here, to run repeatedly:

int angle=map(abc,0,150,500,2500);
SSC32.print("#0 P");SSC32.print(angle,DEC);SSC32.print("#12 P"); SSC32.print(angle,DEC);SSC32.print(“T”);SSC32.println(500);
// SSC32.println("#12 P2500 #0 P500 T200");
/SSC32.println("#12 P700");
SSC32.println("#12 P800 “);
SSC32.println(”#12 P900 “);
SSC32.println(”#12 P1000 ");
/
Serial.println(angle);
}[/code]

I just searched lots of stuff on the internet, it seems that the digital servo only has a range of 120 degrees as default???

I think I found the reason. When I map the degrees to pulse between 500 to 2500, it will generate a dead zone, because the servo only operates from 30 to 150. So I should map it from 834 to 2166. 834 and 2166 respectively correspond to 30 degrees and 150 degrees.
So the command should be pulse=(angle, 0, 120, 834, 2166); or pulse=(angle, 30, 150, 834, 2166); if I give 500 to the servo, it will only be at the position =834 and if I give 2500 to the servo it will only be at the position=2166. That is why when I write 160 or 180 degrees using mega without SSC, the servo will still response! but when I give 165 or 25 (any degrees between 0-30 and 150-180), the servo is not moving, because nor matter what degrees I give to them, they will always be at pulse=834(30 degrees) and pulse=2166(150 degrees) because the angle I assign is in the dead zone!

since I am using digital servos, which will draw more current than normal RC servos, do you think if the power supply is enough for powering the hexpod(18 digital servos) using only one 6V NiMh 2800mAh battery?
If it is not enough, I don’t want to use two NiMh batteries, because they are too heavy, I would rather use a LiPo battery and a voltage regulator (They are definitely lighter than two NiMh batteries!) So which LiPo battery should I use? Do you have a recommendation?
Anyway, it would be perfect if only one NiMh battery will work!!

And I am always confused how can a 6V 2800mAh NiMh battery power 18 servos for hexapod at the same time, since each servo I found in your website has almost 0.5A running current! And when the hexapod is moving, all the servos should be moving at the same time! so it will require 18*0.5=9A! and I don’t even consider the case that there is the loading situation for servos! The battery has 2C discharge rate which provide maximum 5.6A current! This should be insufficient. Why will it still work for your lynxmotion hexapods, even for some 4DOF hexapod! I am so confused! lol

Hi,

Lets address all of this in blocks of answers.

  1. Concerning the servomotors and their range:
    Please connect one RC servomotor to your SSC-32U, channel #0. Then, connect your SSC-32U to a 6 V DC power source to VS1. Connect it by USB to your computer.
    Then, start Lynxterm (download here and install it). Click Setup and change the COM port and baud rate (SSC-32U uses 9600 baud rate by default). Then click OK and then Connect.
    Press the All=1500 button. The servomotor should center. Then, move the vertical slider on the far right up and down, the servomotor should respond by turning.

You can alternatively try one servomotor out with your Arduino board. Upload to is the example Sweep from the Servo library, found here:

  1. Concerning the battery question, you are right about the NiMH pack. Most of them can only discharge at 2C, so the 2800 mAh pack can indeed only provide 5.6 A. Please note that this is the continuous current the battery can provide. Also, it should be noted that 6 of those 18 motors are not actually under any real load, since they are moving perpendicular to the force (moving the legs back and forth). Therefore, you prob. have more around 6 A of maximum current draw. But, as you may have noticed with the gait, only 3 of the 6 legs of an hexapod are in active mode at a time, so that makes for only 6 motors really turning a near maximum continuous current. This makes the current required much more reasonable than it first seems.

Try out the stuff under #1 and let us know what happens. Actually, if you can post a small video of the test, that would be great.

Sincerely,