DIY Electric Car Forums banner
1 - 20 of 22 Posts

·
Registered
Joined
·
6 Posts
Discussion Starter · #1 ·
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!
 

·
Registered
Joined
·
4,064 Posts
Start looking into CAN. There's some info on google on CAN for the Curtis inverters if you look around. They use CAN open, so you'd have to do a lot of protocol implementation. Not much is available over Serial other than what displays on their cheapo little display.
 

·
Registered
Joined
·
187 Posts
CAN is a automotive bidirectional address-based bus. Each "frame" has an ID, length, and data bytes.
A Pi can use CAN if you add an MCP2515 module (cheap on Amazon etc.).
Python works well for CAN since there are lots of libraries you can use.

Software side:
Send an NMT message to put the inverter into state 5. Repeat at least every 100ms.
ID:0x000
DLC:2
Data: 0x01 0x00

Response will be sent with ID=0x700 + node ID. You need the Node ID for the next step (remember it's all in hex).

Then send PDO1 and PDO2 requests.
PDO1
ID:0x200
DLC:8
Data: Whatever

PDO2
ID:0x300
DLC:8
Data: Whatever

Have fun decoding the responses :)


Hardware:
[quick-guide] CAN bus on raspberry pi with MCP2515 - Raspberry Pi Forums

This sets up the MCP2515 CAN interface as a network connection, then you can use can-utils to see what's going on.

Try the python-can library on your Pi. It should work well.

-Isaac

EDIT Also check this thread out: Curtis 1234 and CAN bus
 

·
Registered
Joined
·
4,064 Posts
Yes that HAT should work.

Concerning the CAN messaging, I think there's some if you search online for Curtis + 1236 or 1238 + Canopen. I recall there being some things people have done with RPi already.
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #8 ·
While I'm waiting for the HAT to arrive, I'd like to make sure I understand the wiring between it and the controller. Page 22 of the controller manual is about CAN wiring.
1: Is it correct to connect pin 21 (CAN Term H) and 34 (CAN Term L) on the controller together with short wires? If yes, what does this accomplish? Enabling CAN?
2: Pin 23 (CANH) and 35 (CANL) correspond nicely with the CANH and CANL shown on the HAT here:
119982

Just connect pin 23 to CANH and 35 to CANL? Anything else I should connect?

Thanks for all the help :)
 

·
Registered
Joined
·
187 Posts
1. Yes, that is correct. Connecting those will enable the CAN termination resistors. I don't remember if I did that but my CAN adapter was terminated already.
Termination resistors place a load on the drivers -- I'm not really sure why this is necessary, it probably has something to do with making the signals cleaner (since there's a current flowing). It is definitely needed though, if you skip resistors the signals look really nasty and reflect around inside the wires and also don't work.

2. Correct. Also hook the CAN_GND_ISO to the Curtis ground :)

-Isaac
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #10 ·
Hello again!
There has been some progress. I could not make the HAT work, so I also bought a USB CAN adapter. I like this better, as I can try it out on my laptop (also with Linux) before involving the Pi.

We had some wiring to do. The AmpSeal plug for the controller did not have any CAN wires, so I had to order the pins, wire them up and get them in there according to the manual. A lot of time spent on waiting for packages,

Today, we started actually trying to read something from the CANL and CANH. But first, we checked the resistance of the CANL and CANH from the controller when everything was powered off, 120 Ohms. And when connected to the USB CAN adapter, 60 Ohms. so far so good. We then turned the rig on and measured the voltage across ground (battery minus) and CANH. 2.8V. And across ground and CANL, 2.1V. We used a (high quality) voltmeter, so these would be averages. But since it's not 2.5V, it's a good sign right? 2.5V would mean no messages, if I understand the canbus correctly.

So I connected the adapter and I think the problem lies here. I struggle to find a guide specific to the adapter I purchased, so I can only try various guides. Most of them say roughly the same things. I tried this one. I could skip step 2, the rest went through without errors. But the candump said nothing, and ifconfig said no packets were received. This is where I'm stuck. I tried a few CAN speeds, still nothing.

What should I try next?
 

·
Registered
Joined
·
14 Posts
CAN is a automotive bidirectional address-based bus. Each "frame" has an ID, length, and data bytes.
A Pi can use CAN if you add an MCP2515 module (cheap on Amazon etc.).
Python works well for CAN since there are lots of libraries you can use.

Software side:
Send an NMT message to put the inverter into state 5. Repeat at least every 100ms.
ID:0x000
DLC:2
Data: 0x01 0x00

Response will be sent with ID=0x700 + node ID. You need the Node ID for the next step (remember it's all in hex).

Then send PDO1 and PDO2 requests.
PDO1
ID:0x200
DLC:8
Data: Whatever

PDO2
ID:0x300
DLC:8
Data: Whatever

Have fun decoding the responses :)


Hardware:
[quick-guide] CAN bus on raspberry pi with MCP2515 - Raspberry Pi Forums

This sets up the MCP2515 CAN interface as a network connection, then you can use can-utils to see what's going on.

Try the python-can library on your Pi. It should work well.

-Isaac

EDIT Also check this thread out: Curtis 1234 and CAN bus
Sir, @Isaac97
I have the hardware setup ready!
I also tested the CAN communication between RPi and arduino which works fine!!
I used CAN python in Pi and seedstudio mcp2515 library in arduino.
Now for connecting Pi to curtis do I need to use the python library called canopen?
Do I need to write VCL code for curtis?
Can you please explain how do I recieve data in RPi?
Thank you
 

·
Registered
Joined
·
187 Posts
Fortunately, VCL is unnecessary.
Python canopen is not necessary either - I am not familiar with it, but it might make the job easier.
You should find some documentation on the CANOpen protocol and learn how to send a NMT message to all nodes. That will tell you which address to use for the next few steps.

-Isaac
 

·
Registered
Joined
·
14 Posts
Fortunately, VCL is unnecessary.
Python canopen is not necessary either - I am not familiar with it, but it might make the job easier.
You should find some documentation on the CANOpen protocol and learn how to send a NMT message to all nodes. That will tell you which address to use for the next few steps.

-Isaac
Thank you so much sir, where can I find resources regarding sending nmt messages to nodes and finding out address? Is there any documentation from curtis regarding the same? Now I tried to scan nodes and found one of the node being successfully scanned and printed by python canopen. How do I proceed?
 

·
Registered
Joined
·
14 Posts
Hi sir , @Isaac97
Thank you so much for this very useful link.
I wanted to clarify some doubts regarding process data objects.
I will set the NMT function of the curtis to be always operational as only then my node (curtis) will accept a PDO message.
So if I consider RPi as server and curtis as a client , Should I send a Transmit PDO or a Recieve PDO from RPi?
I also checked with curtis datasheet which has both transmit and recieve PDO indexes.
Assuming I am sending a Recieve PDO from RPi , will the curtis be automatically configured to send back a Transmit PDO?
Thank you
 

·
Registered
Joined
·
187 Posts
I don't quite remember, try them both maybe? :)
The request I remember using was 0x200 + node ID for PDO1.
-Isaac
 

·
Registered
Joined
·
14 Posts
I don't quite remember, try them both maybe? :)
The request I remember using was 0x200 + node ID for PDO1.
-Isaac
Just to confirm that you didn't have to do anything with respect to VCL , you just sent data from a device to curtis and curtis responded to you back!
Thank you so much sir
 
1 - 20 of 22 Posts
Top