Argon one v3 power button and fan scripts issue

the 1st script is for the EEPROM settings allowing the RPI5 max 5amps of power. the 2nd script if the Raspberry Pi OS to control the fan and power button functionalities.

We are still updating the scripts for the LIbreElec and should be ready in a week or 2

1 Like

I have the ONE V3 case, and all working, except the fan. I do not want the EEPROM updates - I did them as part of the install. I don’t like rats nest of the main install script - just the fan control, that I will probably tweak.

BTW Raspberry pi OS no longer has a default ‘pi’ user

It is a shame that Argon40 didn’t just use the Pi5 power switch connector, and the standard fan port/control - they just work without 3rd party hacks.

For me ruins an otherwise good case

1 Like

@smesser,

in the meantime you can use the updated ArgonForty Device Configuration Add-on from here:
LibreELEC ArgonForty Device Configuration Add-on

It’s forked from the orginal one (unluckly 3 years unmaintained) and was changed by me to get it to work with LE10/11/12. One user with a Argon One V3 gave me these days enough feedback to make version 0.0.7 work with this new case in combination with LE12 nightly. LE11 should work too with RPi5, but it’s currently untested. Feedback is very welcome.

PS:
If you want to get your fan control test script working with RPi5, you should change this line:
bus.write_byte(address, percent)
to
bus.write_byte_data(address,0x80,percent)

This case seems to have a new firmware and supports dutycyle / control register and so on. → “https://download.argon40.com/scripts/argonregister.py

2 Likes

@HarryH thanks for you efforts. I have tested the change you suggested to my fan script and it does work. I will test the other things as well.

Question what does the parameter 0x80 represent?

Never mind, I just looked at your argonregister.py

Please have a look in the argonregister.py to the constants “ADDR_ARGONONREG_” (line 16 - 23). This is the only source of thruth I currently know. 0x80 = ADDR_ARGONONEREG_DUTYCYCLE. I had to look at the different argon1 scripts to understand the new behavior.

This is the register for PWM value 0 - 100. Older firmware versions used the address 0x1a directly. Now the new firmware accept registers at this address and ignores the old fan control commands.

for example fan always on (100% dutycycle) at CLI: i2cset -y 1 0x1a 0x80 0x64
address: 0x1a
register: 0x80
value: 0x64

There is also a new register 0x86 ADDR_ARGONONEREG_CTRL for the shutdown control. In contrast to the fan control, the old command is apparently still supported here.
If not, use bus.write_byte_data(address,0x86,1) instead of bus.write_byte(address,0xFF)

https://www.waveshare.com/wiki/Raspberry_Pi_Tutorial_Series:_I2C

Beware: Please be careful with the i2cdump command, because it leaves the MCU at Argon One V2 case in undefined state (could be a maintenance mode or it may hang). You must power cut the case, before it reacts normal again.

How to you package up the addon in your branch? Just zip up the src folder?

Currently I don’t have a build process ready. I simply used zip and updated the archive from 0.0.1 already linked in the LibreELEC thread. Alternatively, you can use this as a template:

Testing version 007 (Bond, James Bond)

  1. Fan always on works

  2. Fan set to come on by temp (default temps)
    a. pulses at startup then never comes on again

  3. Fan set to come on at temp (lowest setting 20 degress celsius)
    a. fan pulsed for about one second while disabling the addon
    b. fan pulsed for about one second while enabling the addon
    c. fan pulses for about one second every 20 seconds

  4. Buttons
    a. Pushing button for one second does nothing
    b. Pushing button for two seconds completely shuts down
    c. Pusning button for about 2.5 seconds completely shuts down
    d. Pushing button for 3 seconds completely shuts down
    e. Pushing button for > 5 seconds completely shuts down

    Note: seems no amount of seconds results in a restart as noted in argon.py

Oops Testing mistake.

I thought I set the lowest temp to 20 but it was still 50 so I set it to 20 and the fan comes on.

Are the temps correct?

Any way to add Fahrenheit as an option?

Regarding the temperatures, possibly there is a bug inside of version 0.0.7. Because of that I have posted some minutes ago version 0.0.6d which is Argon One V3 only (because registers support is required).

But it’s normal that the fan is off as long the CPU temperature value (celsius) is below the first threshold. Pulsing of the fan speed also is possible if the reported CPU temperature directly in the near of a threshold. Because of the integrated fan is not a silent version, the most users are fine if the fan only starts if the CPU is starting getting to hot.

The button behavior like tested is okay. There is a different between b.)c.)d.) and e.)

b.) appears to have been long enough to count as a 3 second press.
c.) d.) should be a graceful shutdown (first power offs KODI and after ~ 10 seconds the red LED should be goes off)
e.) cuts the power from RPi without OS shutdown

For Reboot it needs to tap the button twice, shortly after another.

