Skip to main content
Topic: RC Boat with NRF24L01+ and Arduino (Read 13463 times) previous topic - next topic

RC Boat with NRF24L01+ and Arduino

Hi,

I and my little son built a small electric boat from a kit. However, the kit only offered turning on the motor with a switch, and let the boat cruise wherever fortune it may take.

I thought why not improve it a bit by adding some RC capability. I had some left over toy quad copter remote controls, and decided to use them by building the receiver side out of an 3 $ Arduino mini knock off and the popular NRF24L01+ chip.

[attachment=3]
rcgroups.com forum user bikemikem added some receiver functionality [1] to the popular nrf24-multipro project by goebish [2]. I made some small adjustments, and the final firmware is attached to this post.

The wiring between the Arduino and the NRF board is shown below.  The motor is PWM driven with some random FET, and the whole thing is powered by some old phone battery underneath the connection board.  A single servo is used for steering.

[attachment=1]
The "Bayang" protocol is used by a lot of different models.  The following picture shows a few:
* Eachine H8 Mini (top left)
* Bayangtoys X9 (top right)
* Floureon H101 (bottom left)
* Devo 7E with Deviation [3] and NRF module

[attachment=2]
Here is a short YouTube video: https://youtu.be/VLFMQFPwuEg

Have fun,
Markus

[1] https://github.com/bikemike/nrf24_multi ... 4_multipro
[2] https://github.com/goebish/nrf24_multipro
[3] http://www.deviationtx.com/

Re: RC Boat with NRF24L01+ and Arduino

Reply #1
Thank You for sharing this project! I am not so good at programming, could You help me a little? What parts of code should be cloned/modified to get more servo channels outputs? I studied code, yours and original RX, but I am lost there for now.
Thanks in advance!

Re: RC Boat with NRF24L01+ and Arduino

Reply #2
You could try the following:

In nRF24_multipro.ino define a second servo object around line 36 so that it reads:

#include <Servo.h>
Servo servo;
Servo servo2;

Around line 158 attach some appropriate free pin to this second servo object

    servo.attach( 2 );
    servo2.attach( <yourPinHere> );

Then in Bayang.ino around line 209 use the pitch/yaw/throttle variable to write a value to servo2:

        servo2.write( pitch / 1023.0 * 180 );

Re: RC Boat with NRF24L01+ and Arduino

Reply #3
I am very thankful for Your response! I will try to play with code next days. I tried code "as is", and it is working (with "Floureon H101" remote), so I know basically system is working. I will try to expand possibilities now. Thanks again!

Re: RC Boat with NRF24L01+ and Arduino

Reply #4
Hello again!
I followed Your suggestions, and made additions to code. It is working now with 3 servos control! Thank You for this small code lesson ;-) Big Thankyou.
I post here relevant code changes, so maybe someone else interested can do the same.
In file "nRF24_multipro.ino":
.
.
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
.
.
Serial.begin( 115200 );
Serial.println( "Start" );
servo1.attach( 7 );
servo2.attach( 8 );
servo3.attach( 9 );
.
.

And, in file "Bayang.ino":
.
.
servo1.write( - asin( roll / 511.5 - 1.0 ) / ( 3.1416 / 2 ) * 80.0 + 90 );
servo2.write( pitch / 1023.0 * 180 );
servo3.write( yaw / 1023.0 * 180 );
.
.
// neutral all servos position; motor off:
servo1.write( 90 );
servo2.write( 90 );
servo3.write( 90 );
.
.
I think I will try to understand code of pushbuttons ("flip", "headless", etc), would be awesome to receive and use them too (you know - lights on/off, missile launch, self destruct, etc, etc :) :) )

Re: RC Boat with NRF24L01+ and Arduino

Reply #5
Update: well, that was easier that I thought it will be, with my non-existing programming skills. I added four digital (On/Off, 1/0) outputs that are controlled from four buttons on "Floureon H101" remote, namely: Flip, Return, Invert, Headless.
Summary, receiver features are:
 Servo1 - D7
 Servo2 - D8
 Servo3 - D9
 On/Off from "FLIP" button      - D10
 On/Off from "RETURN" button    - D11
 On/Off from "HEADLESS" button  - D12
 On/Off from "INVERT" button    - D13
 Speed - D6

Again, Thanks to Authors of original code, and RC boat modification!
I attach modified code here.

Re: RC Boat with NRF24L01+ and Arduino

Reply #6
I made another "Bayang" receiver modification. In this version, there are 4 servo-type outputs, any of them can be used also as bi-directional motor control, when signal is feeded to bi-directional ESC (electronic speed controller).
Simple one-way motor analog speed control on D6 is disabled in this version, instead D6 is used as fourth servo (or ESC) signal.
In file "Bayang.ino" I made comments how to easily change servo (or ESC) ranges for your needs.
Look for commented lines like this:
"  //change "80.0" to other servo degrees what you need."
Code is in attachment.
Enjoy :)

Re: RC Boat with NRF24L01+ and Arduino

Reply #7
[quote author="Jueris"]Thank You for sharing this project! I am not so good at programming, could You help me a little? What parts of instant knockout should be cloned/modified to get more servo channels outputs? I studied code, yours and original RX, but I am lost there for now.
Thanks in advance![/quote]

That's cool. Where did you get the original kit from?

I bet your son loves having a dad like you who can make cool stuff!

Re: RC Boat with NRF24L01+ and Arduino

Reply #8
i am facing some issues while installing this version. Any one there to help me out