Outputting sim data...
 
Notifications
Clear all

Outputting sim data to Arduino to use with stepper motor gauges

5 Posts
2 Users
0 Reactions
5,089 Views
(@lesthegringo)
Active Member
Joined: 4 years ago
Posts: 10
Topic starter  

Hi all, I am new to SimHub, so firstly let me give a quick intro. I'm a flight and race sim fan, and I have built my own race cockpits and flight sim cockpits, mostly with bits I made myself but with some off the shelf bits. My flight sim cockpit is made to look like an A10-C and works with DCS World, and they have a similar program called DCS BIOS which allows them to output data so that you can connect real world instruments. As a result, using X27-168 stepper motors, I have all the in game gauges functioning plus OLED displays, button and rotary encoder inputs etc. Very cool, and I'm very pleased to have been able to make so much.

I run Assetto Corsa and Automobilista, and want to do the same with them, in as much some simple dashboards copying the older F1 cars like the Ferrari 312T4. What I want to do is output the game RPM, water temperature, oil pressure etc. in a data form that I can then use with an Arduino sketch, a stepper motor driver like the A4988 and use X27-168 stepper motors or similar to drive the actual gauges as I did with the flight sim. I usually use laser cut and engraved acrylic to make the instruments and housings, so can replicate the look of the real binnacles used on each car. This means that the normal route, that of using real instruments purchased on the web, can't be used without having to seriously hack those devices. 

Of course, if there is no way to do what I want then I will have to cannibalise purchased instruments, but having had so much success with the flight sim instruments I want to see if that can work first.

For reference it appears that what the DCS bios program does is to output a particular signal as a numerical value between a preset range, for example the engine core RPM is presented as being between 0 and 65535, representing 0 to 100% of the reading.

For items like altitude digital readouts it will either use the method above, or it can out put a series of text strings (eg 0, 0.5, 1, 1,5 etc) that can be used with an arduino and OLED display 

So, is what I want possible?

Thanks

 

Les


   
Quote
(@admin5435)
Prominent Member Admin
Joined: 7 years ago
Posts: 732
 

Hi !

That's exacly the purpose of the "Custom serial devices support" : https://github.com/SHWotever/SimHub/wiki/Custom-serial-devices#configuration

It allows you to build "adhoc" protocol and communicate with "non simhub" sketches.

Nicolas


   
ReplyQuote
(@lesthegringo)
Active Member
Joined: 4 years ago
Posts: 10
Topic starter  

Thanks for the reply Nicolas!

As I mentioned I am new to this so please accept my apologies in advance for any dopey or basic questions. As I understand it, the current output method of SimHub for use with a tacho is to send pulses to emulate the ignition coil pulses seen on 'real' engines, and most aftermarket tachos work on this principle. Does the custom serial support mean that I can either convert this to an output of numerical values, or add a modifier to change the frequency of the output so that I can tune the output to correlate the gauge movement to a custom scale?

Also what is the output for things like ammeters, oil pressure, water temp, and they straight linear voltage outputs or PWM outputs? 

Cheers

 Les


   
ReplyQuote
(@admin5435)
Prominent Member Admin
Joined: 7 years ago
Posts: 732
 

No worries 😉 

The custom serial device does not assume anything on the actual hardware part, it only works as a "communication medium" : it simply sends text data over the serial port, so you can drive anything able to receive and parse data over serial.
In the case of an Arduino, you have to build (or reuse) a sketch able to parse that data and do whatever you want, there a lot of samples available around about receiving text data over serial,
For instance it's how simtools works, Arduino sketch is not provided, the software responsibility is only to send the data over serial, in the case of  "Custom serial devices support" it's basically the same, you build your text messages (in order to send game data) in simhub, simhub takes care of sending it over serial, and you have to make your own sketch in order to receive and process that data.


   
ReplyQuote
(@lesthegringo)
Active Member
Joined: 4 years ago
Posts: 10
Topic starter  

Thanks again

I'm starting to wonder if I am overthinking this a little, as for the limited amount of gauges in a car as compared to an aircraft, maybe just cannibalising a readily available tacho and pressure gauge would be a more efficient way to go. Clearly people have already done so successfully, and so re-inventing the wheel doesn't seem to be an efficient way forward.

I'm going to get one of those cheap tachos you can buy online and pull it apart and play around with it, and do a search for people's posts having used them. Hopefully I can use that

Thanks again for the assistance

For info, this is the Flight sim rig with the Arduino controlled gauges, you can see that there are way more than on a car!

 

Les


   
ReplyQuote
Share: