Hyundai IONIQ Forum banner

Ioniq BSO Remote Control - Software for our Plug-in

16K views 37 replies 9 participants last post by  mreekster 
#1 · (Edited)
Hi all,

I have been preparing a system for the charge control of our Ioniq Plug-in for some time, with monitoring and warnings of the state of charge. I am correcting some details and my idea is to publish it tomorrow or last. To start it, you will have to modify an OBD reader and program an ESP8266 boards, which will allow it to be a very low cost assembly.

I have prepared the documentation, but in deference to the colleagues who already know the system and have seen it work, first the audience is Spanish and then in English.

For now, if you are interested, you can see some videos in https://youtu.be/Qt8LGVsRaFE

By the way, the application is designed for Europe or for countries where unfortunately we do not have Blue Link.

I await your comments.

Regards,
 
#4 ·
Hi, It should work with minimal changes. I had to use EV information to program my solution, but it should not be a big problem. Unfortunately I do not have anyone around with an EV.

Tonight I hope to open GitHub, but I anticipate that you have to do some welding, have an OBD that works with our Ioniq and know environment Arduino & ESP8266.

Regards,
 
#5 ·
I know this is kind of getting off-topic but does anyone know why Bluelink is not available for the Ioniq PHEV/EV in Canada? Bluelink is available for other models in Canada and is available for the Ioniq in the US so what is stopping Hyundai adding it here via a firmware upgrade or some such thing? I have mixed feelings about it anyway but I'm curious.
 
#7 ·
I thought that in Canada if BlueLink existed. The multimedia that you have in your country is like that of the USA or like that of Europe? Do you know if it is possible to access the Android layer as we Europeans do?
 
#12 ·
Great job!

I have something similar: I am using an OBD LX connected to my Ioniq and I have a Raspberry Pi Zero W with bluetooth linked to the OBD LX and with a 3G internet key connected to the micro USB.

It connects to the internet and update a MySQL DB on my home NAS where I also have a specific web page to show the SOC.

I started from this project with some modifications:


Would it be possibile to use your software idea but with the easier hardware I am using?
 
#14 ·
Hi Chrispazz,

I know the project was SOChack.eu, but I wanted to avoid that users had to put a MySQL server and a web on remote, and avoid the problems with Raspberry as the shutdown or controlled that causes problems with the SD and reduce the power consumption. The board that I use with a small Nokia battery arrives up to 2 days of continuous operation without charge. In addition, the data update is faster, with more data than SOChack and with notifications via Telegram

I, for the moment, use a WiFi OBD, since this allows me to use Torque or other applications in the Ioniq multimedia, especially on long trips. Although the result is similar, they are different projects since I want to control the loads remotely. If you have any idea of how I could improve or reconcile, I would love to help you.

Greetings.
 
#13 ·
Hi there,

Very nice project, I had a look already to your code. Do you think that it can be implemented any remote commands? Is there such a capability in the OBD? For example, starting heating? I guess I can use a RPC framework for that (GRPC) and send the commands to the board.
 
#15 ·
Thank you for your comments!!

Adding remote commands is easy, but I am not able to do it via OBD. I would like to limit the charge, but I do that via IFTTT when I charge at home, but I can not stop charging when I'm in public chargers.

If someone manages to send orders via OBD, which in theory is read only, I would be grateful if you would comment on it as.

Regards,
 
#22 · (Edited)
Here is wiring diagram for the HC-05 and ESP8266 dev board. No need to buy HC-05 module mounted on the other PCB with voltage regulator and button (shown earlier) - as it was designed for Arduino boards with 3.6 -6V power, and it does not allow access to RESET (always High from VCC) and CMD(The button needs to be pressed while in AT mode) pins access.

So the bare bone HC-05 is absolutely the best candidate from two for ESP8266 boards with native 3.3V power and TTL signaling.
30595
 
