X-sim / Arduino / motomonster / 12V DC truck wiper motors
Years ago, it was really impossible to start such a project... without a software like Xsim !
But when I came back on the Internet in 2013 with this simulator project still in mind : I discovered Xsim and fully functional projets
So, I started a simulator and ... I finished it !!!
I'd like to share in return what I did, to help others as I've been helped by reading your posts
It's running in rFactor IA mode in order to show the maximum effects ! and prouve that wiper motors can be strong enough !
It can be smoother.
Among many designs, I finally choose to follow the building instructions of Lipide512, thanks to him for his great tutorialhttp://www.gamoover.net/Forums/index.php?topic=25907.0 and his help !
A dynamic simulator which integrates the driver, the seat, pedals and steering wheel (but not the screens !)
The two axes (2DOF: Two Degrees of Freedom) are : roll and pitch (roulis and tangage).
The principle is inspired by the commercial model from Frexhttp://www.frex.com/gp/motion/motionpage1.html
but with gearmotors (wiper motor + rod) replacing the electric linear actuators.
[*]This simulator uses the essential software Xsim to extract games telemetry data and send the data to the motors.
[*]Two computers :
Pc #1 (graphic card "7970 lightning", Windows 7) :
- The car games (Dirt3, rFactorLite and Richard Burns Rally)
- Xsim Sender
PC #2 (Recycling) connected via a crossover cable RJ45 to PC #1
- Xsim Profiler
[*]Electronic cards : Arduino + Motomonster
An Arduino card linked to computer #2 with a USB cable.
The Arduino controls the MotoMonster shield "motor driver board".
The power board Sparkfun "MotoMonster" drives the two motors (12V 47A = 575W) according to the instructions of the Arduino (5V 5mA = 25 mW).
For simplicity, the motor driver board is equivalent to 4 relays:
driving the right motor forward <-> this means mounting the right side,
driving the right motor in the other direction <-> this means lowering the right side,
driving the left motor forward <-> this means mounting the left side,
driving the left motor in the other direction <-> this means lowering the left side,
An arduino program (C language)
This program interprets the data sent by serial port xsim (instructions) and sends it to the motor control board.
It performs a feedback control by reading the values of the potentiometer coupled to the motors :
-> The actual position is compared to the setpoint, and this will create a new updated order sent to the MotoMonster card.
This feedback loop is performed every 80 ms.
A punchy 12V Power Supply Unit about 30A.
Electric Motors :
2 Truck Wiper Motors for actuating the movable platform, with their positioning potentiometer (for feedback).
Structure in rectangular steel tube:
- the frame
the frame rests on the ground and supports the movable platform via a motor drive shaft (U joint).
- the moving part: the "cockpit"
- A true racing bucket seat (tubular). The fiber seats are lighter but more expensive.
- A harness! important to feel the seat movements and for realism of immersion
- Force Feedback steering wheel and pedals
Here are the quotations to give you an idea :
The step-by-step pictures:
It was very convenient to have the bucket seat's mounting plate: I drilled the structure easily! (Uh, now it's for sale!)
Power Drill and a conical tool to adjust the hole to good diameter
Take care to ensure the shaft 's squareness : it has to be vertical !
Then I crossed the bars at 45 ° to triangulate my frame :
Here's the frame:
Look for a car or truck gimbal at scrap yard or
an ebay search "rear drive shaft" (don't buy a RC model shaft
The gimbal (U joint) is blocked in rotation along the yaw axis.
the gimbal assembly:
which gives this
Theignition key, of course = )
a plate on the side of the wheel holder:
and here is a "starter / emergency stop" key §
The pedal support
the right bracket must be folded down!
folding legs with a hammer
The D5mm hole for a screw that will lock the support and prevent it from slipping
After welding, the result in perspective:
Dirlling of the pedals and support plate at the same time
Two-components glue bonding and 4 screws M5x16
take the opportunity to remove the unnecessary ballast which adds to the inertia of the system
after painting (and shorter legs):
and perspective view
The 4-point harness
In fact, it is a 6 points but it's too much ! and not comfortable : 4 is fine.
welding a small bolt
the clip can be mounted and removed
conclusion: the harness is great!
- For the look
- For immersion: it feels like being in a rally car!
- For sensations: I think we fight less against movements playseat, it is more inclusive
but it requires a keyboard support!
To finish the structure, a wooden bottom on which I can put my electric stuff
Drilling diameter 4, threading M5 and screw
The rubber feet
Essential accessory: small rubber feet to absorb vibrations and provide stability on the ground.
Here are some hard plastic and adjustable feet
Width of the frame, I aimed a compact size to begin with
Edit: The first tests have shown that ... it was not wide enough!
then I added + 11 cm on each side (it must go through the door ^ -) for a total of 68 cm
The Center of Gravity cdg
I determined it with "precision" with an assistant:
on a tubular steel rod, roll frame until you find the balance
with the driver in it!
(the rod has to be perpendicular to the plateform !)
In Frex system, the seat is operated by electric actuators.
Xsim users recommand the use of SCN5 actuators. The Xsim application has a dedicated setting window.
But the cost was too expansive for me: € 320 each (the only retailer here (https://miraiintertech.com/e-store/products/SCN5.html))
So, the actuators are advantageously replaced by wiper motors and a system of rods (just 10 times less expensive).
Edit : finally, this bracket is too short : I couldn't mount the 2 motors symmetrically .
If you can, make a DIY bracket with custom height.
-> And check that the rod can rotate 360 °.
Mounting with 3 screws M6 x 16 and washers
A steering rod (15 €):
A connecting rod:
- Center distance 65 mm (finally)
- 5 mm thick
With a file, try to file a 18° cone down : it has to go well on the motor shaft.
Tighten hard !
motors and rods final mounting
sanding the edges to remove the zinc coating of the bracket for a good welding
I checked the alignment of the motors with the platform (= I conterbalanced a small angular error during the welding of the platform)
Edit: the engine brackets are not stiff enough! they move under the constraints.
and I checked the rod could rotate freely at 360°
do not hesitate to do the same (one full turn may arrive more quickly than you think
here the assembly of the connecting rod with the movable platform :
Fixing rods on the platform:
we notice the hexagonal hollow: handy to tighten nylstop nut for example
it works well for top seat side.
On the other end, I shortened the length of the threaded rod so that it can rotate 360 ° without stumbling. There is a problem : the spindle mounted on ball, turns on itself when i tighten the nylstop nut : '(
So I made a hacksaw deep enough to insert a screwdriver while I clamped the nut.
wiper motor's preparation = fixing the pot at the back of the engine
1 / tapping of the smooth hole of the engine
2 / a M4 threaded rod
3/ a 6mm diameter (like pot) spacer and M4 tapped
assembled with loctite:
then the parts for making a rotational connection adjustable to adjust the potentiometer
(The brass piece is ... a 380V connecting block course!)
This solution is rather excellent!
it is tight enough to but if it goes too far: the pot is not damaged, it slips.
Making a light and flexible bracket for the pot: it should mainly prevent its rotation and absorb a bit of eccentricity.
thickness: 0.8 mm for soft and flexible
Overall un-folded dimensions: 50mm x 129 mm
the first bracket and the second waiting!
Engine and rods mounting :
- Make sure the platform is horizontal (spirit level)
- the 2 rods has to be perpendicular (red square on picture)
For the electronic part:
The 12V power supply 47A
eBay, the DPS-600bp model (http://www.ebay.fr/sch/i.html?_from=R40 ... pb&_sop=15) is 30 € with shipping: 575W
The mod is very light! https://sites.google.com/site/tjinguytech/my-projects/HP47A ad here http://www.worldwidedx.com/general-ham-radio-discussion/121243-server-power-supply-conversion-cheap.html
There is not need to open the block and therefore no risk of electric shock.
Cards: Arduino and MotoMonster:
here is the wiring diagram I followed from Lipide512
I chose not to stack the two cards although it is expected to:
- I wanted to keep me a chance to reallocate the outputs of the Arduino
- I wanted better cooling system (so I raised the motomonster)
If you bought the Motomonster board, the simpliest is to stack it onto Arduino !
If you don't, you have to follow the following pinout :
Arduino and Motomonster have same pin's number !
......GND <-> GND pin
........5V <-> 5V
.....pin 4 <-> pin 4
.....pin 5 <-> pin 5
.....pin 6 <-> pin 6
.....pin 7 <-> pin 7
.....pin 8 <-> pin 8
.....pin 9 <-> pin 9
pin 13 is not needed
on the pictures, I've soldered more wires (but they are unused wire...).
Alternative: the olimex VNH3SP30 works like Motomonster VNH2SP30: 1 pin for PWM speed, 2 pins needed for direction
and can handle 24V
and so the code is compatible!
specs https://www.olimex.com/Products/RobotPa ... h3sp30.pdf
The Olimex board (integrating VNH chip) pinout is:
Olimex pin 5 = inA motor1
Olimex pin 4 = inB motor1
Olimex pin 6 = pwm1
Arduino /.. VNH3SP30 motor1
Ard GND <-> Olimex GND pin
Ard 5V <-> Olimex 5V
Ard pin 4 <-> Olimex pin 5 inA motor1
Ard pin 9 <-> Olimex pin 4 inB motor1
Ard pin 6 <-> Olimex pin 6 pwm1
Arduino /.. VNH3SP30 motor2
Ard GND <-> Olimex GND pin
Ard 5V <-> Olimex 5V
Ard pin 7 <-> Olimex pin 5 inA motor2
Ard pin 8 <-> Olimex pin 4 inB motor2
Ard pin 5 <-> Olimex pin 6 pwm2
Arduino / Potentiometers
Ard pinA4 <-> center pin of pot 1
Ard pinA5 <-> center pin of pot 2
Ard pinGND <-> 0 ohm's pin potentiometer 1 & 2
Ard pin 5V <-> 10k ohm's pin potentiometer 1 & 2
First movement tests
a video to show the amplitudes of movement of the cockpit and the moving speed.
The position commands are typed by hand in the arduino serial monitor (RF7LF7 then RAELFF etc ...)
Heat sinker had to be cut in half in order to have a good contact with the 2 chips (uneven)
go for the thermal paste
spreading the paste:
Protection for cables :
-> electrical conduit
-> A notch
-> And insert in the hole!
the cover of the electronic cards with his fan
+ a grid that prevents the wires to be worn against the fan's blades.
a glogal overview of the electrical stuff:
For your information, here the wiring for 2 motomonsters and 1 arduino if you intend to build a 3DOF or 4DOF
If you're using more powerfull motors, you can use one Motomonster per motor. Follow the specification of VNH
Arduino configuration :
PC1 : Games & Sender
IP fixe : 192.168.0.11 (TCP/IP v4 protocol)
this PC runs the games
and Xsim Sender
PC2 : Profiler
IP fixe : 192.168.0.4 (TCP/IP v4 protocol)
this PC runs Xsim Profiler
and communicates with Arduino via USB serial cable.
*/ Arduino : install manually the drivers (see the Arduino's documentation for Windows Seven installation).
After complete installation, find in the Windows system on which COM Port it has been installed : you will need to put this information in Xsim Profiler.
Double clic on Arduino's line and adjust the default speed :
In the Arduino plateform, put the right COM Port : if not, you won't be able to upload your program into the Arduino...
If you need to lead some communication tests, use the Serial Monitor ("magnifying lens" on top right ).
Adjust here as well the same default speed :
and you will have to copy this very same information in Xsim Profiler !
see finished project topic here viewtopic.php?f=36&t=1617
copy/paste the code in a "sketch" (.ino file) and upload it into the Arduino
first hardware tests and trials
First : your pot are not mounted onto the motor
you can see the expected behaviour in this video
and please find the explanation of the code here :
The code is written to put the simulator on middle position at start :
/* init position value*/
int DataValueL=512; //middle position
- if your pot is fully turned to max, as Arduino "reads" potentiometer value as motor position, Arduino believes that motor is in max position.
- but the order is to be in middle position
- so the Arduino will ask the motor to go reverse in order to go to middle position
- your motor is turning
- but while your pot keeps still, the motor will turn non stop !
- when you manually turn the pot backward to min, Arduino reads that motor is in min position
- but the order is still middle position, so Arduino will tell the motor to go forward
- motor runs non stop until the pot is in middle position
In the code, you have a "tolerance" parameter : when the pot is around middle position (<middle+tolerance and >middle-tolerance), the motor stops.
You can broader Tolerance value to stop your motor more easily manually.
Second : now checked the wiring
Once you have played in this manner, now checked the wiring
simulate the pot mounted onto the motor (back to back or alongside with gears...)
reduce the speed (pwmMax) to see the direction of motor rotation
and check if Arduino will behave as expected when you turn the pot
if your pot is mounted this way :
when you turn in a direction, motor has to go the opposite way.
If not, invert motor wiring or pot wiring.
Warning ! if you have gears between pot and motor, you'll have to twist your mind to check the correct behaviour.
Third : mount the pot onto the motor, the behaviour will be the following :
- motor goes to middle position and stop
- if you send order to Arduino via Serial Monitor (say R7FLAE) the left motor will move and stop at his new position ! right motor didn't move.
First serial tests: without Xsim
For beginning, start by sending yourself instructions to the Arduino and to your motors...
No need at this stage to use Xsim and Game's data !
L for Left
R for Right
8 bits resolution and hexadecimal output
-> value in hex varies from 01 to FF
01 full speed reverse
FF full speed forward
-> value in decimal (more explanatory) varies between 0 to 255
0 full speed reverse
64 mid speed reverse
192 mid speed forward
255 full speed forward
In the "Serial Monitor" send the following strings in Hexa and Enter:
-> it should move the playseat in horizontal position
R01L01 (max !!)
-> it should tilt the playseat backward and a bit further
RFFLFF (Max !!)
-> it should tilt the playseat forward and a bit further
You can mix for rolling movment :
R01LFF (Max !!)
-> roll left
RFFL01 (Max !!)
-> roll right
you can upload the file (rename it to .rn2) from Kalarius here
Then in Xsim Profiler / Output / port com
serial Port configuration :
select the right arduino's COM Port
if you don't find it in the drop box, write it directly (as explained below the drop box on the screen) like this \\.\com4
For rFactor game (and many other games) :
- find its plugin (if it exists or a compatible one) in the Xsim's plugin's directory : copy it
- paste it in the plugin's directory of the game
Xsim sender (running on the Game PC#1) defines the following parameters :
IP address of the 2nd PC
the path of the game executable file
the plug in being used
informations for the joystick ...
These parameters are saved in a text file with .fsd extension (XSim 2)
Xsim profiler (pc #2) transforms and combines the telemetry data in order to get an order for each motors.
Muy difficil !!!
- serial link choice (for me and my Arduino, its USO not synaptrix)
- Axe 0 : combination of (lateral, longitudinal, pitch ...) game telemetry effects to calculate the right motor's position
- Axe 1 : combination of (lateral, longitudinal, pitch ...) game telemetry effects to calculate the left motor's position
- some general parameters of the software
- serial link's configuration : port number, data's format (for me, its R~a02~L~a01~)
These parameters are saved in a text file with rn2 extension (XSim 2)
select your "Right DOF" and type the format awaited by arduino "~a0~"
8 bits resolution and hexadecimal output
watch out, the ~ characters are mandatory !
the same with "Left DOF"
"Output Protocol Parser" (the values that will be sent every cycle) :
packet send on start : R7FL7F
this is a middle position (ie the simulator is parallel to the ground) (7F = 127 : mi-course de l'amplitude des potards = niveau 0)
data's format :
it means that the values of a0 are sent to the "Right motor/DOF" and the same for a1 and Left Motor
packet send on simstop : R7FL7F
when Xsim stops sending game telemetry's data, it puts the simulator back to the midlle position
On the next picture, I show the different ranges and conversions through all the stages from the game / Sxim / Arduino / pot / motor
it useful if you need to understand the code
Items to buy
- motors 12N.m 24V : 2x35€ + 16€ shipping
SWF VALEO NIDEC ITT 404.458 motoréducteur 24V DC http://www.smolka-berlin.de/onlineshop/fr/artikel/SWF_VALEO_NIDEC_ITT_404.458_motor%E9ducteur_24V_DC__Offre_sp%E9ciale%21%21%21_/4398
- Arduino board : 25€ + shipping http://store.arduino.cc/eu/index.php
- MotoMonster board (16V max) :
70€ @ Sparkfun https://www.sparkfun.com/products/10182
27$ @ DX http://dx.com/p/monster-moto-shield-for-arduino-red-161274
- you can use 2.5mm² wires or bigger
@ 20A continuous
and 30 cm length between driver and motor
-> the wire will heat 37°, which is below the 60° max heat.
http://www.plaisance-pratique.com/spip. ... article=88
Have shortest possible wires between driver and motors!
RacingMat wrote:You can find some Motomonster on Aliexpress @ 14$
or you can use OLIMEX with 24V
9$ per motor
https://www.olimex.com/Products/RobotPa ... -VNH3SP30/
- server PSU 12V 47A (575W) DSP600 : 35€ on eBay
- 2x potentiometers : 2x7€ + shipping
you can buy any cermet potentiometer : "cermet" means Ceramic Metal.
It guarantees you that it's the strongest design compared to plastic-carbon low cost pot.
- linear (not logarithmic)
- 10 kOhm
I bought mine at http://www.gotronic.fr/art-potentiometr ... -11293.htm
you can find here many other electronic distributors : http://codelab.fr/177
+ my plateform structure weight 8,6 kg
tube 30x20x1,5 (1,1 kg/m) 5,4m : 5,9 kg
tube 16x16x1,5 (0,7 kg/m) 4,1m : 2,7 kg
+ rally tube seat : 9 kg
+ rally harness : 1 kg
+ logitech MOMO wheel and pedals : 4,5 kg
+ buttkicker 1 kg
subtotal : 25 kg
+ driver !
grand total : 100 kg which is heavy and has great inertia in mouvements !
-> so keep in mind to build light
Electrical power consumption
I measured the power with this wattmeter :
PC#1 Games : 80 to 100W
PC#2 notebook : 30 to 45W
Dolby 5.1 : 15W
Power supply PSU : in IA mode rfactor which sakes a lot ! between 170W and 220W (depending on the parameters in Arduino code : max speed and amplitude)
the PSU efficientcy is 81%, hence it gives 180W to the motors.
-> 90W per motor -> 7,5 A in 12V DC