NightRider – update e

The programming.

To capture the RC data I am using a simple Arduino function called pulseIn(). You can see all the reference on the Arduino site. I discovered this function while googling “radio control joystick to arduino” and found this great example from Sparkfun.

All the code is at github.

There is a folder called “RC_reader” with a program that captures all the 6 RC channels and prints RAW values to the console. This code it is just for debug purposes and it is not being used for anything else:

int ch1_pin = 6; // right_horizontal
int ch3_pin = 5; // right_vertical

int ch2_pin = 4; // left_vertical
int ch4_pin = 3; // left_horizontal

int ch5_pin = 7; // c_stick
int ch6_pin = 8; // right_knob

int ch1_val; 
int ch2_val;
int ch3_val; 
int ch4_val;
int ch5_val;
int ch6_val;

void setup() {
  // RC pins
  pinMode(ch1_pin, INPUT);
  pinMode(ch2_pin, INPUT);
  pinMode(ch3_pin, INPUT);
  pinMode(ch4_pin, INPUT);
  pinMode(ch5_pin, INPUT);
  pinMode(ch6_pin, INPUT);


void loop() {

  ch1_val = pulseIn(ch1_pin, HIGH, 25000); // Read the pulse width of 
  ch2_val = pulseIn(ch2_pin, HIGH, 25000); // each channel
  ch3_val = pulseIn(ch3_pin, HIGH, 25000); // Read the pulse width of 
  ch4_val = pulseIn(ch4_pin, HIGH, 25000);
  ch5_val = pulseIn(ch5_pin, HIGH, 25000); // Read the pulse width of 
  ch6_val = pulseIn(ch6_pin, HIGH, 25000);
  Serial.print("ch1: ");
  Serial.print("  ch2: ");
  Serial.print("  ch3: ");
  Serial.print("  ch4: ");
  Serial.print("  ch5: ");
  Serial.print("  ch6: ");

Using this code, I am reading raw data from the RC, now we just need to map this data to an usable format (0 – 1023) or (0 – 255) or (0 – 180).

//The actual code have three important functions:

// map RC RAW values to usable values

// map usable values to PWM values

// controls motion with IR sensor and RC control

rc_mapper() – maps the joystick to a differential drive, and once again google made my day, otherwise I would still be struggling with this component. This function will give two values ‘left_vertical’ and ‘right_horizontal’ that will be used later to assign speed to the motors.

motionMapper() – all the source for this function can be seen here. I had to hack this bit of code to use with the Motoruino2, because the motors are on a Slave uC, I am using a function to set PWM for both motors.

motionControl() – just uses the values that comes from the motionMapper() and sends them through the function setPWM(leftMotor, rightMotor).
I am also using the right knob on the remote controller to set maximum velocity.

There is also a Sharp Distance Sensor that is being used to avoid collisions. On the motion control I am testing the distance, and if it is below 100 the bot runs normally, if it is beyond 100 and below 200 it moves slowly, and if it is beyond 200 stops. It can always move backward, there is still some tweak I want to do here, for instance, I want to be able to enable or disable this feature in runtime.

For the light I am using one of the sticks with 3 positions. Each position gives a value, each value will correspond to a light state.

Not to much to say about the servo control. I just need to verify the course limits to avoid collisions with other components on the bot.

All the code is available and commented on GitHub.

NightRider – update c

Motoruino2 is a great board, has a built-in IMU, motor encoder connections and an L298 for more power demanding motors, there is a dedicated low-level Arduino (uno) to handle all the raw data from this sensores and actuators. Then, there is a high-level Arduino (Leonardo) that is totally available to whatever we want to do. Both microcontrollers communicate via I2C. There is also a speaker and a microphone that I intend to use later on this project. Also an xbee socket, 1S lipo charger and a mosfet output capable of driving about 2 amps.

Enough said, its a great board and I hope Artica manage a way to put it into the market. Just see for yourself :)

This is how the bot is looking..

I want to have some lights and I found this little 12v LED lights on the hardware store, this little things in full power completely blind you! To drive the LEDs I am using the mosfet output on the board.

And the shell of course, I changed the pan and tilt system, this is a much robust solution and I removed the pan, if I want to pan I just move the bot side to side.

Et voilá… :D

Robotic Claw

This is a first experiment on building a 3D printed robotic claw, I first got inspired by this project but it was designed for a micro servo, and I wanted to use a standard size servo so I had to design the claw from scratch.

Robotic Claw

The actual design still need one tweak or two to be optimized for 3D printing, but as it is now is fully functional.

STL files are available at

Robotic Claw

This Week In Hobby Robotics 2

Imagine what happen when hobbyists, engeneers, artists and all kinds of cool people from very different backgrounds, gather with a single purpose in common, to create robots, share knowledge and information, and mostly have a lot of fun!

It’s a joy to see my Talkie Walkie being featured in this nice video. Fritsl and Rik, you guys rule!!

Campus Party 2008

Ibero American Countries gather to diffuse digital boundaries, and to avoid digital exclusion.

Astronomy, Robotics, Innovation, Creativity, Modding and Digital Pleasure were the main areas where participants could share their knowledge and experience.

I went into the Robotics area, all the participants were very nice, I´ve met lots of interesting people from ibero-american countries. And there were really amazing Robotics projects!

One big thanks goes to Leonel Moura, he was the one who sent me the link to this event, and another big thanks to Alejandro for inviting me.

I will return to Portugal on Sunday, with a nice felling of hope for a better and unified world.
It was a great event!

22 robots, called skybot were built by the participants, one robot for each country and the final result was really amazing! Congratulations to all the participants! It has been a pleasure!

Robots can make this world a better world !!!    :]