Go Down

Topic: How to interpret these binary pulses (from EGO battery pack) (Read 876 times) previous topic - next topic

ledroid

I have a 5Ah EGO battery and have been trying to interpret the binary pulses from the data pin on the battery (I have attached a picture of the battery contacts).

When you buy a tool pack (blower, line trimmer etc.) they give you a slow charger and a battery (normally 2.5Ah), I have 3 slow chargers now so one was harvested for the 4 pin connector which is just held in with a plastic bracket and screws.

All the tools have the data pin but not the temperature pin. When the battery is on a running tool the LED on the pack lights up green or red depending on the battery voltage, without the data line connected (like on my electric bike) the LED stays off but you can still draw power no problem.

The battery has an internal 10k pull down on the data line, so I connected ground and data to my Teensy LC board with a 4.7k pull-up to 3V and the LED lit up, after some messing around I created a sketch that reads the data pin and outputs a 700 (High) or 200 (Low) to the serial port so I could see the pulses in the plotter: (See attached plotter images)

Code: [Select]

void setup() {
  Serial.begin(115200);
  pinMode(10,INPUT_PULLUP); // Button
  pinMode(13,OUTPUT); // Pulls up the data pin through 4.7k resistor
  pinMode(14,INPUT); // The data pin
  digitalWrite(13,LOW);
}

void loop() {
  digitalWrite(13,LOW);
  while (!digitalRead(10)) {
    digitalWrite(13,HIGH);
    if (digitalRead(14)) {
      Serial.println(700); // Pin is high
    }
    else {
      Serial.println(200); // pin is low
    }
  }
}


Another sketch was created to measure pulse lengths (on a Teensy LC at 48MHz), below:

Code: [Select]

unsigned long pulseTime = 0;
unsigned long previousTime = 0;
bool pinState = 0;
bool lastPinState = 0;

void setup() {
  Serial.begin(115200);
  pinMode(10,INPUT_PULLUP); // Button
  pinMode(13,OUTPUT); // Pull-up
  pinMode(14,INPUT); // Data pin
  digitalWrite(13,LOW);
}

void loop() {
  digitalWrite(13,LOW);
  while (!digitalRead(10)) {
    digitalWrite(13,HIGH);
    pinState = digitalRead(14);
    if (pinState != lastPinState) {
      pulseTime = micros() - previousTime;
      previousTime += pulseTime;
      Serial.print(lastPinState); Serial.println(pulseTime); // pins the pin state (0/1) then the useconds
      lastPinState = pinState;
    }
  }
}


I'm not exactly sure how the bits are represented here as long and short pulses are both high or low in all combinations.
The LOW start pulse is around 1200us
Long pulses (high or low) are around 600us
Short pulses (high or low) are around 200us
Space between bursts can be 10000us up to 120000us long!

A sample of the code output:

Code: [Select]

14731380 // Button pressed
01207      // Start pulse read as: 0 (pin state) 1207 (us)
1221
0608
1214
0212
1623
0609
1217
0208
1624
0609
1216
0212
1621
0612
1214
0211
1640
0211
1620
0610
1216
0609
1217
0211
1622
0210
1625
0608
1214
0612
1216
0609
1232
0211
1624
0606
1218
0608
1214
0211
1624
0608
1218
0609
1216
0209
1624
0609
1233
0210
1625
0211
1620
0612
1214
0212
1623
0610
1214
0611
1215
0211
1622
0612
1230
0211
1624
0609
1213
0610
1217
0210
1622
0211
1624
0211
1621
0611
1214
0610
1146387
01206
1222
0608
1217
0209
1623
0610
1216
0211
1623
0609
1214
0213
1622
0608
1218
0211
1639
0212
1620
0611
1214
0609
1217
0211
1621
0212
1623
0609
1217
0609
1217
0609
1233
0210
1622
0608
1218
0608
1217
0208
1623
0612
1214
0609
1217
0211
1621
0612
1230
0211
1621
0212
1621
0613
1216
0208
1625
0608
1215
0611
1214
0212
1623
0612
1229
0212
1623
0610
1217
0608
1215
0211
1622
0212
1623
0212
1623
0610
1213
0612
116329
0601
1202
0602
1208
0602
1205
0603
1208
0603
1207
0603
1208
0602
1205
0603
1208
0602
1214
0600
1208
0602
1208
0602
1208
0602
1208
0602
1209
0599
1207
0604
1209
0603
1211
0204
1597
0202
1596
0205
1596
0202
1602
0199
1597
0602
1208
0205
1599
0602
1212
0603
1207
0602
1208
0204
1597
0602
1208
0202
1599
0603
1207
0202
1596
0602
1215
0602
1208
0202
1599
0600
1207
0603
1208
0201
1597
0602
1209
0205
1599
0600
1213
0202
1600
0601
1208
0599
1208
0603
1208
0603
1207
0603
1205
0204
1599
0599
1215
0602
1208
0602
1205
0205
1596
0604
1208
0204
1597
0602
1208
0202
1599
0603
1210
0202
1600
0203
1597
0602
1208
0602
1209
0202
1595
0604
1208
0201
1599
0602
1211
0602
1208
0604
1207
0603
1205
0602
1208
0205
1599
0202
1599
0603
1207
0206
199679
01205
1222
0608
1217
0212
1620
0610
1217
0210
1622
0610
1214
0212
1623
0609
1217
0211
1639
0212
1622
0608
1217
0608
1215
0211
1624
0211
1624
0609
1213
0610
1217
0611
1230
0211
1624
0608
1218
0608
1215
0211
1623
0608
1218
0608
1214
0212
1623
0609
1233
0211
1621
0211
1623
0610
1217
0210
1622
0612
1214
0608
1218
0211
1621
0609
1232
0211
1622
0611
1214
0612
1214
0212
1623
0210
1624
0208
1624
0609
1218
0608


This isn't 1wire, I thought it might be some form of Serial but my attempts ended with garbage every time.
I tried reading up on binary data sending etc but without knowing the magic words I ended up in circles.
If I can get the 1s and 0s worked out I would be able to write some code to translate it into something meaningful (like battery voltage I hope!).

Any help translating would be greatly appreciated.

Go Up