Skip to content
Snippets Groups Projects
Select Git revision
  • master default
  • feat/pull_changes
2 results

tv_panel

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Aymeric Bernard authored
    1ddcf010
    History

    Hermod TV Panel

    Installation

    Beginning

    • Create user hermod: (as root or sudo) adduser hermod
    • Put it in the same groups as pi (other than the pi group): groups pi | sed 's/ /,/g', usermod -a -G group1,group2,... hermod
    • Change pi and root passwords
    • sudo apt remove wolfram-engine minecraft-pi
    • sudo apt autoremove
    • sudo apt update && sudo apt upgrade && sudo reboot
    • sudo apt install git vim screen htop xdotool
    • sudo date -s '2018-02-15 2:26:00' if needed (change the date to current date ofc)
    • Generate RSA key ssh-keygen -t rsa -C "hermod.inno@gmail.com" -b 4096 and add it to gitlab
    • Clone project in ~: git clone git@gitlab.viarezo.fr:hermod/tv_panel.git
    • cp front/src/config.template.js front/src/config.js
    • cp server/config.template.js server/config.js
    • Useful links: ln -s ~/tv_panel/scripts/.screenrc ~/, ln -s ~/tv_panel/scripts/.vimrc ~/

    Telegram message on startup to get IP address

    • cp scripts/waitForNetwork /root/scripts/waitForNetwork
    • cp scripts/startup-telegram-message /root/scripts/startup-telegram-message
    • sudo vim /root/scripts/startup-telegram-message to add the token and chat id
    • Add in root crontab (sudo crontab -e):
    @reboot sleep 1 && /root/scripts/waitForNetwork && /root/scripts/startup-telegram-message

    Boot config (only on Pi zeros)

    vim /boot/config.txt to comment out dtparam=audio=on -> #dtparam=audio=on and add

    # Serial
    enable_uart=1
    dtoverlay=pi3-disable-bt

    Reboot

    Download nodejs:

    • wget https://nodejs.org/dist/v10.3.0/node-v10.3.0-linux-armv6l.tar.xz (to adapt to most recent version, for Pi zeros)
    • wget https://nodejs.org/dist/v10.3.0/node-v10.3.0-linux-armv7l.tar.xz (to adapt to most recent version, for Pi 3B+)
    • tar xf node-v10.3.0-linux-armv6l.tar.xz (or armv7l)
    • sudo mv node-v10.3.0-linux-armv6l /usr/lib/nodejs/node-v10 (or armv7l)
    • vim .profile to add:
    # Nodejs
    export NODEJS_HOME=/usr/lib/nodejs/node-v10
    export PATH=$NODEJS_HOME/bin:$PATH

    After reboot or log out - log in, npm install -g yarn pm2

    WS2812

    • Wiring: VCC -> |<diode| -> 5V, GND -> GND, Data -> (resistor ~100 ohm) -> (pin 12 / BCM 18 / PWM0)
    • sudo apt install scons python3-dev swig
    • git clone https://github.com/jgarff/rpi_ws281x.git && cd rpi_ws281x
    • Edit main.c to put good stuff (width height for testing):
    #define WIDTH                   1
    #define HEIGHT                  1
    Make it Python3 compatible:

    In python/neopixel.py file:

    • Add from builtins import range after # Author: Tony DiCola... line (beginning)
    • xrange -> range in lines 33 and 46

    In python/setup.py file, insert 3 lines after line 13:

        url               = 'https://github.com/jgarff/rpi_ws281x/',
        install_requires=[
            'future',
        ],
        py_modules        = ['neopixel'],
    • scons
    • sudo ./test to test
    Python3 installation

    In python folder,

    • python ./setup.py build
    • sudo python ./setup.py install
    Display a status LED without root, and avoid overhead lag

    Back to tv_panel directory

    • cp scripts/statusRGB_listener.py /root/scripts/statusRGB_listener.py
    • Add in root crontab (sudo crontab -e):
    @reboot /usr/bin/python3 /root/scripts/statusRGB_listener.py
    • Reboot or run /usr/bin/python3 /root/scripts/statusRGB_listener.py & as root
    • To display a color for t seconds (float): echo "55ee33 1" > /dev/rgb_pipe

    Disable screen sleeping

    vim .config/lxsession/LXDE-pi/autostart to add

    @xset s noblank
    @xset s off
    @xset -dpms

    RFID reader

    Communicate with the module
    • Wiring: VCC -> 5V, GND -> GND, RX -> TX, TX -> RX
    • In sudo raspi-config, disable serial messages but enable serial interface
    Get and compile libnfc
    wget https://github.com/nfc-tools/libnfc/releases/download/libnfc-1.7.1/libnfc-1.7.1.tar.bz2
    tar xvjf libnfc-1.7.1.tar.bz2
    cd libnfc-1.7.1
    vim examples/nfc-poll.c

    Here you must comment out the bloc near the end of the file that waits for card removing (if not, the stream doesn't end until card removal and this is very impractical).

      // printf("Waiting for card removing...");
      // while (0 == nfc_initiator_target_is_present(pnd, NULL)) {}
      // nfc_perror(pnd, "nfc_initiator_target_is_present");
      // printf("done.\n");

    Exit vim and continue to the compilation:

    ./configure --prefix=/usr --sysconfdir=/etc
    make
    sudo make install
    sudo mkdir /etc/nfc
    sudo cp libnfc.conf.sample /etc/nfc/libnfc.conf
    sudo mkdir -p /etc/nfc/devices.d
    sudo cp contrib/libnfc/pn532_uart_on_rpi.conf.sample /etc/nfc/devices.d/
    sudo cp contrib/udev/42-pn53x.rules /lib/udev/rules.d/

    Start the TV panel at startup

    Put in the hermod contab (crontab -e)

    @reboot sleep 10 && cd /home/hermod/tv_panel && export NODEJS_HOME=/usr/lib/nodejs/node-v10 && export PATH=$NODEJS_HOME/bin:$PATH && /home/hermod/tv_panel/scripts/waitForNetwork && NODE_ENV=production /home/hermod/tv_panel/scripts/update_server.sh