View on GitHub

ラジドリ用ジャイロGyroM5

M5StickCで自作するオープンソースのラジコン二駆ドリフト用ステアリングジャイロ

日本語 English

GyroM5

GyroM5


DEMO

This Tamiya RC car (SU-01) with GyroM5 is performing “RWD drifting”.

https://user-images.githubusercontent.com/64751855/117535983-a1d76280-b033-11eb-9f59-ec6aaef0b9b0.mp4

Features

GyroM5 has unique features.

Requirement

These hardwares are required for GyroM5.

Usage

The outline of usage is as follows. The details are in next section.

Hardware setting

  1. Install Arduino IDE on your PC.
  2. Setup Arduino IDE for ESP/M5StickC.
  3. Connect your PC and M5StickC with USB.
  4. Install sketch GyroM5Stick.ino on your M5StickC.
  5. Install GyroM5/M5StickC on your RC car with LCD up.

Software setting

  1. Turn on your RC car.
  2. Wait for GyroM5 HOME state.
  3. Setup steering end point.
  4. Setup initial PID control gains (KG=50, KP=50, KI=30, KD=10).
  5. Run RC car and adjust PID control gains.

Daily usage

  1. Turn on your RC car.
  2. Wait for GyroM5 HOME state.
  3. Run RC car and adjust PID control gains.

Note

The details are as follows.

Wiring

Wire GyroM5/M5StickC to RC receiver/servo units, as explained in the table below.

GyroM5-hardware

M5StickC in/out RC units
G26 in Reciever CH1
G36 in Reciever CH3
G0 out Servo CH1
GND in Reciever minus
5Vin in Reciever plus

An example image of assembled wire harness is as follows.

GyroM5-wireharness

Caution: Signal levels in M5StickC (3.3v) and RC units (5.0v or more) are generally different. My RC units use 5.0-6.0v and work no trouble with directly connected M5StickC. But higher volotage (over 6.0v) RC units may damage your M5StickC.

GyroInstall

Turning On/off

M5Stick is known to have bugs in its power managment. Find hints for trouble-shooting with google search like keyword “m5stickc not turning on”.

Monitoring LCD

GyroM5 has five states below. One state transits to anothr state at button [A]/[B] or timeout event.

GyroM5-state

state transition descripition
WAIT RC signal waits for PWM signal from RC receiver
INIT Timeout calibrates zero points in CH1 and gyrosensor, dont move RC car
HOME [A],[B] displays RC signals, IMU inputs and PID gains
WIFI [A] WiFi access point and accepts setting commands
ENDS [B] setup CH1 steering end points

GyroM5’s web server returns the following page for various setting. In this page, you can setup PID parameters, PWM frequency and so on.

GyroM5-wifi-link

Tuning

GyroM5’s control algorithm is explained for tuning parameters.

Algorithm

GyroM5 uses generic feedback control algorithm “PID control”.

PID_wikipedia

In the above PID control, the plant/process is your RC car. The target r, the output y and the control u are as follows.

GyroM5 attempts to minimize error value e by adjusting control variable u.

INT is time integral operator, DOT is time derivative operator.

Parameters

You can confirm/adjust the integer PID gains by LCD, A/B buttons and CH1. The integer gains (in uppercase) are normalized from -100 to 100, and are related to the real gains (in lowercase) as follows.

Initial parameters are recommended to set the integer gains “KG=50, KP=60, KI=30, KD=10”. Special integer gains “KG=KI=KD=0 and KP=50” are as same as the setting “pass throw: u=r”. The plus/minus sign of KG is used for normal/reverse operation in steering servo.

Testing

My RC car for testing GyroM5 is as follows.

UpperView

item model
chassis Tamiya SU-01
body Tamiya Jimmny Willy (SJ30)
tire TOPLINE drift tire
RC TX Tamiya fine spec 2.4GHz
RC RX Tamiya TRE-01
RC ESC Tamiya TRE-01
RC servo Yokomo S-007
battery 7.4V LiPo 1100mAh
motor 370 type

Hints for “RWD drifting” are listed bellow.

LowerView

Roadmap

The followings are some ideads for improving your GyroM5.

Author

The author bought a small RC car kit (Tamiya SU-01) for indoor playing under COVID-19. After purchasing, I watched the RC car YouTube channel and became interested in “RC drift car” that did not exist in my childhood. The “RC drift car” is already established as a genre of RC car, and the shortest course to play “RC drift car” is to get dedicated products like Yokomo YD-2.

But in my case, I noticed the “RC drift car” after purchasing the kit, and I believed that any RC car can perform “stable drift driving” by high speed control. So I tried to make steering assit gyro to stabilize RWD drift driving for my small car.

I enjoyed making this GyroM5, and I thought this may be a good material to learn programming and control algorithm while playing RC car. So I release the source code of GyroM5 for expecting that someone use this material for STEM education, or persuading your parents to buy hobby RC car.

I am happy if somebody could reproduce GyroM5 or customize it by themselves.

(^_^)


Reference

Radio Control Car

Automobile Drifting

Software

Hardware