Freematics OBD-II UART Adapter V2.1!!!
Posted: Fri Sep 11, 2020 1:16 pm
Hi there, so i just wanted to add my story about the OBD-II UART Adapter V2.1 adaptor.
It all started with an idea, while looking for parts I found the OBD-II UART Adapter V2.1 adaptor and it would be the secret source for my idea.
I ordered my adaptor and a few days later it arrived, I plugged it in, setup my Wi-Fi mega and when about trying to get this adaptor to work, I jumped in my car and nothing, the blue light would turn off after a few sec and I would just be stuck in the init loop of the OBDII object, I had a look online and found a few posts about its not working and all this kind of thing, I got very dishearten and felt ripped off, gave up on the idea and moved on.
A days goes by and I'm not happy so I do some more reading on lien and stumble over a few post from Stanly asking if the ground line was plugged in... It struck me, nope it wasn't as I was running from USB power and assumed the ground line was for power only, so I set my mega up again ran out to the car and plugged it in, this time with the ground connected, the blue light stayed on, it was even flashing and looked like it was doing stuff, I then went back inside and set things up to use the test sketch, I also wanted some type of update from the init function.
I set up some callbacks and scattered them around the init function(one pumps my serial ports the other draws to the LCD), I then cleaned my code up, turned it into a class and set things up nice, I then went back out to the car, plugged things in, I then see testing link on my LCD, the test pass, then it hit the init function and printed each stage to the screen and bang... I had my car RPM on the LCD.
So in the end it works, just how it should and very well at that. I feel a bit bad for doubting the product when it was my own fault it didn't work, maybe im just bad at this or its not a beginner product.
In my day job im a GFX and network programmer so the code side of things was fine it was just my noob'ish understanding of electronics that got me in the end.
Thanks for reading and if you see this Stanley, thank you so much again for this product, you are helping make my dream come true!!!
PS. Im goign to get a few more adaptors!
TIPS:
Just be sure to check all connections, added some callbacks for feedback from long running functions.
controlTypes.h
//Define some function pointers
typedef void (*UpdateString_ptr)(String newUpdate);
typedef void (*ReadPump_ptr)();
OBDIIUART.cpp @ COBD::begin
//Set the passed in void* onto the class function pointer member, we use a void* so we dont have to include the controlTypes.h in to many headers
StringUpdaterFunction = (UpdateString_ptr)inFunc;
LinkController.cpp
//Do some grossness so i dont have to include things all over the place
void UpdateStringEX(String newUpdate)
{
FLinkController::Self->UpdateStringLocal(newUpdate);
}
//Do the updating
void FLinkController::UpdateStringLocal(String newUpdate)
{
rfLoginCommand = newUpdate;
UpdateScreen(true);
delay(5);
}
OBDIIUART.cpp @ COBD::init
//Call the function pointer and always check for null
if (StringUpdaterFunction)
{
StringUpdaterFunction("Start Stage Two");
}
It all started with an idea, while looking for parts I found the OBD-II UART Adapter V2.1 adaptor and it would be the secret source for my idea.
I ordered my adaptor and a few days later it arrived, I plugged it in, setup my Wi-Fi mega and when about trying to get this adaptor to work, I jumped in my car and nothing, the blue light would turn off after a few sec and I would just be stuck in the init loop of the OBDII object, I had a look online and found a few posts about its not working and all this kind of thing, I got very dishearten and felt ripped off, gave up on the idea and moved on.
A days goes by and I'm not happy so I do some more reading on lien and stumble over a few post from Stanly asking if the ground line was plugged in... It struck me, nope it wasn't as I was running from USB power and assumed the ground line was for power only, so I set my mega up again ran out to the car and plugged it in, this time with the ground connected, the blue light stayed on, it was even flashing and looked like it was doing stuff, I then went back inside and set things up to use the test sketch, I also wanted some type of update from the init function.
I set up some callbacks and scattered them around the init function(one pumps my serial ports the other draws to the LCD), I then cleaned my code up, turned it into a class and set things up nice, I then went back out to the car, plugged things in, I then see testing link on my LCD, the test pass, then it hit the init function and printed each stage to the screen and bang... I had my car RPM on the LCD.
So in the end it works, just how it should and very well at that. I feel a bit bad for doubting the product when it was my own fault it didn't work, maybe im just bad at this or its not a beginner product.
In my day job im a GFX and network programmer so the code side of things was fine it was just my noob'ish understanding of electronics that got me in the end.
Thanks for reading and if you see this Stanley, thank you so much again for this product, you are helping make my dream come true!!!
PS. Im goign to get a few more adaptors!
TIPS:
Just be sure to check all connections, added some callbacks for feedback from long running functions.
controlTypes.h
//Define some function pointers
typedef void (*UpdateString_ptr)(String newUpdate);
typedef void (*ReadPump_ptr)();
OBDIIUART.cpp @ COBD::begin
//Set the passed in void* onto the class function pointer member, we use a void* so we dont have to include the controlTypes.h in to many headers
StringUpdaterFunction = (UpdateString_ptr)inFunc;
LinkController.cpp
//Do some grossness so i dont have to include things all over the place
void UpdateStringEX(String newUpdate)
{
FLinkController::Self->UpdateStringLocal(newUpdate);
}
//Do the updating
void FLinkController::UpdateStringLocal(String newUpdate)
{
rfLoginCommand = newUpdate;
UpdateScreen(true);
delay(5);
}
OBDIIUART.cpp @ COBD::init
//Call the function pointer and always check for null
if (StringUpdaterFunction)
{
StringUpdaterFunction("Start Stage Two");
}