Walking with battery pack – milestone

So here is the test result of walking with battery pack!

On one hand it means totally independent movement and for us this is a milestone. On the other hand this can cause additional load and kill all the servos (this would not mean a real milestone :) ). Our expectation was to see this small robot to walk and walk alone without any external support (no external power, no external control, nothing just Little Johnny).

Vote before you watch the video! Agony or walking?

Add battery and use internal power supply!

This was a critical part of the development. With external power source everything was easy and simple: 5V was just coming flawlessly. Adding the batteries suddenly caused unlimited number of problems:

Problem 1: where on Earth can we place 6 AA batteries in a small robot body? This is solved because my brother designed a battery holder right under the Arduino Mega almost a year ago as you can see below. Sorry :)

battery pack holder

Problem 2: how can you connect AA batteries without soldering and use as less energy and time as possible. I found a proposal to use “snail” formed wires and simple tape.

AA battery connector wire

This was really simple and quick: in 10 minutes I could connect 6 batteries and have a 2200mA 9V pack built-in to the pack holder!

half connected

Problem 3: additional load! Normal weight was 305g before this step and now it is 455g! Will the servos accept this additional load?

Problem 4: can this battery pack provide enough power for the servos – to hold the extra mass caused by the battery pack :) ?

This definitely has to be tested…

Walking on lego – round 2

Last time a simple 4-5cm thick lego obstacle could stop LJ why I simply changed step height to maximum :) Let’s see the result!

Categories: Robot HW and SW Tags: , ,

Walking on lego

The purpose of this test is to check stability and possible problems during normal walk. You will see easy and impossible scenarios :) but this small robot did not fall over and never gave up.

Categories: Robot HW and SW Tags: , ,

Little Johnny careful steps

After 9 hours development I could update the walking code and implement a “higher” but still careful step function. The gyro is not used this time to have a very clear base. Alone a simple walking algorithm was not enough and any time the robot would like to step mass center correction is required. Mass center is moved using shoulder servos and decreased body height on the opposite side. Please check the video and comment if you want! :)

The funny part is that this configuration is not able to keep walking direction. I found two major problems that need to be solved:

1. incorrect servo positioning: interesting that the used positioning function (write) from Arduino Servo Library (http://arduino.cc/en/reference/servo) needs an integer value between 0 and 180. I think as a step it is not fine enough. Luckily this lib provides another function writeMicroseconds() which can be 5 times smoother! Comparing 0-180 degrees to 1000-2000 uSeconds looks good and has much better resolution. Question if any servo can interpret 1500 us and 1501 as control signal. This change of positioning type can have effect only on one part of the robot driver: instead of servo.write(90); something like servo.writeMicroseconds(1500); could be used. Maybe this test should be the subject of the next post.

2. incorrect servo offset setup: when you mount your arm or leg on the servo gear you need to find the possible best orientation out of the very limited variations. Let’s say we have 20 teeth on the servo gear (sample pic below) which means you can change start position only by 18 degrees. If the leg is not positioned properly an offset value needs to be used any time Arduino final position is calculated. As you can see in the video Leg 4 has an offset problem and simply kicks the floor. I use 10 degrees as offset but it should be changed to 5 or 4…

servo gear

 

(3.) Of course different leg friction could cause a small rotation but this was too much.

Arduino to Arduino serial connection

During balancing experiment I had to remove IR sensor because it’s software library disturbed my servos. I could continue the work and change key walking and balancing parameters using keyboard but it was not too comfortable. So I had to find out how to use IR with servos without unexpected side effects. My Arduino nano volunteered to do the job. I have tested I2C and ISP low-level interfaces why I decided to use simple serial communication this time. It was much simpler than I thought.

Source: http://robotic-controls.com/learn/arduino/arduino-arduino-serial-communication

All I needed on HW level:

- Connect Nano TX pin to Mega (main Arduino) RX1

- Nano RX pin to Mega TX1 and

- connect GNDs. That’s all.

On SW level it was also very simple. The best if you check the code itself:

Sender:

#include <IRremote.h>
int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}

void loop()
{
if(irrecv.decode(&results))
{
Serial.println(results.value, HEX);
irrecv.resume();
}
delay(10);
}

Receiver:

char str[20];

void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
}

void loop()
{
int i=0;

if (Serial1.available()) {
delay(10); // min 8 ms required!
while(Serial1.available() && i<20)str[i++] = Serial1.read();
str[i++]=”; // should be = ‘[backslash][zero]‘ but WordPress removes spec chars…
}

if(i>0)
{
Serial.print(str);
}
}

From now on I have a fully separated IR sensor module :)

This is how it looks like in action:

Two Arduinos powered

 

One weird thing: both Nano and Mega required power supply why standard USB cable was connected to both. When I finished the testing I simply disconnected the USB cable from Arduino Nano. Without the cable it was still operating! I also could use all IR functions and serial communication! Basically two cables could keep Nano alive: GND and Mega TX1 to Nano RX. I was not aware of this possibility of power supplying :) Funny…

Only Mega powered

Balancing 4 leg robot – code v2

Balancing code v2.0 has been developed and tested successfully! :)

Main differences between previous standing and this version:

- balancing in standing phase (in previous post) was a fake mode because the gyro provided rotation values were used directly: added to standing leg degree parameter and set as shoulder servo angle

- this version uses gyro data as just one of the inputs of walking calculations. A primitive model of robot body is rotated in 3D around X and Z axis to simulate rotated body orientation. All calculations are done by Arduino in real-time. Knowing the rotated coordinates of all key points of the model leg by leg v2.0 walking code can make the necessary amendments on body height level. Based on actual leg body height and step phase the real servo angles can be calculated. So there no direct connection between the gyro provided data and the final servo position. The bonus of this code version is that the shoulder servos are not even used and can provide more degree of freedom later when I need to change mass center for complex balancing scenarios…

Let’s see the video where we should see almost the same as in the case of standing/balancing except that this is done by the walking code. Actually Little Johnny is not walking because the speed was set to zero :)

Follow

Get every new post delivered to your Inbox.