GPy + Pytrack + OBD-II Adapter



  • Hello

    I'm thinking of starting to use pycom, I've used before arduino, PLCs, etc ...
    I want to start with an idea using Gpy, Pytrack and OBD-II Adapter. [https://freematics.com/pages/products/arduino-obd-adapter/](link url)

    The objective of this project is educational, for my final project, with the purpose of obtaining a set of information about the vehicle and its mode of driving, to help someone who is learning to drive to better understand the car, as well as learn to driving more efficiently while saving resources while optimizing your driving.

    It will also in the future be created a bridge through BLE with the smartphone to identify the driver, indicate when it cost the fuel that was added, notify the driver about his behavior, etc.

    I chose Pycom mainly due to the small size, simplicity of the hardware itself, the possibility of having Bluetooth, wi-fi, LTE, GPS, in a small hardware.

    OBD-II has 4-pin connector two 2-pin connectors, including power lines (VCC / GND) and data lines (Rx / Tx or SDA / SCL).

    Issue number 1:
    How do I wire and where do I wire (Rx / Tx or SDA / SCL)?

    Issue number 2:
    Can OBD-II can power Pytrack directly? (Powering attached devices with DC 5V up to 2A)
    I know it is necessary to have a battery always connected, to Pytrack.

    Issue number 3:
    For arduino there is a dedicated library at [https://github.com/stanleyhuangyc/ArduinoOBD](link url)
    Is there something similar in MicroPython?

    I am waiting for your support.
    I hope you have enjoyed my idea ...



  • The library does say it will work with Micropython so reusing some of the code regarding OBDII protocol should be less difficult. However the library is designed for the ELM327 device. Unless you use the device, there will be effort into making the code work with your specific communication method, for example directly using the Pycom CAN interface.



  • Hi,
    I'm interested too at this topic. I found out this link for a micropython lib
    https://github.com/s-s-boika/obdlib

    Let me know if it is useful



  • Hello,

    There is a lot of different things that you are asking, so I will try to help point you in the right direction instead of just telling you what to do.

    The link you show list it as a I2C based communication device. You should look at the I2C pycom documentation, and get familiar with how it is used. Also look at how their Arduino libraries are used, there will be a lot that crosses over into Micropython with minimal editing.
    https://docs.pycom.io/chapter/firmwareapi/pycom/machine/I2C.html

    I do believe that the power from the ODB-II port should be plenty for powering your device, but the bigger issues is regulating it to the voltages needed for the Pycom modules. What would be the simplest is using a car 12v to USB converter and power the pycom board from that. I do not believe the LiPo battery is required, but helpful.

    I doubt there is a similar library specific for this device in the Micropython community, so you will likely have build your own communication.

    My personal suggestion is that if you need to ask these questions you should spend time learning I2C communication and how it is used by building your own library. Also taking the time to read documentation and datasheets for how power and use devices.


Log in to reply
 

Pycom on Twitter