Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This will work with DL24 over bluetooth #26

Open
Darthmonkey opened this issue Aug 12, 2024 · 8 comments
Open

This will work with DL24 over bluetooth #26

Darthmonkey opened this issue Aug 12, 2024 · 8 comments

Comments

@Darthmonkey
Copy link

Although clearly designed for PX100, this works with an ATorch DL24 when paired over Bluetooth.
Perhaps the description or title can include that?

@ways
Copy link

ways commented Aug 15, 2024

Although clearly designed for PX100, this works with an ATorch DL24 when paired over Bluetooth. Perhaps the description or title can include that?

How? I'm able to connect via bluetooth, but the app says

swcccv_reset
No instruments found

Ubuntu 22.04

image

Note that I had to switch pandas to latest version, just to get the app to start, thus my versions are

Package Version


async-timeout 4.0.3
contourpy 1.2.1
cycler 0.12.1
fonttools 4.53.1
ifaddr 0.2.0
kiwisolver 1.4.5
matplotlib 3.9.2
numpy 2.0.1
packaging 24.1
pandas 2.2.2
pillow 10.4.0
pip 22.0.2
pyparsing 3.1.2
PyQt5 5.15.11
PyQt5-Qt5 5.15.14
PyQt5_sip 12.15.0
pyserial 3.5
python-dateutil 2.9.0.post0
pytz 2024.1
PyVISA 1.14.1
PyVISA-py 0.7.2
setuptools 59.6.0
six 1.16.0
typing_extensions 4.12.2
tzdata 2024.1
zeroconf 0.132.2

If I don't do that the app doesn't start, and shows:

