So I’m back on the project of using a photon and can-hitch to send an rpm signal and a VSS signal to the electric power steering (EPS) column from a Toyota Prius that I’ve integrated into a 1967 Ford Fairlane. I have the can bus wiring setup and can use an OBD2 connector to read data and codes from the EPS module. However the module goes into a limp in mode since it isn’t receiving an RPM or VSS signal from the ECM/ABS over the can bus. I would like to program the photon/can-hitch to output the two (or possibly more, not sure yet if the EPS is looking for a single vss or individual vss readings) signals. I’m not real great at coding yet so I’m not sure how to modify the sample code to output two messages. So far I have this:
// This #include statement was automatically added by the Particle IDE.
#include <carloop.h>
#include “application.h”
#include “carloop/carloop.h”
// Don’t block the main program while connecting to WiFi/cellular.
// This way the main program runs on the Carloop even outside of WiFi range.
SYSTEM_THREAD(ENABLED);
// Tell the program which revision of Carloop you are using.
Carloop carloop;
// Send a message at a regular time interval
void sendMessage() {
static uint32_t lastTransmitTime = 0;
uint32_t transmitInterval = 100; /* ms */
uint32_t now = millis();
if (now - lastTransmitTime > transmitInterval) {
CANMessage message;
// A CAN message has an ID that identifies the content inside
message.id = 0x2C4;
// It can have from 0 to 8 data bytes
message.len = 8;
// Pass the data to be transmitted in the data array
message.data[0] = 0x06;
message.data[1] = 0x8A;
message.data[2] = 0x00;
message.data[3] = 0x19;
message.data[4] = 0x00;
message.data[5] = 0x00;
message.data[6] = 0x92;
message.data[7] = 0x09;
// Send the message on the bus!
carloop.can().transmit(message);
lastTransmitTime = now;
}
}
void setup() {
// Configure the CAN bus speed for 500 kbps, the standard speed for the OBD-II port.
// Other common speeds are 250 kbps and 1 Mbps.
// If you don’t call setCANSpeed, 500 kbps is used.
carloop.setCANSpeed(500000);
// Connect to the CAN bus
carloop.begin();
}
void loop() {
sendMessage();
}
Which should output a set 1674 rpm signal which will “wake up” the EPS module so the steering powers up immediately at key on instead of waiting 15 seconds and going into limp mode. With no other message the EPS will still see a “loss of communication with ABS module” and will default to the minimal assist strategy. So I would like to also output the VSS signal. How would I incorporate that into this code.
A sample message would be: 0B4= message ID, 8 length, 00 00 00 00 8D 06 66 B5 which should be 10mph
I can change the mph settings (the 06 66 here, 06 66=1638*.0062=10.15MPH) to make the EPS believe the car is moving at different speeds until I found an assist level that would work for now (minimal isn’t quite enough). If I can get this basic system working then I plan to eventually figure out how to read a vss signal with the photon and have it output so the system will work as it did on the Prius, but that is a ways off.