Skip to content

Arduino code and other bits and pieces required to ride a bike through ETS2

Notifications You must be signed in to change notification settings

RootlessAgrarian/USBcycle-EuroBikeSimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EuroBikeSimulator

Arduino code and other bits and pieces required to ride a bike through ETS2

(Oct 20 2017): USBcycle is ready for public download...

The project is complete (this version) and working, but could do with improved documentation and packaging (ongoing). Youtube video is probably the fastest way to understand what it's about:

https://youtu.be/vI55Mqzf5uQ

The project in a nutshell is this: USBcycle Arduino hw/sw and related Euro Truck Simulator 2 mods to make it possible to ride a stationary bike (in my case my regular mtb on a trainer stand) through ETS2, using the bike's own brake, steering and pedals as a controller, with a control panel (buttons, LEDs etc) which mounts on the bike handlebars so no keyboard is required. So ETS2 becomes a HUGE open world virtual cycling app. Here's a long, elaborate writeup explaining the rationale, design decisions, etc.

https://create.arduino.cc/projecthub/Tazling/usbcycle-ride-through-your-virtual-world-8ff961

This project does not qualify as a pro trainer (yet). There is as yet no telemetry/feedback from the game (for realistic effort on grades etc) nor is there any provision for advanced trainer stands with lean-steering. It is a simple USB game controller. There are two versions: one interfaces with basic WASD games, the other is the full-blown kbrd/mouse/3-axis version suitable for driving sims.

This version is a prototype. If there is sufficient interest I might eventually make a packaged "USB Bike Controller kit" ... but it is pretty easy to DIY and I am happy to share my code and notes with anyone who wants to pursue this excellent off-season fitness strategy. Riding through the endless midsummer of ETS2 is not only good exercise but good winter light therapy to offset to gloom of the long dark days!

Huge thanks and appreciation to the team at SCS, authors of the core ETS2 game, and the ProMods team, authors of imho the best map extension available. Both teams have created a world of startling beauty and richness which is a pleasure to visit. Also thanks to a few pioneer makers who have created similar bike game controllers over the last couple of years: your projects really inspired me.

What you need to make this work:

-- a gaming computer, and a game that accepts (at most) 3 axis control plus mouse and keyboard, or just WASD keyboard. I built this project to work with Euro Truck Simulator (and American Truck Simulator), but you could adapt it to other driving, walking, or endless-runner games.

-- a bicycle + trainer-stand or other device (rotary stepper, treadmill, etc) with a rotating or reciprocating mechanism that would enable you to detect fwd (and reverse if desired) motion using reed switches and magnets.

-- 2 Arduinos with USB HID capability, i.e. Leos, Pro Micros, Dues. they run the Leo1 and Leo2 code from this repository.

-- associated parts (see detailed project writeup above): LEDs, switches, sensors, wire, proto boards, etc

-- a few evenings of your time to attach sensors to bike, make a harness, build a control box for the duinos, etc.

-- (preferably) a basic USB HID debug/monitor tool to help you verify the functioning of your control box

-- a few more evenings of your time to test with your game and tune your USBcycle for your specific application: if you are using ETS2, you'll want to install my Cyclist profile and BikeView mod (tweaks to the Mercedes Actros truck to suppress truck sfx and move camera 5 to a cyclist's head position ahead of the front bumper).


*** WASD version:

This version of USBcycle requires only one Leonardo or similar Arduino with USB HID capability.

You may notice there is a different .ino file here, USBcycle_WASD (or whatever version it is at the time you download the kit). It enables you to play traditional open-world WASD (walking) and keyboard-driving games such as Portal, Dear Esther, Obduction (WASD) or Crash Drive 2 (driving). The code as written switches between these modes in response to a toggle switch on an Arduino port. It has various options including the use of a wiichuck as a steering/mousing device (you might use this with a portable stepper instead of a bike, or with an exercise-bike that has no brakes or steering).

This is a much simpler project to build, and it can be quite fun. You need an open world game in which there's more running and walking than, say, fiddling about inside buildings interacting with control panels and stuff. Dear Esther actually makes a pretty good mountain biking playground :-) and if you've played Obduction all the way through and unlocked everything, then you can ride around that spectacular world. I have tested the Crash Drive version more thoroughly and it is a challenging and fun ride, but it's more a series of quick sprints and stops than a continuous spinning workout.

Now for the bad news...

USBcycle used to work with Unity games such as Off Peak (which was one of my favourite test games early in development, April/May 2017). However, as of October 2017 Unity games are consistently refusing to recognise any Mouse X/Y input from the Leonardo. They do recognise mouse button presses, just not movement. I have posted queries to Unity Answers and to Arduino forum and am waiting hopefully for a clue. In the mean time, I have to warn users that Unity-based games probably will not work with USBcycle, and this is very disappointing (because I do a little virtual world building in Unity myself). A list of Unity games that don't accept mouse xy input from USBcycle includes: Off Peak Everything Dr Langeskov (&c) Although CrashDrive is built with Unity, the mouse problem doesn't matter because CD2 doesn't use the mouse at all :-) Anyway, I'm sorry about this and am hoping that Unity will eventually respond and we can figure out what's not working.


*** Future Plans:

-- Improving ETS2 and ATS support with more appropriate base vehicle, better sound mods, etc.

-- ETS2 telemetry server enabling feedback for e.g. a 12v fan whose speed is proportional to truck speed...

-- custom pcb design for a "kit" version

-- improved front panel layout (version 2 of the control box)

-- (possible) "flying bike" mode using ETS2 godcam