Few weeks back I published a project on making a cheap 4 channel RC Plane Transmitter and Receiver using Arduino and HC12 Module. That project was well received by hobbyists and Arduino enthusiasts. You can see the project here.
After that, I received a few mails and comments on my video asking how to modify this to control an RC boat. Then I thought of modifying this circuit a little bit to control an RC boat using Arduino and post it here.
Here we are going to build an RC Boat Transmitter Receiver using Arduino, cheap components and an HC12 wireles module. We will read the Joystick data using Arduino Nano Micro Controller process the data, and make it into a single string and pass it on to the HC12 Module for Transmitting OTA. The receiver HC12 will receive the data, pass it on to the Arduino Nano, which will then drive the DC Motor and Servo Motor.
- Arduino Nano x 2
- HC12 Wireless Module
- DC Motor or Brushless Motor - Depends on the speed
- Servo Motor
- H Bridge Motor Driver
- Bread Board
About the components - Get Familiarized
Before starting the project it would be better if you know a little bit about the components and boards used in making RC Boat Transmitter Receiver pair. Let us get familiarized.
Arduino Nano, Joy stick and HC12 modules are already discussed in the first part of my previous project. Click on the below link and learn more about the components and boards.
H Bridge and L293D Motor Driver
An H-bridge is a circuit which enables a voltage to be applied across terminals of a load (in our case motor) in both direction without rewiring or changing the physical circuit. These circuits are widely used in robotics and other automation projects in order to rotate DC motors to rotate them in either direction.
L293D is one of the most widely used Motor Driver IC that enables a DC motor to be driven on both direction. L293D is a 16 pin IC which can control two DC motors at the same time in any direction. It allows you to control two DC motor with a single L293D.
Start Building your own RC Boat Transmitter Receiver
Before proceeding let me tell you some thing that may save you some money. It would be better to use a bread board for building and testing the circuit (both Transmitter and Receiver) than building a PCB. Using the breadboard will make it easier for you to test the circuit.
Our transmitter consist of an Arduino Nano connected to a HC12 RF module and a Joystick.A voltage of 5 V can be supplied to Joystick and HC12 module for its working. You can power up Arduino using an external power supply using Vin or USB port and use its 5V out to power up the Transmitter and JoyStick.
Download the code from the below link and upload it to the Adrduino Nano of the Transmitter module.
I used two joysticks but actually one is enough for simply driving the boat forward, backward, left and right; I had a few more servo motors to rotate the camera in the boat. I used analog pins A0, A1to get the analog reading of the joysticks (A0 for Xout of Joystick1 and A1 Yout of Joystick2). These values varies from 0 – 1023. But these values are converted from the range 0-1023 to a range of 0-180, the reason of doing this conversion will be explained in the coming steps. These values will be stored in the variables “thr”, “dir”.
These values will be sent to the transmitter ina single string seperated by a coma (,) like show below
Here, I have used software serial library to view what is actually happening and what is being sent and received during the transmission. But let me tell you guys, this library is not stable with all the clones. I spent nearly 1 week trying to figure out whats wrong in that circuit.
Now Let us take a look at the receiver part of RC Boat Transmitter Receiver. The receiver HC12 will receive the data, pass it on to the Arduino Nano, which will then drive the DC Motor and Servo Motor. Below is the block diagram of the receiving unit.
Here I used a LiPo battery so that we can drive both the DC motor and the servo motors which will draw good amount of current from the battery. LiPo battery is connected to a 5 V regulator whose output is then fed to the Nano as well as HC12 Module. You can also power the HC12 using the 5V out of Arduino Nano.
In L293D, there are two pins for providing power. One is for the working of the internal components of the IC and the other is the supply used for driving the DC motor.
Pin 8 is for Power Supply Driving the Motor – 5 V to 32 V
Pin 16 – is for Internal working of the components with in the IC– 5V
No matter what happens, never reverse the connection; which may cause the IC to burn off.
The output of the regulator (5V) is also fed to the servo motor.
The HC12 module receives the data from the transmitting unit and will pass the signals to the arduino via the serial communication port (0 and 1). It will be a string of numbers separated by comas as mentioned in the first part. In arduino, these strings are split into separate values and are stored in different variables. These values will be used to create PWM signals which are later fed to Servo motors and for driving the DC motor.
Given below is the arduino code that is to be uploaded to the arduino nano of the receiving unit. Download the code by clicking the download button below.
Click Below to Download The Code
Here, I used an Arduino nano clone which will read the data coming from the HC12 module to a variable named 'input' which will be a string separated by coma. This is then broken down into smaller numbers and are then stored in variables.
Here we use servo.h library to drive servo motor.
Connecting the motors to the Boats
As mentioned earlier, this is a simple project just for showing how RC Plane circuit can be modified to drive an RC Boat. So the set up here is so simple. A propeller is attached to the shaft of the DC motor which will provide the torque to the boat in the direction it is pointing to.
The DC motor is attached to the horns of a servo motor (which is attached to the back side of the boat) so that, when the servo motor rotates, it will change the direction of the DC motor shaft with respect to the boat and the direction of the torque acting on it.
RC Boat Transmitter Receiver is now ready for action. Once the code is uploaded to both transmitter and receiver arduino boards, you can test it. You can power the Transmitting unit using a power bank or any other regulated 5 V power supply. Once it is ready, it will start the transmission (you can see the red LED blinking).
The video tutorial for RC Boat Transmitter Receiver using Arduino will be uploaded in my you tube channel. Click the subscribe below to subscribe my youtube channel for future updates.
If you have any doubts regarding RC Boat Transmitter Receiver using Arduino, need clarifications or you want help in modifying the codes, please let us know in the comments. If you find this useful share this project. If you have any doubts, need clarifications or you want help in modifying the codes, please make use of our community.