Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Good Chinese BMS review
#61
(09-01-2019, 12:16 PM)3xtr3m3 Wrote: cool thanks
Hi forgot to mention , comandoarecibir is an established variable set to know when we send the command DD A5 04, every 15 secondns send commands 03, 04 and 05 but I only process response of command 04.

This is full on port open function
Code:
port.on("open", function () {
        console.log("open");
     
        port.on("data", function(data1) {
            port.drain(function (error) {});
            var data = Buffer.from(data1);
            var data3 = data.toString('hex');
            var cantidad_datos = data.length;
            console.log("datos recibidos: " + data3);
            var posicion = parseInt(data3.indexOf("dd04"));
            posicion = posicion /2;    
    
            if (comandoarecibir  =="04" && posicion >-1 && cantidad_datos >=35){
                SendDataToInflux("voltajes,pack=1 voltios="+data.readUIntBE(posicion+4, 2)/1000+"\n"+"voltajes,pack=2 voltios="+data.readUIntBE(posicion+6, 2)/1000+"\n"+"voltajes,pack=3 voltios="+data.readUIntBE(posicion+8, 2)/1000+"\n"+"voltajes,pack=4 voltios="+data.readUIntBE(posicion+10, 2)/1000+"\n"+"voltajes,pack=5 voltios="+data.readUIntBE(posicion+12, 2)/1000+"\n"+"voltajes,pack=6 voltios="+data.readUIntBE(posicion+14, 2)/1000+"\n"+"voltajes,pack=7 voltios="+data.readUIntBE(posicion+16, 2)/1000+"\n"+"voltajes,pack=8 voltios="+data.readUIntBE(posicion+18, 2)/1000+"\n"+"voltajes,pack=9 voltios="+data.readUIntBE(posicion+20, 2)/1000+"\n"+"voltajes,pack=10 voltios="+data.readUIntBE(posicion+22, 2)/1000+"\n"+"voltajes,pack=11 voltios="+data.readUIntBE(posicion+24, 2)/1000+"\n"+"voltajes,pack=12 voltios="+data.readUIntBE(posicion+26, 2)/1000+"\n"+"voltajes,pack=13 voltios="+data.readUIntBE(posicion+28, 2)/1000+"\n"+"voltajes,pack=14 voltios="+data.readUIntBE(posicion+30, 2)/1000)
            }
        });
        var buffer = Buffer.from([0xDD, 0xA5, 0x04, 0x00, 0xFF, 0xFC, 0x77]);
        port.write(buffer, function(err, res) {
        if (err) {
            return console.log('Error on write: ', err.message);
        }
        comandoarecibir = "04";
     
        });
     
        setInterval(function () {
            var buffer = Buffer.from([0xDD, 0xA5, 0x03, 0x00, 0xFF, 0xFD, 0x77]);
            comandoarecibir = "03";
            port.write(buffer, function(err, res) {
            if (err) {
                return console.log('Error on write: ', err.message);
            }
            console.log('Mensaje 03');
            });
    
            setTimeout(function() {
                var buffer = Buffer.from([0xDD, 0xA5, 0x04, 0x00, 0xFF, 0xFC, 0x77]);
                comandoarecibir = "04";
                port.write(buffer, function(err, res) {
                    if (err) {
                        return console.log('Error on write: ', err.message);
                    }
                    console.log('Mensaje 04');
                });
            }, 2000);
        
            setTimeout(function() {
                var buffer = Buffer.from([0xDD, 0xA5, 0x05, 0x00, 0xFF, 0xFB, 0x77]);
                comandoarecibir = "05";
                port.write(buffer, function(err, res) {
                    port.drain(function (error) {});
                    if (err) {
                        return console.log('Error on write: ', err.message);
                    }
                    console.log('Mensaje 05');
                });
            }, 4000);
        }, 15000);
    });
Reply
#62
Ooh I like your sample code jesusangel!

I'm not that good so I just used the python json package and just output in json, then use telegraf to import it.

