Skip to content

Angry Oxide running on Raspberry Pi Zero 2 with waveshare 2.13” e paper HAT

License

Notifications You must be signed in to change notification settings

thomsonny/AngryOxide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Angry Oxide running on Raspberry Pi Zero 2 W - Basic Step-by-Step Guide

1. Setting Up Your Hardware

  • Hardware Components:

    • Waveshare 2.13 inch e-Paper HAT v4
    • Raspberry Pi Zero 2 W
  • Connecting the Hardware:

    • Connect the Waveshare 2.13 inch e-Paper HAT to your Raspberry Pi Zero 2 W using the provided GPIO pins.

2. Setting Up the Software

  • Install Raspbian OS:

  • Update and Upgrade:

    sudo apt-get update
    sudo apt-get upgrade
  • Install Necessary Libraries:

    sudo apt-get install python3-pil python3-spidev python3-rpi.gpio git
  • Clone and Install Waveshare e-Paper Library:

    git clone https://github.com/waveshare/e-Paper.git
    cd e-Paper/RaspberryPi_JetsonNano/python
    sudo python3 setup.py install

3. Install Angry Oxide

  • Clone the Angry Oxide Scripts Repository:

    git clone https://github.com/ScriptTactics/AngryOxide-Scripts.git
    cd AngryOxide-Scripts
  • Install Angry Oxide:

    sudo make
    sudo make install

4. Create Your Python Script

  • epaper_display.py:
    import os
    import subprocess
    import time
    import spidev
    import RPi.GPIO as GPIO
    from waveshare_epd import epd2in13_V4
    from PIL import Image, ImageDraw, ImageFont
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)
    
    RST_PIN = 17
    DC_PIN = 25
    CS_PIN = 8
    BUSY_PIN = 24
    
    epd = epd2in13_V2.EPD()
    epd.init()
    epd.Clear(0xFF)
    
    width, height = epd.height, epd.width
    image = Image.new('1', (width, height), 255)
    draw = ImageDraw.Draw(image)
    
    font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 14)
    
    def update_display(process_status):
        draw.rectangle((0, 0, width, height), fill=255)
        draw.text((10, 10), "Process Status:", font=font, fill=0)
        y_offset = 30
        for line in process_status:
            draw.text((10, y_offset), line, font=font, fill=0)
            y_offset += 20
            if y_offset > height - 20:
                break
        rotated_image = image.rotate(180)
        epd.display(epd.getbuffer(rotated_image))
    
    def check_process(process_name):
        try:
            result = subprocess.run(['pgrep', '-f', process_name], stdout=subprocess.PIPE, text=True)
            return f"{process_name}: Running" if result.stdout else f"{process_name}: Not Running"
        except Exception as e:
            return f"Error: {e}"
    
    def main():
        processes_to_check = ["angryoxide", "other_process"]
        try:
            while True:
                process_status = [check_process(proc) for proc in processes_to_check]
                update_display(process_status)
                time.sleep(10)
        except KeyboardInterrupt:
            print("Exiting...")
            epd.sleep()
            GPIO.cleanup()
    
    if __name__ == '__main__':
        main()

5. Create systemd Service Files

  • epaper_display.service:

    [Unit]
    Description=E-Paper Display Service
    After=network.target
    
    [Service]
    ExecStart=/usr/bin/python3 /home/pi/epaper_display.py
    WorkingDirectory=/home/pi
    StandardOutput=inherit
    StandardError=inherit
    Restart=always
    User=pi
    
    [Install]
    WantedBy=multi-user.target
  • angryoxide.service:

    [Unit]
    Description=Angry Oxide Service
    After=network.target
    
    [Service]
    ExecStart=/usr/local/bin/angryoxide --interface wlan1 --headless
    WorkingDirectory=/home/pi
    StandardOutput=journal
    StandardError=journal
    Restart=always
    User=root
    
    [Install]
    WantedBy=multi-user.target
  • Enable and Start the Services:

    sudo systemctl daemon-reload
    sudo systemctl enable epaper_display.service
    sudo systemctl enable angryoxide.service
    sudo systemctl start epaper_display.service
    sudo systemctl start angryoxide.service

About

Angry Oxide running on Raspberry Pi Zero 2 with waveshare 2.13” e paper HAT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages