So I’m looking to dabble a bit with data from an OBD2 scanner, mostly to explore aspects of my EV’s energy consumption, and/or something about how the charging infrastructure is evolving, if I can find an appropriate API out there for such data.
I don’t really have a specific project in mind yet but in the longer term it would be really cool to somehow be able to determine optimal route/driving/charging patterns and with measured data figure out how well I’m doing relative to this. Which would obviously be a pretty lofty goal so for now I’d like to start by tinkering with data collection & analysis.
I haven’t heard of anything related to OBD2 and Julia (otherwise a number of Julia packages are available for very exotic interfaces/hardware), and googled and found nothing. Only for Python: Getting Started - python-OBD
It can stream real time sensor data
[That package works on Raspberry Pi, Julia itself does too, and I think also packages below I mention.]
I’m not really recommending Python over Julia (but it’s an option), rather using that (or some other?) package from Julia. With e.g. PythonCall (I hear it’s excellent, and it takes care of Python dependencies).
It has a rather slow startup (but should be fine, at least after startup on Raspberry Pi):
julia> @time using PythonCall
4.598435 seconds (2.44 M allocations: 171.395 MiB, 1.04% gc time, 84.54% compilation time)
PyCall.jl has a faster startup, is know to be excellent (so might be more appropriate, at least on the slower RPi), but you have to manually install Python dependencies (not really a problem).
This is more advanced than you seem asking for, but Julia is used in autonomous/self-driving research:
Everything I’ve seen for Julia for hard-realtime, is not yet used in actual hardware, that I know of (but would like to be proven wrong, i.e. only used in a simulation). But since people trust Julia for hard-realtime, and use (with care to avoid the GC) rather than C++ or Java, then it seems plausible also for self-driving…, while I doubt it will be used (soon) for that in actual hardware, or with pure Julia.
That said, you seemingly don’t need hard-realtime, only needs soft-realtime (or even best-effort), what I assume “real time” means for the above Python package.
We demonstrate the use of the Julia programming language to solve this problem by being fast enough for online control of a humanoid robot and flexible enough for prototyping. We present several Julia packages developed by the authors, which together enable roughly 2× realtime simulation of the Boston Dynamics Atlas humanoid robot balancing on flat ground using a quadratic-programming-based controller
Yeah for now I’m definitely fine with just logging data while I drive and analyzing it offline later. So far I have a Bluetooth OBD2 dongle and an app that does logging, with sync to iCloud which makes it pretty nice, basically I just need to start an app on my phone to log and a CSV file will have appeared in my filesystem when I get home.
I guess one could effectively DIY the app + cloud sync part with the RPi replacing the phone but at least for the time being this is more than what I need. Maybe even the Bluetooth dongle could be replaced, I haven’t looked into how far off it is from basically a serial port. What could be nice about the RPi is logging during charging though I’m not sure my car/dongle supports that.