Also another BMS to consider, this one is an active balancer. Unknown serial protocol though. Too bad my current balancer works fine now, but will try in the future. It has what I wanted which was a capability to turn on at a certain differential voltage and to turn on and off the balancer. It looks like a better balancer than mine, with supercaps as the storage. They make a few versions, from 1A to 10A.

1A https://www.aliexpress.com/item/32945565819.html
2A http://s.click.aliexpress.com/e/3a7mTtbK
Reply
#63
(09-01-2019, 12:29 PM)jesusangel Wrote:
(09-01-2019, 12:16 PM)3xtr3m3 Wrote: cool thanks
Hi forgot to mention , comandoarecibir is an established variable set to know when we send the command DD A5 04, every 15 secondns send commands 03, 04 and 05 but I only process response of command 04.

This is full on port open function
Code:
port.on("open", function () {
        console.log("open");
     
        port.on("data", function(data1) {
            port.drain(function (error) {});
            var data = Buffer.from(data1);
            var data3 = data.toString('hex');
            var cantidad_datos = data.length;
            console.log("datos recibidos: " + data3);
            var posicion = parseInt(data3.indexOf("dd04"));
            posicion = posicion /2;    
    
            if (comandoarecibir  =="04" && posicion >-1 && cantidad_datos >=35){
                SendDataToInflux("voltajes,pack=1 voltios="+data.readUIntBE(posicion+4, 2)/1000+"\n"+"voltajes,pack=2 voltios="+data.readUIntBE(posicion+6, 2)/1000+"\n"+"voltajes,pack=3 voltios="+data.readUIntBE(posicion+8, 2)/1000+"\n"+"voltajes,pack=4 voltios="+data.readUIntBE(posicion+10, 2)/1000+"\n"+"voltajes,pack=5 voltios="+data.readUIntBE(posicion+12, 2)/1000+"\n"+"voltajes,pack=6 voltios="+data.readUIntBE(posicion+14, 2)/1000+"\n"+"voltajes,pack=7 voltios="+data.readUIntBE(posicion+16, 2)/1000+"\n"+"voltajes,pack=8 voltios="+data.readUIntBE(posicion+18, 2)/1000+"\n"+"voltajes,pack=9 voltios="+data.readUIntBE(posicion+20, 2)/1000+"\n"+"voltajes,pack=10 voltios="+data.readUIntBE(posicion+22, 2)/1000+"\n"+"voltajes,pack=11 voltios="+data.readUIntBE(posicion+24, 2)/1000+"\n"+"voltajes,pack=12 voltios="+data.readUIntBE(posicion+26, 2)/1000+"\n"+"voltajes,pack=13 voltios="+data.readUIntBE(posicion+28, 2)/1000+"\n"+"voltajes,pack=14 voltios="+data.readUIntBE(posicion+30, 2)/1000)
            }
        });
        var buffer = Buffer.from([0xDD, 0xA5, 0x04, 0x00, 0xFF, 0xFC, 0x77]);
        port.write(buffer, function(err, res) {
        if (err) {
            return console.log('Error on write: ', err.message);
        }
        comandoarecibir = "04";
     
        });
     
        setInterval(function () {
            var buffer = Buffer.from([0xDD, 0xA5, 0x03, 0x00, 0xFF, 0xFD, 0x77]);
            comandoarecibir = "03";
            port.write(buffer, function(err, res) {
            if (err) {
                return console.log('Error on write: ', err.message);
            }
            console.log('Mensaje 03');
            });
    
            setTimeout(function() {
                var buffer = Buffer.from([0xDD, 0xA5, 0x04, 0x00, 0xFF, 0xFC, 0x77]);
                comandoarecibir = "04";
                port.write(buffer, function(err, res) {
                    if (err) {
                        return console.log('Error on write: ', err.message);
                    }
                    console.log('Mensaje 04');
                });
            }, 2000);
        
            setTimeout(function() {
                var buffer = Buffer.from([0xDD, 0xA5, 0x05, 0x00, 0xFF, 0xFB, 0x77]);
                comandoarecibir = "05";
                port.write(buffer, function(err, res) {
                    port.drain(function (error) {});
                    if (err) {
                        return console.log('Error on write: ', err.message);
                    }
                    console.log('Mensaje 05');
                });
            }, 4000);
        }, 15000);
    });

