Connect L298N motor driver with RC remote control receiver

Although the servo output of an RC receiver provides all the information required to control an L298N motor driver, the signal must be evaluated and recoded in a suitable manner, as the control logic of the motor driver is fundamentally different to that of an RC servo.

This task can be performed by the RCRX2Bridge module. This is a single-chip solution that evaluates one channel at a time and thus controls one motor of the L296 bridge. The circuit is very simple, and the module is quick to assemble with the breakout board.

RCRX2Bridge Breakout Board
RCRX2Bridge Breakout Board

 

RCRX2Bridge supports the two common, but different control modes of L298N bridges: Models with 2/4 phases and models with two logic inputs and one speed input.

Control of bridges with two inputs

Typical L298N motor driver with two inputs per motor
Typical L298N motor driver with two inputs per motor

 

The RCRX2Bridge module is connected to the receiver on the input side, as shown in the picture. The input pins of the motor driver IN1 and IN2 are connected to the output pins of the breakout board as shown in the picture. If a second motor is to be controlled, a second RCRX2Bridge module is required.

Control of bridges with three inputs

Typical L298N motor driver with three inputs
Typical L298N motor driver with three inputs

 

Configuration of the RCRX2Bridge for motor drivers with three inputs
Configuration of the RCRX2Bridge for motor drivers with three inputs

For this application, the RCRX2Bridge module is configured for the changed logic using a solder bridge at “MODE” and then also connected to the receiver on the input side in this case, as shown in the article image.

The input pins of the motor driver ENA, IN1 and IN2 are connected to the output pins of the breakout board as shown in the picture. If a second motor is to be controlled, a second RCRX2Bridge module is also required here.

 

The kit for the breakout board with the RCRX2Bridge controller is available in the store.

 

Remote control with gamepad or joystick

Overview

In the previous article we already presented the possibility to control up to eight servos via a USB interface using a joystick or gamepad, a PC and a PiKoder/SSC. Here is now described how a wireless model remote control can be realized with a PiKoder – receiver, the PiKoder/SSC RX. Bluetooth for command transmission.

Setup

First, the PiKoder/SSC RX must be connected to the PC at the operating system level. For this purpose, you first search for new Bluetooth devices in the device control.

After a short time, the Bluetooth module of the receiver should be offered. The PIN is “1234”.

With the selection “Connect” the coupling (pairing) takes place on system level.

As the following view from the device manager shows, the coupling of the system also establishes two virtual serial interfaces, which we access later in the program for establishing a connection.

This completes the setup and the JoystickRC program can now be started as described in the previous post.

Control servos with gamepad or joystick

Overview

In the field of robotics, it is often necessary to control several servos by wire, e.g. when realizing a robot arm or an underwater ROV. In this case, operation with a gamepad or joystick is ideal because the large number of axes / degrees of freedom enables efficient control of many channels.

This blog describes the setup for controlling eight servos by wire using the free Windows APP JoystickRC.

The mapping of the axes and switches to the servo channels is done flexibly in the software. The actual pulse generation for the servos is performed by a PiKoder Serial Servo Controller (PiKoder/SSCng), which is connected to the PC via its USB interface.

Setup

The setup is ideally carried out with the aid of a PiKoder/SSCng –development board and with a standard USB cable. The PiKoder is supplied with power via the USB port. As the USB interface cannot supply enough power to operate the servos, they must be supplied with an independent power source via the terminal strip. In order to prevent balancing currents that could damage the PC, the jumper must not be plugged into the PiKoder circuit board under any circumstances. More detailed information can be found in the PiKoder User Manual.

Software

The JoystickRC program is available free of charge from the Microsoft Store. You can find more instructions on how to use the program on the program’s website.

Mix several joysticks with Joystick Gremlin to one PPM – signal

Sometimes only a joystick or a gamepad is not enough for a use case but other USB devices like rudder pedals and a headtracker should be mixed into the PPM signal.

