View Full Version : Building up a Tachometer with the Arduino µController
FW-05
8th July 2010, 08:20
Hi there!
I´m working for some time on a way to make the Arduino Duemilanove µC handle a real tachometer. But i am still in the beginning, so only the µC is bought, tachometer comes up in some days or so, depending on my income.
But let´s start in the beginning. Some weeks ago I was browsing uTube and some vids catched my eye. People had a real tachometer connected to LfS or rFactor. Looked great so I checked out some electronics forums and a user from a german LfS-Board recommended the Arduino µC (see the datasheet http://www.atmel.com/dyn/resources/prod_documents/doc8161.pdf). I was impressed because it can handle six PWM channels.
Now my lack of programming skills comes up. I have no clue how to get out the values of speed, RPM, Temp, pressure, fuel out of LfS in a form so I can feed the µC with it. I know, that thats the part of OutGauge.
Has anybody an idea how it could make it work? Maybe there is another way, without using OutGauge but X-Sim, but I want to try it first with the build-in LfS feature.
I think the worst problem is to adress the data from LfS over USB-port to the Arduino. The output of the values should be realized by (depending on the kind of tachometer I could get) using the internal motors (which are infact ammeters I guess) or some RC-servos I have here laying around.
Well guys, thats what I am working now on. Progress will be updated.
PS: sorry for language, if there are any missunderstandings, please ask...
boycey10802002
11th July 2010, 13:45
Hello FW-05,
I'm working on an outgauge project myself that uses an Arduino and data from outgauge. I'm creating a program in python that parses the UDP packet information into readable data and then sends it over the USB connection to the arduino, that then sends it to an instrument cluster and/or an LCD display panel mounted in a steering wheel. The hard thing about you learning outgauge right now is that all of the documentation seems to have disappeared from the internet.
Instruments:
As for getting the tachometer to work it really depend on how it is constructed. If it is a true air-core instrument you'll need 4 PWM terminals to run it. otherwise the servor may be a better solution, it all depends on your hardware though. I have an arduino sketch that runs an air-core gauge if you'd like to have a look at my code let me know.
USB
Python doesn't have native support of using the USB interface, but there is a small extension called pyUSB that allows USB port connections and data transmission. There are certain methods for encoding the data to make sure that data isn't lost, but for my first tests I'll just use some sort of character delimitation to split up the values for the arduino.
I hope this helps. post if you have any other questions.
FW-05
12th July 2010, 09:27
Hello boycey,
I´m quite happy, that someone else wants to connect an Arduino to LfS.
Your post makes me feel sick, because I can´t deal with any programming language. But it is not a reason for me to quit my project. I´m studying with a lot of nerds in programming so maybe they could help me.
How far is your sourcecode? Is something working right now. Maybe you could pass your code, because I wanted to work through some tutorials and maybe in a while, I could help you out.
Concerning the instrument you said, that a true air-core instrument could be driven by the PWM channels. How could I check out whether its a air-core or just a ammeter. Is it depending on model and year?
I guess the option with the servos should be more easier, becaue the servo library is already written and there is no additional hardware (h-bridges, transistors, potentiometers; and of course soldering) needed, just the servos.
I´ll let you know if I got any progress.
Kind regards, Tomasz
PS: nice to see, that my thread moved you to write your first post! =)
Degats
12th July 2010, 15:55
The hard thing about you learning outgauge right now is that all of the documentation seems to have disappeared from the internet.
All the OutGauge documentation you'll need is at the bottom of /your_lfs_directory/docs/insim.txt
FW-05
13th July 2010, 08:12
All the OutGauge documentation you'll need is at the bottom of /your_lfs_directory/docs/insim.txt
Yeah right! This is what is written in the InSim.txt:
(just to have quick access to the content)
// OutGauge - EXTERNAL DASHBOARD SUPPORT
// ========
// The user's car in multiplayer or the viewed car in single player or
// single player replay can output information to a dashboard system
// while viewed from an internal view.
// This can be controlled by 5 lines in the cfg.txt file :
// OutGauge Mode 0 :0-off 1-driving 2-driving+replay
// OutGauge Delay 1 :minimum delay between packets (100ths of a sec)
// OutGauge IP 0.0.0.0 :IP address to send the UDP packet
// OutGauge Port 0 :IP port
// OutGauge ID 0 :if not zero, adds an identifier to the packet
// Each update sends the following UDP packet :
struct OutGaugePack
{
unsigned Time; // time in milliseconds (to check order)
char Car[4]; // Car name
word Flags; // Info (see OG_x below)
byte Gear; // Reverse:0, Neutral:1, First:2...
byte SpareB;
float Speed; // M/S
float RPM; // RPM
float Turbo; // BAR
float EngTemp; // C
float Fuel; // 0 to 1
float OilPressure; // BAR
float OilTemp; // C
unsigned DashLights; // Dash lights available (see DL_x below)
unsigned ShowLights; // Dash lights currently switched on
float Throttle; // 0 to 1
float Brake; // 0 to 1
float Clutch; // 0 to 1
char Display1[16]; // Usually Fuel
char Display2[16]; // Usually Settings
int ID; // optional - only if OutGauge ID is specified
};
// OG_x - bits for OutGaugePack Flags
#define OG_TURBO 8192 // show turbo gauge
#define OG_KM 16384 // if not set - user prefers MILES
#define OG_BAR 32768 // if not set - user prefers PSI
// DL_x - bits for OutGaugePack DashLights and ShowLights
enum
{
DL_SHIFT, // bit 0 - shift light
DL_FULLBEAM, // bit 1 - full beam
DL_HANDBRAKE, // bit 2 - handbrake
DL_PITSPEED, // bit 3 - pit speed limiter
DL_TC, // bit 4 - TC active or switched off
DL_SIGNAL_L, // bit 5 - left turn signal
DL_SIGNAL_R, // bit 6 - right turn signal
DL_SIGNAL_ANY, // bit 7 - shared turn signal
DL_OILWARN, // bit 8 - oil pressure warning
DL_BATTERY, // bit 9 - battery warning
DL_ABS, // bit 10 - ABS active or switched off
DL_SPARE, // bit 11
DL_NUM
};
//////
boycey10802002
14th July 2010, 03:58
I know about the insim.txt file, but there used to be a ton of info on the LFS wiki and a trove in the forums.
An air-core 'motor' uses positive voltage to align the needle toward the positive pin. so an 8-bit PWM value of 255 at the north pole of the dial will give you up, and the same at the west pole of the air-core will give you west. but a value of 128 at the west and north pole will give you North-west.
I know I'm not doing a very good job of explaining it and I'd love to stay on and figure out a better way to explain it but I've got a very busy day tomorrow so here's a forum that has some explanations and links on it; http://www.x-simulator.de/forum/speedometer-tachometer-etc-with-air-core-t1074.html and I promise to show you an arduino sketch later this week. as well as answer any questions you may have.
~Dustin
FW-05
15th July 2010, 11:17
Hi Dustin,
the InSim.txt file explains everything that has to do with LfS concerning OutGauge. All other documentations should be made, imho, by the developers of the OutGauge tools. Regarding my abilities in programming, I would favour a transscripted source code, so I can reconstruct the steps a programm makes...
The link you posted is very usefull, if it comes so far that I have to drive some air-cores.
Do you have any progress? I have to write some exams, after that I can spend more time for the project.
Kind regards,
Tomasz
FW-05
21st July 2010, 23:17
Hi there,
just made a small step ahead. Bought a dashboard from a ´97 Mitsubishi Galant.
Makes 8000RPM and 160mph. In a few days I will start some hardware testing, if possible.
Maybe someone of you has a clue how to connect to the dash. At the moment I havent coped with that...
If anything else happens, I´ll write soon as possible!
Kid regards, Tomasz
FW-05
28th July 2010, 07:39
Hey guys,
progress is made. I have now a Code to feed the Arduino with data from LfS and parse it through to the cluster.
When my cluster will be delivered, I will make a vid and post the link.
At this point I can just say, that it is possible to drive parts of the cluster directly, other air-cores need a h-bridge. Depends all on thecluster ant the internal hardware used.
Regards,
Tomasz
SJB
10th September 2010, 18:01
Could u publish the python scripts which reads the outgauge data from LFS and feeds the Arduino?
I have a Diecimila and i will use a BMW E30 Tachometer :nod:
MfG SJB
boycey10802002
14th September 2010, 12:32
At the moment it's kind of broken. I've been trying to modify some parameters to send the data to a GUI as well and I haven't got it returning the proper data objects. If you're half-decent with python you can fix it no problem, I've just been coding 10 hours a day at work and haven't had the energy to finish fixing it. I will hopefully get around to having it fully functional in a couple weeks.
To run the files you put them all in one folder and run the Outgauge_GUI.py file in an python interpreter. I recommend KomodoEdit (which is free) from Active state and create a command that will run it in python.
if (komodo.view) { komodo.view.setFocus() };
komodo.doCommand('cmd_save')
ko.run.runEncodedCommand(window, '%(python) \"%F\" {\'cwd\': u\'%D\'}');
That is the command I use, it's java so you'll have to select that in the command options. I think there was one more thing I wanted to tell you, but I forget it at the moment. If I think of it, I'll post later. Send me another message if you have any questions.
boycey10802002
19th September 2010, 01:17
I have been updating the code (I know the stuff I gave you didn't work as it was still work-in-progress being re-purposed, but now I have working (again) code that can take data and out-put it to the python Command Output. I'm going to change some code that I've made perviously and set it up to output a data string through USB to the Arduino. That code will be happening a little later, but for now if you want some badly commented, but functioning code message me on this thread! :nod:
SJB
22nd September 2010, 23:58
Hi!
Yeah it would be really cool when u upload the working code :nod:
Regards,
SJB
Jadran
23rd September 2010, 09:16
Hi!
Yeah it would be really cool when u upload the working code :nod:
Regards,
SJB
:thumb:
boycey10802002
26th September 2010, 04:25
Hey Sorry.
Busy couple of days & nights at work.
I got the GUI to put values on separate lines, but there are still some bugs to work out.
Don't exit or pause LFS before closing the GUI program, otherwise it'll freeze.
The reason for this is because the GUI won't refresh until it gets new data. The fix is to restart or unpause LFS, then my program starts getting data again and you can exit it properly.
There are some other data values like 'pit_limiter' that show weird, incorrect values, but that's because Scawen modified the Outgauge UDP packets after Nilo wrote the UDP Packet parser for LFS in 2008.
But I'll get around to fixing those. Once that's up it should be easy to get the program to send the data over USB (I've got some code I've already written for something else laying around)
Cheers
boycey10802002
4th October 2010, 23:22
Hey there. I need an answer from you guys
I'm facing a design branch; creating the design for the instrument cluster is going to take some interface circuitry. Would you guys want some mildly complex microchips, or a lot of bulky transistors in the design if you're going to make it yourself? Or, if I make something that's more compact would you buy it? I don't know where to go with this so I'm looking for your input.
Cheers,
d
SJB
6th October 2010, 20:27
At the moment i'm playing with a TLC5940 (4Pins from Arduino -> 16 PWM outputs) and transistors (as amplifiers) for dimming 4 RGB-LED strips.
I'm planning to use the same layout for the tachometer (and have some cool light effects e.g. white background light for RPM and when i'm at the red RPM range, fading to red background light) :D
But for the intruments only, i think transistors would be enough :)
Regards,
SJB
boycey10802002
8th October 2010, 03:40
Hey guys.
Got LFS working tonight with an Arduino and the RPM values on a Servo.
Working on making it flexible with other data streams (Speed, Turbo, etc.) and to get it working with Aircore Instruments.
Woot!:)
Martin Deutschland
8th October 2010, 23:09
Hey guys.
Got LFS working tonight with an Arduino and the RPM values on a Servo.
Working on making it flexible with other data streams (Speed, Turbo, etc.) and to get it working with Aircore Instruments.
Woot!:)
:thumb:
I want to see it :shrug:
today I ordered a arduino uno - insim, i coming!
boycey10802002
20th October 2010, 02:32
Hey sorry for not posting for a bit. I've got two huge deadlines coming up at the end of October for both my Full-time job and freelance work. I will continue to develop the USB-parsing protocol for the Arduino at the start of November.
boycey10802002
15th November 2010, 02:33
just a quick update. My extreme work schedule ended with an extreme cold/flu and I've been down for a little while and lacking energy. But now I feel I'm back at full strength and can finish this stuff of for you guys and create a wiring diagram so you can hook up some air-core gauges as well.
Right now the only thing holding me back is a small bug in the Arduino that is causing it not to compile so I'm working on a fix.
I hope to update soon with awesome working code.
Cheers
boycey10802002
8th December 2010, 00:55
Hey!
Update!
I've got the more robust USB protocol working with gauges. I'm ordering a shift register and a TLC5940 because SJB mentioned it. Right now I'm working on expanding the python script to properly handle the not-so-new updates to the dash light system and then it will be awesome!
CursedPustule
8th December 2010, 01:03
I'm very interested to see how this progresses.
I've just picked up a mega 2560 and a 128x64 graphical LCD panel that I'm hoping to use along side (or instead of) my Bodnar SLI-M. I have a few ideas on how I would implement this thing, but I'd be keen to see how you've done it.
boycey10802002
18th December 2010, 04:18
That sounds awesome.
I've created the USB protocol to be as versatile as possible when it comes to LFS-formatted packets, so you could potentially pull OUTSIM or INSIM data as long as you had a function to handle and display the data on your graphic LCDs.
I've also got the indicator lights working now, I'm waiting for some shift-registers and that TLC594 to create the handling functions for that for you guys.
Cheers
boycey10802002
3rd January 2011, 04:14
Happy New Years!
The shift registers are working. They arrived just as I was leaving for the holidays and while I've had some time off work I've gotten them working.
When I finished the with the air core ICs I'll post a wiring schematic and the code for you guys.
PWILLARD
5th January 2011, 23:36
Don't know if this will help... but this is what I've done using the Arduino.
This link below is to my Gear Indicator project using the Arduino but heavily based on Vladimir (AKA KADA) and Nick A.'s original LPT Gear Indicator Code.
Updated to be compatible with S2 Z28 and concerns about LAG all proved wrong. Very Responsive... very cool and even expandable.
So...
Out with the LPT Port and In with the Serial Port ( including any USB-SERIAL converter... as found on Arduino boards)
Project Status is here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293046321
CursedPustule
12th January 2011, 00:17
Well, I'm pausing on doing the pretty pictures on the LCD for now. I'd like to start and look at pumping real data into this thing.
Here's what it looks like so far:
http://www.youtube.com/watch?v=wD3WWjNY-hQ
The input data for it is just a loop counter at the moment :D
boycey10802002
14th January 2011, 01:12
Thanks Willard, that's something along the line of what I've done with python.
Cursed, that's some wicked LCD display stuff.
If you're eager to pump some data into the Arduino I've got some serial parsing code right here:
=:REMOVED OLD CODE:=
This code takes a serial string formatted like this: ˙rpm:1000<null>
and parses it into values and that a different handler can take. I'm sorry if it's not really commented all that well, it's still in heavy development. The <null> is supposed to be a null. (0x00, chr(0), bin(00000000)) In debug mode the parser also takes a tilde(~) since I haven't figured out how to communicate a null over the serial monitor. When it's done you have two values, OutGaugeLable and OutGaugeValue. Lable is anything before the colon(:) In this example 'rpm' and Value is anything after, in this case, '1000' there's some extra code in a different section that takes the text version of '1000' and turns it into either a float, a double or int; depending on which version of the function is called.
Also, I've got the aircores working and I am trying to implement the polarity pins into another shift register to save pin space on the arduino board.
Cheers, guys.
boycey10802002
14th January 2011, 01:20
this is what I've got in another tab of the same sketch to take the value and apply the proper handling functions to it depending on what it is.
For example, rpm gets passed to a function that takes the string '1000' and turns it into an int; 1000.
This then gets passed to a remapping function to be mapped to an angle, let's say 45 degrees.
That value is then sent to a function that writes it out to arduino pins in a sin+/- & cos+/- way.
Another example is the Dash lights.
They are assigned to an output of a shift register and when a serial command like ˙shiftlight:1<null> get sent, it turns the 6th output of the shift register to 'HIGH' and the light hooked up to that output turns on.
if you're not clear about something please ask me to clarify.
Here's the code:
=:REMOVED OLD CODE:=
boycey10802002
14th January 2011, 01:23
And finally the nut-and-bolt functions.
These are the ones that take the values ant mutate them into something usefull for the Arduino board to output to the hardware
Code:
=:REMOVED OLD CODE:=
I realize a some stuff is commented out, and my notes may be out of date at some parts, but It's still a work in progress and I'm trying to get 4 air core dials working simultaneously tonight. ;)
CursedPustule
14th January 2011, 01:32
Thanks for that lot. It's going to take me a while to wade through it all.
My plan was to have a python app on the PC receive the outgauge data from LFS and then have the arduino poll it, asking for the latest whenever it can.
I'll see what I can use from your samples.
Cheers! :)
killer415
17th January 2011, 19:19
Hey Sorry.
Busy couple of days & nights at work.
I got the GUI to put values on separate lines, but there are still some bugs to work out.
Don't exit or pause LFS before closing the GUI program, otherwise it'll freeze.
The reason for this is because the GUI won't refresh until it gets new data. The fix is to restart or unpause LFS, then my program starts getting data again and you can exit it properly.
There are some other data values like 'pit_limiter' that show weird, incorrect values, but that's because Scawen modified the Outgauge UDP packets after Nilo wrote the UDP Packet parser for LFS in 2008.
But I'll get around to fixing those. Once that's up it should be easy to get the program to send the data over USB (I've got some code I already wrote for something else laying around)
Cheers,
boycey
thx for your great job, but, i cant find how to set the serial configuration
my arduino is on COM11 and i dont know how to comunicate my arduino with your python program
my arduino simply reads nothing on serial
=/
boycey10802002
18th January 2011, 12:11
Hey Killer,
I'm sorry I totally forgot to include the python side of things.
It'll be attached to this message, along with the proper Arduino Sketch.
As for configuring COM ports; I'm trying to get it to automatically detect which COM ports are available and then have the user select from a list and let it connect that way, but right now it's hard-coded into a couple of lines in the OutgaugeGUI.py file
There are two lines that need to be changed:
Line 13 has (port = "COM4") at the end, change it to whatever port your arduino is set to.
Also, line 81; same deal. Change "COM4" to whatever port your Arduino is.
You also need pySerial to be able to run the serial connections required for the Arduino.
Just message me if you guys have any questions, or run into problems.
For January I'm on a tight deadline for a C++ project at work so I won't be free to update much code here, but if you need something fixed or clarified I'll try to get back to you ASAP.
killer415
18th January 2011, 12:53
thx, but the sources .py have to be compiled on my pc. I have an importerror of "bad magic number" U_U
could u attach them, plz?
thx in advance.
boycey10802002
19th January 2011, 01:36
Haha. Sorry, my bad.
New files attached.
As a note to people trying to use my Python script, I'm using python v2.6
killer415
19th January 2011, 14:10
thx , all works perfectly now, the serial comunication have a little lag but i think it can be resolved..
thxxx a lot.
boycey10802002
19th January 2011, 22:00
There shouldn't be any lag with the serial device.
I added in some code that reduces the number of updating serial calls to the bare minimum so all that is there would be is the lag imposed by your lfs.cfg file.
killer415
21st January 2011, 11:52
i forgot turn off debug var.... xDDD that was the problem of my lag... =)
Schnitzer327
24th March 2011, 01:32
Hello guys , i want to ask if that arduino work with those rpms and boost dash that i will attach pictures in the end , and if yes what exactly i need to do to let them work , plz iam asking for ur help if it possible
regards
boycey10802002
24th March 2011, 03:08
I did some detective work for the Tach and it seems it really depends on how you want it set up to work with the PWM outputs, I don't have that style controller pre-programmed, but I could add/modify some code to make it work.
As for the Turbo, it looks like a standard, 4-wire air-core. Those have been worked into the Arduino sketch and all you need to make that work is a SN74HC595N or similar shift-register and a L293DNE, or similar motor driver. I had been planning to take a bunch of pictures and make some wiring diagrams but I've been completely side-tracked with work. I'll see if I can find some free time and try to write up some documentation about how different pieces of the sketch relate to actual hardware on a board.
To recap you need:
Those gauges you want
1 x Arduino
1 x SN74HC595N
1 x L293DNE
Some extra wire, header pins a breadboard and patience.
Google is a good resource to check how to wire up the shift registers, you can also drive a 7-segment display with a shift-register, too; along with all the other dash lights and miscellaneous warnings that happen in LFS.
I'll do my best to help you out and answer any more questions you, or anyone else, may have.
And I'll work on getting some pics up tomorrow.
Cheers.
Schnitzer327
24th March 2011, 19:36
Hello , 1st of all thx a lot for ur help and ur reply but i want to ask u what is the (SN74HC595N) and the (L293DNE) and what do u mean with the breadboard iam so sorry for those questions but realy i cant understand , and what if i want to make it on a bmw e36 dash board
regards
boycey10802002
25th March 2011, 02:01
Google is a handy brain-extender.
Arduino Board (http://arduino.cc/en/Main/Hardware)
SN74HC595N -> link (http://parts.digikey.com/1/parts/513339-ic-8-bit-shift-register-16-dip-sn74hc595n.html)
L293DNE -> link (http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=296-9518-5-ND)
breadboard -> link (http://en.wikipedia.org/wiki/File:Breadboard.JPG)
The two jumbles of numbers and letters are special types of integrated circuits (micro chips) the first turns its output on or off in a special order (a shift register) the second is a motor controller, used for air-core motors, like the ones commonly used in older car dashboards. As for your e36 dash, you'd have to check how it's set up.
The way my dash works I pulled the air-core motors out of an old car and just mounted them to some foam core in an arrangement that I kinda like and all I've used are those
I'm sure you'll have more questions.
Cheers.
Cant run it, every time I press START after enabling USB:
PREV_DATA[item]:
time:505190
data[item])
time:505290
Old data is NOT equal to new data
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "C:\Users\SJB\Desktop\LFS_OutgaugeApp_2011_01_V0.04 \Outgauge_GUI.py", lin
e 113, in startDataPull
USB_Writer.writeAdvancedUSBMessage(OUTGAUGE_CONNEC TION, str(data[item]))
File "C:\Users\SJB\Desktop\LFS_OutgaugeApp_2011_01_V0.04 \USB_Writer.py", line
83, in writeAdvancedUSBMessage
SERIAL_CONNECTION.write(chr(255)) # Init bit
File "C:\Python26\lib\site-packages\serial\serialwin32.py", line 255, in write
raise SerialException("WriteFile failed (%s)" % ctypes.WinError())
SerialException: WriteFile failed ([Error 6] Das Handle ist ung³ltig.)
Another question:const int SRCLK_PIN = 7;
const int RCLK_PIN = 4;
const int SER_PIN = 2;
SER = Serial data input = PIN13 at 595
But SRCLK and RCLK? Which is the "Shift register clock pin" (PIN 11 at 595) and which the "Storage register clock pin (latch)" (PIN 12 at 595)?
Edit: RCLK = "Storage register clock pin (latch)" (PIN 12 at 595) - looked at the code of a ShiftOut Example and your UtilityFunctions ;)
But Arduino is still receiving nothing :(
Regards, SJB
boycey10802002
1st June 2011, 12:55
It looks as though it's not able to connect to the correct serial device.
Have you modified lines 14 and 82 of Outgauge_GUI.py to correspond to the name or index of the COM device your Arduino shows up as? i.e. switching "COM4" to be named "COM3" or, alternatively the index 2.
And do you have pySerial installed as well?
As a side note; now that I've had more experience with C++, I'm looking at possibly changing this outugauge program over to a single .exe file so that it runs faster and is easier to install. :)
boycey10802002
5th June 2011, 02:26
Did that help you at all?
No ;)
PySerial is already installed (was a bit tricky on win7 x64: http://www.python-forum.org/pythonforum/viewtopic.php?f=15&t=21763 ) and Arduino is connected to COM4 (Arduino Code upload on COM4 works)-
Edit: tried the Software from PWILLARD too, but it has 1-2 seconds lag and the rpm bar (first green LED) starts at 6500 rpm O_o
Regards, SJB
boycey10802002
17th June 2011, 12:26
When you're testing the connection to the arduino, do you have the Serial Com window connected as well as the python program? The Arduino Com Window blocks other connections to the software. If you're doing both at the same time that may be the problem.
No, I tried to open the arduino console after I opened your python script and the Arduino console said "another program blocks serial com port 4" ;)
boycey10802002
20th June 2011, 12:14
are you using python 2.X and a compatible version of pySerial?
python console says "python 2.6.6" and I installed pyserial 2.5 :)
Scoundrel
2nd February 2012, 20:41
Haha. Sorry, my bad.
New files attached.
As a note to people trying to use my Python script, I'm using python v2.6
I'm trying to use this but always i have an error when im going to run it
python says: invalid syntax
then shows me where is the error, but i see all ok.
http://i41.tinypic.com/rw6gx4.png
I don't know how to solve it. I just want to comunicate lfs with my arduino :weeping:
DarkTimes
3rd February 2012, 00:42
Are you using the correct version of Python? That code was written for Python 2.6, so you will need to have either Python 2.6 or 2.7 installed to run it. From that error it looks like you're probably using Python 3.0, which is why it won't work. You can download Python 2.7 here (http://www.python.org/download/releases/2.7.2/).
boycey10802002
3rd February 2012, 12:43
DarkTimes is correct. It looks like you may be using the wrong version of python.
Also you should undefine DEBUG once you get it running because all the tesing communications overload the available bandwidth on the serial bus
**EDIT**
By undefine I mean make DEBUG = 0, instead of 1
Scoundrel
4th February 2012, 17:12
Are you using the correct version of Python? That code was written for Python 2.6, so you will need to have either Python 2.6 or 2.7 installed to run it. From that error it looks like you're probably using Python 3.0, which is why it won't work. You can download Python 2.7 here (http://www.python.org/download/releases/2.7.2/).
That's it :)
Now when I run "Outgauge_GUI.py" i can see the GUI. If I push start, the program crashs.
Which order have i open the programs?
1-Python
2-Arduino
3-LFS
is it ok?
DarkTimes
5th February 2012, 13:42
I've not tried this, but I'd imagine you should start the Python program last, after LFS and Arduino are running. Otherwise the program might try to connect to LFS or Arduino before they are ready and cause an error.
Scoundrel
5th February 2012, 18:34
i have started Arduino and LFS first then python. Now GUI doesn't open and python shows me this::really:
http://i43.tinypic.com/wkp7uq.png
If i run arduino and python with out LFS, error doesn't appear but when i press start, program freezes.
boycey10802002
6th February 2012, 03:36
If memory serves I think this is how you do it.
Before you open LFS or the python script:
Ensure you configured LFS's cfg.txt settings to match what is expected from the python script.
OutGauge Mode 2 <-- Can be 1 for just your car
OutGauge Delay 10 <-- Set this so your dials don't lag; it's set to '2' on my pc
OutGauge IP 127.0.0.1 <-- Very Important
OutGauge Port 12024 <-- Very Important
OutGauge ID 0 <-- packet ID, not used here
Also ensure that the script is looking for the correct serial device. (i.e. substitute "COMx" where ever it says "COM4" in the code, the 'x' in 'COMx' being the COM number of the Ardiono you want to control.
Step #1
Start LFS and the Python script (it doesn't matter which is first at this step)
Step #2
Click the 'Start' button. If you've got a solid connection all of the parameters being sent for Out Gauge will start updating.
Step #3
Click the enable USB Connection checkbox
That will start streaming the data you see in the GUI to your Arduino.
I think this is the way I designed it to work.
Let me know if you run into any more errors
Scoundrel
7th February 2012, 17:51
I'd followed ur steps and it's the same. The cfg is ok.
I'd tryed some test...
- Test 1
If I run Python alone, it shows me this:
http://i43.tinypic.com/wkp7uq.png
- Test 2
I plug my arduino, then i run python. It shows me interface, when i press start, the program crashes. If i run lfs before i press start, the result is the same.
http://i40.tinypic.com/drc7zp.png
- Test 3
The same as test 2 but at beginning i'd started LFS. When i press start the program crashes
boycey10802002
8th February 2012, 18:06
I'm assuming you've installed a compatible version of pySerial?
if not you can nab it from here: http://pypi.python.org/pypi/pyserial.
If you have and it's still not working I'll see if I can rework something over the weekend.
clunk1986
9th February 2012, 17:12
any instructions how to wire it all up an what arduinos can be used ?
Scoundrel
9th February 2012, 18:20
I had installed pyserial 2.5 :( Now i have installed 2.6 version :schwitz: but it's not working... same problem
Thx to waste ur time with me :thumb:
boycey10802002
9th February 2012, 18:45
I'm sorry it's not working properly, I'll try to cleanup the python code this weekend and see if I can't get it working again.
As for hooking up Arduinos; I think that every Arduino can listen to output from the python script. It's all about how you tell the Arduino to interpret that information that gets sent to it.
What the script sends is packaged like this:
|--- START BYTE ---|--- Parameter Tag ---|--- SEPARATOR ---|--- Value ---|---END BYTE---|
I believe the start byte is set as a null Character ( ASCII value of 0 ), the end byte is the character represented by the ASCII value of 255. the separator is a colon ( : ) and the Parameter and values are char arrays. After that you can get as simple or as complicated as you want.
If you want to be really complicated you can run all the gauge data to real air-core gauges as well as have a seven-segment display read the current gear and have all the dash lights light up some LEDs. For that you'd need to interface some bit-registers and some motor controllers ( L293Ds work great as simple motor controllers )
If you want to go the medium-complexity route, You can hook up an LCD and read out all the available data, or graph it or whatever.
A dead-simple way to do it, without any hardware, is to map the Shiftlight to pin13 on the Arduino which lights up the little, on-board LED.
If you have any specific questions please ask.
boycey10802002
11th February 2012, 04:46
**EDITED**
Now at V0.2
what exactly would i need circuit wise to hook up air cores to a arduino currently i have a l293d an sn74hc595n arduino uno thanks in advance
I've uploaded a couple of pictures demonstrating the test setup that I have. I know it looks like a jumble of wire, but don't freak out and think it's impossible. What it is is a couple of little systems copied and distributed around some breadboards.
Close Up of the Motor Controller (http://www.flippedout.ca/sites/all/images/CloseUp_MotorController.jpg)
A wide shot of my testing rig (http://www.flippedout.ca/sites/all/images/WideShot_Labled.jpg)
As an example I've also attached an image explaining how I have hooked up the wiring for the L293DNEs. Clearly this isn't what Texas Instruments calls the pin-outs on their chips, but this is how, conceptually, they are connected to other hardware
L293DNE as an air-core driver (http://www.flippedout.ca/sites/all/images/L293DNE_AirCoreWiring.jpg)
SN74HC595N as a controller for 8 LEDs (http://www.flippedout.ca/sites/all/images/SN74HC595N_LedController.jpg)
While searching for some SN74HC595N spec I happened across a google books sample of "Beginning Arduino" By Michael McRoberts. Chapter 6 is entirely devoted to hooking up shift registers to an Arduino (using only 3 control pins) and with resistors for the LEDs. I would recommend reading that chapter, it has great explanations about how bit registers work and has good diagrams and some code samples to go along with it.
A note to Scoundrel:
I am currently fixing up the python code so that it works properly and is more manageable. I have all of the sub-components working and am just pulling everything together in the UI. It will hopefully be done soon.
Scoundrel
6th March 2012, 21:18
A note to Scoundrel:
I am currently fixing up the python code so that it works properly and is more manageable. I have all of the sub-components working and am just pulling everything together in the UI. It will hopefully be done soon.
Thanks for ur time :laola:
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.