a8ksh4 / chonky-pocket

An almost pocket-sized portable computer!
GNU General Public License v3.0
122 stars 3 forks source link

External Slide Switch on AmpRipper 4000 #1

Open alfredone78 opened 8 months ago

alfredone78 commented 8 months ago

Hi! I'm Alfio and I'm creating a project using a Raspberry PI 4 and an AmpRipper 4000.

I noticed your project "chonky-pocket" and i'ts amazing!!!

I'd like to use an external slide switch to turn on the AmpRipper 4000.Please could you tell me how I'd connect this slide switch? In parallel at slide switch onboard of AmpRipper 4000? But...how exactly? Could I use the "EN" pin? How?

This is the slide switch I'll use: https://www.adafruit.com/product/805

Please, could you help me? Thank you!

Regards, Alfio Scuderi

a8ksh4 commented 8 months ago

Hi Alfio, I just checked the board documentation here: https://www.kickstart-design.com/s/AR4-Product-Brief.pdf

EN Input Boost Enable. Function logic control of the MP3424 IC. Drive EN HIGH to enable VOUT. Drive EN LOW to disable VOUT. EN is automatically driven HIGH unless overridden

You should be able to wire the en pin to the middle leg of the switch, and ground to one of the side legs. Then leave the power switch on the amp ripper in the on position and your switch will work to turn it on and off.

Please share your project when you get it working!

alfredone78 commented 8 months ago

Hi Dan,

thank you for your suggestion: it worked!

I have another question. In Python I got voltage and battery percentage using I2C protocol, but I'd like to get as well if the input USB connector is plugged in or not. I know you created the "rpi-integrated-battery-module" but I'd simply like to know if the AmpRipper 4000 is in charge or not.

Please, could you help me? Thank you in advance!

Regards, Alfio Scuderi

a8ksh4 commented 8 months ago

Are you using the adafruit_max1704x.MAX17048 python module?

I used "max17.charge_rate > 0" to detect whither or not a charging cable was plugged in. This worked pretty reliably.

https://github.com/a8ksh4/rpi-integrated-battery-module/blob/main/get_ar4k_voltage.py

alfredone78 commented 8 months ago

Hi Dan,

the problem is the following.

I did step by step what you wrote on https://github.com/a8ksh4/rpi-integrated-battery-module but, at point "3 - Test and install the service", I try to launch "sudo ./battery_update.py", I got the following errors:

insmod: ERROR: could not insert module /home/alfredone78/rpi-integrated-battery-module/integrated_battery.ko: Invalid module format ['SOC_change_alert', 'SOC_low_alert', 'class', 'delattr', 'dict', 'dir', 'doc', 'eq', 'format', 'ge', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_alert_status', '_cell_SOC', '_cell_crate', '_cell_voltage', '_cmd', '_config', '_hibrt_actthr', '_hibrt_hibthr', '_reset_voltage', '_status', '_valrt_max', '_valrt_min', '_vreset', 'active_alert', 'activity_threshold', 'alert_reason', 'cell_percent', 'cell_voltage', 'charge_rate', 'chip_id', 'chip_version', 'comparator_disabled', 'enable_sleep', 'hibernate', 'hibernating', 'hibernation_threshold', 'i2c_device', 'quick_start', 'reset', 'reset_alert', 'reset_voltage', 'sleep', 'voltage_alert_max', 'voltage_alert_min', 'voltage_high_alert', 'voltage_low_alert', 'voltage_reset_alert', 'wake'] Voltage alert minimum = 3.50 V Voltage alert maximum = 4.08 V

Please, could you help me? Thank you in advanvce!

Regards, Alfio Scuderi

a8ksh4 commented 8 months ago

You might need to recompile the module. Remove the existing .ko file, do a make clean, and make. Then try again.

Maybe you did an apt update after you built it last time and got a newer kernel. You'll have to rebuild it any time you get a new kernel from apt update.

alfredone78 commented 8 months ago

Hi Dan,

now it seems to work, but there is another problem.

I'm using the last Raspbian.

After compiling and starting the service (battery_update.service), the file "status.log" updates every 15 seconds (as aspected), but nothing else happens... I don't see any battery icons on taskbar.

If I try to manually add the item "Battery Monitor", I see a simple vertical bar but it is empty. I mean: it is not "connected" to service "battery_update.service".

Do I have to do something else?

Please, could you help me? Thank you!

Regards, Alfio Scuderi

a8ksh4 commented 8 months ago

I never got it working on raspbian... didn't spend too much time on it though. It works on Ubuntu.