#23 · (Edited)
Finally, got my hands on HC-05. It is interesting beast, so far it is working fine with these OBD: ELM327 V1.5 PIC18F25K80 Chip Bluetooth, BAFX Products - Wireless Bluetooth OBD2, KONNWEI KW902 ELM327 Bluetooth OBDII . No luck with this one: ELM327 V1.5 Bluetooth OBDII makes HC-05 really "mad" (status LED blinks like they are busy talking between themselves, but like nothing in spec and no comm for app). The only difference I could see in Windows BT - working ones marked as "Port" or "SPP" as Service Name and not working one shows "SPP Client" as Service Name. Most likely " Client" suffix is the reason for failed connect, probably HC-05 considers it not compatible, when it sees this in Service Name.
Things are moving along nicely. I wired LEDs from pin 32 & 31 to monitor the status of HC-05 visually and use pin 31 as hardware check on connection status. Bare bone HC-05 is very tiny and fragile, I learn my lesson and I am using tiny wires that do not put stress on the HC-05 pin' soldering pads, as standard patch wires would easily rip off those pads from PCB, so repair is very difficult.
HC-05 works great when you know what you are doing. Luck of documentation makes it slow to master it. At this point, I managed to use stored config for connection, so it connects in a few seconds and there is no need for lengthy configuration steps on every boot. Also, there is a way to convert it to full featured BT RN-42. It would be a great, but overkill for this particular project.
30636
 
#25 · (Edited)
HELTEC_WIFI_Kit_8 OLED 128x32 to make it to work the following lines need to be changed in latest library OLED.cpp file:
sendcommand(0xA8); //SSD1306_SETMULTIPLEX
sendcommand(0x01F); // 128x32 OLED: 0x01F; 128x64 OLED: 0x03F; 96x16 OLED: 0x0F

...
sendcommand(0xDA); //SETCOMPINS
sendcommand(0x02); // OLED 128x32 & 96x16: 0x02; 128x64 OLED : 0x12

Without these changes the display output is garbled, not readable as library defaults to 128x64 resolution.
 
#26 · (Edited)
Interesting fact about BT vs. WiFi. When working with BT you need to realize the buffers are very small (64 bytes vs. 32K bytes), so the moment you sent the command you need to start reading immediately, no delays, or it would truncate/discard unread data. The car battery was almost full, so I could not verify charge logic while figuring out the "source of incomplete data" in OBD responses.

Revised pin assignment:
Code:
#define HC05_txD   15  //Arduino pin connected to Rx of HC-05
#define HC05_rxD   13  //Arduino pin connected to Tx of HC-05
#define HC05_CMD   14  //Arduino pin connected to CMD (34) of HC-05 (enter AT Mode with HIGH)
#define HC05_RESET 16  //Arduino pin connected to Reset of HC-05 (reset with LOW)
#define HC05_STATE 12  //Arduino pin connected to pin 24 status of HC-05 (Low not connected, HIGH connected)

#define HC05_KIT8_txD    0  //Arduino pin connected to Rx of HC-05
#define HC05_KIT8_rxD   15  //Arduino pin connected to Tx of HC-05
#define HC05_KIT8_CMD   14  //Arduino pin connected to CMD (34) of HC-05 (enter AT Mode with HIGH)
#define HC05_KIT8_RESET 12  //Arduino pin connected to Reset of HC-05 (reset with LOW)
#define HC05_KIT8_STATE 13  //Arduino pin connected to pin 24 status of HC-05 (Low not connected, HIGH connected)
 
#27 · (Edited)
Not a very good news. It seems 2101 command only works for a brief time after charger plugged in, then it returns CAN ERROR all the time while charging. When car is in READY state - all commands are working correctly. I think it is time to scrap it, EV or model year seems to have different command life cycle vs. PHEV. Also, 2501 response has mostly 00 compared to test data: 5: 00 29 00 00 00 00 00 vs 5: 00 06 02 03 E8 51 01

