▲ Current state of the car as of May 3rd 2017
This week has been very busy for me since I started making my self driving car model out of an RC Car. Last year I got a Red Hammer H2 RC Car. This car is made in China on a Ratio of 1:14 and runs on 5x1.5V .The project is simple, make it drive itself and learn alot of stuff while at it. Am sure there are many tutorials online but I wanna make my own. Currently it is controlled by a remote. The manufactueres put in sime really good suspension kits installed. When I got this car last year, I was excited to start tinkering about self driving cars but was stopped on my heels due to not having Python skills, which I have now :-). So lets gets moving. I taught myself python proramming here at Learn Python The Hard Way.com. I highly recomend this to anyone who is interested to take up Python.
To make it easier to track the progress of this project, I will be making frequent updates on my Medium Page and code updates on Github. I like Medium since its faster to publish a story. Weekly updates will appear here to summarise the progress. If you have any questions you can drop me an email or leave a comment here and we will talk further.
The first thing I need to do is to reconfigure the remote control. It transmits at 27MHz to the car which is bad since it is really affected alot by walls. The 27MHz is for low cost cheap RC cars. More expensive RCs operate upto 2.4 GHz. Yes I know how crazy that sounds. The problem with the 27Mhz is that if the remote gets lost, another remote wont work for my RC car. That’s how bad the situation is.The remote also features a 9V battery to power it. I dismantled the remote, got the circuit board, analysed it and mounted in on bread board so that I could access the button controls. ▲ The transmitter’s circuit. The TX-2B CMOS LSI is the black chip on the board.
After following the circuit layout I concluded that the buttons are fed into a TX-2B CMOS LSI which is responsible for the button controls and transmission to the car. In the car there is another TX-2B for the receiver. I break out the board onto the breadboard, rewire the buttons and also provide them with a direct connection onto the breadboard. Power from the 9V batter is first fed onto the breadboard power bus then tapped into the circuit board. Now I can control the car from the breadboard. The power for the RC is supplied by the above China made low cost batters which I used for testing phase only. They cost Ksh.20 (USD 0.2) each. They can spit out good power but don’t last for long. After the soldering and modding, the car responded to my modifications well.
The TX-2B is a robust CMOS that controls the Left, Right, Front, Back operation of the RC Car. This is used in most MADE IN CHINA RC cars for its reliability and economic reasons. My Self Driving Car will use the workings of this car. Before I go into coding and OpenCV stuff, I decided to take some time and understand the workings of this car in detail which will prove worthy in the future should a need for expansion rise. The RC car operates on the 27Mhz frequency which is known as ISM (Industrial Scientific and Medical Band). Another well know band is the 24Ghz which is most crowded since its used by Bluetooth, Wifi and even the microwave.
▲ The transmitter’s circuit block diagram.
To power the Tx-2B a 3V zener diode regulator is set up using the 390 Ohm and Zener Diode D1. The Rosc sets the internal oscillator frequency of the Tx2B to 128KHz. Now the 27MHz carrier signal is generated by he oscillator circuit formed by X1, Q1 and L1. Resistor R1 sets the bias current for Q1 while R2 provides the current limit protection. The encoded data signal on pin 8 is then coupled with the carrier signal through C1. The coupled signal is shown below.
▲ The transmitter’s circuit diagram.
This signal is then fed into the AC gain stage formed by Q2 and L2. Because of the large magnitude of the data signal this gain stage is only active when the data line is high. When the data line is high the 27 MHz carrier signal gets amplified, but when the data line is low the Q2 gain stage is turned off. The resulting waveform on the collector of Q2 is simply the amplified carrier signal being turned on/off by the data signal. This method of radio communication is called continuous wave (CW) radio. CW is the simplest type of radio transmission. In fact, it’s the method of radio communication used by telegraph machines to transmit Morse code. The continuous wave signal on the collector of Q2 is shown below.
A pi-network consisting of L3, C3, and C4, along with L4, is used for impedance matching with the antenna. Proper impedance matching is critical for optimizing the efficiency of the antenna. Now lemme go and see the receiver circuit and learn how it works. It more complicated that the transmitter circuit.
The Receiver Circuit
The encoded 1kHz data signal is fed into Pin3 then amplified and decoded. Once the corresponding function has been determined from the decoded signal, the appropriate output pin is enabled for either LEFT, RIGHT, FOWARD and REVERSE.
Two standard H-bridge circuits are used for the propulsion motor and the steering motor. The H-bridge allows the direction of the motor to be controlled by switching the direction of current flow through the bridge and motor. The turbo function increases the current through the propulsion motor (via Q3) but only when the forward direction is selected.
▲ The receiver’s block diagram.
The receiver is the circuit built around Q1. This type of receiver is known as a regenerative receiver because it uses positive feedback. A tuned LC circuit consisting of L2 and C3 provides positive feedback but only at the tuned frequency (27 MHz). So this means that only the intended signal gets amplified by the positive feedback. One downside of this type of receiver is that L2 must be custom coiled in order to accurately tune the receiver. The output signal from the receiver circuit goes to pin 14 on the RX-2B. This signal is now filtered to remove the carrier and ran through two internal inverters. By the time the signal makes it to the RX-2B signal input pin (pin 3) it has been filtered and cleaned up enough that only the 1 kHz data signal remains. As with the TX-2B, a 3V zener regulator is used to power the RX-2B. Rosc again sets the internal oscillator frequency to 128 kHz.
▲ The receiver’s circuit diagram.
When the RC car came in it was powered by 6x1.5 V dry cells which would be mounted below just like any RC car. They however proved quite ineffective due to their short life and tendency to become warm when used over a period of time. Check you my youtube video below
I replaced them with a 6V Sealed Lead Acid Accumulator battery. This worked out well but when I placed the RC car on the ground, it barely moved. I quickly realised that it was too heavy and the battery was not giving the motors enough juice. I ditched it.
Today morning I was going through my trash box when I came across a China made Lipo battery. I last used it in 2014 when I was in Nanjing, China. It was intact with its own Balancer charger. I checked for the voltage and it was low so I charged it and after some 2 hours it was full. Connected ot to the RC car power cables and the wheels spun like they wanted to take off.
Now let me work on the code that will control it. Next update will be in a weeks time.