Similar in nature to this previous issue #223,
where by flashing the image from AIY help site to a sd card and then running ~/AIY-projects-python/src/examples/voice/assistant_grpc_demo.py the arcade button LEDs remains off/do not turn on; however, if I run ~/AIY-projects-python/src/examples/vision/leds_example.py the arcade button LEDs light up as intended.
If I update the sd card to ensure I have the latest from the AIY project as per the AIY help site, I get the same errors that plagued #223. I believe, a kernel update was pushed to stable channel which is recreating the same issues as #223 with just the standard apt-get update/upgrade commands: the leds-ktd202x driver is gone from /sys/class/leds folder and leds_example.py when run gives the following error
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/leds/ktd202x:led1/device/reset'
Two problems exist:
I am unsure how one can, or if it's possible to, update the deb packages while skipping an update to the kernel.
I followed #223 and tried to rebuild the drivers to no avail. I am unsure where to go from here, my thoughts are that the ~/drivers-raspi/leds may have a role to play, unless the leds-ktd202x driver is deprecated.
following steps below running leds_example.py should light up arcade button on the newly released voice (v2) and vision (v1.2?) kits with rpi zero w.
leds_example.py worked as intended: arcade button lights up and cycles colorrpi-update) update commands from AIY help siteonce the raspberry pi finishes reboot cycle
cd /sys/class/leds, type ls,led0 dir, then leds-ktd202 driver failed to remake and reinstall during kernel update which may be expected (discussed below)cd /usr/src/, type lsleds-ktd202x-1.0 dir should be listed,leds-ktd202x-1.0 dir: sudo cp -r ~/drivers-raspi/leds /usr/src/leds-ktd202x-1.0 go into this newly created folder, run ls, should see thesesudo dkms install leds-ktd202x-1.0sudo rebootcd /sys/class/leds, type ls, should see~/AIY-projects-python/src/examples/vision, type leds_example.pyleds?@TrylN3rr Thank you for reporting this! We need some time to investigate. KTD driver is not deprecated and should still be working after system upgrade.
@dmitriykovalev you're welcome. In fact, it was a great learning experience as I'm fairly new to all this,
learned a bit of driver module management (dkms) and debian pkg creation (dpkg) through it all.
I have the same symptoms. I am a new python/pi user.
I was playing around and not I can't get the led to work when I run cloudspeech.py but it does work when I run leds_example.
I have been paying around a bit so I am not sure what broke things, I ran an update to install VNC (but I do not recall doing an upgrade) and then after that the voice examples were not turning on the led.
Note: As described, I did not have leds-ktd202x-1.0 and I created and installed it per the described process; but, cloudspeech.py still does not work but leds_example does.
@TrylN3rr or @dmitriykovalev can you give me some ideas on how to trace the cause. My AIY is currently broken.
I have played a bit in Python on a couple of other projects and this sort of update/version fragility seems to be inherent to Python.
@markshancock in my solved post, under background subheading point three: the assistant_grpc_demo.py, mult reports of no arcade button light up, so assumed arcade button leds not supposed to work in that demo
I believe, refers to the same issue you鈥檙e having with cloudspeech_demo.py.
As far as I can tell the demos are referencing the on board led of the voice hat (green led), and not the arcade button.
now that you mentioned this I鈥檓 trying to get arcade button leds to work for both assistant_grpc_demo and cloudspeech_demo.
@markshancock Hi, This is how I make Arcade LED works. You can have a try.
@TrylN3rr and @a54144
My perception that cloudspeech_demo.py should control the LED in the Arcade button comes from several YouTube videos that show exactly that behavior.
https://youtu.be/kCfkHkl00gg
https://youtu.be/Y8joFK2O8Es
These seem to be both for V1 rather than the V2 I have. I wonder if something changed?
I also seem to seeing the light come on before; but, that could be a false memory.
After it was pointed out that leds_example.py worked, I looked at and compared the code and noticed that they were using a different class and method. It was on my list to investigate. The whole thing does seem pretty poorly documented. One frustration is that since V2 uses a Pi Zero, you can't use the "OK Google" alert phrase (one of the original intents of the project).
As another data point, I ran a full apt update and upgrade and had the same issue: leds_example.py worked, but they didn't work when I ran assistant_grpc_demo.py.
I looked at @a54144's linked script, but found I that leds had moved below aiy.vision in the version of the code that I have.
The following snippet works for me and can be hacked-in in-place of aiy.voicehat.status_ui
import aiy.vision.leds
WHITE = (0xFF, 0xFF, 0xFF)
leds = aiy.vision.leds.Leds()
leds.update(leds.rgb_on(WHITE))
We released new SD card image with many fixes in debian package scripts. I hope previous issues should be resolved.
I had to do the same thing for the buzzer pwm - following @TrylN3rr instructions above for that module (on the Vision RPI Zero kit).
Confirming: even with most recent SD card image, if you apt-get upgrade, it'll break things due to kernel change.
running this (or some variant of this) will fix it again:
sudo dpkg-reconfigure aiy-board-info aiy-bt-prov-server aiy-cwc-server aiy-dkms aiy-io-mcu-firmware aiy-models aiy-overlay-vision aiy-overlay-voice aiy-projects-python aiy-python-wheels aiy-usb-gadget aiy-vision-dkms aiy-vision-firmware aiy-voice-services aiy-voicebonnet-soundcard-dkms leds-ktd202x-dkms pwm-soft-dkms
Most helpful comment
Solved
following steps below running
leds_example.pyshould light up arcade button on the newly released voice (v2) and vision (v1.2?) kits with rpi zero w.background
the fix
why?
background
leds_example.pyworked as intended: arcade button lights up and cycles color(the assistant_grpc_demo.py, mult reports of no arcade button light up, so assumed arcade button leds not supposed to work in that demo)
rpi-update) update commands from AIY help sitethe fix
once the raspberry pi finishes reboot cycle
cd /sys/class/leds, typels,if only
led0dir, then leds-ktd202 driver failed to remake and reinstall during kernel update which may be expected (discussed below)cd /usr/src/, typelsleds-ktd202x-1.0dir should be listed,if not in dir follow step 3
if in dir skip step 3, go to step 4
leds-ktd202x-1.0dir:sudo cp -r ~/drivers-raspi/leds /usr/src/leds-ktd202x-1.0go into this newly created folder, runls, should see these> dkms.conf leds-ktd202x.c Makefile make.sh
sudo dkms install leds-ktd202x-1.0sudo rebootcd /sys/class/leds, typels, should see> ktd202x:led1 ktd202x:led2 ktd202x:led3 ktd202x:led4
~/AIY-projects-python/src/examples/vision, typeleds_example.pywhy?
leds?orled driver may be deprecated and there was some other way to activate LEDs, but the examples weren't updated to make use of new LED driver?