Code:
Sending OBD command: 2101
SEARCHING...
03D
0: 61 01 FF FF FF FF
1: BB 1F 40 26 48 20 00
2: 00 0F 63 19 18 19 19
3: 18 18 19 00 18 CD 0B
4: CC 31 00 00 81 00 00
5: 5B 38 00 00 59 F5 00
6: 00 21 28 00 00 1F DC
7: 00 0E 8D 94 09 00 04
8: 00 00 00 00 03 E8 00
Sending OBD command: 2105
Processing OBD: 2105
02D
0: 61 05 FF FF FF FF
1: 00 00 00 00 00 19 19
2: 19 00 00 00 00 1F 40
3: 26 48 00 01 64 00 00
4: 03 E8 06 03 E8 31 C4
5: 00 29 00 00 00 00 00
6: 00 00 00 00 00 00 00
Sending OBD command: 2101
ERROR:CAN ERROR
Sending OBD command: 2105
Processing OBD: 2105
02D
0: 61 05 FF FF FF FF
1: 00 00 00 00 00 19 19
2: 19 18 18 19 19 1F 40
3: 26 48 00 01 64 00 00
4: 03 E8 06 03 E8 31 C4
5: 00 29 00 00 00 00 00
6: 00 00 00 00 00 00 00
 
#28 · (Edited)
After some testing - it looks like 2101 would return CAN ERROR if not called for a few seconds - Control Unit would go to sleep, then it takes a series of 2101 with CAN ERROR retuned to wake it up (actually one after error is enough). Also, it seems PHEV has some differences in 2105. What "bso" value means? It would help to adjust it for EV. My guess it is "SOC Display", but it is in 4: line for EV
After adjustments for 2101(errors) and 2105 (SOC) it finally works!
30724


30725
 
#29 ·
I just received ESP32 - it would be next adventure to get it working. I think I got all the info to get it working with legacy BT in ESP32 stack, but have to hack into BluetoothSerial.h/cpp library files to make it work in master mode.
 
#30 · (Edited)
Must be my lucky day, ESP32 did not offer any resistance to add master mode
So connecting to OBD as master is very trivial now. I wonder why they omitted this functionality - it was not a lot of code to hook it up from example_spp_initiator_demo.c
Looks like Helec ESP32 WiFi Kit 32 could be the winner as it combines WiFi, BT, OLED and Li-Ion Battery in one tiny solution, no need to wires and soldering gun:

Code:
#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

BluetoothSerial SerialBT;

uint8_t address[6]  = {0xAA, 0xBB, 0xCC, 0x11, 0x22, 0x33};
String MACadd = "AA:BB:CC:11:22:33";
String name = "OBDII";
//char *pin = "1234"; //<- standard pin would be provided by default

void setup() {
  Serial.begin(115200);
  //SerialBT.setPairPin(pin);
  SerialBT.beginMaster(address,"ESP32test");
  //SerialBT.beginMaster(name,"ESP32test");
  Serial.println("The device started in master mode, make sure remote BT device is on!");
}

void loop() {
  if (Serial.available()) {
    SerialBT.write(Serial.read());
  }
  if (SerialBT.available()) {
    Serial.write(SerialBT.read());
  }
  delay(20);
}
Code:
The device started in master mode, make sure remote BT device is on!
+CONNECTING<<24:6F:28:22:3D:3E?>NNECTED?
>ATZ
ELM327 v1.5
>ATE0
OK
>ATL1
OK
>ATH0
OK
>ATST62
OK
>ATSH 7E4
OK
>2101
SEARCHING...
STOPPED
>2105
SEARCHING...
STOPPED
>
 
#31 · (Edited)
Forked esp32 repo and pushed changes to enable Master mode, pin and SSP. Will make a pull request tomorrow: https://github.com/IonicEV/arduino-esp32
Source code and sample master app: https://github.com/IonicEV/arduino-esp32/tree/master/libraries/BluetoothSerial

