BTTO – 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.

The following code captures all the 6 RC channels and prints RAW values to the console.

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).

Now I need to map the joystick to a differential drive, and once again google made my day, otherwise I would still be struggling with this component. This link explain all the details.

I have modified 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. So I am just assigning values to the variables [VAR NAMES] and them setting this variables as parameters on the function setPWM(leftMotor, rightMotor).

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.

BTTO – 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

BTTO – update d

About the controller, I want it to have something we see in the drone industry, a controller with the screen, all-in-one. There is always the option to connect the receiver to the TV, but I really want it to be standalone, independent of power wallets, just something that I can carry anywhere I go.

First step was to find a way to hold the screen to the remote, so I added zip ties to the back of the screen.

I also added a compartment to hold the receiver, battery and wires (collecting acrylic stuff is a good habit I guess)

Not bad..

The back side is still messy, but I will live with it for now.

and it just works..

BTTO – update b

I felt with courage to start the modifications to the bot, first I moved the battery to the lowest possible place, this makes the center of gravity lower.

With the electronics board all looks good..

I added a power switch and a Sharp Infra Red sensor, this sensor will act as a fail safe to avoid collisions.

I also wanted to create some kind of a shell, so went to 3D to design the plates and this is the result.

The plates will be cutted in laser or CNC, but meanwhile I will just print them and manually cut PVC sheets.

using graphite pencil to transfer the plate drawings to the PVC sheets.

All the plates are transfered and ready to be cutted.

The plates are cutted, now I will just sand a bit to give a final touch

All plates are looking good for now

Time to start with the supports for the plates, I will go to these small L shape things

All the supports are fitted, when we have loads of screws an electric screwdriver is handy, this one is the cheapest I could find

Now to fit the plates I will use this selftap screws, they come together with the servos motors, and I always harvest them because they are hard to find in hardware stores.

You can also see a hinge, this will actually make a door to swap batteries.

And this is how the plates are securelly fitted.

A look on the inside

This is how I managed to hold the power button in place, it is just PVC pieces fitted to the chassis, and then hold the power button with selftap screws.

There’s the hinge.

Testing everything, all look good.

I was doing another quick test when suddently smoke started to come out, it was the L293D that got smoked.. well, I couldn’t expect worse since I was pushing 12V to 4 motors and the L293D only handles 600 mAh per channel.

I will swap the board to the new Motoruino2 from Artica, wich is still a prototype but nothing better that this bot to test it.

BTTO update A

I wasn’t happy with the hacked chassis, besides the caster wheel was freaking out my wife because it was making a lot of noise on the apartment’s pavement. Luckily me I had another brand new chassis, and so decided to swap all the electronics to the new one, and the result is great, glad I did it! With 4WD it moves really quicly and its motion is much more stable, besides I am feeding the motors with a 12V Lipo battery wich gives it a great pump.

The experiences I had are very fun, and the torch light is a great addon.

I still don’t like the way it is, with the battery exposed on the top GC is very high, besides the pan/tilt is very shaky when it moves in full speed.

I tried my first FPV experience with the Quanum Goggle Set from HobbyKing and it freak me out, running the thing in full speed and all the shakiness made me almost to throw up (lol). The screen that comes with the kit is just great. I think I will buy another kit just to have another screen.

I stick to the screen and connecting the receiver to the TV wich is great.

For now I will try to stick all the electronics inside the chassis and probably will make a shell for it, or at least try.

Processing House Visualizer

During this holidays week we had the idea of creating a lamp, but a different lamp. We want it to have the shape of a little house, so we thought in going to a FabLab to cut some shapes in order to create a house. Because I used a 2D vectorial program I needed to visualize the shapes to be sure that the snaps would feat together, so I invented the challenge of building a custom visualizer, with the possibility to load SVG’s, adjust and rotate them in xyz.

Nothing better than Processing for the task.

Processing House Visualizer

The SVG’s are loaded and displayed on a 3D space, with the help of the sliders it is possible to position each one of the shapes and record a preset in CSV format.

This was a two day work and because I didn’t wan’t to spend the rest of the holidays coding, I left some features that I will add at another time (or maybe not). This is what I would like to add:

  • add a left overlay layer
  • possibility to change colors
  • possibility to extrude SVGs
  • add a chimney
  • make it playable on the browser

The code is available on GitHub

Meanwhile the shapes seemed to be good to go. It was our first time in FabLab Lisboa and it was a great experience. Using the laser cutter was something new to me and I am thinking in more future stuff to build.

The final result was just great, you can see more in A Rosa Cor de Rosa ‘s blog.

Simple physical control for racing games

This project was made on a rainy weekend, I was showing Trackmania to my 5 years boy and while he was trying to play the game, he was actually struggling with the keys, so I had the idea of hacking an old remote control of a broken toy.

Trackmania Controller

Trackmania Controller

Just hooked an Arduino Leonardo to the steering wheel and throttle sticks  and assigned key strokes for TrackMania. For the ones who don’t know trackmania, its a free racing game and very cool to play with, I should say very addictive too!

Trackmania Controller

Loads of fun of course!! :D

Code can be downloaded on GitHub


Back to the Origins

Has been a long time since my last robot project.

Recently everything related to FPV, Drones, and Robots in general have been occupying my mind. I wanted to create an FPV Terrestrial Drone experience to anyone without the need of having (in portugal we say “kit the unhas”, “nails kit”) skills to pilot an aerial drone.

This little project reminds me those times when I have time and patience, to build small robotic creatures just because the fun of it, I guess I’m getting very nostalgic with this one.


The Turnigy controller works just fine, and to get the sticks values I am using the very well documented code from Sparkfun Nick Poole


And this is the controller with the screen. There is still missing the video receiver and the battery.


More to come ;]