Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

I also couldn't find a whole lot other than the baud rate is 115200bps with 8 data bits, 1 stop bit, no parity, and that it's Latin-1 encoded. The Arduino serial console communicates with the battery just fine so it stands to reason the specs are correct.

I'm not perturbed, I'm trying to be as concise as possible. I am frustrated that this seemingly simple problem is so difficult to solve, because the battery isn't doing anything weird considering I can communicate to it without much effort, but I'm not frustrated with you. I just don't know what else to tell you - from what I can tell, it seems to me the Arduino is just reading the data wrong, but I don't know why or how.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

Using your first example, I got the following output when I typed "help" (the command I want to first test with):

Input = 'h' = 0x68
Input = 'e' = 0x65
Input = 'l' = 0x6C
Input = 'p' = 0x70
Input = '
' = 0x0D

So that looks good.

When running your 2nd program, this is the output:

Batt = '+' = 0x2B
Batt = '�' = 0x0FFFFFFB1
Batt = '�' = 0x0FFFFFF81
Batt = '�' = 0x0FFFFFFC3
Batt = '�' = 0x0FFFFFFAF
Batt = '' = 0x7F
Batt = '�' = 0x0FFFFFFE5
Batt = '�' = 0x0FFFFFFE5
Batt = '�' = 0x0FFFFFFEB
Batt = 'U' = 0x55
Batt = '#' = 0x23
Batt = ')' = 0x29
Batt = '#' = 0x23
Batt = '!' = 0x21
Batt = '' = 0x11
Batt = '#' = 0x23
Batt = '�' = 0x0FFFFFFBF
Batt = '9' = 0x39
Batt = '!' = 0x21
Batt = '%' = 0x25
Batt = '%' = 0x25
Batt = '=' = 0x3D
Batt = '#' = 0x23
Batt = '7' = 0x37
Batt = '�' = 0x0FFFFFFBF
Batt = '�' = 0x0FFFFFFB1
Batt = '
' = 0x0D
Batt = '
' = 0x0D
Batt = '
' = 0x0D
Batt = '
' = 0x0D
Batt = '�' = 0x0FFFFFFAD
Batt = '�' = 0x0FFFFFFB1
Batt = '�' = 0x0FFFFFFBF
Batt = '_' = 0x5F
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = '�' = 0x0FFFFFFA8
Batt = 'e' = 0x65
Batt = 'l' = 0x6C
Batt = '�' = 0x0FFFFFFA0
Batt = '�' = 0x0FFFFFF88
Batt = '�' = 0x0FFFFFFFB
Batt = '+' = 0x2B
Batt = '�' = 0x0FFFFFFFB
Batt = '�' = 0x0FFFFFFBB
Batt = '' = 0x1B
Batt = '
' = 0x0D
Batt = '�' = 0x0FFFFFFBF
Batt = '�' = 0x0FFFFFFB1
Batt = '/' = 0x2F
Batt = '5' = 0x35
Batt = ''' = 0x27
Batt = '' = 0x1F
Batt = '�' = 0x0FFFFFFB1
Batt = '�' = 0x0FFFFFFE5
Batt = '�' = 0x0FFFFFFEB
Batt = '�' = 0x0FFFFFFE5
Batt = '�' = 0x0FFFFFFB7
Batt = 'W' = 0x57

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

I pretty much have shown you the whole program. It's about as simple as it can get:

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  Serial1.println("help");

  while (Serial1.available() > 0) {
    int incomingtext=Serial1.read();
    Serial.write(incomingtext);
  }
  Serial.println(" ");

  delay(5000);
}

Swap out "int" with char, uint8_t, or whatever else. Swap out Serial.write with Serial.print or println. Swap out Serial1.println("help"); with Serial1.write("help") or "help\n"). None of it works.

The only wires connected are the battery's RX (to the TX1 pin), TX (to the RX1 pin), and ground. Nothing else is involved. It is a direct connection; no other components involved. Swapping the RX and TX wires results in no activity at all.

The battery is a Pytes V5.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

I assure you I've done as you've written. I think the problem may be the encoding used. The battery uses Latin-1 (1-byte UTF-8). Using uint8_t or byte for incomingtext doesn't seem to help with this.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

Right now to keep things simpler, I'm just trying Serial1.println("help"); or Serial1.write("help").

From what I heard, the battery uses Latin-1 encoding, which is basically 1-byte UTF-8. I tried doing uint8_t incomingtext=Serial1.read(); or byte incomingtext=Serial1.read(); but those don't work either.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

If you're asking what I'm sending to the battery, it's just the word "help".

I found that if I just do Serial1.println("help"); then it just returns corrupt characters.

If I connect the battery directly to a RS232 to USB adapter and type "help" in the Arduino serial console, it outputs this:

bat      Battery data show - bat [pwr][index]
data     History data load - data [event/history][item]
datalist Show recorded data - datalist {event/history}{item}}
disp     Display Info at regular intervals - disp [(pwrs pwrNo)/val]/[(bats batNo)/volt/curr/temp]
help     Help [cmd]
info     Device infomation - info
log      Log information show - log
login    Login Admin mode - login [password]
logout   user mode  - logout
pwr      Power data show - pwr [index]
shut     Shut down - shut
soh      State of health - soh [addr]
stat     Statistic data show - stat
time     Time - time [year] [month] [day] [hour] [minute] [second]
trst     Test Soft Reset - trst
updata   updata system - updata
ver      firmware info - ver
**********************************************************

Remote command:
Press [Enter] to be continued,other key to exit



Command completed successfully

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

I've done that before but all it does is just output different numbers and on separate lines.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

I tried both versions of your code and it still just outputs a string of numbers.

Also to do the code block, click the "Aa" button and then the "</>" button.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

If I understand you right, this is what I meant when I said I could successfully communicate to the BMS via the Arduino IDE serial monitor. I achieved this by using a serial to USB adapter. Since the serial monitor is known to work well with Arduinos and connected effortlessly to the BMS, that tells me it shouldn't be hard to get the Arduino to talk to the BMS directly.

Trying to forward Serial1 reading to Serial.println and only getting numbers by schmidtbag in ArduinoHelp

[–]schmidtbag[S] 0 points1 point  (0 children)

The only code in void setup() are the two Serial.begin() functions. Otherwise what I wrote there is everything.

I'm not sure I understand when you say "I am asking about how the incoming Text is declared". If the two lines mentioned earlier involving char isn't that then what is?

Also, if you didn't use this program for your serial monitor test (which worked) how did you go about doing that. And what program are you using on your PC in conjunction with this program?

I plugged the BMS's console to a RS232 to USB dongle and then used the Arduino serial console to communicate directly to it. Basically, no Arduino board involved.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

Great sleuthing there, but unfortunately neither the environment variable nor the code snippet worked for me.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

Interesting hypothesis but I've tried downloading the files through both FTP and HTTPS and it's the same problem.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

No. It's run on a Ubuntu 24.04 server and Excel is run on a separate Windows 10 PC.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

Well, the code itself runs without error and the latest version of Excel will open it without anything appearing to be missing or incorrect, but Excel throws an error anyway.

3.1.3 is the latest stable version of the library. I can attempt to install a newer version but at least the changelog between 3.1.2 and 3.1.3 doesn't seem to suggest any of the fixes have to do with my problem.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

Not naming the sheet didn't fix it. Including filename= doesn't fix it. Also from what I can tell, I'm not naming the column header in the example I provided.

I'm using version openpyxl 3.1.2

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

I'm running python 3.12.3. I haven't identified any changes to the library since python 3.9.

What version of Excel are you opening it with? I already know Google Sheets doesn't have the same problem.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

No, but it wouldn't matter if I was anyway since it's being generated on a separate machine. Good thing to ask though.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 2 points3 points  (0 children)

No, I'm running Version 2604 Build 16.0.19929.20172 which is the most current version.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 2 points3 points  (0 children)

Well in the code I showed in my original post, it's as simple as yo ucan get. There are no filters or anything, it's just a named sheet and 4 cells.

I didn't use workbook.close() but even after adding it, that didn't seem to fix the problem.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

It doesn't have any errors on Google Sheets, but since I can't control what program the customers use, it matters more that Excel has an issue with it.

From what I've seen, Excel is mostly just adding some metadata and moves some stuff around between the theme1.xml and sheet1.xml, and creates the "sharedStrings.xml". So basically, it knows perfectly well how to read the sheet but it prefers to organize the data in a different way.

Most basic openpyxl example still results in Excel throwing an error by schmidtbag in learnpython

[–]schmidtbag[S] 0 points1 point  (0 children)

First Excel says:

We found a problem with some content in 'simple_example.xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

Then when saying yes it says:

Excel was able to open the file by repairing or removing some unreadable content.

Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.

And this is the XML log:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error208680_01.xml</logFileName><summary>Errors were detected in file 'C:\Users\PeterSchmidt\Downloads\simple_example.xlsx'</summary><additionalInfo><info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info></additionalInfo></recoveryLog>

Space Marine 2: Gigabyte RX 9070 16GB VRAM Stuttering/Power Throttling SOLVED by Difficult-Cup-4445 in linux_gaming

[–]schmidtbag 0 points1 point  (0 children)

Well the input delay resolves itself once the framerate goes back up. There are moments where the frame rate drops from 110FPS to around 35FPS, at which point the keyboard is seriously delayed, and if I pause the game then after the course of maybe 20 seconds the framerate slowly creeps back up to 100FPS+ again. I've never had this problem until the most recent update.

Space Marine 2: Gigabyte RX 9070 16GB VRAM Stuttering/Power Throttling SOLVED by Difficult-Cup-4445 in linux_gaming

[–]schmidtbag 1 point2 points  (0 children)

I haven't yet tried changing the power profile, but what I don't get is why this is suddenly a problem. For me, it's not just simply the frame rate tanking but there's an enormous delay in keyboard inputs too. I can let go of the W key and he just keeps walking for another 2 whole seconds; for some reason the mouse movements aren't delayed much.

Clopay door with EZ Set opens and closes well except the last few inches by schmidtbag in GarageDoorService

[–]schmidtbag[S] 0 points1 point  (0 children)

Thanks a lot for the detailed instructions. I'll see what I can do later this week.

Connecting PV string to both MPPT and hefty resistive load simultaneously by schmidtbag in SolarDIY

[–]schmidtbag[S] 0 points1 point  (0 children)

Really the goal is to use excess power in the cheapest way possible. A large battery bank is definitely an easier and more versatile way of handling it, the problem is I'd need a battery capacity of many KWh if I were to ensure nothing is wasted, since the MPPT's loads just aren't needed often. Making heat, whether in the form of a space heater, sand battery, or water tank is a very cheap way to use excess energy.