And sure enough - it worked with: ELM327 V1.5 Bluetooth OBDII. Although, it requested pin a bit differently (with pin challenge, now that I could see in in low-level debug messages I added). The other adapters just took preset pin, but this one challenged for pin. So looks like HC-05 could not handle "challenge pin" situation. This particular OBD is widely available and very inexpensive.
 
#32 · (Edited)
Nah, ESP32 WiFi is very flaky. As of now it could not resolve many dns names to address (resolves time.nist.gov some time, but fails on north-america.pool.ntp.org, neither could resolve anything in cloudmqtt.com nor in telegram.org). BT master was only one of the issues (now resolved). ESP32 needs to polish WiFi first. Or maybe Heltec ESP32 WiFi Kit 32 is an issue. I could not believe "espressif" would release product with most WiFi examples not working right. Am not even talking about using WiFi and BT at the same time.
 
#33 · (Edited)
Heltec ESP32 WiFi Kit 32 is a bit shaky when starting WiFi, but after cleaning includes it seems to operate. It takes a few resets to get it going with WiFi and once it is working - it seems to work, but not reliably. When you enable WiFi and BT - those ESP32 libraries take a lot of space, so you have to switch to "Huge App (3MB no OTA) to get this app going. The only hope is for Expressif reference ESP32 board.
 
#34 · (Edited)
Wow, what do you know? Reference board worked perfectly fine like a Swiss clockwork.
Genuine Espressif (not a Clone) ESP32 ESP32-DEVKITC inc ESP-WROOM-32 soldered Female HEADERS. It worked fine with: "NO OTA (2MB APP/2MG SPIFFS)"
Any reference board like ESP32-DEVKITC would work (Mauser with economy shipping is very reasonably priced). Stay away from ESP32 clones. Another clone I got was so bad - I could not even load any sketch on it due flaky USB. Stay away from Heltec ESP32 WiFi Kit 32 - although the company is decent, but this product just a big let down. Will fork repo and upload ESP32 variant in a few days as it is the simplest of all - no wires, no solder. Just ELM327 BT ODBII and ESP32 board.
 
#35 · (Edited)
The ESP32 variant is available here: https://github.com/IonicEV/Ioniq-BSO-Remote-Monitor/tree/master/arduino-esp32/Ioniq_SRM_v1.0
The ESP8266+HL05 variant is here: https://github.com/IonicEV/Ioniq-BSO-Remote-Monitor/tree/master/arduino-hl05/Ioniq_SRM_v0.9

Use ESP32 board package v.1.0.2.

v.1.0.3 is not working with Telegram due to increased memory usage even further with latest WiFi code:
[E][ssl_client.cpp:33] handle_error(): X509 - Allocation of memory failed
It is very clear in the debug logs - it is leaking memory on each retry iteration

I got Heltec ESP32 WiFi Kit 32 working as well, but the issue with it - the antenna is only 1/2 size of reference ESP32 board, so it is very weak and only works at close distance or direct line of sight. It may be acceptable for the work inside the car as everything is next to each other. When same OLED settings (in OLED library) from KIT 8(128x32) are kept for ESP32 OLED(128x64) the text becomes bigger and more legible.
30778

You can always get this monster with 16 MB of flash and good antenna, but RAM size (528KB) is the same on all variants: LILYGO® TTGO 16M bytes (128M Bit) Pro ESP32 OLED V2.0 Display WiFi +bluetooth ESP-32 Module For Arduino
 
#37 · (Edited)
The BluetoothSerial source code changes are now merged with master branch and it would become a part of the future ESP32 package releases.
As there was not many changes for over a year in this area, you can easily copy those two files into older distributions of ESP32 packages to enable bluetooth "master" functionality from the master branch : https://github.com/espressif/arduino-esp32/tree/master/libraries/BluetoothSerial/src
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top