Tuesday 2 July 2019

RC Car PS3 Control Demo

Here's a little video demonstration of the new RC Car working!


Stay tuned for the next blog post on update milestones and progress on autonomy!

Modifications to the RC Car

Here are the list of modifications made to get the RC car ready for autonomous driving.

Replaced ESC

First of all, the electronic speed controller (ESC) is used to take control signals such as from a remote control and convert that to a signal that can control the motor's speed and direction. The plan was to figure out where and what types of signals that the ESC took as input, so that I could replicate them using a micro-controller such as an Arduino. This turned out to be a fruitless approach since the ESC was coated in a waterproof plastic that prevented access to the electronics. This led me to decide to purchase my own ESC that could be able to take in simple input to control the motor.

HobbyKing X-Car 45A Brushed Car ESC
HobbyKing X-Car 45A Car ESC: Source

If you recall from the last post, the motor in the RC car is rated at 40A, which led me to buy the ESC with the closest current rating as possible. This was a nice and simple speed controller to work with, and all that I had to do was de-solder the old from the motor and replace it with this one.

The inputs to the ESC were also simple as it uses PWM to control the motor speed and direction. When you turn on the ESC, it will record the current PWM signal being sent to the motor as the stationary position. Thus a signal with a higher duty cycle will signal the motor to spin forward and faster as the duty cycle increases. On the other hand, a signal with a lower duty cycle will cause the motor to spin backwards and at a faster rate as duty cycle decreases. This was simple to implement using an Arduino with its inbuilt PWM function.

Steering servo modification

The inbuilt steering servo on the RC car was unfortunately of the analog type. Analog type servos have a potentiometer output where the resistance corresponds to the current angle of the motor. This meant that an external PID controller had to be used to control the steering.

PID Controller from old servo

Fortunately, I had an old servo motor lying around which somehow had very close potentiometer resistance to this steering servo. The old servo is a digital type and contains its own PID controller. It was as simple as de-soldering the PID controller and attaching it to the steering servo. From there I was able to control the steering angle using PWM. A little experimentation was required to see what duty cycle corresponded to which angle.

Speed Restriction

Since the RC car was capable of doing up to 33km/h, this was overkill for my application. To restrict the speed of the motor, I experimented with different PWM duty cycles and gauged by eye, an adequate speed for the autonomous navigation. On the Arduino, this speed was set as a fixed speed, and now the RC car is only capable of driving at the decided speed.

Mounting Structure

The bare chassis of the car has no nice place to mount the electronics such as the raspberry pi and the Arduino. As a result, I had to build my own mounting structure. I had some pieces of medium density fibreboard (MDF) lying around and seemed suitable for the mount. With that, I reused one of the pieces from the old robot car kit since it was a nice mount with holes to tie things to.

Bare Chassis

The resulting new chassis allowed me to mount all the items needed for autonomous navigation. I used zip ties and blu-tac to secure all the items.

Everything mounted sort of nicely.
You can see the old plastic mount from the old kit used on top.

Another view of the mount

Battery Upgrades

The batteries that were provided with the car were two 18650 cells in series with only 1500mAh capacity. This was clearly not enough for a longer drive and to also power the on-board electronics. I decided to upgrade to a 5000mAh battery cell with 7.4V 2S output. Besides the added capacity, this battery also had a much higher discharge rate if needed in the case of more power required for the motors.
Turnigy 5000mAh 2S 20C Lipo Pack w/XT-90
5000mAh 2S Battery: Source

To power the electronics, I decided to use a 5V USB powerbank which had a 6600mAh capacity.

Closeup of the power bank

Putting everything together

All the components

Parts list:
  1. ESC Controller
  2. Arduino
  3. Raspberry pi and camera
  4. RC 390 DC Motor
  5. Batter Bank
  6. Steering Servo
The blue prism sitting underneath the plastic mounting plate is the LiPo battery mentioned before.
This new RC car uses the same method of control as the old RC. However, instead of a dedicated motor driver, an ESC and an Arduino is used to control the motor, and steering is also controlled by the Arduino.

The raspberry pi takes in commands over Bluetooth from the PS3 controller, which then get translated into a serial command output to the Arduino. The Arduino then parses this command and determines where to steer and how much to accelerate etc. It was simple to map one joystick to the steering and the other joystick to the motor control.

This will most likely be the final vehicle for autonomous navigation with the current milestones.

New RC Car

I decided to replace the old robot car that was built using a cheap kit, with a more powerful RC car. The biggest differences are the steering mechanism and motor power.

Steering Mechanism Difference

The original robot car used what was called differential steering, in that to turn in a direction, the opposite wheel would spin faster compared to the wheel on the same side. To illustrate with an example, to turn left, the right wheel would spin faster while the left wheel spins slower, causing the car to rotate to the left.


Image result for differential steering
Mechanics of differential steering: Source

However the problem with this was that the wheels would cause the car to slip on a difficult to grip surface such as a timber floor. This was seen in my earlier video demonstration where the car would occasionally slip while turning (Link to video). This led me to decide to use a different steering mechanism.

The new RC car that I am currently using, utilized what's called Ackermann steering. This uses a steering linkage that orients each wheel appropriately. The main property of this steering mechanism is that the wheels are oriented at slightly different angles to compensate for the different circle radii that are being traced during turning. This prevents the wheels from slipping whilst turning for the cost of being more complex.


Image result for ackermann steering
Different angles of the wheels: Source
The reason I have decided to go with Ackermann steering, is that I can specify turning angles rather than trying to figure out the speeds of each side for differential steering. This will make it much easier to control.

Motor Power

The other significant difference is the motor power. The cheap robot car kit uses these small DC motors which are powered by a higher voltage but a lower current. These are typically powered by combining several AA batteries in series to operate in the voltage range 9-12V. Then gears are used to convert the high rotation to more torque. Even then, the power or torque of these motors are severely limited by the battery current output (1A maximum for AA batteries) and also the thickness and number of coils that the motor has.

Cheap DC Motor

The new RC Car has a motor that is rated for up to 40A. This motor has much more torque and runs off 7.4V which is two LiPo cells in series. The car has an advertised maximum speed of 33km/h but for our purposes, this is overkill and a speed limiter will be implemented.


Image result for rc 390 dc motor
RC 390 DC Motor


The RC car

Without further ado, here's the new car that I will be using. It is a RC 4WD 1:12th Off Road Truck. The main reason I picked this was that it was on sale for half price! It seemed to do the job and has the much needed Ackermann steering. Another reason was the size of it meant it would be able to hold the components needed for autonomous driving. Link to car


The car without the cover
However, in its out of box state, it doesn't have enough battery power, no place to easily mount components and also the steering and the motor cannot yet be controlled with a micro-controller. Many modifications are required and this will be detailed in the next post!