Sunday, 22 June 2014

RC Car - Part 1

My friend and I were working on a weekend project. We have successfully made a chat app over radio frequency easily one weekend and decide to take the project one step ahead. Our goal was to remotely control an Arduino-brained car from the internet. The car will optionally have a live video camera that's going to be broadcasted to internet. The grand plan is something like this:

We use Arduino for the car because it's more energy efficient compared to Raspberry Pi. On the other hand we use Raspberry Pi to interface the car with internet because it's much easier to program, thus allowing us to rapidly iterate the code. Everything looks good, for now.

Problem With Connectivity

Then we realized that we might not be able to send the video over radio frequency because it's too slow. Fortunately, I have MRF24WB0MA WiFi module by AsyncLabs for our disposal. I tried to assemble it with Arduino Uno and program it with AsyncLabs' WiShield library.

It's... not working.

I tried to debug it for hours and found that it got stuck trying to execute DRV_STATE_START_CONN. Later on I found that the WiFi module is sending an unrecognizable byte: 14
Where are you "14"
To date I haven't found the solution. My ultimate goal is controlling the car, with or without the camera. But I'm still confused for why do the WiFi library fails for me. And I don't even know whether the camera will work with Arduino Nano. Will it have enough computing power? For now I'll give up on this one and probably fallback to Bluetooth for future work.

Problem With Power

Of course with my (kinda) Computer Science background I have close to zero knowledge in hardware (even though my FYP is hardware related). I unashamedly bought 15 motors from eBay, not knowing what are they for, what the working voltage is, what the required current is, what the torque is, or any hard stuff I don't even know what the meaning is. All I knew was: all motors are equal; give high voltage on one end and low voltage on the other one it will spin. I was half-wrong.

First I need wheels. I want to understand the physics behind a car as much as I can - and that's why I won't buy a ready-to-go Arduino Robot Chassis. My friend suggested an awesome solution. I "sew" this together:
Yes, those are bottle caps

I did a test run. I gave the motor a go by connecting it to my Arduino Nano. Then...

It is not strong enough

When I tried to press the wheel against a plane, the wheel was not spinning. I tried to connect the motor directly to battery. It was a lot faster than the last one. Still, it wasn't fast enough. Then I checked the documentation of the motor.

FOR HOLY GOD SAKE, it was an RC aircraft motor, not an RC car motor. And the working current is merely 0.03mA. I'm sure it's not even enough to cut a paper.

Fortunately I have some spare motors from Hubsan X4 quadcopter which seemed more reliable. I connected it directly to the battery - my hand could barely hold the motors. "Looks good," I thought. But when I tried to connect it to my Arduino, it was weak. Then I began to wonder.

What makes it slow on Arduino?

Apparently, Arduino pins only gives out 40mA of current. We might be able to increase the current output by serially combine the pins. But that's not a scalable solution. What if one day we need to power a monitor?

Then I consult the internet (which doesn't really help), then my friends. They suggested that I use transistor as a switch so the motors can be powered directly by the battery while allowing us to control the on-off logic using Arduino.

It worked! Finally, something worked. This weekend is not lost! Though I need new transistors because I just busted 3 of them.

That's for the first part of it. Hopefully we can finish this project. If you have similar experience please kindly leave comments and help us :)