If the devices are recognized as Windows joysticks/gamepads, then Joystick Gremlin in conjunction with vJoy provides the ability to combine devices into one or more new virtual devices.

The Joystick2PPM – applications Joystick2PPM, Joystick2PPM4Arduino, USBtoPPMforCompuFly and JoystickRC4Diddyborg offer all connected (also virtual) joysticks then at program start as input device and enable by virtualization the assignment of the axes of the different USB devices to the PPM channels.

The installation of Joystick Gremlin is described in the manual and was possible without any problems. Then you configure virtual devices with the desired assignment of axes and keys.

If one of the Joystick2PPM apps finds more than one device (no matter if physical or virtual) at startup, the user is offered a selection with all found devices at program startup.

If no selection is made by the user, then the first joystick in the list is automatically used.

DiddyBorg with QGroundControl – remote control joystick

In this blog I describe how I evolved the joystick / gamepad remote control of my RPI-controlled DiddyBorg to QGroundControl and MAVLink as communication protocol.

This has given me the basis to process more sensors in a standard environment in the future and to plan and execute missions for the DiddyBorg.

Software installation on the Raspberry Pi (RPi)

On the RPi, first install pymavlink, the Python version of the MAVLink libraries. The easiest way to do this is with PIP:

pip install pymavlink

Then create a directory, e.g. diddy2QGC, into which you copy the Python modules diddy2QGroundControl.py and ThunderBorg3.py from the Github repository of this project. In this directory you then start the Python script later with:

 python diddy2QGroundControl.py

Software installation on the desktop

Install QGroundControl on your desktop.

Starting the applications

Make sure the RPi and your desktop are on the same network and run QGroundControl (QGC) and the Python script (the order is irrelevant).

The DiddyBorg sends heartbeat messages, which are recognized and answered by QGC. After exchanging a few more messages (please do not be confused by the error messages), the connection is established and you will then find the option to teach in your joystick in the vehicle settings. Please note that diddy2QGroundControl.py in mode 2 uses the roll channel for right/left control and the inverted value of the pitch channel for motor control.

Modernized User Interface for CompuFly by Flytron

In this blog I am presenting my Windows-App USB2PPM4CompuFly for the CompuFly USBtoPPM Converter V2.0 by Flytron. This software replaces the CompuFly – programm available on the Flytron web-page.

The USBtoPPMforCompuFly-app maintains the proven user interface of the CompuFly-programm to a large extend but presents itself as a completely rewritten Windows 10/11 app with a more modern inerface and new features.

When started the app will automatically connect with the converter and the first DirectX capable Joystick or Gamepad found. Your configuration will be saved and reloaded when restarting.

The user interface of the app is intuitive and self-explanatory: simply associate joystick axes, sliders or buttons to channel outputs. In order to accommodate the specifics of your application, channels connected to sliders and axis can be trimmed and the pulse range can be adjusted (EPA).

On top of the feature set of the open source CompuFly.zip version 1.35 buttons can be turned into on/off switches. You would assign a button to an output channel. By checking the “sw” box which replaces the inverse option after you assigning a button to an output channel.

You will find the USBtoPPMforCompuFly app in the Microsoft app store.

 

Remote control DiddyBorg with gamepad or joystick

In this blog I present my Windows app JoystickRC4DiddyBorg for remote control of the DiddyBorg (from PiBorg) with a joystick or gamepad.

The DiddyBorg sample programs published by the manufacturer PiBorg also include a Python remote control script with joystick, but it uses Bluetooth and therefore has a rather limited range.

The app presented here uses the existing WLAN and UDP as protocol to ensure sufficient agility of the remote control. For safety reasons, the time-out logic of the ThunderBorg motor controller is activated.

Software installation

The DiddyBorg needs a Python script JoystickRC4DiddyBorg as receiver, which you can find on github.com. In addition to the receiver program, you will also find a version of the ThunderBorg – Library for Python 3.x in the repository (the sample programs for the DiddyBorg are still based on Python 2.x).

