Forum Index : Electronics : driving via canbus Eltek 2kW Flatpack2 supplies
Contact us to discuss your requirements of flatpack2 48/ he. Our experienced sales team can help you identify the options that best suit your needs.
Page 1 of 5 Posted: 02:55amCopy link to clipboard
poida
Guru
Another project that I need to get going is to develop some custom code and hardwareto control a number of Eltek power supplies.Wiseguy and I have been looking at a problem he has.Commercial products are available that can and do control these suppliesvia canbus. But our needs are special so it means do it yourself.Step 1get some SPI to canbus transceiver boards. Connect one to an Arduino Uno.Note well that canbus transceiver earth/ground needs to be tied to Eltek supply DC output groundstep 2observe data flows.I am stuck at step 2Here is what is on canbus High and low wires. This is output even if thecanbus transceiver is unpowered. I have 200R termination present and when absentthere are spikes in the hi/low or low/hi transitions as well as rounded risetime.So the termination resistors stay.it is 125KHz canbus speed.and the supply spits this particlar data stream out continuouslyHere is the signal. No idea what it means.Anybody here know much about canbus?Is this signal suitable for input into the MCP canbus transceiver chipto be detected correctly and converted to data?wronger than a book full of wrong numbers
Posted: 06:25amCopy link to clipboard
SimpleSafeName
Senior Member
Which Rigol do you have? Some of them with "field upgrade" (google your model) can interpret Canbus directly.
https://www.youtube.com/watch?v=METmiiieV6Y
Copy link to clipboard
poida
Guru
#include <SPI.h>
#include "mcp_can.h"
#include <mcp_can_dfs.h>
unsigned char login[8] = {0x16, 0x36, 0x71, 0x07, 0x03, 0x76, 0x00, 0x00}; //this is for logging into your flatpack. Must use your serial number.
const int SPI_CS_PIN = 10;
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin
#define VOLTAGE
#define CURRENT
uint8_t outset[8] = {CURRENT & 0xff, (CURRENT >> 8) & 0xff, VOLTAGE & 0xFF, (VOLTAGE >> 8) & 0xFF ,VOLTAGE & 0xFF, (VOLTAGE >> 8) & 0xFF ,0x3E, 0x17};
void setup()
{
Serial.begin();
pinMode(3,INPUT);
START_INIT:
if(CAN_OK == CAN.begin(MCP_ANY, CAN_125KBPS, MCP_8MHZ))
{
Serial.println("CAN BUS Shield init ok!");
}
else
{
Serial.println("CAN BUS Shield init fail");
Serial.println("Init CAN BUS Shield again");
delay(100);
goto START_INIT;
}
CAN.setMode(0);
delay(200);
CAN.sendMsgBuf(0x, 1, 8, login); // id = 1 so XX = 04
}
void loop() {
unsigned char len = 0;
unsigned char buf[8] ;
int c=0;
if(CAN_MSGAVAIL == CAN.checkReceive())
{
CAN.readMsgBuf(&len, buf);
uint32_t canId = CAN.getCanId();
Serial.print("0");
Serial.print(canId,HEX);
Serial.print("\t");
for(int i = 0; i<len; i++)
{
if( buf[i] < 0x10){ Serial.print("0");} Serial.print(buf[i],HEX);
Serial.print(" ");
}
Serial.println();
Serial.print("Temperature = ");
Serial.println(buf[0]);
Serial.print("Current = ");
Serial.println(buf[2]*255*0.1+buf[1]*0.1);
Serial.print("OutputVoltage = ");
Serial.println(buf[4]*255*0.01+buf[3]*0.01);
Serial.print("OutputPower = ");
Serial.println((buf[4]*255*0.01+buf[3]*0.01)*(buf[2]*255*0.1+buf[1]*0.1));
Serial.print("InputVoltage = ");
Serial.println(buf[5]);
//send request for new update
CAN.sendMsgBuf(0x, 1, 8, login); // XX = 04
//CAN.sendMsgBuf(0x05FF, 1, 8, outset);
}
}
(etc.)
20 0F 00 C1 12 F3 00 2D
Temperature = 32
Current = 1.50
OutputVoltage = 47.83
OutputPower = 71.74
InputVoltage = 243
(etc.)
I have the DSZ with all options enabled here at home. At work I have a DS with all options.But decoding canbus is no longer needed. I have some code working now that can talk to and listen from the Eltek.I just changed the default output voltage to 48.00VNow to change default current limits...and I getin the serial terminal.I can talk to it!wronger than a book full of wrong numbers
Posted: 07:32amCopy link to clipboard
wiseguy
Guru
Well done Poida !
I surmise that the allowable adjustment for the Elteks is in the (from Memory) 43-54V.
I also seem to recall that for a constant current each communication to the Eltek requires the current information to be sent, however (again this is second hand) for voltage once the value is sent it stays that way when polled until another updated value is sent.
Still reading the forum when I have time, we are finally shifting house to the new address on Tuesday.If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
Copy link to clipboard
wiseguy
Guru
I shall recap on my initial (ambit) requirements for the controller.
A display of the Eltek(s) output current and voltage.
Perhaps the Set Current (I Limit) and Set Voltage, visible when supply is not enabled.
If there are 2 or more Elteks, on power up the software should sniff the comms line ie ping address range and note any replies received.
If there is more than 1 Eltek, assume the outputs are in parallel.
It would be nice if the controller would add the Elteks currents together and display the sum total.
If the current limit is set to say 60A then the controller would divide that by the number of Elteks and set them each to 20A ( ie 3 x 20A = 60A )
I will leave a possible display and how to set values open for the moment to see what suggestions come up as cost effective and not too arduous to program.
I guess if it all gets too hard a 16 x 2 could do the job.
One button for Enable/Off, one button for Amp/Volt and 2 buttons for Up/Down control.
We probably need a way to set their initial address to ie "1", "2", etc
This spec is shooting from the hip - I may have overlooked some basics.....If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
Copy link to clipboard
poida
Guru
The flatpack2 48V 2KW has a output voltage range of 43.5 to 57.6V
I suspect if I command it to go outside this range it will ignore me.
Max current is 41.7A at 48V which is W
I have not been able to set a current limit and see the unit hit the limit and not exceed it. But I can set any voltage and the unit alters output to the new setting.
(assuming it's within the limits..)wronger than a book full of wrong numbers
Copy link to clipboard
SimpleSafeName
Senior Member
poida said I have the DSZ with all options enabled here at home. At work I have a DS with all options.
That's what I have, it is effectively a Z with the upgrade.
https://www.instructables.com/id/How-to-Hack-Upgrade-a-Rigol-DSZ-Digital-Oscill/
poida said I can talk to it!
Excellent!
Edited -03-30 00:19 by SimpleSafeName
Copy link to clipboard
poida
Guru
It's been a while since I worked on this project. I blew 2 canbus to SPI modules, the only 2 I had ($10 each or something.) So I got on to something else that needed doing.(the charge controller)I now have 7 new canbus to SPI modules and it's time to play again.Here is the background info:We can get Eltek 2kW HE power supplies for about $70-80 here in AUSThey are very efficient and have near 1.0 power factor.Input is 240V AC, output 43.5 V to 57.4V with an internal 2kW output limit.There are no user controls. All settings are done via canbus.There is some information available on the canbus protocol.Wiseguy has a need to have 2 or 3 of these PS in parallel with control overoutput voltage & current in total and the individual PS.I was talking with RenewableMark about these things and he wants to use oneas a battery charger for his 48V (ex. forklift) battery for the home solar.Today I want to show progress in establishing a basic understanding of control via canbus.A power supply can be run in constant voltage mode (CV) or constant current mode (CC) or both. I have the Eltek working in both modes now.First CV:The Eltek can only output voltage in the range of 43.5 - 57.4V so there is no pointdirecting it to output voltages outside that range. It continues to run, but will never exceed either ends of the limit.I hacked up an Arduino Uno with output voltage control via a potentiometer and it works surprisingly well. Load is a solar buck converter and the 1 Ohm 3kW bucket of water.The code can set the output voltage of course and it can get the Eltek's operating data too, which includes output voltage and output current.I plot the voltage setpoint, output voltage and output current belowin Blue, Red and Green. There are 500 data points in this graph and data is plottedat about 5 Hz (5 points a second). This gives you an idea how quickly the PS can respond to changes to the setpoint.Vertical scale is 0,15,30,45,60.Output may exceed 2kW for a second but it is quickly brought back to 2kW bythe Eltek's control system.I did some testing to see how the PS operates under CC.Instead of sending a voltage setpoint, I send a current limit to the PS.I had to modify the solar buck converter firmware to simulate a discharged battery.The converter/simulated battery draws maximum power when input voltage is 57V and zero power wheninput is 45V. This simulates a lead acid battery quite well I think and more importantly this load permits the Eltek control system to reduce the output voltageto bring output current down to the setpoint over the entire range of values (0 Amps to 45A)If I used a resistor I would only have a narrow range of power levels where the Eltek could control output current. The simulated battery load is very non-linear but works as it should.I vary the output current setpoint via a pot and we can see the Eltek track the changes.Blue is CURRENT setpoint, Red is output voltage, Green is output current.It appears the CC tracking is a bit slower than CV.The above results show I can control both the output voltage and currentin the manner of a CV/CC power supply which is all we need for both Wiseguy'sand RenewableMark's projects.This is simply a proof of concept.The arduino code is nice and robust. It can run at all times, waiting for the Eltek to power up. Once powered, the Eltek then comes under control of the code.I switch off the Eltek and the code is fine, waiting until the next time the Eltek is running.Looking at the battery charger project:The Eltek's 43.5 to 57.4V seems ideal for sealed Lead acid batteries. For flooded cells I would like a bit higher voltage to permit faster equalization.There is a mismatch between the voltage setpoint and the output voltage as reported by the Eltek.At 57.4V output, the difference is about -0.3V with 0.05V noiseso the output is 0.3V less than the setpoint commanded by the canbus control.This does not change with output current.At 43.5V it is 0.2V less than the commanded setpoint.This difference might be due to manufacturing tolerances?I think I could make a very nice battery charger using the Eltek and the arduino.I imagine an LCD to show the status of the battery and power supply.We program the absorb and float voltages, maybe maximum current, times to runabsorb, maybe a low current limit to automatically switch from absorb to float.The LCD could show charge volts/current/power/amp.hours etc.
Posted: 03:47amCopy link to clipboard
disco4now
Guru
Following with interest. Have order some bits.
Regards
Gerry
Copy link to clipboard
noneyabussiness
Guru
https://endless-sphere.com/forums/viewtopic.php?f=2&t=#p
Ive created a charger from the above info... i also managed to score a proper eltek charge controller, which is yet to be used in anger... scored 9 by fluke for 20 bucks at dump one day ( hen teeth moment), I usually use the modified dc welder for a charger but for 20 bucks !!
Also had 4 48v to 24v eltek high current (35 or 40 amp) psu's as well..
Copy link to clipboard
The company is the world’s best rg supplier. We are your one-stop shop for all needs. Our staff are highly-specialized and will help you find the product you need.
wiseguy
Guru
noneyabussiness said https://endless-sphere.com/forums/viewtopic.php?f=2&t=#p
Thanks for the link noneya a few hours of good reading history with some code examples of the protocol and how they talked to the Elteks with a nano.
The most helpful pages for me were 3, 4 & 12 if you want to save a lot of reading.
I thought I did good when I bought ten brand new Eltek HE's at $50 each, your "dump" catch was excellent.
The Elteks as supplied appear to all be set to a default value of 53.5V.
Whilst a controller can be used to set any output voltage within the allowable range, the units can also have their default voltage reprogrammed to a new target such that when powered up with no can controller connected they will now use the new default voltage value ie 44V or 48V as a stand alone.
If intending to use the can bus and intending to series two or more Elteks, be aware the can interfaces will need to be galvanically isolated as the can bus for each Eltek are referenced to the negative output terminal. I guess that if the first Eltek unit has a can bus directly connected to it along with the nano, when adding another Eltek/s in series with the existing + terminal of the first Eltek, it means only the can bus that communicates to the "upper" unit/s will need isolation.
Peter, the examples noneya linked to may well be examples of how not to write code, but I suspect they might also provide some useful hints and information in the quest to talk to and interpret the information packets flowing back and forth.
Copy link to clipboard
poida
Guru
#include <SPI.h>
#include "mcp_can.h"
#include <mcp_can_dfs.h>
unsigned char login[8] = {0x16, 0x36, 0x71, 0x07, 0x03, 0x76, 0x00, 0x00}; //this is for logging into your flatpack. Must use your serial number.
const int SPI_CS_PIN = 10;
MCP_CAN CAN(SPI_CS_PIN);
#define VOLTAGE
#define CURRENT 450
uint8_t outset[8] = {CURRENT & 0xff, (CURRENT >> 8) & 0xff, VOLTAGE & 0xFF, (VOLTAGE >> 8) & 0xFF ,VOLTAGE & 0xFF, (VOLTAGE >> 8) & 0xFF ,0x3E, 0x17};
volatile int got_cb_data = 0;
unsigned char setdefaultvolt[5] = {0x29, 0x15, 0x00, 0x80, 0x16};
float potvolts;
void setup()
{
Serial.begin();
pinMode(3,INPUT);
pinMode(12,INPUT);
START_INIT:
if(CAN_OK == CAN.begin(MCP_ANY, CAN_125KBPS, MCP_8MHZ))
{
\\ can bus comms OK
}
else
{
Serial.println("CAN BUS Shield init fail");
delay();
goto START_INIT;
}
CAN.setMode(0);
delay(200);
CAN.sendMsgBuf(0x, 1, 8, login); // id = 1 so XX = 04
potvolts = 54.0;
}
void loop() {
unsigned char len = 0;
unsigned char buf[8] ;
int rv;
float a,i,v;
unsigned int ui;
got_cb_data = 0;
rv = CAN.checkReceive();
if(rv == CAN_MSGAVAIL )
{
CAN.readMsgBuf(&len, buf);
uint32_t canId = CAN.getCanId();
if (canId == 0x || canId == 0x)
{
i = buf[2]*255*0.1+buf[1]*0.1;
v = buf[4]*255*0.01+buf[3]*0.01;
Serial.print (potvolts); Serial.print(" ");Serial.print (v); Serial.print(" ");Serial.print(i);Serial.println(" 0 60 ");
}
//send request for new update
CAN.sendMsgBuf(0x, 1, 8, login); // XX = 04
a = analogRead(0)/660.0; // pot is connected to 3.3V so need this scale for 0 - 1 range. 5V pin is used by canbus adaptor
potvolts = 40.0 + 20.0*a; // set demand from 40 to 60V. flatpack has output limits smaller than this range.
if (potvolts > 57.4) potvolts = 57.4;
if (potvolts < 42.7) potvolts = 42.7;
ui = int(potvolts * 100.0);
// make changes to control word with new Vout
outset[2] = outset[4] = ui & 0xff; // low 8 bits of scaled x 100 voltage
outset[3] = outset[5] = (ui >> 8) & 0xff; // high 8 bits
CAN.sendMsgBuf(0x05FF, 1, 8, outset);
}
}
I read the long post on endless-sphere.com before I started playing with the Eltek.Even though there are working code examples posted there I knew I would not learnmuch if I just copied it. I had to write my code from the start to forceinto the thick 'ead the details that sometimes are not apparent from reading code and it's comments.here is the code that runs it in CV mode.I clamp the potentiometer control value to the Eltek output voltage limitsbefore sending it. The control loop executes at about 5 Hz.
Posted: 03:19amCopy link to clipboard
poida
Guru
I received another 48/ HE, identical to the first one used above.It works fine, needing only one change to the above code, wherethe 8 byte login string is constructed. I needed to change it to suitthe new unit's serial number.Now it's time to look at using 2 units.When in, the 2 units share a common ground, tied to the DC output negative.This is good since I need to communicate via canbus to both and so both canbus to SPI modules will work fine with shared 5V supply, common logic grounds etc.I suspect I will have to use a nano plus the canbus module per unit, and then use another microcontroller to supervise the nanos. I am not sure the Arduino canbus software permits multiple instances. Maybe it does, I need to read a few working examples of this.When inone unit will be 50V above the ground of the other.I will need some sort of isolated TTL level transceiver for the SPI bus. And an isolated 5V supply to drive the canbus to spi and iso-trans.Two units means W with voltages from 43V to 114V. This is looking to be a bit of a beast.Also, I bought a Eltek DC-DC converter, 18-75V IN, 53V/25A out.I could not get it work. When powered, the fan runs but zero output.And in the spirit of the EEBLOG (waves to Dave!) I opened the cases up beforeI turned them on.First, the 48/ HEnext is the DC-DC converterI think there was a repair made to it. Whether the repair was successful is an open question.a closeup of the repair. I think things got very hot here.Also, the PCB is 4 layer to my eyes.All the soldering looks as new, except on the 2 common mode choke terminalsand the very average reworked 3 terminal device. Things got hot there and I doubtit got hot during soldering. 99% Tin solder is used throughout so the rework tempswill be high...This area corresponds to the multiple fuse array protecting the output.There are 2 x 3 fuses in parallel under the black plastic box. I wonder if some are blown.Anyway, it only owes me $50 so I will not worry too much.
Posted: 04:58amCopy link to clipboard
disco4now
Guru
Hi @poida,
What CAN library are you using to compile your code. I found a couple of different ones that give the files
#include "mcp_can.h"
#include <mcp_can_dfs.h>
but each is slightly different on a couple of the function definitions.
Regards
Gerry
Copy link to clipboard
poida
Guru
Gerry:
the library is, I think,
CAN by Sandeep Mistry v 0.3.1
I found quite a few can libraries, but when I list what is "installed" on the
imac here at home is the above.
Copy link to clipboard
disco4now
Guru
Hi @Poida,I just received my Flatpack2 48/ HE,What sort of connector did you come up with. I see one made with vero-board on the other forum and also some PCBs made to do the job.RegardsGerry
Posted: 09:53amCopy link to clipboard
poida
Guru
Wiseguy sent me a PCB connector.
The one shown in your post is probably the same sort of thing.
the 3 pins for canbus are sort of isolated.
When using them, the ground needs to be tied to output negative.
And the canbus transciever needs to terminate can-hi and can-low
with a resistor. There seems not to be any termination resistor within
the Eltek's canbus outputs.
Copy link to clipboard
poida
Guru
Added an LCD now.Need to add CV/CC mode switching and some warning and error messages.These may include:3 High Mains4 Low Mains5 High Temp6 Low Temp7 Current LimitThe wiring for my serial LCD is easy to do, took me 10 minutes.and on the other side..
Posted: 12:40amCopy link to clipboard
poida
Guru
The PCBs arrived from Wiseguy.This means it's time to parallel 2 Eltek Flatpack 2kW 48V supplies.The first test is CV, that is, I set the output voltage and let the current go where it pleases.The load is a modified mppt dc-dc converter that presents zero current load at45V and max load at 56.7V input. This makes for about W total load on the converter's output, rapidly bringing the water cooled resistor to a boil.pics or it didn't happen, right?This shows the 2 Elteks and their output voltages and currents.The setpoint is in volts and is used to program both Elteks to output thatvoltage.The display showsEltek PS #1 reports 53.9V and 12.1A on the outputEltek PS #2 reports 54.0V and 12.3AThe canbus wiring has both Elteks parallel their can-high, can-low and can-groundpins, which are then fed into the MCP module.Talking to one or the other PS is done with different canbus ID.No need for two (or more!) MCP modules. The canbus standard permitsmultiple devices on the single bus.This is the display from the dc-dc converter. It shows input voltage and currentas well as output information.It shows 24Amps in at 53.7VThe two PSs are sharing the output.How does it go dynamically?Blue is setpoint voltage.Read and Yellow are output voltages as reported by the PSsGreen and Purple are output currents as reported by the PSsThere are clearly differences in the closed loop control performancewhen tracking a voltage setpoint. This will not be able to be remediedsince it's a function of Eltek firmware.But to me it looks fine. What is a couple of Amps difference in outputgoing to matter?There are good reasons why they do not track in lockstep perfection.1 - different DC output lead lengths2 - different calibration from PS to PS, factory set calibration too.3 - possibly a difference in firmware revision yielding altered PID performance.
Posted: 08:26amCopy link to clipboard
wiseguy
Guru
Excellent results Poida, looks to work a treat !
I have also been considering how to control Elteks in series and it doesnt look easy.
The simplest (?) method I can come up with involves a bastardisation of the can bus.
essentially it is 3 optically isolated can bus transceivers merged to a 1 of 3 or 4 switcher for the Txd & Rxd lines.
The nano selects an address on 2 pins which gates up to 1 of 4 outputs.
ie select can 1 talk to Eltek 1, when transaction complete select can 2 talk to Eltek 2, when transaction complete select can 3 talk to Eltek 3 etc.
Because of the full duplex nature of the can bus and the complex bus arbitration required for multiple can unit comms it doesnt lend itself easily for multiple isolated nodes for talking to Elteks that have elevated voltages when they are connected in series for higher voltages.
What are your (and any one else with any ideas) comments and thoughts on how to achieve comms with series connected Elteks ?
solamahn wrote: 'Oh. I didn't notice the CAN bus with my quick search, sorry. That should be pretty easy. There are plenty of inexpensive CAN to USB adapters available. But the problem is how to talk to the USB. Some might provide a serial interface, and you send it 12 bytes for one CAN message, with the first 4 bytes being the CAN id. Some might provide a DLL that you have to talk through with function calls. The details vary. Or you could use something like an Arduino with a CAN shield as the interface. Or have the Arduino do all or most of the work.Sat, 26 Dec , 22:55
I thought there should be some way to connect a laptop to the can busI thought there should be some way to connect a laptop to the can bus
Oh. I didn't notice the CAN bus with my quick search, sorry. That should be pretty easy. There are plenty of inexpensive CAN to USB adapters available. But the problem is how to talk to the USB. Some might provide a serial interface, and you send it 12 bytes for one CAN message, with the first 4 bytes being the CAN id. Some might provide a DLL that you have to talk through with function calls. The details vary. Or you could use something like an Arduino with a CAN shield as the interface. Or have the Arduino do all or most of the work.The other thing is that you need to know the format of the CAN messages that the charger responds to. That should be documented somewhere.
If you want to learn more, please visit our website flatpack2 rectifier.