CamJam-EduKit / EduKit3

CamJam EduKit 3 - Robotics
MIT License
154 stars 97 forks source link

How to get motor controller board to work with Pi 5? #36

Open Starman7312 opened 2 months ago

Starman7312 commented 2 months ago

I recently got a pi 5, with AI kit - hoping to use the kit with it to create an AI powered robot. However the motor controller board won’t work. It doesn’t even power up? No lights at all on top (it does still work with pi 4B).

I’m aware that the GPIO pins have been redesigned for pi 5, and are no longer run on chip - however their orientation stayed the same so can this work and if so how?

I tried running robot code and get multiple errors, such as: “warning (from warnings module) : File /us/Lib/python3/dist-packages/gpiozero/devices.py", Line 300 warnings warni PinFactoryFallback: Falling back from Igpio: [Errno 2] No such file or directory

-Lgd-nfy-3*

Traceback (most recent call Last): File "/us/lib/python3/dist-packages/gpiozero/pins/pi.Py", line 411, in pin pin = self-pins[info] KeyError: PinInto(number=21, name='GPIO9' : BOAR0217, 9, GPT09, WA113'1), putow-11,cot-1,ntertaces-frozenset (C'' "uart', 'spi'. 'dpi', '12c, "gpio'})) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/media/henry/USB DISK1/Pi Documents Backup/Documents/Robotic Car Project /Source Code/Robotic Car Code-Py", line 4, in ‹module> robot = CamJamKitRobot() File "/usr/lib/python3/dist-packages/gpiozero/devices.Py", Line 108, in call self = super ().call_(args, kwargs) File "/usr/lib/python3/dist-packages/gpiozero/boards.py", Line 2343, in init Left=Motor ('BOARD21', 'BOARD19', pum=pwm, pin_factory=pin_factory), File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 108, in call Fife/usT/120/python3/1st-packages/gplozero/utput.devtces.py. tine 1197, 1 n Init ('forward _device', PinClass(forward, pin_factory=pin_factory)). File "/usr/lib/python3/dist-packages/gpiozero/devices.py", Line 108, in call self = super (). call(*args, **kwargs) File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py". Line 392, in init super()- init (pin, active_high=active_high, initial_value=None, File "/usr/lib/python3/dist-packages/gpiozero/output_devices.py", line 74, in AnIL super(- Init(pin, pin_factory=pin_factory) File "/usr/11b/python3/dist-packages/gpiozero/mixins-py", line 75, in _init super (). init(*args, kwargs) File "/usr/lib/python3/dist-packages/gpiozero/devices.py". line 553, in _init pin = self, pin_factory-pin(PIn) File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", Line 413, in pin pin = self-pin_class(self, info) File "/usr/Lib/python3/dist-packages/gpiozero/pins/rpigpio.py". Line 101, in - InIT GPIO setup(self, number, GPIO. IN, self. GPIO PULL UPS[self-_pulL]) RuntimeError: Cannot determine SOC peripheral base address Ln: 83 Col: 1 “

I would appreciate help on how to get it to work with Pi 5. Thanks in advance, Henry 😎

IMG_4022

GeekyTim commented 1 month ago

Sorry for the delay. I have been looking at this issue and believe I know the issue and how to fix it. I will respond with the solution very soon.

Starman7312 commented 1 month ago

Thanks @GeekyTim, please keep me posted

GeekyTim commented 1 month ago

I found a similar issue with a different HAT on the Pi 5 when I was using a virtual environment, but not allowing the venv to access the GPIO libraries required by GPIO Zero.

So this issue may depend on if you are using a virtual environment or not, and which version of the OS you are using.

Try creating a venv with:

python3 -m venv CamJam3-venv

And installing libraries with:

./CamJam3-venv/bin/python -m pip install gpiozero ./CamJam3-venv/bin/python -m pip install lgpio

Let me know how that goes. I've not got a spare Pi 5 with accessible GPIO available at the moment.