mayanks
November 29, 2023, 10:07am
1
Hello,
I have bought the Trilobot Kit and a RasPi5 8GB. I am facing a the same SN3218 been reported earlier by others.
I have done some steps unique to Pi5 (making a Venv, downloading a few addnl packages etc) and the usual For trilobot incl activating I2C and re-verifying any bent pins.
My detailed note on steps taken are enumerated here:
pimoroni:main
← pimoroni:patch-sn3218-2.0
I bought the Trilobot kit and with that the new Rasberry Pi 5 (as opposed to the… older Rasberry 4).
I have done the following on a fresh OS install on the RasPi5, 64Bit OS.
1) Create a venv. PIP install does not work without this. I used the following code from (https://www.raspberrypi.com/documentation/computers/os.html#python-on-raspberry-pi)
```
$ mkdir my_project
$ cd my_project
$ python -m venv env
$ source env/bin/activate
(env) $
```
2) Install Trilobot:
```
(env) $ pip install trilobot
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting trilobot
Downloading https://www.piwheels.org/simple/trilobot/trilobot-0.0.2-py3-none-any.whl (14 kB)
Collecting sn3218>=2.0.0
Downloading https://www.piwheels.org/simple/sn3218/sn3218-2.0.0-py3-none-any.whl (4.3 kB)
Collecting evdev
Downloading evdev-1.6.1.tar.gz (26 kB)
Preparing metadata (setup.py) ... done
Installing collected packages: evdev, sn3218, trilobot
DEPRECATION: evdev is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for evdev ... done
Successfully installed evdev-1.6.1 sn3218-2.0.0 trilobot-0.0.2
```
3) Activate IO
The command line does not work:
```
(env) $ sudo raspi-config nonint do_i2c 0
DTOVERLAY[warn]: no matching platform found
```
Had to do on the GUI
(env) $ sudo raspi-config
--> Interface options -> I2C -> enable
4) Then I had to clone the Repo to get the examples files.
```
(env) $ git clone https://github.com/pimoroni/trilobot-python
Cloning into 'trilobot-python'...
remote: Enumerating objects: 664, done.
remote: Counting objects: 100% (171/171), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 664 (delta 137), reused 122 (delta 115), pack-reused 493
Receiving objects: 100% (664/664), 136.45 KiB | 2.90 MiB/s, done.
Resolving deltas: 100% (411/411), done.
```
Still get the following error on running the code:
```
(env) $ python flash_underlights.py
Traceback (most recent call last):
File "/home/user/Trilobot/trilobot-python/examples/flash_underlights.py", line 4, in <module>
from trilobot import Trilobot
File "/home/user/Trilobot/env/lib/python3.11/site-packages/trilobot/__init__.py", line 4, in <module>
import sn3218
File "/home/user/Trilobot/env/lib/python3.11/site-packages/sn3218/__init__.py", line 1, in <module>
from smbus import SMBus
ModuleNotFoundError: No module named 'smbus'
```
5) Install SMBus package:
```
(env) $ pip install smbus
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting smbus
Downloading smbus-1.1.post2.tar.gz (104 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 105.0/105.0 kB 416.1 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Installing collected packages: smbus
DEPRECATION: smbus is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for smbus ... done
Successfully installed smbus-1.1.post2
```
Still getting an error:
```
(env) $ python flash_underlights.py
Traceback (most recent call last):
File "/home/user/Trilobot/trilobot-python/examples/flash_underlights.py", line 4, in <module>
from trilobot import Trilobot
File "/home/user/Trilobot/env/lib/python3.11/site-packages/trilobot/__init__.py", line 5, in <module>
import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'
```
6) Install RPi.GPIO
```
(env) $ pip install RPi.GPIO
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting RPi.GPIO
Downloading RPi.GPIO-0.7.1.tar.gz (29 kB)
Preparing metadata (setup.py) ... done
Installing collected packages: RPi.GPIO
DEPRECATION: RPi.GPIO is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for RPi.GPIO ... done
Successfully installed RPi.GPIO-0.7.1
```
Now I am back to the original error / issue.
```
(env) $ python flash_underlights.py
Trilobot Example: Flash Underlights
Traceback (most recent call last):
File "/home/user/Trilobot/trilobot-python/examples/flash_underlights.py", line 20, in <module>
tbot = Trilobot()
^^^^^^^^^^
File "/home/user/Trilobot/env/lib/python3.11/site-packages/trilobot/__init__.py", line 81, in __init__
GPIO.setup(self.BUTTON_A_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
RuntimeError: No access to /dev/mem. Try running as root!
Exception ignored in: <function Trilobot.__del__ at 0x7fff734d2d40>
Traceback (most recent call last):
File "/home/user/Trilobot/env/lib/python3.11/site-packages/trilobot/__init__.py", line 155, in __del__
self.sn3218.disable()
^^^^^^^^^^^
AttributeError: 'Trilobot' object has no attribute 'sn3218'
```
Please advise have been doing this for many days and hitting a roadblock. Thank you.
Exact error being faced is as below:
(env) $ python flash_underlights.py
Trilobot Example: Flash Underlights
Traceback (most recent call last):
File “/home/user/Trilobot/trilobot-python/examples/flash_underlights.py”, line 20, in
tbot = Trilobot()
^^^^^^^^^^
File “/home/user/Trilobot/env/lib/python3.11/site-packages/trilobot/init .py”, line 81, in init
GPIO.setup(self.BUTTON_A_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
RuntimeError: No access to /dev/mem. Try running as root!
Exception ignored in: <function Trilobot.del at 0x7fff734d2d40>
Traceback (most recent call last):
File “/home/user/Trilobot/env/lib/python3.11/site-packages/trilobot/init .py”, line 155, in del
self.sn3218.disable()
^^^^^^^^^^^
AttributeError: ‘Trilobot’ object has no attribute ‘sn3218’
Have been at it for the past few weeks, now I am at a complete dead end. Look forward to any guidance and support.
Thanks.