Introduction: Create an FPV 4WD Robot
This project shows a walk through the process of creating a robot with an FPV (first person view) system. Sometimes people ask how does a robot ends with this or that shape of feel, and I just tell them that this is like a painting, it evolves regarding the tools and materials available, according to the spare time wich is not much and of course, it evolved regarding my mood.
I am showing here simple ways to create fun stuff with available pieces of technology, like chassis, motors, servo motors, camera, PVC sheets and FPV components (radio tx-rx and a screen).
Step 1: Create an FPV 4WD Robot - Step 1
I started with a 2WD chassis and assembled a Motoruino, a Camera and a Pan and Tilt servo, plus a Radio Remote Control.
This hacked chassis wasn't performing the way I wanted, besides the caster wheel was freaking out my wife because it was making a lot of noise on the apartment’s pavement, and luckily I had another brand new 4WD chassis.
The Turnigy controller works just fine, and to get the sticks values I am using the very well documented code from Sparkfun Nick Poole.
Step 2: Create an FPV 4WD Robot - Step 2
I decided to swap all the electronics to the new chassis, and the result is great, glad I did it!
With 4WD it moves really quickly and motion is much more stable now, besides I am feeding the motors with a 3S Lipo battery witch gives a great pump.
I still don’t like the way it is, with the battery exposed on the top, makes the gravity center high, besides the pan/tilt is very shaky when it moves in full speed.
Step 3: Create an FPV 4WD Robot - Step 3
After completed the assemble of the 4WD chassis, I started by placing the battery on the lowest level, this is one of the heaviest components of the robot, and it will make the center of gravity low witch is always good.
Step 4: Create an FPV 4WD Robot - Step 4
with the electronics all looks good
Step 5: Create an FPV 4WD Robot - Step 5
I added a power switch and a Sharp Infra Red sensor, this sensor will act as a fail safe to avoid collisions.
Step 6: Create an FPV 4WD Robot - Step 6
I also wanted to create some kind of a shell, so went to 3D to design the plates and this is the result.
Step 7: Create an FPV 4WD Robot - Step 7
The plates will be cutted in laser or CNC, but meanwhile I will just print them and manually cut PVC sheets.
Step 8: Create an FPV 4WD Robot - Step 8
using graphite pencil to transfer the plate drawings to the PVC sheets.
Step 9: Create an FPV 4WD Robot - Step 9
All the plates are transfered and ready to be cutted.
Step 10: Create an FPV 4WD Robot - Step 10
The plates are cutted, now I will just sand a bit to give a final touch
Step 11: Create an FPV 4WD Robot - Step 11
Time to start with the supports for the plates, I will go to these small L shape brackets.
Step 12: Create an FPV 4WD Robot - Step 12
All the supports are fitted, when we have lots of screws, an electric screwdriver might be very handy, this one is the cheapest I could find and works great.
Step 13: Create an FPV 4WD Robot - Step 13
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.
And a look on the inside.
Step 14: Create an FPV 4WD Robot - Step 14
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 self tap screws.
Step 15: Create an FPV 4WD Robot - Step 15
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 better 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 Artica's Motoruino2, it has an L298 witch handles 2 amps per channel.
Step 16: Create an FPV 4WD Robot - Step 16
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 :)
Step 17: Create an FPV 4WD Robot - Step 17
This is how the bot is looking now, the Motoruino2 is slightly bigger than the previous version, but it just fits perfectly.
Step 18: Create an FPV 4WD Robot - Step 18
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.
Step 19: Create an FPV 4WD Robot - Step 19
Et voilá… :D
Thanks for watching this walkthrough, I hope you find it useful!
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 I think!
The back side is still messy, but I will live with it for now.
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 available in 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. 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.