TOLDOTECHNIK / buildroot-webkit

Buildroot WebKit fullscreen browser for Raspberry Pi. Suitable for HTML 5 user interfaces or digital signage / kiosk installations. It also can be used as a fullscreen video loop player. Ready to use RPi Zero/W and RPi 3 B SD card images are available.
244 stars 53 forks source link

Rpi zero gpio access #28

Closed ghanjiboy closed 3 years ago

ghanjiboy commented 3 years ago

Hi, first wanted to say thank you, the rpi zero image works great.

I am looking to add a motion sensor to the setup using gpio and not sure what the right way to do that as there isn't any python and the node version doesn't support onoff. Do you have any recommendations?

TOLDOTECHNIK commented 3 years ago

Did you see https://github.com/TOLDOTECHNIK/buildroot-webkit/issues/9?

ghanjiboy commented 3 years ago

I did, but wasnt sure its same response as I am asking about the zero. I was actually able to do this C++ by cross compiling and using wiring PI. So now I can get to the gpio pins. The last part now is about turning off the display - i was looking to use tvservice which just doesnt seem to work - it just hangs. I tried copying a version from rpi3 and also cross compiling. i can get the tvservice to show help info, but not when passing any parameters - it just sits there. Do you have any idea about this or an alternate way to turn the display off/on?

Thanks!

ghanjiboy commented 3 years ago

I was able to solve this. The use case is for a kiosk where if there wasnt any motion, it would disable the screen and enable if there was. I used WiringPi library in a C program with a motion sensor and used the already existing command vcgencmd with parameter display_power to control the screen.

mindnuts commented 3 years ago

@ghanjiboy care to share your work here? i am also interested in such a solution. Its for a waiting room. If there is no movement i would like the Screen to go off after lets say 10 minutes.

ghanjiboy commented 3 years ago

RPiSleepMotion.zip

Find attached some work - here's my setup:

Requirements: WSL and Docker if on windows - or you can run this on a linux box too, just might need some modifications

  1. I used a cross compiler to build the C program - I used Ubuntu on WSL for Windows - thats under the cross-compiler folder - run the build.sh command which will download the docker image from docker hub for dockcross/linux-armv6
  2. 1 should be a one time activity

  3. Then its time to look at the C program itself - its super rudimentary and just is orchestrating vcgencmd - alter as you see fit. Just run the build.sh command which downloads WiringPi, compiles it as a dependency
  4. Once built, copy the executable and libwiringPi.so to the raspberry pi and you should just run the C program