c.).d.) and Reboot works only if the Add-on is installed and working right. Alternatively without the Add-on a script like argononed service can be used.

The kernel source for the CPU temperature is in Celsius. This is the reason for that. If I were experienced enough with KODI Add-on development I would answer: “Yea, no issue”. But currently I must learning additional things to can make it happen.

pushing the button twice close together doesn’t do anything

Then something seems wrong with the communication with the MCU inside the case or the worker thread isn’t running.
Can you please check if these lines are in your /flash/config.txt

dtoverlay=gpio-ir,gpio_pin=23
dtparam=i2c=on
enable_uart=1

I have no RPi5 device to test it and need your feedback if it has really changed with RPi5. It looks like it should configured to:

dtoverlay=gpio-ir,gpio_pin=23
dtparam=i2c=on
dtparam=uart0=on

#dtoverlay=gpio-ir,gpio_pin=18

dtparam=i2c=on
enable_uart=1

dtparam=fan_temp0=47000
dtparam=fan_temp0_hyst=6000
dtparam=fan_temp0_speed=165

dtparam=fan_temp1=52000
dtparam=fan_temp1_hyst=6000
dtparam=fan_temp1_speed=190

dtparam=fan_temp2=57000
dtparam=fan_temp2_hyst=6000
dtparam=fan_temp2_speed=215

dtparam=fan_temp3=61000
dtparam=fan_temp3_hyst=6000
dtparam=fan_temp3_speed=255

I put in the dtparam lines from other stuff I was trying via Google

I tried 23 and double press still does nothing

Still using version 007

FYI the fan on the Argon40 V3 expansion board has a standard 4-pin PWM connector. Just plug it into the RPI board and it will work exactly like the stock fan. I don’t know why they don’t spec it out that way, or wire it up with a pass-through connection.

1 Like

tried version 006d but I am getting exceptions.

No module names smbus line argon.py line 30

2024-02-17 17:46:41.290 T:997 error : Exception in thread
2024-02-17 17:46:41.290 T:997 error : Thread-2 (thread_powerbutton)
2024-02-17 17:46:41.290 T:997 error : :

2024-02-17 17:46:41.290 T:997 error :
2024-02-17 17:46:41.290 T:997 error : Traceback (most recent call last):

2024-02-17 17:46:41.290 T:997 error :
2024-02-17 17:46:41.290 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/pins/pi.py”, line 101, in pin

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error : pin = self.pins[n]
2024-02-17 17:46:41.291 T:997 error :

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 info : Skipped 9 duplicate messages…
2024-02-17 17:46:41.291 T:997 error : ~
2024-02-17 17:46:41.291 T:997 info : Skipped 8 duplicate messages…
2024-02-17 17:46:41.291 T:997 error : ^
2024-02-17 17:46:41.291 T:997 info : Skipped 2 duplicate messages…
2024-02-17 17:46:41.291 T:997 error :

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error : KeyError
2024-02-17 17:46:41.291 T:997 error : :
2024-02-17 17:46:41.291 T:997 error : 4
2024-02-17 17:46:41.291 T:997 error :

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error :

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error : During handling of the above exception, another exception occurred:

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error :

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error : Traceback (most recent call last):

2024-02-17 17:46:41.291 T:997 error :
2024-02-17 17:46:41.291 T:997 error : File “/usr/lib/python3.11/threading.py”, line 1038, in _bootstrap_inner

2024-02-17 17:46:41.292 T:997 error :
2024-02-17 17:46:41.292 T:997 error : File “/usr/lib/python3.11/threading.py”, line 975, in run

2024-02-17 17:46:41.292 T:997 error :
2024-02-17 17:46:41.292 T:997 error : File “/storage/.kodi/addons/script.service.argonforty-device/resources/lib/service.py”, line 15, in thread_powerbutton

2024-02-17 17:46:41.293 T:997 error :
2024-02-17 17:46:41.293 T:997 error :
2024-02-17 17:46:41.293 T:997 error : argon.shutdown_check()
2024-02-17 17:46:41.293 T:997 error :

2024-02-17 17:46:41.293 T:997 error :
2024-02-17 17:46:41.293 T:997 error : File “/storage/.kodi/addons/script.service.argonforty-device/resources/lib/argon.py”, line 62, in shutdown_check

2024-02-17 17:46:41.294 T:997 error :
2024-02-17 17:46:41.294 T:997 error :
2024-02-17 17:46:41.294 T:997 error : btn = Button(shutdown_pin, pull_up = False)
2024-02-17 17:46:41.294 T:997 error :

2024-02-17 17:46:41.294 T:997 error :
2024-02-17 17:46:41.294 T:997 error :
2024-02-17 17:46:41.294 T:997 info : Skipped 9 duplicate messages…
2024-02-17 17:46:41.294 T:997 error : ^
2024-02-17 17:46:41.294 T:997 info : Skipped 36 duplicate messages…
2024-02-17 17:46:41.294 T:997 error :

