Skip to content

React Native & Expo & ClojureScript for interfacing with OBD to a Volt/Ampera

License

EPL-1.0, Apache-2.0 licenses found

Licenses found

EPL-1.0
LICENSE
Apache-2.0
font_license.txt
Notifications You must be signed in to change notification settings

akaivola/high-voltage

Repository files navigation

OBD/Bluetooth realtime power meter and visualizer for Chevrolet Volt / Opel Ampera cars

Goal: To display a live visualization of the power used (in kW) by the electric drivetrain of the car.

Secondary goals: Add more features and data visualization

Implemented using Re-frame on ClojureScript on Expo on React Native.

Fully functional REPL to a running program on a real device.

All changes immediately visible on the device without recompiling or restarting.

Usage

If you don’t want to use XDE (not IDE, it stands for Expo Development Tools), you can use exp CLI.

Install npm modules

yarn install

Patch react-native-obd2 to newest SDK

  1. edit node_modules/react-native-obd2/android/src/main/java/com/jetbridge/reactobd2/ReactNativeOBD2Package.java
  2. delete method createJSModules()

Install Android SDK, NDK, Platform tools and accept licenses

brew tap homebrew/cask
brew cask install android-ndk
brew cask install android-platform-tools
brew cask install android-sdk

Add env vars to .bashrc / .zshrc:

export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
export ANDROID_HOME=$ANDROID_SDK_ROOT
export ANDROID_NDK_HOME="/usr/local/share/android-ndk"'

Accept licenses:

sdkmanager --licenses

Install react-native command

npm install -g react-native-cli
react-native link

How to develop with repl and figwheel

XDE

  1. Plug in phone with a USB cable, development powers need to be unlocked.
  2. Open XDE and click “Open existing project…”
  3. Open ‘high-voltage’ project directory
  4. Start the project

Install a debug version of the app to the phone:

cd android
./gradlew installDevMinSdkDevKernelDebug

Start reverse port for figwheel, required for live eval

adb reverse tcp:3449 tcp:3449

nREPL:

lein with-profile dev repl

Connect to nREPL with your $EDITOR and evaluate:

(start-figwheel)

Start the app

On your phone, open Expo. High-voltage should appear on the list. Tap on it.

You’re all set.

From this moment on you only need to save your files in $EDITOR and figwheel will immediately evaluate changes in the running program.

You will also have a fully functional REPL to your program running on your phone. The holy grail of programming.

Notes

Adding native libraries

Libraries requiring linking use ExpoKit

Install ExpoKit:

exp detach

Install and link:

npm install -g react-native-cli
react-native link

Start and run Android project (first run will download the internet):

cd android
./gradlew installDevMinSdkDevKernelDebug

TODOs

Import OBD libs

Connect to actual OBD

Debug window for OBD data

request and visualize power PIDs from OBD using a timer (first phase)

request multiple PIDs from OBD at once using multi query or whatever it was called

Design user interface for selecting adapter

About

React Native & Expo & ClojureScript for interfacing with OBD to a Volt/Ampera

Topics

Resources

License

EPL-1.0, Apache-2.0 licenses found

Licenses found

EPL-1.0
LICENSE
Apache-2.0
font_license.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published