Thanks. do you get connectivity problems time to time? like even though bluetooth is connected no data is returned?
Reply
#64
(09-01-2019, 05:33 PM)3xtr3m3 Wrote: Thanks. do you get connectivity problems time to time? like even though bluetooth is connected no data is returned?

No, very stable with USB that is what I use, only some trash bytes before data thats why I had to determine the beginning of response with

var posicion = parseInt(data3.indexOf("dd04"));
Reply
#65
The raspberry pi3 onboard bluetooth is a bit unreliable and sometimes unstable, especially used in conjunction with WiFi. All my problems got solved when I disabled it and used a USB bluetooth adapter instead.
Modular PowerShelf using 3D printed packs.  30kWh and growing.
https://secondlifestorage.com/t-AJW22-s-...PowerShelf
Reply
#66
in my case, it turns out that sending one command and wait for response may not work. if i keep writing to bms via bluetooth in regular intervals then bms start responding and stable once it start sending data.

ajw22 likes this post
Reply
#67
(09-03-2019, 08:33 AM)3xtr3m3 Wrote: in my case, it turns out that sending one command and wait for response may not work. if i keep writing to bms via bluetooth in regular intervals then bms start responding and stable once it start sending data.

That's the main symptom of the RaspPi3 bluetooth +WiFi problem.  I also tried to work around by simply keep sending the commands, but eventually (days ~ weeks) it crashes.
Someone suggested that they chose to free up an I/O pin by not using the bluetooth interrupt signal, so when there is too much going on (eg. Wifi), the CPU may sometimes not get to service the bluetooth data, which then gets lost/overwritten by the next data packet.


This is my current display.  A bit more messy, but more data to diagnose issues.
Modular PowerShelf using 3D printed packs.  30kWh and growing.
https://secondlifestorage.com/t-AJW22-s-...PowerShelf
Reply
#68
nice information. i'm using a mini-pc running ubuntu, wifi turned off. may be not responding problem is at bms side though

how do you calculate the max difference?
Reply


