Datalogging/telemetry with a wireless router

A place For General Chit Chat Etc
User avatar
Posts: 1020
Joined: Sat Apr 30, 2011 6:27 pm
Location: Narellan, NSW

Datalogging/telemetry with a wireless router

Postby festy » Fri Dec 09, 2011 9:49 am

It's been a bit quiet here recently, so thought i'd post something about my latest project that I've been working on.
Not sure what sub-forum this thread should go in (aldl logging? custom code? tool development? hardware modification? "festy's dodgy hacks"?) so off topic it is, unless a mod has a better idea...

It's based around a wireless router, this one is an Asus WL500gp. It has a 266MHz processor, 32MB ram, 8mb flash, 2 USB ports and 2 TTL serial port headers.
Image
Image

A wireless router (aka wireless access point, or AP) is a great hardware platform for a datalogger - as they're small, cheap, solid state (i.e. have no moving parts) and run from 5 or 12v DC usually. Plus running a cut down embedded linux, they're very flexible.

I replaced the original firmware with OpenWRT, which is an opensource linux distribution for routers. I've been playing with OpenWRT for years, but couldn't find anyone who had tried to teach an AP to speak ALDL before, which kind of surprised me.

I could have used any AP that has a USB port and was supported by OpenWRT (or one of the other linux WRT systems, i.e. DD-WRT) but I have a couple of WL500gs laying about so that's what I used.

My ECU is an 808, running 12P with one of my 'DSfesty' NVRAM boards and a CP2102 USB-TTL module for high speed comms.
I was going to wire the 808's RX/TX lines into one of the AP's onboard UART headers, but as the CP2102 is supported by OpenWRT I just plugged it into the USB port instead.
Add a USB stick for storage and a serial LCD, and it makes a pretty decent platform for datalogging and basic telemetry as well (seeing as it is a wireless AP after all).

I'm writing the logger code in perl, and keeping it as cross-platform compatible as possible. It will even run on windows by changing 3 lines of code.
It's intended purpose is for circuit racing logging, and one of the features I'm aiming for is lap overlay - which is more for developing the driver and/or car setup than the engine tune.
This is where the log is split up per lap, and then specific traces (TPS, brake, gear, accelerometers etc) are compared between different laps, so see where time is lost or made up.
i.e. the impact of braking later into a specific corner affecting exit speed, or where the driver is not getting back on the throttle efficiently, or the impact of a suspension change on corner exit speed etc...

What I've got working so far:
* reads adx from usb stick
* connects to ecu and logs timestamped data (only csv format so far)
* 90% of the adx maths is working for logging/dispalying real values
* lcd displays some chosen data values, MALFs etc
* data is streamed over wifi (port 808 of course!) for remote telemetry
* basic 2 way telemetry/telecommand, i.e. remote clearing of MALFs from wifi
* logging start/stop from the router's hardware buttons (red button in the pic above)

Still to come:
* log in xdl format instead of csv
* add buttons to lcd dash for control and menu navigation
* write basic lcd menu for choosing adx, display params etc (currently uses a config file on the usb stick to choose adx and other settings)
* add lap beacon support using a spare digital input on the ECU, to be able to display best/last lap times on the dash and enable lap overlay
* come up with a method of overlaying laps from data logs - kind of important ;)
* try to speed up the loading, it currently takes about 15 seconds to start logging but once it starts it logs message6 at about 22Hz (compared to 32Hz when running on a 2GHz linux box, and it starts instantly)


Ideas to possibly implement, or maybe not:
* cal/bin upload and download from the dash
* TCP->serial glue for TP5 connection over wifi
* integrate GPS for position logging, (and possibly as an alternative to a lap beacon) and maybe even to feed back a VSS signal to the ECU
* any other ideas I get distracted by

The logger code is still a long way from being ready for publishing, but I'm pretty happy with the way it's working so far.
As usually happens, it started out structured, neat and well commented - but as more functionallity was added it became a bit of a dogs breakfast so it's due for a bit of a cleanup now.

I'll post some photos when I remember to take some - but apart from some numbers on the LCD, there's not much to see.
It's just a boring looking wireless router plugged into an '808 after all ;)

Posts: 2407
Joined: Sun Aug 02, 2009 9:16 pm
Location: Bayside, Melbourne, Victoria

Re: Datalogging/telemetry with a wireless router

Postby VX L67 Getrag » Fri Dec 09, 2011 11:23 am

Holy Crap, That taking it to a new level!

Nice Work :thumbup:

Site Admin
User avatar
Posts: 5659
Joined: Sat Feb 28, 2009 8:34 pm

Re: Datalogging/telemetry with a wireless router

Postby antus » Fri Dec 09, 2011 1:48 pm

