Ned Posted April 30, 2020 Share Posted April 30, 2020 I made this. Can send the hex files if useful 3 Quote Link to comment Share on other sites More sharing options...
ThePog Posted April 30, 2020 Author Share Posted April 30, 2020 9 minutes ago, Ned said: I made this. Can send the hex files if useful Keen as beans, that looks like a good way to eyeball it on the fly. Does it log the session for analysis afterwards? Quote Link to comment Share on other sites More sharing options...
Ned Posted April 30, 2020 Share Posted April 30, 2020 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 2 Quote Link to comment Share on other sites More sharing options...
ThePog Posted May 1, 2020 Author Share Posted May 1, 2020 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... Quote Link to comment Share on other sites More sharing options...
NickJ Posted May 1, 2020 Share Posted May 1, 2020 Could that run 2 or even 3 inputs? how big is the screen? thats super handy, does what I achieved with my laptop without the hassle Quote Link to comment Share on other sites More sharing options...
Roman Posted May 1, 2020 Share Posted May 1, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
NickJ Posted May 1, 2020 Share Posted May 1, 2020 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? Quote Link to comment Share on other sites More sharing options...
ajg193 Posted May 2, 2020 Share Posted May 2, 2020 You gotta be careful with that map function, it has a fair few pitfalls. Quote Link to comment Share on other sites More sharing options...
Ned Posted May 2, 2020 Share Posted May 2, 2020 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 2 Quote Link to comment Share on other sites More sharing options...
Ned Posted May 2, 2020 Share Posted May 2, 2020 19 minutes ago, ajg193 said: You gotta be careful with that map function, it has a fair few pitfalls. Like what? Other than rounding down? Quote Link to comment Share on other sites More sharing options...
Roman Posted May 2, 2020 Share Posted May 2, 2020 Maybe weird shit happening when you go out of bounds? Quote Link to comment Share on other sites More sharing options...
ajg193 Posted May 2, 2020 Share Posted May 2, 2020 Basically just those two. They seem innocent enough at first but can catch you if you aren't careful. Quote Link to comment Share on other sites More sharing options...
h4nd Posted May 6, 2020 Share Posted May 6, 2020 I tend to run serial at 115200, just for less lag. Have used megabit OK on some devices. Serial.begin(115200); Quote Link to comment Share on other sites More sharing options...
h4nd Posted May 6, 2020 Share Posted May 6, 2020 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.