Hi,
I have 4 dead Flatpacks, not opened yet.
jean0, did you ever bring the Flatpack2 back to life with the 2 parts?
Best regards
Bernhard
Hi,
Currently I do not have any pcb to connect, I connect two wires directly on the ELTEK pcb.
Code: Select all
// Eltek Flatpack Permanent Voltage changer, Code By RHO
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>
const int SPI_CS_PIN = 17; // Set CS pin to pin 17
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin for CANBUS shield
void setup() // Initialisation routine
{
pinMode(23, OUTPUT); // Set pin 9 to output (backlight of the LCD)
digitalWrite(23, HIGH); // LED on
delay(250);
digitalWrite(23, LOW);
START_INIT:
if(CAN_OK == CAN.begin(CAN_125KBPS)) // init can bus : baudrate = 125k !!
{
}
else
{
delay(100);
goto START_INIT;
}
unsigned char login[8] = {0x14, 0x49, 0x72, 0x00, 0x31, 0x66, 0x00, 0x00}; //this is the serial number of the Flatpack + 2 [quote=Hayds13 post_id=1418753 time=1539581632 user_id=41294]
Hello Camon,
I can see from previous posts you've checked the serial number is in your code...excellent.
Have you tried some basic code that will just get the status from the canbus via Arduino? ie...is it talking? (There are some examples in this thread...but if you need me to repost, let me know).
My PCB breakout board came incorrectly labelled on the canbus pins. you might want to check yours.
My Arduino Leonardo will talk to the flatpack with the terminator connected or disconnected...So I don't think it's that critical.
I have a few flatpacks. All of them (except one) set the voltage correctly. The one that doesn't goes over the set voltage by about 1.7v from memory. So if I set it to maximum, I think it gets upset goes to default. You might want to try and set a lower voltage and see if it works?
[/quote]added bytes of 00 each)
CAN.sendMsgBuf(0x05004804, 1, 8, login); //send message to log in and assign ID=1 (last 04 means ID=1, for ID=2 use 05004808 )
unsigned char setdefaultvolt[5] = {0x2B, 0x15, 0x00, 0x44, 0x16}; //this is the command for setting the default output voltage (Last two bytes, LSB first). 16 80 is the maximum voltage of 57.6 V
CAN.sendMsgBuf(0x05009C02, 1, 5, setdefaultvolt); //send message to set ouput voltage to all Flatpacks connected to the CAN-bus
digitalWrite(23, HIGH);
}
void loop() // main program (LOOP)
{ // nothing to do :)
}
I only see the amber LED light up when I have the jumper connected
Hi I try to change the value of voltage to 57Volts 1644HEX and nothing
I don't have any idea to get the status can you help me?
I measure with the polymeter in the terminals of the aruino leonardo and I measure 60,56 ohmpm_dawn wrote: ↑Oct 15 2018 12:22amHi !
Try to measure the resistance over the bus when both the leonardo and eltek is powered off.
It should be about 60ohms.
If if is lower than that remove the 120 at the Eltek Side.
I only have a resistor at my CAN2USB tool when communicating with the Eltek.
Give that a try.
Regards
/Per
Code: Select all
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>
const int SPI_CS_PIN = 17; // Set CS pin to pin 17
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin for CANBUS shield
void setup() // Initialisation routine
{
pinMode(23, OUTPUT); // Set pin 9 to output (backlight of the LCD)
digitalWrite(23, HIGH); // LED on
delay(250);
digitalWrite(23, LOW);
START_INIT:
if(CAN_OK == CAN.begin(CAN_125KBPS)) // init can bus : baudrate = 125k !!
{
}
else
{
delay(100);
goto START_INIT;
}
// unsigned char login[8] = {0x14, 0x49, 0x72, 0x00, 0x31, 0x66, 0x00, 0x00}; //CAMON this is the serial number of the Flatpack + 2 added bytes of 00 each)
unsigned char login[8] = {0x15, 0x44, 0x71, 0x02, 0x11, 0x66, 0x00, 0x00}; //HB this is the serial number of the Flatpack + 2 added bytes of 00 each)
CAN.sendMsgBuf(0x05004804, 1, 8, login); //send message to log in and assign ID=1 (last 04 means ID=1, for ID=2 use 05004808 )
// unsigned char setdefaultvolt[5] = {0x2B, 0x15, 0x00, 0x44, 0x16}; //???? INCORRECT ??? this is the command for setting the default output voltage (Last two bytes, LSB first). 16 80 is the maximum voltage of 57.6 V
unsigned char setdefaultvolt[5] = {0x29, 0x15, 0x00, 0x9C, 0x13}; // 50.2V
// CAN.sendMsgBuf(0x05009C02, 1, 5, setdefaultvolt); //???? WRONG COMMAND ???? send message to set ouput voltage to all Flatpacks connected to the CAN-bus
CAN.sendMsgBuf(0x05019C00, 1, 5, setdefaultvolt); //send message to set ouput voltage to all Flatpacks connected to the CAN-bus
digitalWrite(23, HIGH);
}
void loop() // main program (LOOP)
{ // nothing to do :)
}
Code: Select all
#include <mcp_can.h>
#include <mcp_can_dfs.h>
#include <SPI.h>
const int SPI_CS_PIN = 17;
MCP_CAN CAN(SPI_CS_PIN); // Set CS pin for CANBUS shield
#define INT32U unsigned char
void setup() // Initialisation routine
{
Serial.begin(115200); // Sets the data rate in bits per second (baud) for serial data transmission to PC.
delay(1000);
START_INIT:
if(CAN_OK == CAN.begin(CAN_125KBPS)) // init can bus : baudrate = 125k !!
{
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;
}
unsigned char stmp3[8] = {0x15, 0x44, 0x71, 0x02, 0x11, 0x66, 0x00, 0x00}; // ***** Serial number
CAN.sendMsgBuf(0x05004804, 1, 8, stmp3); //send message to log in
delay(10);
unsigned char stmp4[8] = {0x14, 0x00, 0x9C, 0x13, 0x9C, 0x13, 0x3E, 0x17}; //this is the command for changing the output voltage 50.2v 14A
CAN.sendMsgBuf(0x05FF4004, 1, 8, stmp4); //send message to set ouput voltage to all chargers connected to the CAN-bus
Serial.print("Output Voltage set to : ");
Serial.println(stmp4[3]*256*0.01+stmp4[2]*0.01);
}
void loop() // main program (LOOP)
{
unsigned char len = 0;
unsigned char buf[8] ;
if(CAN_MSGAVAIL == CAN.checkReceive()) // check if data coming
{
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
INT32U canId = CAN.getCanId(); // read the CAN Id
Serial.print("0"); // leading zero
Serial.print(canId,HEX); // output CAN Id to serial monitor
Serial.print("\t"); // send Tab
for(int i = 0; i<len; i++) // print the data
{
if( buf[i] < 0x10){ Serial.print("0");} Serial.print(buf[i],HEX); // send a leading zero if only one digit
Serial.print(" "); // space to seperate bytes
}
Serial.println();
Serial.print("Temperature = ");
Serial.println(buf[0]); //first byte is temperature in celcius
Serial.print("Current = ");
Serial.println(buf[2]*256*0.1+buf[1]*0.1); // third (msb) and second byte are current in 0.1A (deciamp) calculated to show directly in Amps
Serial.print("OutputVoltage = ");
Serial.println(buf[4]*256*0.01+buf[3]*0.01); // fifth (msb) and fourth byte are voltage in 0.01V (centivolt) calculated to show directly in Volts dc
Serial.print("OutputPower = ");
Serial.println((buf[4]*256*0.01+buf[3]*0.01)*(buf[2]*256*0.1+buf[1]*0.1)); // Power is calculated from output voltage and current. Output is in Watts
Serial.print("InputVoltage = ");
Serial.println(buf[5]); // sixth byte is input voltage in volts ac/dc
//send request for new update
unsigned char stmp3[8] = {0x15, 0x44, 0x71, 0x02, 0x11, 0x66, 0x00, 0x00}; // *** this is the serial number of the unit
CAN.sendMsgBuf(0x05004804, 1, 8, stmp3); //send message to request updated figures and keep being 'logged in' or the charger defaults to 53.5 V
}
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
It works¡¡¡¡¡ wow amazing first I programed to 50.2v and works :O before I programed to maximun value 1680 and it works.
Hi !