~/src/Electronic_load_px100$ python main.py
Traceback (most recent call last):
  File "/home/lars/Downloads/src/Electronic_load_px100/main.py", line 6, in <module>
    from data_store import DataStore
  File "/home/lars/Downloads/src/Electronic_load_px100/data_store.py", line 4, in <module>
    from pandas import DataFrame
  File "/home/lars/Downloads/src/Electronic_load_px100/venv/lib/python3.10/site-packages/pandas/__init__.py", line 22, in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev  # pyright: ignore # noqa:F401
  File "/home/lars/Downloads/src/Electronic_load_px100/venv/lib/python3.10/site-packages/pandas/compat/__init__.py", line 18, in <module>
    from pandas.compat.numpy import (
  File "/home/lars/Downloads/src/Electronic_load_px100/venv/lib/python3.10/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
    from pandas.util.version import Version
  File "/home/lars/Downloads/src/Electronic_load_px100/venv/lib/python3.10/site-packages/pandas/util/__init__.py", line 2, in <module>
    from pandas.util._decorators import (  # noqa:F401
  File "/home/lars/Downloads/src/Electronic_load_px100/venv/lib/python3.10/site-packages/pandas/util/_decorators.py", line 14, in <module>
    from pandas._libs.properties import cache_readonly
  File "/home/lars/Downloads/src/Electronic_load_px100/venv/lib/python3.10/site-packages/pandas/_libs/__init__.py", line 13, in <module>
    from pandas._libs.interval import Interval
  File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

That was a lot info in one post...

@misdoro
Copy link
Owner

misdoro commented Aug 19, 2024

🤔 @ways from my experience DL24 can be slow to switch to PX100 protocol, sometimes it silently swallows a few first commands, needing a few seconds or few attempts to start working again.

Can you try re-starting this program second time without changing anything else?

@ways
Copy link

ways commented Aug 19, 2024

After a reboot I'm able to get this:

(venv) lars@tenk:~/src/Electronic_load_px100$ python3 main.py
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Detecting instruments...
common /home/lars home /home/lars sel /home/lars/Downloads
swcccv_reset
ASRL/dev/ttyS0::INSTR
err opening instrument
ASRL/dev/ttyS1::INSTR
err opening instrument
ASRL/dev/ttyS2::INSTR
err opening instrument
ASRL/dev/ttyS3::INSTR
err opening instrument
ASRL/dev/ttyS4::INSTR
err opening instrument
ASRL/dev/ttyS5::INSTR
err opening instrument
ASRL/dev/ttyS6::INSTR
err opening instrument
ASRL/dev/ttyS7::INSTR
err opening instrument
ASRL/dev/ttyS8::INSTR
err opening instrument
ASRL/dev/ttyS9::INSTR
err opening instrument
ASRL/dev/ttyS10::INSTR
err opening instrument
ASRL/dev/ttyS11::INSTR
err opening instrument
ASRL/dev/ttyS12::INSTR
err opening instrument
ASRL/dev/ttyS13::INSTR
err opening instrument
ASRL/dev/ttyS14::INSTR
err opening instrument
ASRL/dev/ttyS15::INSTR
err opening instrument
ASRL/dev/ttyS16::INSTR
err opening instrument
ASRL/dev/ttyS17::INSTR
err opening instrument
ASRL/dev/ttyS18::INSTR
err opening instrument
ASRL/dev/ttyS19::INSTR
err opening instrument
ASRL/dev/ttyS20::INSTR
err opening instrument
ASRL/dev/ttyS21::INSTR
err opening instrument
ASRL/dev/ttyS22::INSTR
err opening instrument
ASRL/dev/ttyS23::INSTR
err opening instrument
ASRL/dev/ttyS24::INSTR
err opening instrument
ASRL/dev/ttyS25::INSTR
err opening instrument
ASRL/dev/ttyS26::INSTR
err opening instrument
ASRL/dev/ttyS27::INSTR
err opening instrument
ASRL/dev/ttyS28::INSTR
err opening instrument
ASRL/dev/ttyS29::INSTR
err opening instrument
ASRL/dev/ttyS30::INSTR
err opening instrument
ASRL/dev/ttyS31::INSTR
err opening instrument
No instruments found
no data

Still no successfull connection. Have checked permissions on /dev/ttyS*.

@Darthmonkey
Copy link
Author

I haven't tried this in Ubuntu, but I did find there are two Bluetooth devices when attempting to connect it in Windows.
They don't both show immediately, so perhaps try variations on:

  1. Remove any existing 'DL24' Bluetooth connected devices.
  2. Reboot the DL24, then attempt to connect to it via Bluetooth, and choose the 'DL24_SPP' (assuming you have the option) after waiting a few seconds for it to show up.
  3. Open Battery tester PX100, and wait for it to connect. Going over this to check my methods, I found it didn't work the first time, so I retried using the same methods, and it worked. BT can be a bit flaky.
    image

@Rootthecause
Copy link

Rootthecause commented Dec 3, 2024

I was using the DL24 with misdoro's px100 code for a while now, but since I updated python/pandas I'm having trouble with internal resistance mesasurement (random missing values and not returning from 0 to the set current) and enableing the load via the "Enabled" button on the GUI. I need to start the test by physically pressing the start button on the load instead. Sometimes the program crashed randomly mid-test.

So I'm currently using the Fork by Jay2k1 https://github.com/Jay2k1/Electronic_load_DL24
Surprisingly it all seems to work even with my updated python/pandas with the added benefit of Power and (internal)Temp logging. Bluethoot connection seems to work better as well: While misdoro's code automatically connected to the load in 2 out of 10 tries on programm start-up, the code by Jay2k1 worked 5 out of 10 times. Could be a fluke, but still.

So I wonder, if the issue is on my side with misdoro's code because I'm using different hardware?

@Darthmonkey
Copy link
Author

For anyone who isn't a developer (probably no one here) Roodthecause's suggestion does work (thanks!). The installation and running instructions on Github are typically woefully inadequate (not a criticism of the developer, simply a statement of all devs). I shall attempt to correct them here - Note this is one of several paths you can take:

  1. Install Python - this very much depends on how you want to install it, simply Google 'install pyton for 'windows','mac',etc.
  2. Open a PowerShell window, and ensure Python is installed correctly py.exe --version should show v3 or higher.
  3. Click the link to the Electronic_load_DL24 github page, and clone it to a folder on your system by using the code below (I'm using C:\scripts as a base folder):
    git clone https://github.com/Jay2k1/Electronic_load_DL24.git 'c:\scripts\DL24LoadTester' --progress
  4. Double click the 'main.py' script in the 'DL24LoadTester' folder. Don't try to run it from the command line, it won't show the GUI.
  5. Create a shortcut to main.py in the same folder, and call it something like 'DL24 Battery Tester', then add it to the start menu, optionally changing the icon first.

To offer a potential answer Rootthecause's question, I suspect it wasn't due to a python update, although I have no basis for that, other than to suggest that it may be more likely a temporary Bluetooth dropout causing crashing and random missing values. I purchased a new-ish V5 BT dongle, and put it on a USB extension cable, running it to the top of a window. This allows me coverage through most of the house, as opposed to some strong and some extremely patchy signal areas.

@Rootthecause
Copy link

Rootthecause commented Dec 4, 2024

@Darthmonkey
Yes, it seems to be a BT dropout. I was able to screenshot the event:
error
But this is still weird, because the load is just ~1 m away from the MacBook. Normally I can get stable BT connections across the house through 3 Walls.

Note to your instructions:
I'm running on macOS (Ventura 13.6). For me it's is pretty much how the dev wrote it in the readme.

  1. connect to the load via BT, find the one saying "DL24_SPP". After the connection is made, it might disconnect on its own after a few seconds (seems to be normal). You can try connect to it again, but it might connect on its own later.
  2. download the files (unpack zip)
  3. open terminal
  4. type cd and drag the folder in the terminal window to get the path -> hit enter
  5. type python main.py Note: Depending on your Python istallation, sometimes python3 is required instead of python
    -> hit enter. The GUI will open.

With some luck, the Programm will automatically connect to the load on program startup. If not, connect to the load again in the BT menu and restart the program (close and type python main.py again or press arrow up for the last command)
Btw. I'm running python 3.10.13

@Abdull
Copy link

Abdull commented Dec 6, 2024

I did the following steps for version https://github.com/misdoro/Electronic_load_px100/tree/be917afdaf9b361c7a3b5b8457e706a63e4c65c8 to work on my system (Debian 12, KDE Wayland, Framework 13 AMD laptop):

# clone project
git clone https://github.com/misdoro/Electronic_load_px100

cd Electronic_load_px100/

# create venv virtual environment
python -m venv .

# activate venv virtual environment
source bin/activate

# set numpy dependency to last (latest?) 1.x version.
# this fixes the numpy 2.x error message ...
#   ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
# ... reported in _this_ issue
#
# see https://stackoverflow.com/a/78641304/923560
# see https://github.com/numpy/numpy/releases/tag/v1.26.4
nano requirements.txt
# change "numpy" to "numpy==1.26.4"

# install requirements
pip install -r requirements.txt

# install pip-psutil. I'm not sure if this is required, but it was suggested to me at "python main.py" start-up by the following warning message:
#   Electronic_load_px100/lib/python3.11/site-packages/pyvisa_py/tcpip.py:409: UserWarning: TCPIP:instr resource discovery is limited to the default interface.Install psutil:
#   pip install psutil if you want to scan all interfaces.
pip install psutil

# provide the DL24 with its own power so its screen turns on. 
# find out the MAC address of bluetooth device "DL24_SPP", e.g. by using a GUI such as toolBLEx.
# The "DL24_SPP" MAC address is different from the "DL24_BLE" MAC address at the highest byte, e.g.
#   DL24_SPP: 4D:E1:C5:E7:9A:AA
#   DL24_BLE: 4C:E1:C5:E7:9A:AA

# in another shell, sudo-rfcomm-connect to the previously identified DL24_SPP MAC address: ...
sudo rfcomm connect hci0 4D:E1:C5:E7:9A:AA

# ... the shell should provide output similar to this:
#   Connected /dev/rfcomm0 to 4D:E1:C5:E7:9A:AA on channel 1
#   Press CTRL-C for hangup
# keep this shell like it this

# in the other shell with the activated venv virtual environment, execute main.py:
python main.py

# if everything works fine, you should see output similar to the following:
#   qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
#   common /home/abdull home /home/abdull sel /home/abdull
#   swcccv_reset
#   Detecting instruments...
#   ASRL/dev/ttyS0::INSTR
#   err opening instrument
#   ASRL/dev/ttyS1::INSTR
#   err opening instrument
#   ASRL/dev/ttyS2::INSTR
#   err opening instrument
#   ASRL/dev/ttyS3::INSTR
#   err opening instrument
#   ASRL/dev/rfcomm0::INSTR
#   SerialInstrument at ASRL/dev/rfcomm0::INSTR
#   probe
#   found PX100
#   2024-12-06 19:01:11.042 time_running=00:01:00 is_on=0.0 v=12.309 i=0.000 Ah=0.02 board_temp=23.0 i_setpoint=0.0 v_setpoint=0.0 timer_setpoint=00:00:00
#   2024-12-06 19:01:11.810 time_running=00:01:00 is_on=0.0 v=12.308 i=0.000 Ah=0.02 board_temp=23.0 i_setpoint=1.4 v_setpoint=0.0 timer_setpoint=00:00:00
#   ...

The GUI should show up, present the currently attached probe's voltage, and should allow controlling the DL24 device:

Screenshot_20241206_190432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants