Jump to content

Wideband + Datalogging Q


ThePog

Recommended Posts

Nah, just shows you the last x amount of seconds. I can add an input so that it stops when you flick a button or something? So flick a switch and it starts, and when you flick it again it stops and shows the last x amount of seconds?

The idea was never to do super crazy tuning with it, but being able to do a pull and see a little history would be ace. Looking at a number on the screen when doing a WOT run just isnt feasible if you ask me

  • Like 2
Link to comment
Share on other sites

Fair enough. In my mind you either do it that way or do a whole lot of pulls that are logged so you have a full map, but I imagine a real time indication would be the most direct way to get where I want to get...

Link to comment
Share on other sites

On 30/04/2020 at 08:15, NickJ said:

To get the ball rolling i'll post the code I used, disclaimer, I'm no code wizard, I just used basic knowledge and googled what I was after and stitched shit together to get a result, there will 100% be a better way and anyone is welcome to offer improvements.

First step, Arduino code, this was loaded onto an Arduino uno

Just a thought, if it was a bit sluggish and you wanted to optimize it a bit.
Floats absolutely bog down arduinos, they hog their processing power like you wouldnt believe.
Its crazy how slow floats go. 

If it needed to be faster, (I realize its probably fine as is, and widebands are a bit laggy anyway so this is irrelevant and I'm being a dick. sorry.) 
You could keep everything as an int on the arduino side and then do the rescaling after the serial transfer, onto the PC where it's got some more grunt. 

If your wideband has a linear output of (for example) 10:1 to 20:1 from 0.5v to 4.5v

Then the map function is handy for rescaling 
like 
 val1 = map (analogRead(0), 0, 1024, 1000, 2000);

So 10:1 would read as 1000 but you can divide by 100 and keep decimal places on the PC side of it. By converting to a float at that point instead.
It will run like 100 times quicker

Over serial I think it only transmits the first two digits of a float but before that it does the maths for 6 decimal places worth.

Or even quicker again just send the raw 0-1024 value over serial and do maths on the side thats got a lot more horsepower to spare.

 

  • Like 1
Link to comment
Share on other sites

8 hours ago, Roman said:

Just a thought, if it was a bit sluggish and you wanted to optimize it a bit.
Floats absolutely bog down arduinos, they hog their processing power like you wouldnt believe.
Its crazy how slow floats go. 

If it needed to be faster, (I realize its probably fine as is, and widebands are a bit laggy anyway so this is irrelevant and I'm being a dick. sorry.) 
You could keep everything as an int on the arduino side and then do the rescaling after the serial transfer, onto the PC where it's got some more grunt. 

If your wideband has a linear output of (for example) 10:1 to 20:1 from 0.5v to 4.5v

Then the map function is handy for rescaling 
like 
 val1 = map (analogRead(0), 0, 1024, 1000, 2000);

So 10:1 would read as 1000 but you can divide by 100 and keep decimal places on the PC side of it. By converting to a float at that point instead.
It will run like 100 times quicker

Over serial I think it only transmits the first two digits of a float but before that it does the maths for 6 decimal places worth.

Or even quicker again just send the raw 0-1024 value over serial and do maths on the side thats got a lot more horsepower to spare.

 

Thats the kind of rookie code I was expecting, if anyone else is actually reading this thread suggestions like this will help them along.

In hindsight its obvious arduino has a rescaling function and would tidy up the code nicely. I also agree that doing that maths in the computer makes more sense.

One of my original ideas was to make a blackbox DAQ to hook up and run on all sorts of projects, I guess it comes down to which end someone wants to program at each application, or code in a menu to set limits?

 

Link to comment
Share on other sites

Your serial port is way slower than your math conversions :-) you'll be fine. Even with floats. Plus the wideband probably doesnt have a very high update rate anyway.

Still, using decimal is way better there :-)

Also, roman, its 0-1023, not 1024 BTW ;-)

  • Like 2
Link to comment
Share on other sites

Oh yeah, "Device Manager" is a good place to find which port an Arduino is on, look in "Ports (COM & LPT)" section

(plug and unplug to get clear which, if you have like 8 attached...)

Also, CH340 clones can mess up OS sleep (especially laptops) and reboots for OS updates. Un plug them after session to avoid hassles.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...