The easiest way is to copy the two files additionally into the directory with the examples – then the script should work without further adjustments of path names.

On the PC side, install the Windows app JoystickRC4DiddyBorg of the same name, which you can get for free from the Microsoft App Store.

Operation

First start the Python script on the DiddyBorg. If you have a screen connected, then the program will log in and indicate that it is waiting for a client.

When you start the PC app, it will automatically search for a DiddyBorg with an active and compatible receiver on the local WLAN (to which both the DiddyBorg and the PC being used must be connected). If no connection can be established, a corresponding error message is displayed.

After the connection has been successfully established, the channels can be assigned to the various joystick axes and keys. Channels 3 and 4 are used as push buttons and allow for example fast / slow rotation (the function of the push buttons can be traced in the Python script).

The assignment of the channels is saved and restored at the next program start.

Open Source Android App for Bluetooth R/C

Overview

The “picCAR” App turns an Android-Tablet or Smartphone with Bluetooth into an R/C transmitter.

The app is based on the Cxem Car 1 Open Source Projekt. The app has been extended and revised to interface with a PiKoder/SSC RX receiver.

The picCar app is open source and released under a GNU General Public License Version 3. The app can be installed via the Play Store. The source code is provided through github.

User interface

picCar Main activity

The user interface of the picCAR app is pretty intuitive and straight forward. You can select one of four control modes by touching the respective screen button: button control, a virtual joystick, accelerometer (control by moving the device) and a combination between accelerometer and a slider. The Bluetooth connection would be established once the mode has been selected.

For building your receiver please refer to the PiKoder/SSC Bluetooth receiver page. The App is supported by all PiKoder/SSC firmware versions. It is recommended though that you use a PiKoder/SSC firmware 1.03 or above in order to deploy the TimeOut-Funktion of the Android app.

picCAR User’s Guide (.pdf File, EN)

The picCAR User’s Guide describes the picCAR app in detail.

Arduino remote control transmitter with iRangeX multi-protocol module

The previous blog describes the Arduino PPM encoder. Together with a multi-protocol module, you can set up a complete remote control transmitter with little additional effort.

To do this, adapt the module using an Arduino prototype shield. However, not all shields are equally suitable. Some shields do not have a hole pattern in the lower right area but a specific layout like the red circuit board in the picture. But you need a prototype board with a complete breadboard like the blue circuit board.

Arduino Prototype Sields

You make the electrical connection between the Arduino and the module with a five-pole pin header with extra-long pins. Insert the pin header into the socket header on the back of the module. Then position the module on the prototype shield and find the correct position for the module and the soldering points that you need to use.

To ensure a secure hold, I have also provided Velcro tape. Since this additional intermediate layer changes the height of the soldering pins again, you can only solder the pins now.

The wiring for the power supply and for the PPM signal can be found in the picture. The assembly is completed when the module is plugged in.

 

 

 

 

 

 

 

 

USB2PPM by Arduino

My previous blogs about connecting a joystick to a model remote control via USB have always used one of my PiKoders. But of course an Arduino can also take over the PPM signal generation.

To implement this idea I created an Arduino Sketch USB2PPM_by_Arduino (Open Source), which you can find on Github . The program implements a PPM encoder whose parameters and channel values are set via serial commands.

For example, you can switch the polarity of the output signal and select the number of PPM channels in the range from one to eight in order to adapt the encoder to your transmitter.

The PPM signal can be found on pin D8. To connect to the student input of your model remote control, you will then need a corresponding cable. It may also make sense to use an Arduino prototype shield that accepts a suitable socket to ensure a stable connection.

For the integration of the PPM encoder into your application, the definition of the commands and messages can be found in the header file protocol.h.

Additionally you will find the Joystick2PPM4Arduino app in the Microsoft Store with which you can connect a joystick or gamepad (DirectX-compatible) to your Arduino-based PPM-Encoder. The app connects to the Arduino Uno, Nano and Pro Micro.