nrf24l01 Module not Working with Raspberry Pi Pico W - micropython

I can use the nrf24l01 wireless module just fine with a Raspberry Pi Pico, but when I try to compile the same code on the Raspberry Pi Pico W, it fails to recognize the device. I am using this library, and I get this error:
Traceback (most recent call last):
File "<stdin>", line 31, in <module>
File "nrf24l01.py", line 78, in __init__
OSError: nRF24L01+ Hardware not responding
The boards are supposed to have the same footprint, so what is the difference here? How can I use these modules with the Pico W?

Related

Raspberry Pico W network test fails

I just put my hands on RP Pico W to try it out but I hit the issue with the very first wifi test.
Tutorials say to do this:
import network
import socket
from time import sleep
from picozero import pico_temp_sensor, pico_led
import machine
so my pico lib folder looks like this when I imported all required packages:
However when try to run wifi test like this:
def connect():
#Connect to WLAN
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)
while wlan.isconnected() == False:
print('Waiting for connection...')
sleep(1)
ip = wlan.ifconfig()[0]
print(f'Connected on {ip}')
try:
connect()
except KeyboardInterrupt:
machine.reset()
it fails with following error:
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/network.py", line 8, in <module>
File "/lib/socket.py", line 42, in <module>
AttributeError: 'module' object has no attribute 'socket'
>>>
This is whole code, I skipped only ssid and password.
I cannot figure out what exactly is wrong here. I do not have any other files named the same as socket or so.
I took the example from RP foundation pages:
https://projects.raspberrypi.org/en/projects/get-started-pico-w/2

OSError: libmmal.so: cannot open shared object file: No such file or directory while trying to run picamera on Raspbian

I am trying to open camera with the picamera module in my Raspberry pi B+ with has Raspbian 64 bit OS installed in it. I get this error:
Traceback (most recent call last):
File "/home/pi/Documents/hydroponics/scripts/picamera_test.py", line 1, in <module>
from picamera import PiCamera
File "/home/pi/.local/lib/python3.9/site-packages/picamera/__init__.py", line 72, in <module>
from picamera.exc import (
File "/home/pi/.local/lib/python3.9/site-packages/picamera/exc.py", line 41, in <module>
import picamera.mmal as mmal
File "/home/pi/.local/lib/python3.9/site-packages/picamera/mmal.py", line 49, in <module>
_lib = ct.CDLL('libmmal.so')
File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libmmal.so: cannot open shared object file: No such file or directory
The camera is enabled (I tried to capture the camera with opencv and it worked).
I tried sudo rpi-update as well and it says that my firmware is already up to date.
Tried sudo apt update and sudo apt upgrade but none of them solve the above issue.
I tried sudo ldconfig -p | grep mmal as well and it outputs:
libmmal_vc_client.so (libc6) => /opt/vc/lib/libmmal_vc_client.so
libmmal_util.so (libc6) => /opt/vc/lib/libmmal_util.so
libmmal_core.so (libc6) => /opt/vc/lib/libmmal_core.so
libmmal_components.so (libc6) => /opt/vc/lib/libmmal_components.so
libmmal.so (libc6) => /opt/vc/lib/libmmal.so
Any suggestions on what I can do to solve this error? Thanks!
I just found out that picamera is still not supported for Raspbian 64 bit OS.
https://github.com/raspberrypi/firmware/issues/1558#issuecomment-983483179
So we could probably use libcamera (didn't try it yet) or opencv (tried and works fine)

TypeError: object with buffer protocol required - trying to write to SMBus

I'm using a raspberry pi pico to read data from a SHT3x sensor using the I2C protocol. I'm quite new to (micro)python so I used this example. This example is for a regular Raspberry Pi since I didn't find any for the Pico. However, the SMBus library is not found. I assume it is just not available for micropython (I have version 1.17).
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'smbus'
There seems to be only one micropython wrapper for SMBus (as far as I found), this one. When I use this wrapper, the problem I have and don't understand is the following error:
Traceback (most recent call last):
File "<stdin>", line 8, in <module>
File "usmbus.py", line 50, in write_i2c_block_data
TypeError: object with buffer protocol required
Refering to this line function: writeto_mem(addr, register, data) (documentation).
The data that I pass in is as follows
addr = 0x44
register = 0x2C
data = [0x06]
I understood that it has something to do with framebuffer in micropython not being supported, but I don't understand how to fix it. Can someone help me out? Or suggest me other solutions?
If the sensor supports I2C, you should be able to use the builtin MicroPython I2C support.
I also found a library for the SHT3x, by searching on the MicroPython forum.

Google Coral USB Accelerator on Raspbian Lite Buster and Raspberry PI 4

I am following the getting started guide for the Google Coral USB Accelerator and even though I was able to trick the install.sh file to install for RPI4
https://twitter.com/hansamann/status/1154021771554766849
I cannot run the example with the image classification. When I run the sample, I get this:
python3 classify_image.py --model ~/Downloads/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --label ~/Downloads/inat_bird_labels.txt --image ~/Downloads/parrot.jpg
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_edgetpu_cpp_wrapper', [dirname(__file__)])
File "/usr/lib/python3.7/imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_edgetpu_cpp_wrapper'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "classify_image.py", line 19, in <module>
from edgetpu.classification.engine import ClassificationEngine
File "/usr/local/lib/python3.7/dist-packages/edgetpu/classification/engine.py", line 17, in <module>
from edgetpu.basic.basic_engine import BasicEngine
File "/usr/local/lib/python3.7/dist-packages/edgetpu/basic/basic_engine.py", line 15, in <module>
from edgetpu.swig.edgetpu_cpp_wrapper import BasicEngine
File "/usr/local/lib/python3.7/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 28, in <module>
_edgetpu_cpp_wrapper = swig_import_helper()
File "/usr/local/lib/python3.7/dist-packages/edgetpu/swig/edgetpu_cpp_wrapper.py", line 20, in swig_import_helper
import _edgetpu_cpp_wrapper
ModuleNotFoundError: No module named '_edgetpu_cpp_wrapper'
Any idea whay I could try?
I had the same problem but with an older Rpi 3. This is the solution I used. I don't think it's a make or break to complete the project:
$ sudo cp _edgetpu_cpp_wrapper.cpython-35m-arm-linux-gnueabihf.so _edgetpu_cpp_wrapper.cpython-37m-arm-linux-gnueabihf.so
Can you go through : https://github.com/google-coral/edgetpu-platforms ?
This repository holds auxiliary platform-related material related to Google Coral Edge TPU. Here you can find precompiled images, shared libraries and patches for using the USB Edge TPU accelerator on additional platforms to the main supported ones.
For convenience Google has uploaded prebuilt images for Raspberry Pi Zero, Pi 3 and Pi 4. Simply write the image to an sd card and boot up your Pi. The images contain several examples that should work out of the box.

Error when installing scikits.audiolab on Raspberry PI 1

When trying to install scikts.audiolab with pip install scikits.audiolab on my raspberry PI 1 I get the following error:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 248, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 55: ordinal not in range(128)
How can I fix this? I unfortunately don't have much experience with Linux :(