DIY Electric Car Forums banner

1 - 13 of 13 Posts

·
Registered
Joined
·
262 Posts
Discussion Starter #1
Hello everyone,

Been searching this forum for answers on how to control the TC/Elcon chargers with CAN, especially the new UHF chargers you can get for cheap for the amount of power they put out. I’ve got the spec for the byte structure, and I’ve got some beginner knowledge in sending the CAN data packet with an Arduino microcontroller. Now I read on the net that in CAN, every byte of the 8 bytes of data are in hexadecimal, makes sense. But also when you convert that hexadecimal value you decimal, it cannot exceed 255. But in the CAN spec from TC charger, it says for example the max charging voltage input is formatted at “3021” which would be equivalent to “302.1V”.

So 1. I don’t understand how to fit that large number when a byte can only be up to 255.

2. Check the attached spec, but they also state the max voltage in byte 1 and 2, and they call it the high and low byte. I just don’t know what that means. Like if my charge to voltage is 302.1 and the corresponding value is 3021 that needs to be sent, do I send “30” in byte 1 and “21” in byte two? Obviously those numbers converted into hex..

If anyone has any insight on this, that would be a HUGE help. I’m not a high level programmer, just an amateur. I’m trying to make a simple way to control these chargers so everyone can use it to control them to adjust end voltage and current limit.

Thanks for any help! Check the attached pictures of the CAN byte spec 95580E25-C634-47F7-A87A-C877B2004504_1557058855601.jpeg 0E64DFDA-3F58-4FEB-BC42-6FF41E6278BC_1557058863847.jpeg 0E64DFDA-3F58-4FEB-BC42-6FF41E6278BC_1557058863847.jpeg
 

·
Registered
Joined
·
934 Posts
what you literally do is the following:

lets say 302.1 V, as you said it has an gain of 10 so becomes the decimal 3021.

which is hexadecimal 0BCD, see how i made this 16 bits, now each byte can only contain 8 bits.
You have a high and low section of the 16 bit number that gets put into each of the bytes.

High byte : 0x0B and Low Byte: 0xCD

I cannot really make it any easier then this.
 

·
Registered
Joined
·
1,478 Posts
Re: binary numbers

Your attachments are of poor quality that i can't read them.

do you know how to count in binary (base 2)? Hexadecimal (base 16) is just a different base and format for counting, just as decimal is a number system for counting with base 10. Hexadecimal uses the single digit numbers, 0-9, and the letters A-F, in order to have a compact format of representation.

4 binary bits is called a nibble, and the maximum number you can represent with 4 bits is b1111, which equals the "F" character of Hex or the number 15 in decimal.

8 binary bits make a byte or word of data, which can be represented in hexadecimal by 2 nibbles or characters. b1111_1111 is the maximum number you can represent with 8 bits, which equals "0xFF" in Hex, or 255 in decimal.

16 bits is 2 words or 2 bytes of data, where you can say there is a high byte and a low byte to represent the number, e.g. Hb1111_1111, Lb1111_1111 is the maximum number for 16 bits, which equals 0xFFFF in Hex, or 65535 in decimal.

In binary or hexadecimal you can only count using whole intergers and the smallest interger is the number 1.

So if you want higher resolution of voltage, such as 302.1, you have to use computer math tricks, such as multiply by 10 to get it to a whole number, 302.1 Volts x 10 = 3021.

Now you can represent this as a binary number as
Hb0000_1011, Lb1100_1101, or in hex as
0x0B, 0xCD shown as the High byte, Low byte.

do you understand the hexadecimal format system to represent numbers?

Here's your homework: how to represent 308.3 Volts so the device can understand? Answer in binary and hex.
 

·
Registered
Joined
·
262 Posts
Discussion Starter #7
Thank you both for your replies! This makes MUCH more sense now!!



I will answer in hex as I don't want to try to do too much here and confuse myself..haha..


308.3V where the device could read it in hex with the high byte and low byte would be 0x0C, and 0x0B


At my pack charge to voltage of 141.5V it would be... 0x05, and 0x87


I think I got it now, makes much more sense! Now here's where it still gets a bit tricky for me.. the max allowable charging current setting also has a high and low byte. It has the same 0.1V resolution and "scaling". So if max charging current were to be 58.2A you would need to send a decimal value of 582.



here's where I will probably mess up...
so would the high byte be 0x14 and the low byte be 0x10?


Thanks so much to you both for making that much more clearer for me! Also, please let me know how wrong that second part is..


Note: I am trying to attach the photo again, not sure why quality is so bad
 