Who read this thread?
100 User(s) read this thread:
hbpowerwall (08-08-2019, 01:38 AM), AZ_Tekkie (04-16-2019, 05:09 AM), daromer (09-03-2019, 02:42 PM), Sean (09-01-2019, 08:41 PM), mike (09-03-2019, 11:34 AM), station240 (03-19-2019, 07:09 AM), yenzand (09-10-2019, 06:06 AM), Majorphill (09-02-2019, 06:08 AM), Korishan (09-02-2019, 12:18 AM), A + A (05-16-2019, 06:57 PM), PAF (03-18-2019, 05:37 PM), Franky Beuselinck (05-09-2019, 09:20 AM), Batrium (09-13-2019, 07:29 AM), BobinTN (05-16-2019, 03:00 PM), Frnandu Martiński (06-05-2019, 09:27 AM), Droid126 (03-13-2019, 01:01 PM), jdeadman (09-03-2019, 03:36 AM), wim (08-28-2019, 05:14 AM), melsom (03-29-2019, 11:17 AM), watts-on (08-30-2019, 11:16 AM), Dan Lim (03-31-2019, 07:14 AM), jesusangel (09-03-2019, 04:09 PM), Hanssing (07-22-2019, 03:52 AM), tamkov (04-22-2019, 07:11 PM), Stefaan De Ridder (06-17-2019, 07:56 AM), Igor Maliszewski (03-11-2019, 08:17 PM), Chiptosser (08-30-2019, 12:03 PM), KtB (08-27-2019, 03:07 PM), Geek (09-03-2019, 11:56 PM), Bigfillly (07-27-2019, 09:16 PM), Jon (04-05-2019, 07:48 AM), Ivo Staelens (08-30-2019, 01:19 PM), floydR (04-16-2019, 01:25 AM), Herbi (07-01-2019, 06:22 AM), Grumplestiltskin (05-29-2019, 08:30 AM), SemaJG (03-18-2019, 03:01 PM), DCkiwi (07-02-2019, 08:13 PM), mattclar (03-18-2019, 11:17 AM), cristof (05-09-2019, 02:19 PM), Oz18650 (09-04-2019, 01:41 PM), tocool24 (04-11-2019, 03:58 AM), setite (06-23-2019, 08:30 AM), not2bme (09-01-2019, 12:47 PM), dmallia (07-11-2019, 08:27 AM), CarelHassink (09-01-2019, 07:50 PM), bogptrsn (03-08-2019, 02:52 AM), Jensk (03-07-2019, 10:09 AM), bigblue (04-04-2019, 06:51 PM), Ste Collister (03-07-2019, 12:17 AM), Charly144 (06-03-2019, 10:24 AM), djuro (08-29-2019, 08:09 PM), BaronVonChickenPants (07-17-2019, 05:37 AM), spinningmagnets (03-07-2019, 01:10 AM), Lindsaymac1 (04-29-2019, 07:07 AM), drchips (04-15-2019, 11:24 AM), HughF (09-03-2019, 07:31 PM), Issac (09-04-2019, 02:08 PM), txurdi (05-13-2019, 05:12 PM), gpn (03-07-2019, 05:11 PM), Jimbob01 (09-03-2019, 08:12 AM), Chablis_m (08-27-2019, 09:38 AM), Headrc (09-01-2019, 01:50 PM), kanchana (06-04-2019, 01:09 PM), mbrunton (04-10-2019, 04:58 AM), thanar (05-09-2019, 08:33 AM), rogales141 (09-01-2019, 07:50 AM), Crimp Daddy (08-27-2019, 11:15 PM), jonyjoe505 (05-09-2019, 07:46 PM), Redpacket (09-06-2019, 02:27 PM), Ibiza (09-01-2019, 10:30 AM), Christian Schneider (04-26-2019, 01:12 PM), iomagico (06-17-2019, 07:18 AM), Pyromancy5 (03-28-2019, 06:23 PM), Oliman (08-27-2019, 08:35 PM), SilverNodashi (03-29-2019, 06:03 AM), hyzersauce (03-24-2019, 01:50 PM), dezinger (03-20-2019, 04:18 AM), cadric (07-10-2019, 11:49 AM), philsocal (08-22-2019, 09:51 PM), choncy12 (03-06-2019, 03:51 PM), Bubba (09-06-2019, 01:25 AM), Leo_C (04-15-2019, 02:27 PM), Cherry67 (08-05-2019, 07:27 PM), Walde (05-24-2019, 03:28 PM), Riplash (09-03-2019, 01:31 PM), Gaudi (05-16-2019, 03:53 PM), 100fuegos (06-05-2019, 09:14 PM), tecu81 (03-19-2019, 09:06 PM), edd021 (04-22-2019, 05:13 AM), Jim Jr. (09-02-2019, 01:15 PM), mishok (08-13-2019, 06:41 PM), bukvaahmed@gmail.com (04-09-2019, 07:10 PM), Robaroni (04-10-2019, 05:42 PM), Duswillum (06-04-2019, 08:59 AM), barias (07-23-2019, 06:29 PM), HikingGuy42 (05-17-2019, 07:23 PM), Mikethezipper (04-14-2019, 01:57 AM), michaell (05-12-2019, 07:21 PM), Finihen (03-20-2019, 01:58 PM), tig77 (09-06-2019, 11:15 AM)

Forum Jump:


Users browsing this thread: 1 Guest(s)