WARNING!
The following is a description of what I did to replace the original firmware of my
DOFReality P6 platform with a modified version of the SMC3.ino sketch for the Arduino UNO.
If you follow these instructions, you're doing so at your own risk!
I shall not be responsible for any damages resulting from you attempting to do what I did!
The DOFReality P6 platform used here has two control boxes with Arduino UNO processor boards
controlling the motors. The software ("firmware") used in these boards is supposedly based on
the SMC3.ino sketch originally published
here [1].
In order to have a controlled shutdown
I wanted to replace the original firmware with an open source version. To do so I first
took the original SMC3.ino and widely refurbished the code to make it more readable and easier
to extend. The result of this work can be found here [2].
Since the original SMC3.ino was published without mentioning any software license, I tried to contact
the author to get permission to base my work on it, but unfortunately there was no reaction to my
private message about this. In the hope that this is a useful contribution, and also to protect
myself from litigation in case somebody uses this software and something goes wrong, I am putting
my work under the MIT license.
Backwards compatibility
The first thing to do when trying to replace an original firmware is to make sure you can go
back to the original in case something goes wrong. The safest way to do this here is to take
out the Arduino board and replace it with a new one, containing the new firmware. You can then
simply swap the boards if you later want to have the original back.
The program "DOF Reality Tools (run as Administrator).exe" from the
DOFReality tools [3] package is used to upload new
(proprietary) firmware versions to the Arduino. But it does so only if it recognizes
the existing firmware in the Arduino as one of their proprietary versions.
With the help of a USB sniffer [4]
and some additional information from Igor Demenchuk (DOFReality) I was able to figure out the
necessary protocol, so this version of SMC3.ino can be flashed back to the original version
from DOFReality. The proper version protocol is also necessary to communicate with the
Sim Racing Studio (SRS) software.
Installing the new firmware
1. Get the software
Download the firmware source from here [5].
Make a directory named SMC3, unzip the source archive and move the files into it (the Arduino IDE requires this subdirectory).
Go to https://www.arduino.cc, select SOFTWARE and download
the Arduino IDE.
Install it on your PC.
2. Preparations
Make sure that no other software is running that might access the control boxes (like SIMTOOLS,
Sim Racing Studio etc).
Also make sure the main power switch on both control boxes is in the OFF position.
3. Determine the installed firmware version
| Run the DOFReality Tool and plug in the USB cables of both control boxes (one at a time).
Once the boxes are recognized, the installed firmware versions are listed. In this case they are
UP6_M1_A.06807 for the left box, and UP6R_M1_A.06807 for the right one. |
4. Save the setup parameters
When a new firmware runs for the first time, it may overwrite several parameters in the Arduino's EEPROM
with default values. You may want to save your existing parameter settings, so you
can restore them later with the new firmware.
| While in the DOFReality Tool (see step 3) click on the "Start SMC3Utils P6 Left"
button. In the "Windows SMC3 Setup and Monitor Utility" click on "Save" and enter a file name, for
instance "p6-setup-left.txt". This will save the setup parameters for all three motors in the given file.
Close this window and repeat by clicking on "Start SMC3Utils P6 Right" (using "p6-setup-right.txt" as file name).
|
5. Edit the source code
In the file SMC3.ino locate the lines
#define DOFR_BOARD 'U' // Arduino board (U = UNO, M = MEGA)
#define DOFR_MODEL 6 // model ID (5=H6, 6=P6)
#define DOFR_CONF 'A' // SFU gear configuration (A or B for 6 motors, X for 3 or 2 motors)
and, if necessary, adjust the entries according to the firmware versions from step 1.
Note: Only 'U', 5/6, and 'A'/'B' have been verified to enable re-flashing of the original firmware.
All other combinations may or may not work! If in doubt, you better replace the original Arduino
boards with new ones.
6. Flash the Arduinos
7. Test
Before using the platform for actual motion simulation with the new firmware, you need to
carefully test everything to make sure the sensors and motors run in the right direction.
Otherwise, if something is set up the wrong way, your platform might make sudden, heavy and
disruptive movements, which might lead to hardware damage or even injuries!
- Make sure both control boxes are turned OFF.
- Run the DOFReality Tool and plug in the USB cables of both control boxes (one at a time, as described in step 3).
- Launch the "Windows SMC3 Setup and Monitor Utility" for the left control box (as described in step 4).
- Select "Motor 1" in the top left corner of the window.
- Set the parameters Kp, Ki, Kd, PWMmin, PWMmax, PWMrev to 0 (this will make sure the motor doesn't move).
- Set "Clip Input" to 255 (you need to do this first) and "Max Limits" to 255 (this will give you plenty of margin if something
goes wrong while setting up).
- Click on "-> M2" and "-> M3" to copy these settings to motors 2 and 3.
- Turn on power to the left control box - nothing should move at this stage!
- Set Kp to about 400.
- Now slowly increase PWMmax. At some point the motor should start to move. When it does check the "Green" feedback line is moving
toward the "Blue" target position.
- If it is then that motor and feedback sensor are behaving correctly.
- If it is moving away turn off motor power immediately (or quickly reduce PWMmax again).
In this case check all of the wiring and the settings in SMC3.ino, as described in steps 5 and 6.
- Repeat from step i for motors 2 and 3.
- Repeat from step c for the right control box.
8. Restore setup parameters
Do as described in step 4, this time using "Load" to load the parameters from the files
previously saved.
[1] https://www.xsimulator.net/community/threads/smc3-arduino-3dof-motor-driver-and-windows-utilities.4957
[2] https://git.tvdr.de/?p=smc3.git
[3] https://dofreality.com/tools.zip
[4] https://www.hhdsoftware.com/device-monitoring-studio
[5] https://git.tvdr.de/?p=smc3.git;a=snapshot;h=refs/heads/master;sf=zip
|