Attachments

·
Registered
Joined
·
1,478 Posts
you got the first two correct but failed the last one.

0x1410 is 5136 in decimal-- that would be 513.6 Amps, yikes!
 

·
Registered
Joined
·
262 Posts
Discussion Starter #9
you got the first two correct but failed the last one.

0x1410 is 5136 in decimal-- that would be 513.6 Amps, yikes!

Ahh..you are right!


I redid my math, 582 converted to hex is 0x246! I also checked this with a calculator online so I know it is correct.



But now, how do you split this into a high and low byte? That part doesn't make much sense to me still
 

·
Registered
Joined
·
1,478 Posts
Correct notation means you use all the placeholders until you have mastered the formats.

582 decimal = Hex 0x02 0x46 in Hi byte, Lo bytes, each byte is 8 bits. We went over that earlier, but it didn't take. 0x246 is really zero-two, four-six, not two forty six.

That is why you need to study the binary until you understand what it means and what you are doing. The computer can only understand binary; maybe a program or app uses other formats to make it easier for the humans, but it all goes to 0's and 1's in the end.

go back to the BASEics; what does counting in a BASE mean, base 2, base 8, base 10, base 16, etc. That is how computers count.

Sure it might be math and seem boring, but you have to get educated if you want to know how stuff works.
 

·
Registered
Joined
·
262 Posts
Discussion Starter #11 (Edited)
Correct notation means you use all the placeholders until you have mastered the formats.

582 decimal = Hex 0x02 0x46 in Hi byte, Lo bytes, each byte is 8 bits. We went over that earlier, but it didn't take. 0x246 is really zero-two, four-six, not two forty six.

That is why you need to study the binary until you understand what it means and what you are doing. The computer can only understand binary; maybe a program or app uses other formats to make it easier for the humans, but it all goes to 0's and 1's in the end.

Ohhhhh I see now! Thanks so much!! This makes perfect sense now. The place holder just makes logical sense, can’t believe I didn’t think of that. Anyway, i should be able to send those bytes to the charger using CAN with an Arduino and be able to “reprogram” my own elcon /TC charger. I am hoping to make a little box that will simply do this.

Now that this is starting to finally make sense, I’m going to start studying up on binary as well
 

·
Registered
Joined
·
262 Posts
Discussion Starter #12
Hello everyone,


I hope everyone is doing great! I appreciate everyone's help on this topic, I have definitely learned a lot.


I can now craft a CAN message with arduino and send it out, so I am proud I can do that much, and I understand the TC charger byte structure now as well, but it just isn't working for me.


I have used both transmitting CAN ID's for their chargers, the one from the 1440 protocol and from their 900 something protocol. No luck with either. I used two arduinos and two CAN modules to ensure that the messages were sending as I set the second arduino up as a receiver and that all looked fine. Once it's hooked up to the charger it doesn't work.


My charger is the UHF 6.6kW charger with CAN @250kbps, and when 240VAC is switched on to the charger, 0.4A are flowing, so I think that means the internal processor of the charger is on, and there's probably just a communication error.



At this point, I didn't attach my code because it's short and isn't working anyhow. Does anyone know how to control these chargers via CAN by hand? I just want to set the "charge parameters" and be able to leave it, and didn't want the enable function so I can use the charger for different projects.


If anyone has any way of doing this, or knows how to use an arduino to control it, every ounce of help is greatly appreciated.



Thank you
 

·
Registered
Joined
·
1,148 Posts
I can now craft a CAN message with arduino and send it out, so I am proud I can do that much...
Well done.

My charger is the UHF 6.6kW charger with CAN @250kbps,
I don't know these newer chargers, but know the older ones well.

and there's probably just a communication error.
You probably need to be sending packets continuously. With the older models, if the charger didn't see a packet for 10 seconds, it would go into a comms error mode and flash the LED appropriately.

Does anyone know how to control these chargers via CAN by hand?
You might be able to get some clues from my Windows / Linux code below. It's a really simple command line program, I hope it should be pretty self explanatory. NOTE: this program simply talks to a serial port; it expects a simple interface to talk to one of the old chargers at 2400 bps serial. So you can't use this program directly; just to get ideas. Twelve bytes sent to the comm port in the appropriate format would be like a single 8-byte CAN packet with a CAN ID stuck at the front. I have no idea what the protocol is for these UHF models, but I would guess that it would be similar.

Edit: it seems identical, if the protocol in the first few posts is correct (for the UHF chargers I mean).
 

Attachments

1 - 13 of 13 Posts
Top