$30 off During Our Annual Pro Sale. View Details »

Hardware hacking with PHP via Raspberry Pi

U-Zyn Chua
September 12, 2012

Hardware hacking with PHP via Raspberry Pi

Ever wished you knew Python or C so you can do some electronics projects but couldn't afford the time to pick up the languages? Fret not, if you are familiar with PHP, you can hack hardwares too!

Presented at Singapore PHP User Group Meetup on 12 September 2012.

Code available at https://github.com/uzyn/raspi-gpio-demo.php

U-Zyn Chua

September 12, 2012
Tweet

More Decks by U-Zyn Chua

Other Decks in Programming

Transcript

  1. U-Zyn Chua
    [email protected]

    View Slide

  2. I work at

    View Slide

  3. What is

    View Slide

  4. Why hardware?

    View Slide

  5. PHP
    • Ugly language
    • Hated by hackers
    • Most tutorials in Python, Ruby.
    • Arduino mainly in C

    View Slide

  6. PHP
    • But we love PHP!

    View Slide

  7. PHP
    • But we love PHP!
    • Because it’s like the mother of language, C!
    (excuse)

    View Slide

  8. PHP
    Anyway, we’re most proficient with it!

    View Slide

  9. Hardware
    is not scary

    View Slide

  10. Hardware
    is not scary
    is just I/O

    View Slide

  11. Hardware
    is not scary
    is just I/O
    just like file-handling
    /sys/class/gpio

    View Slide

  12. Pins

    View Slide

  13. GPIO
    is all we care
    (for noobs at least)

    View Slide

  14. GPIO
    is all we care
    (for noobs at least)
    + some basic electronics

    View Slide

  15. GPIO
    WiringPi
    https://github.com/WiringPi/WiringPi
    C-based
    very simple

    View Slide

  16. WiringPi
    gpio mode 1 out
    gpio write 1 1
    gpio write 1 0

    View Slide

  17. WiringPi-PHP
    PHP wrapper for WiringPi
    https://github.com/WiringPi/WiringPi-PHP
    Requires compilation (is it ready?)

    View Slide

  18. PHP-GPIO
    PHP wrapper for /sys/class/gpio
    https://github.com/pickley/PHP-GPIO
    Simple to setup

    View Slide

  19. PHP RasPi GPIO Libs
    • WiringPi-PHP
    • Userland
    • Requires compilation
    • PHP-GPIO
    • Easy to set up
    • root :(

    View Slide

  20. Demo time!
    https://github.com/uzyn/raspi-gpio-demo.php

    View Slide

  21. PHP
    web language
    tons of frameworks + libraries
    scripts
    easy!

    View Slide

  22. PHP + Hardware
    world domination

    View Slide

  23. Ideas?
    U-Zyn Chua
    [email protected]
    twitter.com/uzyn

    View Slide