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, there is more often the need to control several servos, e.g. when realizing a robot arm. 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 to use the free Windows APP JoystickRC to control eight servos wired, e.g. for a robot arm.

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 done by a PiKoder Serial Servo Controller (PiKoder/SSC), which is connected to the PC via a USB adapter.

Setup

The setup is ideally done with the help of a PiKoder/SSC – development board and with a standard USB adapter. The PiKoder is supplied with power via the USB cable. Since the USB interface cannot supply enough power to control the servos, they must be supplied with an independent voltage 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.


Connecting the USB cable to the PiKoder/SSC development board – please note that the jumper must not be plugged in.

Connecting the USB cable to the PiKoder/SSC development board – please note that the jumper must not be plugged in.

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

After that you have to replace the module mavutil.py, because otherwise there will be no connection between the RPi and QGroundControl due to a pymavlink-issue. To do this, find the installation location of the pymavlink library with:

pip list -v  

Then replace the mavutil.py module with the version in the github repository for this blog. The new version is backward compatible.

Finally, create a directory, e.g. diddy2QGC into which you copy the Python modules diddy2QGroundControl.py and ThunderBorg3.py. 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 logs into the QGC and you will then find the option to teach 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.

Metz Mecatron transmitter 191/1 – conversion into Baby 2 transmitter 191/11?

Some time ago I bought a Metz remote control transmitter 191/1 on ebay. The description stated that the transmitter had been converted to a connection to 12 volts (plug for cigarette lighter).

When I looked at the transmitter a few days ago, I came across an interesting inner workings: in addition to the expected DC voltage regulator for 6 volts according to the battery voltage, a circuit board was built into the battery compartment with a relay, wire potentiometer, motor and a break contact.

After a few tests and considerations, it soon became clear that the transmitter would be clocked by the motor with an interrupter. The switching disk on the motor ensures a pulse-to-pause ratio of 1: 1 and the pulse length can be adjusted via the rotary resistance.

At first this was astonishing to me, since the remote control technology of the time worked more with tone frequencies than with pulse lengths and I tried to imagine the required receiver logic.

After doing some research, I came across the following publication in Funkschau issue 21/1965, in which the process is well explained. Apparently someone has recreated the logic of the transmitter using electromechanical means.

I am not sure whether the approach worked, as my system is quite “built-in” – the integrated voltage regulator is probably the result of a later adjustment / repair, the mechanical and soldering quality are very different, so that the attempts by several owners are assumed and the structure found will certainly not work with its current wiring. But maybe this conversion was also presented in a model making or electronics magazine? – I would be very grateful for any relevant information!

The description of the Metz system in the radio show gives a pulse duration of 5 ms. This would correspond to an engine speed of 6,000 rpm. My measurements with the oscilloscope show that the contacts are at a pulse length< = Bounce heavily for 20 ms. On the other hand, based on the receiver circuit, I can also imagine that a reliable channel differentiation is possible even with larger pulse lengths. As soon as I can get hold of a working receiver, I will check my thesis.

To be continued…

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.