1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Using WLAN UDP connection to Rig?

Discussion in 'SimTools compatible interfaces' started by Viktor, Aug 21, 2018.

  1. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    Hi from germany,

    I am currently developing an Arduino sketch to connect my Simukit SK3 rig to Simtools via a cheap ESP32 Controller Board with integrated WLAN (instead of the more widely used Arduino Uno or Mega and USB).

    This would have the benefit that no physical electrical connection between the PC and the rig is needed. The ESP32 controller board is powered by the rig and connects via WLAN /UDP to Simtools. First Tests with Simtools Axis Control were succesful, but my rig isnt finished yet.

    Has anybody experiences or suggestions /comments regarding this approach?

    Regards, Viktor
    • Informative Informative x 1
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. TheBaucek

    TheBaucek Only one Lost in Space Soul

    Joined:
    Nov 8, 2019
    Messages:
    16
    Occupation:
    Mehatronic
    Location:
    Slovenija
    Balance:
    55Coins
    Ratings:
    +11 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform
    Hello

    Have you find out?
    Is it possible?
    Wifi would be impressive.
  4. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    I have stopped this approach, as I had severe problems with latency and stuttering (though this might have been my fault).

    If anyone was succesful with an ESP32 and wlan, i would
    like to know...
  5. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    The great thing about ESP32 is that it has wifi and decent performance. I use it to control my 3DOF racing simulator while playing Forza 7 on XBox or Project CARS on PC.

    The ESP32 board receives telemetry data from the racing game on a UDP port (pitch, yaw, roll, suspensions...) With these data I calculate the amount of pulses needed for the three AC servo motors which move the whole racing rig. I have done everything by myself (building the simulator, writing the firmware for ESP32, PC software...)

    Originally I used the STM32 board. For the communication between STM32 and PC use the COM port. A small program of mine runs on Windows, receives UDP data, calculates the amount of pulses and sends them to STM32. The STM32 in its turn sends the pulses to the motor drivers.

    I was very glad when I discovered the ESP32 since I could get rid of the long serial cable. Now I have just to turn on the XBox and power up the racing rig. No PC is needed. I use LEDs and a a LCD to get some feedback from ESP32, for example, IP address, reset state, online state etc... A keypad is used to send some test commands like homing, going to min, max positions.

    For the demo I attached some pictures. You can see the ESP32 and the wifi IP address on the LCD.

    If you want to use ESP32, go ahead. It works. Of course one has to do a lot of thing by oneself but isn't it fun :)

    Attached Files:

  6. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    Thank you for this interesting information.

    I am using my rig for flight simulation only, where smoothness und low latency is very important.

    Since some month I am using an Heltec Wifi Kit Esp32 Board (with a small on Board Oled display) to drive 3 24V 400W Motors with worm gears via Serially attached Sabertooth Motor drivers . For position feedback I replaced the original pots with interrupt driven 18$ Chinese 2400 PPR quadrature rotary encoders and capacitive proximity switches (for Homing) which gives a much better resolution and reliability. Communication with Simtools is via a short Text Telegramm via USB/Serial.

    After some tuning of the PID parameters i am now very happy with the performance of my Simukit3 rig when using Aerfly FS2 and a Vive.

    When i have more time I might give Wifi/UDP Communication a try again. I hope this will not introduce latency or small stuttering /roughness again. Your results show that this should be possible.
  7. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    Indeed, information exchange is useful.

    Encoders are definitely better than pots. With an encoder one is able to go to exactly the same position over and over again which is not the case with pots. I have this 2400 PPR encoder too. It is well built and the price is reasonable.

    Originally I used the NMRV worm gears. They worked ok, but due to the construction, worm gears always have backlash and that often create unplesant noises (cluck, cluck...) the motors change direction. Then I tried planetary gears (bought on eBay, PX110N0116S0) they worked fine and noiselessly. But after using these gears for a month I began again to search for another solution because these planetary gears don't have the double output shaft like the worm gears which make the platform more stable. Finally I found on Alibaba a gears manufature in China. I ordered three helical hypoid gears with double output shaft. It took two weeks for them to produce the gears. These things are great, they work very quietly.

    I don't experience any latency with my rig either. The UDP packages come approximately every 16 ms over wifi from the racing game. The ESP32 processes the data and give the timer interrupt routine the numbers of pulses it must generate for the three motor drivers. Everything happends in real time. Additionally to pitch, roll I also feed the rig with suspension data which make the racing experience more fun. One can feel a lot of bumping when driving.

    Thanks to the Chinese we can buy high quality motors for affordable price on Aliexpress now. That was not the case 10 years ago. The motors I use are 1,8 Kw AC servos which have 10000 PPR built-in encoders. They are so powerful so they can move the whole platform (me + 55 inch display + fanatec stuff + heavy wood plate) smoothly and pretty fast (appr. 370 mm/s). The funny thing is, after playing for hours, when I touch the motors, they are still cold as if they had never been turned on hahah...

    Would be glad to hear from your wifi project someday!
  8. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    A small correction. The speed is actually appr. 750 mm/s (120 RPM on the gearbox output shaft). That should be more than enough.
  9. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    Using timer based interrupts is the key to get precise timing, thank you for this feedback, will try it :)

    I wonder if eliminating Simtools (by doing all the calculations in the ESP32) is worth the effort to further improve latency / responsiveness...?

    Can you share Name or a link for your gear and Servos?

    Attached Files:

  10. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    1,526
    Location:
    Portugal
    Balance:
    11,758Coins
    Ratings:
    +1,638 / 13 / -0
    My Motion Simulator:
    6DOF
    You could try Mover, it has an udp output, and I'm working on a bi directional protocol.
    The advantage of using the pc is to make filtering easier and you have interpolation, because we can easily go down to 2 ms calculation loop or even less.
    Most games send data at 16ms (60fps) but we can fill that hole.
  11. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    - Here is the motor. I like it very much, have four of this 1,8 Kw. I also have three motors of this series but with less power which I use for CNC and drilling machines. Another thing to mension is that the motor drivers are very quiet. That is not the case with DC power sources (they usually make a lot of noise because of the cooling fans, sometimes even very loud).

    https://www.aliexpress.com/item/32867430250.html?spm=a2g0s.9042311.0.0.27424c4dCidiTe
    - Here is the gear box. At first I ordered one piece. After I tried it for a while I ordered two more. The suitable model for the motor should be BKM050. But in any case they will ask you about the specs of the motor to double check everything. The sale person is a nice and helpful Chinese woman.
    https://www.alibaba.com/product-det...spm=a2700.galleryofferlist.0.0.57ff1108Xmz8c3

    - Yes, you should try using the timer interrupt routine. It has the highest priority. I set the timer up in a way that the ISR is called each 10 microseconds. Every time the ISR is active I call gpio_set_level() to set the voltage output either high or low or simply do nothing. All depends on the pulse with I want to generate. You can use the oscilloscope to see the beautiful square wave.

    For programming ESP32 I use the ESP-IDF SDK. This is the original development tool the manufacture gives developers. The documentation is very detailed and there are examples for literally every category (timer, I2C, ISP, ADC, DAC, serial, wifi, udp, bluetooth...). Of course one can do a lot of things with Arduino but if one want to get to the core of ESP32 one should use the ESP-IDF. Maybe you are already using it.

    By the way, I have just ordered two 2500 PPR encoders on Aliexpress, 35 EU/piece. Your price of 18 EU is indeed very favorable hahah...
  12. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    I can see the sensor you use for homing on a picture, looks very solid. For that I use a dirt cheap optical endstop (costs about 1,3 EU on Aliexpress).

    To generate motor vibration I use a BLDC motor. The higher the RPM is the more it vibrates, and this thing can vibrate like crazy.

    Attached Files:

  13. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    I started using capacitive proximity sensors because first tests showed that they are able to detect 3D printed PLA. However Adjustment was very sensitive (and even dependent on room humidity) so I am using screws now to mark the lower and upper end position. Aside of this, capacitive and inductive Proximity sensors are very cheap (10$) and reliable nowadays, so I can recommend them. While a single Home position marker is theoretically sufficient, i use markers for the lower and upper limits, so I can “sanity check” if the platform leaves its allowed range.
    Last edited: Jul 20, 2020
  14. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    Thanks for sharing these valuable informations.
    My next steps will be towards that direction... ;)
    • Like Like x 1
  15. Viktor

    Viktor New Member

    Joined:
    Jul 12, 2018
    Messages:
    8
    Occupation:
    C# Developer
    Location:
    Germany
    Balance:
    - 37Coins
    Ratings:
    +3 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Motion platform
    One advantage of worm gears is that they are self blocking (i.e. on a power failure).
    I assume your integrated servo Motors hold the position even under heavy load changes, as long as power is available. What happens when you switch power off?
  16. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    You are right, this is an important advantage. The helical hypoid gears are not self-blocking. When the power goes off everything "falls" down. Sounds scary right? hahah... I tried once. The right side of the wooden base was broken but nothing happened with the gearbox itself. The base was damaged because of roller casters. If it lay right on the surface of the floor everything would have been OK.

    After that I used a stronger and thicker wooden plate and installed more roller casters under the base (14 pieces). Everything seems to be fine now. Of course I would like to have a method to slow down the fall in case the power suddenly goes off. Mechanical or electrical, whatever.

    A steel or aluminium construction would the best solution but it is not safe to do welding in a rent apartment. Aside from that I like wood. It is cheap, easy to process and recycle. I also constantly modify things to try new designs. I attached a new picture. You see some wooden gears and a motor holder for the AC servo. It is a FFB wheel which is based on the MMos driver.

    Attached Files:

    Last edited: Jul 22, 2020
  17. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    I looked around in Internet and found this thing. It is called a solenoid magnetic brake. It is probably not cheap but the idea is good. Besides, there is no need to lock the output shaft completely. It suffices that the brake creates strong friction around the shaft.

    Attached Files:

  18. jsoftware

    jsoftware New Member

    Joined:
    Sep 9, 2016
    Messages:
    8
    Occupation:
    IT
    Location:
    Germany
    Balance:
    222Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    3DOF, AC motor, Motion platform
    It looks like there is a doable solution.

    I have just tested the racing rig with a 360W UPS. I plugged out the power but all three motors still run as if nothing had happened (switch time to battery mode = 4-10 ms). The motors are 1,8 Kw but they never operate at full power for a long duration of time so even a 360W UPS suffices to support the rig.

    I am gonna order a 1200W UPS on Amazon. At last the problem is solved.

    Attached Files:

    • USV.jpg
      USV.jpg
      File size:
      152.8 KB
      Views:
      75