2024-02-17 17:46:41.294 T:997 error :
2024-02-17 17:46:41.294 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/devices.py”, line 108, in call

2024-02-17 17:46:41.296 T:997 error :
2024-02-17 17:46:41.296 T:997 error :
2024-02-17 17:46:41.296 T:997 error : self = super(GPIOMeta, cls).call(*args, **kwargs)
2024-02-17 17:46:41.296 T:997 error :

2024-02-17 17:46:41.296 T:997 error :
2024-02-17 17:46:41.296 T:997 error :
2024-02-17 17:46:41.296 T:997 info : Skipped 10 duplicate messages…
2024-02-17 17:46:41.296 T:997 error : ^
2024-02-17 17:46:41.296 T:997 info : Skipped 45 duplicate messages…
2024-02-17 17:46:41.296 T:997 error :

2024-02-17 17:46:41.296 T:997 error :
2024-02-17 17:46:41.296 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/input_devices.py”, line 414, in init

2024-02-17 17:46:41.297 T:997 error :
2024-02-17 17:46:41.297 T:997 error :
2024-02-17 17:46:41.297 T:997 error : super(Button, self).init(
2024-02-17 17:46:41.297 T:997 error :

2024-02-17 17:46:41.297 T:997 error :
2024-02-17 17:46:41.297 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/mixins.py”, line 433, in init

2024-02-17 17:46:41.298 T:997 error :
2024-02-17 17:46:41.298 T:997 error :
2024-02-17 17:46:41.298 T:997 error : super(HoldMixin, self).init(*args, **kwargs)
2024-02-17 17:46:41.298 T:997 error :

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/input_devices.py”, line 165, in init

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error : super(DigitalInputDevice, self).init(
2024-02-17 17:46:41.299 T:997 error :

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/mixins.py”, line 218, in init

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error : super(EventsMixin, self).init(*args, **kwargs)
2024-02-17 17:46:41.299 T:997 error :

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/input_devices.py”, line 83, in init

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.299 T:997 error : super(InputDevice, self).init(pin, pin_factory=pin_factory)
2024-02-17 17:46:41.299 T:997 error :

2024-02-17 17:46:41.299 T:997 error :
2024-02-17 17:46:41.300 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/devices.py”, line 549, in init

2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error : pin = self.pin_factory.pin(pin)
2024-02-17 17:46:41.301 T:997 error :

2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 info : Skipped 9 duplicate messages…
2024-02-17 17:46:41.301 T:997 error : ^
2024-02-17 17:46:41.301 T:997 info : Skipped 24 duplicate messages…
2024-02-17 17:46:41.301 T:997 error :

2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/pins/pi.py”, line 103, in pin

2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error : pin = self.pin_class(self, n)
2024-02-17 17:46:41.301 T:997 error :

2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 info : Skipped 9 duplicate messages…
2024-02-17 17:46:41.301 T:997 error : ^
2024-02-17 17:46:41.301 T:997 info : Skipped 22 duplicate messages…
2024-02-17 17:46:41.301 T:997 error :

2024-02-17 17:46:41.301 T:997 error :
2024-02-17 17:46:41.301 T:997 error : File “/storage/.kodi/addons/virtual.rpi-tools/lib/gpiozero/pins/rpigpio.py”, line 111, in init

2024-02-17 17:46:41.302 T:997 error :
2024-02-17 17:46:41.302 T:997 error :
2024-02-17 17:46:41.302 T:997 error : GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[self._pull])
2024-02-17 17:46:41.302 T:997 error :

2024-02-17 17:46:41.302 T:997 error :
2024-02-17 17:46:41.302 T:997 error : RuntimeError
2024-02-17 17:46:41.302 T:997 error : :
2024-02-17 17:46:41.302 T:997 error : Cannot determine SOC peripheral base address
2024-02-17 17:46:41.302 T:997 error :

@smesser
sorry, you are right - I have this overseen. 0.0.6d can’t work with LE 11.x because this version was build against LE12 nightly and the library path within the system-tools Add-on has change from “…/virtual.system-tools/lib” to “…/virtual.system-tools/lib.private”. If you revert that in the argon.py and poweroff.py files of version 0.0.6d, it should work with LE11.

In the meantime I had released version 0.0.8 with a fix against the fan fluctuation.

If you want to use the IR receiver of the Argon One case, you should change “gpio_pin=18” to “gpio_pin=23” and remove the hashtag at this line.

The other parameters you manually set will only work with the origin PWM connector at RPi 5 pcb. If wmorgan is right, probably you should switch the fan connection to that way.

Can you show me that in the picture? I do not have much experience.