Go Down

Topic: Need Help With Arduino :-| (Read 3420 times) previous topic - next topic

Steve Virgo

Jan 26, 2013, 09:12 pm Last Edit: Jan 26, 2013, 09:35 pm by Steve - The OMSI Fan Reason: 1
Hi everyone.

I have started a project which is to make a dashboard for a game called OMSI DerOmniBusSimulator.
here is a picture of the amazing gazz's omsi dash.


My dashboard is not to that standard.
No. #1 Because I do not know the programming to get the data from the game to the led's on my arduino uno.
Currently I have all the led's hooked up correctly and working, - I have tested all of them.
I really need help extracting the data from the game and getting it to my arduino uno.
No. #2  - I have some switches and I would like them to control functions in the game such as door open/close etc. Is there any way I can get the signal from the switch to my arduino uno and then to the pc/game WITHOUT and custom firmware of any kind.

Thankyou for your time and effort to answer these questions.

Steve
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

gazz

I put the codes needed on my site, linked from my youtube page...

www.kampenwagen.co.uk

Hopefully that should get your led's turning on and off with the game's dashboard light (remember i use a mega, so have many more outputs than a uno)

I havent tried using my arduino for inputs, i used a leo bodnar usb input board for that, i'd recomend the
http://www.leobodnar.com/shop/index.php?main_page=index&cPath=86
It's a usb button box input board, just connect any buttons to it, assign them in the gam, and roberts your wifes sisters hubby,

I have recently blown my bodnar input board, mis-wired a voith gear selector, and shoved 24 volts for the lights up an input pin, so i now have a U-HID from ultimarc, twice the price of the leo bodnar board (or 3 times if you go for the solder the pins on your self version) but it is more than an input board (can do a few outputs, but mainly it can easily be set up for pulse on switch down, pulse on switch up, so no need to faff about modifying every bus's script to handle latching switches in omsi.


Hope some of this helps,
Gazz

Steve Virgo

Thanks for the link gazz.
You are the person I wanted to talk to!

The problem I am having while using your scripts is that yours are set up for the mega not the uno
and my board is not working as It needs to be set up using 8, 9 ,10, 11, 12, 13  and your program is 22,23,24,25.

But... I have  edited the arduino code and deleted the gauges section  - verified and all ok, Then I changed the numbers for all of the outputs to the ones I have.

Do you think this will work?

Steve
Please stay in contact
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

Steve Virgo

#3
Jan 27, 2013, 07:40 am Last Edit: Jan 27, 2013, 01:11 pm by Steve - The OMSI Fan Reason: 1
REPLYING TO MY OWN TOPIC:

Yay, I have re-coded it to work on my setup, Thanks very much gazz, You owe me everything.
I dont actually know this works but I sort of do as the abs goes to line 13 and the led comes on and off with the abs, so... everything must be setup right!
And for the buttons I took apart a logitech attack 3 joystick which I have had in the back of the cupboard for years!
I will email you some pictures if you pm me your email.
I owe you everything gazz.

Here is what I have done so far, The reds going up in the air with the labels are all of the 'lives' which will go to dash lights. The block at the bottom in the middle is connections to 4 grounds, 5v, and 3.3v.
I have connected 3 of the digial pwn lines to a block which is not visable.
The single block up in the top left is the ground next to pin 13.
I am going to connect 6 L.e.d's Do you think I will need a power supply for that. If so is a 12v 200ma ok if I need it.


Many thanks
Regards,
Steve
Please stay in contact - You are my omsi dash hereo!
email: virgopaperbus@lycos.com
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

gazz

Cool,

On mine i have just ran all the led's directly off the arduino, i.e. each led, i connect the anode through a suitable resistor to run it at 15Ma on 5 volts, and then to the arduino's output pin i want to control that led,

All the cathodes from the led's are tied together and go back to one of the GND pins on the arduino (the one next to pin 13 on the uno is connected to the ones by the 3.3 and 5v pins on the other side of the board btw)

Now, i may be stressing my arduino by doing this, i believe the max current that should be drawn from any 1 pin is 20Ma.... and i have just realised i am running about 10 white led's off one pin for the instrument backlights.. oops,

I am not sure if the current limit applies when the arduino pins are sinking the current... someone else can answer that as i am just not sure,

But for now, i'd not bother with an external power supply on your set up, as it's only 6 leds, and the arduino is more than capable of running that load,

i only need 12 volts in my set up as i have automotive gauges that run on 12 volts, i also have 24 volts for a few illuminated buttons that just do not look right with led's in them, but as i mentioned, when mixing voltages, you really need to keep them seperate and away from the arduino,

Steve Virgo

Thanks for the help gaz, Subscribe to my youtube http://youtube.com/virgocomputing    as I am going to be uploading some videos of my progress soon.

Sorry if you have already explained this but what voltage do pins 8 to 13 give out;
As I want to run some other lights apart from led's as well, e.g 4 led's and 2 light bulbs (e.g 2, 5 volt ones?)
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

Steve Virgo

video: http://www.youtube.com/watch?v=v9CsxXvZPV8
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

GoForSmoke


Now, i may be stressing my arduino by doing this, i believe the max current that should be drawn from any 1 pin is 20Ma.... and i have just realised i am running about 10 white led's off one pin for the instrument backlights.. oops,


Max on a pin is 40 mA but 20 mA is recommended as most.
Max total you should pull from an UNO is 200 mA.

Feed a transistor to power the backlights. Each should have its own resistor. For higher power there are Darlington's (ULN 2803 has 8 in one chip I believe, can run 500 mA 30V) and FET's (FET's are -very- static sensitive).

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Steve Virgo

Just as an update...

just to tell everyone. I have fitted all the led's to the dash, and all the switches that run to the game controller. My next think'a'bout is the speedometer!  :smiley-eek: I have got one ready to be picked up. Just..... I dont know how to wire it up???????? Please can someone help. Preferably gazz as he knows this kind of thing!.

Steve
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

JimboZA

Quote
Sorry if you have already explained this but what voltage do pins 8 to 13 give out


They're 0v or 5v....

The ones with the ~ are PWM pins so they give a pseudo-voltage between 0 and 5v, but they're really switching on-off-on very quickly between 0 and 5v. The "voltage" delivered is scaled between 0 and 5 with a value set for the pin between 0 (0% on = 0v) and 255 (100% on = 5v).
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Steve Virgo

Thankyou for your help with the voltage:)  i just have to wire the speedo/tacho head now.... :smiley-eek-blue:
------------
Youtube: http://youtube.com/virgocomputing
Current Projects: Using an Arduino UNO To Control a Model Railway's Points and Signa

Adam164

Hi mates!

I'm trying to build this project, which is magnificent! :)
I would like to ask you if it is possible, instead of an analogue gauge, to have a series of led showing the RPM...

Thank you in advance!

JimboZA

Is this the kind of thing you mean?

"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Adam164

Not exactly... but it touches the general idea. It needs a lot of customisation in order to can be adapted on the OMSI dashboard script.. I'll have a try although...

Adam164

Some years ago I made a hallmeter for my car. This is the sketch.

Can I use it as "LED - gauge"?

Go Up