DIY Electric Car Forums banner

Getting Curtis data into computer

7190 21
I'm involved in a project where we're converting a diesel boat to electric. All the electronics and the motor work on the bench, no questions there. My main task in this is getting the data about the rpm, power and everything else from the Curtis 1236 controller, into a raspberry pi. I'm having trouble where to start. What pins on the controller and pi should connect, is something between necessary, what software do I need? Say I want to log the rpm to a file every second, as a start. Thanks!
21 - 22 of 22 Posts

·
Registered
Joined
·
6 Posts
Discussion Starter · #21 ·
Hello again!
I've been trying a lot with slcand, ip, ifconfig and such on my computer with the motor running slowly and the CANbus seemingly correctly connected. Whatever I try, nothing comes out. There are those CAN speeds (-s1 (20kbps) to -s6 (500kbps)), whether or not it is can or vcan, and maybe more variables I'm not aware of. I've tried all the CAN speeds. My USB-CAN adapter has an "ACT" LED, I assume this stands for activity. This lights a solid orange/red.

I'm starting to suspect the controller does not send CAN signals at all. The controller was pulled from a G-Wiz/REVAi which did not use the CAN interface, so I would not be surprised if CAN is turned off in the controller. As far as I know, the only way to enable it is to buy the 1313 or 1314, which cost hundreds of dollars. Is this the case?

I'm also looking at the Curtis 840. I still want the data into my own computer, but the 840 points to the fact that the serial connection also can give me the information I want. If this is the route to go, can you guys point me to how I can read and parse the serial data from the Curtis 1236 on a computer?

Thanks :)
 

·
Registered
Joined
·
14 Posts
You can buy an Arduino and a cheap SPI to CAN module and connect it with arduino.
SPI 2 CAN module
A general example to send a NMT message via arduino to curtis to put it into operational state.
C:
#include <SPI.h>
#include <mcp_can.h>

const int spiCSPin = 10;
int ledHIGH    = 1;
int ledLOW     = 0;

MCP_CAN CAN(spiCSPin);

void setup()
{
    Serial.begin(115200);

    while (CAN_OK != CAN.begin(CAN_500KBPS,MCP_8MHz))
    {
        Serial.println("CAN BUS init Failed");
        delay(100);
    }
    Serial.println("CAN BUS Shield Init OK!");
}

unsigned char stmp[2] = {0,0};
 
void loop()
{
  stmp[0]=0x01;//Operational state
  stmp[1]=0x00;//target node ==> set 0x00 for all nodes
  Serial.println("In loop");
  CAN.sendMsgBuf(0x00, 0, 2, stmp);// COB-ID, 0 for standard ID and 1 for extended ID, 2 is the data length , stmp is the data
  delay(120);//heartbeat message rate
}
A general example to send a SDO message via arduino to curtis to retrieve Key Switch Voltage

C:
#include <SPI.h>
#include <mcp_can.h>

const int spiCSPin = 10;

MCP_CAN CAN(spiCSPin);


void recv()
{
  unsigned char len = 0;
  unsigned char buf[8];
  unsigned char a,b,c;
  int a1,b1,c1;
  if(CAN_MSGAVAIL == CAN.checkReceive())
    {
        CAN.readMsgBuf(&len, buf);

        unsigned long canId = CAN.getCanId();

        Serial.println("-----------------------------");
        Serial.print("Data from ID: 0x");
        Serial.println(canId, HEX);

        for(int i = 0; i<len; i++)
        {
            Serial.print(buf[i]);
            Serial.print("\t");
            a = buf[4];
            b = buf[5];
         

         }
        a1 = (int)a;
        b1 = (int)b;
        c1 = b1 << 8 | a1 ;
        Serial.print("\nKey_switch_voltage:");
        Serial.println(c1);
        Serial.println();
    }
}

void setup()
{
    Serial.begin(115200);

    while (CAN_OK != CAN.begin(CAN_500KBPS,MCP_8MHz))
    {
        Serial.println("CAN BUS init Failed");
        delay(100);
    }
    Serial.println("CAN BUS Shield Init OK!");
}

unsigned char stmp[8] = {0,0,0,0,0,0,0,0};
 
void loop()
{
  stmp[0]= 0x40; //Read Dictionary Object
  stmp[1]= 0x4D;//second eight bytes of hex value(sub index)
  stmp[2]= 0x32;// first eight bytes of hex value (index)
  stmp[3]= 0x00;
  stmp[4]= 0x00;
  stmp[5]= 0x00;
  stmp[6]= 0x00;
  stmp[7]= 0x00;
  Serial.println("In loop");
  CAN.sendMsgBuf(0x626, 0, 8, stmp);//... , 0 for standard ID and 1 for extended ID, ... , stmp is the data
  delay(100);// timeout
  recv();
}
 
21 - 22 of 22 Posts
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