Remote tank project part 1

Today I received the tank model set of Tamiya which I have already waited days. The set includes 3 parts and they are sold separately (well, good selling policies). The components are well designed so it only takes less than 2 hours for assemblin.

The tank tracks and base are light and strong, which are suitable for build a remote toy tank with minimal power and weight. The current design is Arduino nano + h-bridge + xbee, controlled with the general joystick described in the previous post. The motor set supports 3 different speeds, for tank toy like this one the slowest speed (203:1 gear ratio) is appropriate. They work for 3 to 6v so a 4 AA battery case is needed.

The tracks are easy to assemble, there are parts of different lengths included in the package, so different lengths of tracks can be made. For this tank project I used one 30 links, two 10 links and one 8 links parts for each track. The top view of the tank base is shown so you can refer to the arrangements of the wheels and motor position.

Next thing to do! design a compact layout of the control circuit, including a on/off switch. Also considering to add robotic arm or claw to the tank afterward.


Processing: Simple follow part 1

Processing is a simple and useful programming platform for fast prototyping and testing, especially for graphical output and 2D drawing.

Here is a short collection of posts about how to use the concept of target positioning to achieve simple following, wandering, avoidance and flocking. The basic idea is simple, during each update iteration, we setup the suitable target positions of the rendering objects, and move the objects to their target positions smoothly. That it is!

Let start with simple example, we want to move a target object, following the mouse cursor, the direct solution is to update the object location:

x = mouseX;
y = mouseY;
ellipse(x, y, 10, 10); // draw small circle at (x, y)

but this cannot give smooth movement as the object (here is the small circle) just sticks to the mouse cursor. To make it moves smoothly towards to mouse cursor, we consider the mouse location as target position and move the object towards the target, instead of jumping to the target directly.

float dx = mouseX - x;
float dy = mouseY - y;
x += dx * 0.05;
y += dy * 0.05;
ellipse(x, y, 10, 10);

Here dx and dy are the differences between the mouse and current object location. Each time the object is moving towards the target by adding a small portion of the different vector (in this case is 5%). This is so called the easing movement as the object’s speed decreases when it closes to the target location.

Here is the final version of the follow program, now the moving object is a small triangle and it always points to the cursor, which is rendered by simple rotation and translation that are not discussed here.


External EEPROM

This is the first time to use external EEPROM with Arduino. The test uses the 24LC256 I2C enabled EEPROM. Two chips are connected to the same serial line, the connection is shown below.

According to the data-sheet only 3 bits of the address of 24LC256 can be defined by the address pins (pins A0, A1 and A2), therefore at most only 8 24LC256 can be connected to the same I2C line. This time I tried to connect two EEPROM to the Arduino, using the default I2C serial IO of Arduino (Arduino nano Pins A4 and A5).

Read the rest of this entry »

Making a general joystick (V1.0)

In this summer I have a few ideas want to make for personal usage and also for the coming teaching materials, but the first thing to do is to make a general joystick so everything can be controlled wirelessly. Yes, you know, remote moving toy is a must and this is one project I will start with.

This is the first version of the DIY joystick, so it is big and has bad arrangement. Anyway it has one big joystick and 4 buttons, also a 3D accelerometer is used for gesture and orientation input. In this version XBee (version 1) chip is used for wireless connection since this is extremely easy to setup. For details please check the item list below.

I used the Hitachi H48C tri-axis accelerometer for handling gesture input. This can measure G force up to 3G in all three directions which is good for gaming.

Read the rest of this entry »