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.

 

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.

Joystick model remote control with iRangeX multiprotocol module and Android smart device – even more compact!

The previous blog described how the originally used remote control transmitter can be replaced by an iRangeX multi-protocol module and how the entire setup can be simplified.

In this blog, an even more compact structure is described in which the USB hub, the USB2PPM PiKoder and the multi-protocol module are mechanically combined into one unit, which then only needs to be connected to the smart device and the joystick.

The following steps are required for the implementation:

    1. Extend the USB hub cable
    2. Modify USB2PPM PiKoder with USB connector
    3. Realize mechanical rack
    4. Assemble and wire modules

Extend the USB hub cable

The common USB OTG hubs (on the go) usually have a very short connection cable (0.1 – 0.15 m). In practical use, this results in restrictions, since the hub must always be close to the smart device and possibly hangs in the air next to the holder and so a “rigid connection” with the PiKoder is not possible.

The extension of the connection cable is not a problem. It is only to be noted that an OTG connector with the corresponding coding (see picture) is still used as the connector, because otherwise the hub will not be recognized and will not be supplied with voltage.

The easiest way to extend the extension is to solder a piece of USB cable of the desired length to the hub board and attach the existing plug with the short cable end to the other end and fix it with shrink tubing.

Modify USB2PPM PiKoder with USB connector

For the direct connection between the USB hub and the PiKoder, the USB2PPM requires a USB plug (see picture on the right) instead of the normal USB micro socket. So that the connector can be installed, saw the circuit board in order to then be able to push through the fastening straps. In addition, a hole is required in order to be able to wire the connection cables of the plug (see picture below).

Then stick the connector to the circuit board with two-component adhesive and equip the circuit board with the remaining components (see pictures below). Note: In the further course of the project I replaced the three-pin header with a Molex connector.

Finally connect the pins of the USB connector with the corresponding PiKoder pins; a thin, insulated wire is used for this. The following pictures show the schematic connection and then you can see the actual wiring on the underside of the circuit board.

Realize mechanical rack

The subrack consists of a simple angled wooden structure. The square base plate with a side length of 85 mm accommodates the hub and the USB2PPM Pikoder. The multi-protocol module is clamped in the vertical fork. To improve the appearance of the cable routing, I drilled a corresponding channel.

Assemble and wire modules

You can see the complete setup in the following pictures. The hub is fixed with double-sided adhesive tape, the USB2PPM PiKoder is plugged in and fixed with screws through the two front mounting holes. It is best to use some washers as spacers so that the circuit board does not bend.

With the micro USB connector, the “compact transmitter” is initially intended for connection to an Android device. With a small adapter, e.g. from Micro USB to USB C plug, the transmitter can of course be easily connected to a Surface Notebook.