Good job! The thought of using a linux based AP like this had crossed my mind, but never eventuated due to the size of the job! Using DD-WRT as a base is nice. I used it years ago on linksys AP, but have not revisited it since that hardware died. I'd be pretty keen to make up one of these and have a play myself. Hardware logging, and that future feature of wireless to aldl is good too. Would be real nice to have a laptop in hand, and be able to log and tune the engine - no wires :)
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

User avatar
Posts: 1020
Joined: Sat Apr 30, 2011 6:27 pm
Location: Narellan, NSW

Re: Datalogging/telemetry with a wireless router

Postby festy » Fri Dec 09, 2011 2:05 pm

that future feature of wireless to aldl is good too

It's not so much a future feature - I've got that working already.
I just need to put some more thought into making it work while logging as well :oops:
Using something like ser2net you can tie a tty to a tcp port on the AP, and create a virtual com port on the remote windows box for TP5/OSEPlugin to talk through.
I just need to either make the tcp server (or an additional one) on the AP talk correctly to a vcom client, or change the logger to connect to the ser2net server rather than the com port - as both can't have the tty open at once.

Or another option, what's the likelyhood of OSEPlugin supporting TCP comms some time in the future? Or does the plugin communicate via TP5 and not directly handle the com port I/O itself?

I know you're quite impartial to a bit of perl - if you ever need an adx parser or aldl functions, you know who to ask ;)

Site Admin
User avatar
Posts: 5659
Joined: Sat Feb 28, 2009 8:34 pm

Re: Datalogging/telemetry with a wireless router

Postby antus » Fri Dec 09, 2011 3:27 pm

festy wrote:Or another option, what's the likelyhood of OSEPlugin supporting TCP comms some time in the future? Or does the plugin communicate via TP5 and not directly handle the com port I/O itself?


Piece of piss. I'll PM you. :thumbup:
Have you read the FAQ? For lots of information and links to significant threads see here: viewtopic.php?f=7&t=1396

User avatar
Posts: 4988
Joined: Sun Mar 01, 2009 2:54 pm
Location: Perth, WA

Re: Datalogging/telemetry with a wireless router

Postby VL400 » Fri Dec 09, 2011 9:44 pm

Nice work there festy :thumbup:

The lap overlay is actually something that would be a nice feature to have in TP, being able to overlay logs or section of logs - its one thing I really miss from logworks to TP. Will suggest it as a feature request :think:

User avatar
Posts: 1020
Joined: Sat Apr 30, 2011 6:27 pm
Location: Narellan, NSW

Re: Datalogging/telemetry with a wireless router

Postby festy » Fri Dec 09, 2011 9:54 pm

I figure that by using a spare digital input as the lap divider, worst case I can export the log as csv and graph with GD or something seeing as the lap marker is in the data stream.

User avatar
Posts: 4795
Joined: Sat Feb 28, 2009 8:38 pm
Location: Wellington NZ

Re: Datalogging/telemetry with a wireless router

Postby delcowizzid » Mon Dec 12, 2011 4:50 pm

i want one what a great idea :thumbup:
If Its Got Gas Or Ass Count Me In.if it cant be fixed with a hammer you have an electrical problem

Posts: 345
Joined: Sun Apr 05, 2009 1:07 pm
Location: Gisborne NZ

Re: Datalogging/telemetry with a wireless router

Postby VNracer34G » Tue Dec 13, 2011 10:08 am

delcowizzid wrote:i want one what a great idea :thumbup:

X2
Even though i'm not allowed :sad2:
Build it, Race it, Break/Bend it ; Repeat.

User avatar
Posts: 1020
Joined: Sat Apr 30, 2011 6:27 pm
Location: Narellan, NSW

Re: Datalogging/telemetry with a wireless router

Postby festy » Tue Dec 13, 2011 10:32 am

From a hardware point of view, all you need is an OpenWRT-supported AP with a USB port. The ASUS WL-520gU is a good cheap candidate, you should be able to find one for around $40.

Then you'll need a $5 USB hub, a USB flash drive ($10) and a serial LCD (I made my own out of a 20x4 HD44780 and a picaxe-40x2 but a commercial unit is about $30) and a USB-serial adapter for the display (I use a no-name $2 ebay adapter) so maybe $100 all up if you buy everything new.

I wouldn't run out and start buying hardware just yet though, I have a bad habit of getting distracted and abandoning projects so wait and see if this one gets finished first ;)

Here's my "test bench", discretely hidden under the coffee table in my loungeroom ;)
festylog.jpg
festylog.jpg (51.87 KiB) Viewed 3667 times

Next

Return to Off Topic

Who is online

Users browsing this forum: No registered users and 5 guests