I assume you have arrived here by following the link i posted on one of my videos on my YouTube channel, if not, check out:
http://www.youtube.com/user/gazznhelz for videos of the dashboard in action.
|This is a very simple site i have
thrown together to give a little info about the dashboard i have built
for the bus driving simulator
At the moment all i am putting here are the .DLL, .OPL and the .PDE files, so people who know what they are doing can do something similar.
Basically my dashboard's gauges and lights are controlled by an Arduino, the particular model i use is a mega 1280, it's actually a clone board from china, cost me all of £15 on eBay,
The button inputs were handled by a Leo Bodnar BU0836 usb input board, i say 'were', as i recently found out they do not like 24 volts on their input pins (a result of mis-wiring the gear selector lights power wires)
So i am going to be using a U-HID from Ultimarc in future, 3 times the cost, but it can perform certain function i will find useful.
But the button inputs can be handled by any usb input board you choose to use, I'd recommend the button box interface by Leo Bodnar, but you could even use hacked gamepads/keyboards, That's the easy part, getting the info out of Omsi and sent to the dash to light and move instruments is the hard bit.
|I also had to modify the
bus scripts in Omsi, to handle latching switches, luckily Omsi lets you
do this pretty easily, but you need to modify the scripts for every
single bus you will drive.
When i get the U-HID input board, i can program it to send pulses on switch down and switch up, so i may not need the modified scripts anymore.
Anyway, if you have built a dashboard or have a real one at home, and have an Arduino, i will assume you have already wired some lights and things from it to the Arduino and had it turn them on and off, so you just need to get Omsi to tell the Arduino when to turn them on and off, and to move the gauges.
Firstly you need a couple of bits of code for Omsi, The most important bit is the .DLL file, this is what gets the data out of Omsi and sends it on to the Arduino in a format it can understand.
To the right you can see 3 links, the first one is for the .DLL file, download this and save it in your Plugins folder in Omsi.
Then click the .OPL contents link, copy the text it shows, then open notepad, paste the text, and save it in your Omsi plugins folder as gazz.opl
Your plugins folder should look like this:
Finally click the 'view Arduino script' link on the right, copy the contents, and paste it into your Arduino script editor,
Have a good look through it and work out how it works, as unless you have the exact same Arduino mega as i have, and have wired the led's to the same pins as me, filament bulbs through transistors controlled by the same pins as i do, and are driving the exact same gauges as i am using, again via the pins i have chosen, not much will work properly,
So take a little time and re-write the script to suit your Arduino and dashboard connections.
A little note, i found i can only run one gauge on a tone output at a time (which is just a fixed frequency signal, that varies the pulse count... just like a car's RPM or speed gauge works), this means you can run either a rev counter or speedo, not both,
So ywhen i upload the sketch to my arduino, i delete the rev counter code, D92's don't have rev counters anyway.
It's something to do with the way the Arduino works, the tone function ties up a timer or something, so no matter how many other pins you assign the tone function to, it will only run the first one,
The other gauges run on the PWM functions, and are fine for multiple instances of that function running at once,
I have changed the frequency the timer runs at for the gauge outputs to 31Khz, as at lower frequencies the coils in the gauges vibrate in the human audible spectrum, i.e. we can hear them 'singing'
At 31Khz only people with pet bats should have a problem.
Again this is based on an Arduino mega, which has 4 timers, so you can change the running frequency of certain ones without messing up the rest of the scripts timing.
Download the .DLL file
View the .OPL contents
View the Arduino Script
To use the plugin, start Omsi the normal way, you will notice there is a new window on the screen sitting on top of the main Omsi window:
Don't try to do anything different just yet, on my system it will not let you click buttons in the plugin window, so minimise it if you want, and start up Omsi as normal, i.e. select a map and a bus to drive.
Once Omsi has started fully, the plugin window will be hidden behind the main Omsi window, so press the windows key, and select the 'gazz's D92 dashboard 1.0' window from the taskbar, it's behind omsi's taskbar icon.
If you are just playing to see what it does and don't have the Arduino connected to the dashboard yet, keep the plugin window on top of the Omsi window, and get in your bus, you should see the values changing for things like engine RPM's, oil pressure, indicator etc.
If you have your Arduino all set up and connected, press the 'change settings' button, and change the com port your Arduino is connected to, click OK once you've done that, leave the other settings alone, you only need to do this once, unless you change the USB port your Arduino is plugged into later.
Now press 'Connect' and it should connect to the Arduino,
The blue bar at the bottom of the plugin window shows what is being sent to the Arduino, and hopefully your dashboards lights and gauges should be doing similar.
Unfortunately i don not have access to the source code for the plugin.DLL, so what you see is what you get I'm afraid,
i wanted to add the air pressure gauge outputs, as well as the rest of the dashboard's idiot lights, plus the lights in the switches for things like the parking heater, deck lights, instrument light dimming and so on, i even hoped to be able to use a few linear potentiometers to control the heating sliders in the bus.
The person who wrote the plugin for me is at a very important stage of his studies, so can not help me for the foreseeable future.
So unless someone is able to de-compile the .DLL, and re-write it adding extra functions, I'll just have to wait until a time when the author can help me out again.
Please let me know if you do manage to de-compile the plugin, or even know what you are doing to be able to write a new one, and i will try to help any way i can, i have the original conversations i had with the original writer of the plugin i have shared here, showing how we figured most things out to make it work.