Thread Tools
This thread is privately moderated by closedsink, who may elect to delete unwanted replies.
Feb 13, 2020, 12:41 PM
Registered User
Thread OP

B-Robot RC Conversion

So, recently, I purchased one of these amazing balancing robots, from jjrobots:

It balances *extremely* well, and is a whole lot of fun. It's controlled via wifi from an app on your phone.

Almost perfect. But, naturally I wanted radio control.

The code is open source from the good folks at jjrobots, so I took a look at it. The balancing is accomplished with a fairly tight real-time loop. I needed to figure out how to get data out of an RC receiver without disturbing the timing of this loop too much.

I decided to use a receiver with a PPM output (also called CPPM), for the following reasons:

- PPM/CPPM is available on multiple different protocol receivers
- Only one signal pin is needed for the interface
- I felt I could use a interrupt routine to read the PPM stream so as not to affect the main timing loop of the robot

I had a Frsky XSR receiver laying around, so I used this for my development of the software modifications. Writing the PPM decoder turned out to be straightforward using interrupts. For reference, the PPM stream looks like this:
Sync - high for > 10ms
Low - .4ms
High - .6-1.6ms (ch1)
Low - .4ms
High - .6-1.6ms (ch2)
Low - .4ms
High - .6-1.6ms (ch3)
Low - .4ms
High - .6-1.6ms (ch4)
Low - .4ms
High - .6-1.6ms (ch5)
Low - .4ms
High - .6-1.6ms (ch6)
Low - .4ms
High - .6-1.6ms (ch7)
Low - .4ms
High - .6-1.6ms (ch8)
Low - .4ms
Sync - high
This repeats every 27ms.

The above shows an 8-channel stream, but it can be fewer channels. I've tested this with a 6 channel receiver, and it works also.

I used an interrupt routine that triggered on a falling edge of the interrupt (PPM) pin. After getting data for all 8 channels, I set a flag so the main loop knows data is ready.

I stitched this into the main loop, using the variables for "throttle" and "steering". A third channel is used to activate the servo, which controls the robots arm. This can be used to help the robot stand when it has fallen down. The software, knowing the position of the robot, automatically moves the arm in the correct direction to right the robot, so it works if the robot is face down or face up.

It took some time to get this all working. In the end, I wound up stripping out the wifi control (I had originally hoped I could have WiFi and RC coexist). It's working really well now. Having radio control of this thing makes it SOOO much fun. You can check it out here:
B-Robot Slalom (1 min 21 sec)

I'm planning to upload the code to github soon. Stay tuned!
Last edited by closedsink; Today at 10:17 PM.
Sign up now
to remove ads between posts
Feb 16, 2020, 03:50 PM
Registered User
Thread OP

Code in Github

I uploaded the code into Github:

Let me know if there are any issues accessing it.
Feb 17, 2020, 05:09 PM
Registered User
Thread OP

Conversion Steps

This process requires the following:

- The Devia board version of the B-Robot. I know there are other versions, and I haven't looked into whether these boards can be upgraded. This procedure applies to the Devia version only.
- Basic Soldering skills (optional, depending on RC receiver used)
- The ability to upgrade the Arduino code on the B-Robot (I won't be covering this since the information is widely available)
- An RC transmitter and receiver
- The receiver MUST support PPM (also called CPPM). This uses a single wire for all 8 channels. If your receiver documentation doesn't mention PPM/CPPM, then it is likely not supported
- Three "Socket type" test leads to allow connecting to the Devia board headers. Something like these, which are readily available from Amazon and other vendors:
Name: socket_wires.jpg
Views: 1
Size: 302.4 KB

Conversion Procedure:
1 - Install socket pins on RC receiver. Three wires with socket terminals are needed on 3 pins: +5V, Ground, and PPM/CPPM. If the receiver has pins that the socket terminals can plug directly onto, this is easy. Some receivers use smaller connectors; in this case, you will need to cut and solder the test leads onto the wires from your receiver. Be sure to insulate any bare wires so they are not exposed.
2 - Plug 3 wires onto the Devia board as follows:
+5V - J16 pin 1
Ground - J17 pin 1
PPM/CPPM - J17 pin 2
Name: Devia-board-FRONT-VIEW -markup.jpg
Views: 3
Size: 167.5 KB
3 - Secure the RC receiver to the B-Robot. One way is to use double sided tape, or tie wraps, to hold the receiver to the underside of the top piece of the B-robot.
4 - Power up the Devia board. The receiver should be on, and it can be bound to the transmitter, if not already done
5 - Download the B-Robot_RC code from github:
6 - If channel mapping needs to be changed, this can be done in the transmitter. If this is not possible, then it can be done in the cppm_dec2 module.
7 - Program the Devia board with the new software.
8 - Power on the board, and turn on the transmitter. Receiver should indicate that it is bound. At this point, the robot should respond to the RC transmitter
9 - Have fun!

If you want to go back to Wifi control, using the app, you can download the regular software, which can be found on
Last edited by closedsink; Feb 20, 2020 at 10:48 AM.

Quick Reply
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Lazy cell. OPtion to conver 4S to 3S jferfre Batteries and Chargers 3 Apr 18, 2016 05:55 AM
Discussion Real Robots Live - online RC game. Drive RC cars online. lewisRRL Car Talk 1 Sep 07, 2015 06:25 AM
Discussion Autonomous Robot to Rc Robot NRPCaz Robotics 0 Mar 26, 2009 08:23 AM