Close
0%
0%

Python Scripts executed by Siri on the RPi

Using the Shortcuts iOS app to trigger python scripts on the Raspberry Pi

Public Chat
Similar projects worth following
By establishing an SSH connection from the iOS device to the Raspberry Pi using the Shortcuts app we can control anything we want, from monitoring the RPi CPU status to controlling hardware from the GPIO by running python scripts with voice commands from Siri.

This project is supposed to be used on iOS devices, however, there's a bunch of apps out there to establish SSH Communication from Andriod. i.e: Putty, JuiceSSH, and Termius.

What is SSH?

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Typical applications include remote command-line, login, and remote command execution, but any network service can be secured with SSH.

-Wikipedia

  • 1 × Raspberry Pi from 0 to 3
  • 1 × iOS Device iPhone, iPad
  • 1 × Shortcuts App (Requires iOS 12.0 or later) Free from the App Store
  • 1 × LED Fiber Optics / Emitters

  • 1
    SSH Configuration

    First of all, we need to ensure the SSH is configured on the Raspberry Pi, enter the following command at the terminal to display the RPi configuration screen: Then go to Interfacing Options and enable SSH

    sudo raspi-config
    
  • 2
    IP Address

    Once you enable SSH, you need to know your RPI IP Address: just type:

    ipconfig

     
    to show your current IP Address (Ethernet or WLAN)

  • 3
    Python Code

    For this example, we're just going to turn on an LED with the RPi.GPIO library already included in your O.S. Make sure you know the exact location of your code file: i.e. '/Documents/PythonCode/LED.py'

    We're going to create our python code file with the command nano + 'filename'.py

    nano LED.py

     This will open a text editor, this is the code I write for this example:

    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)
    GPIO.setup(18,GPIO.OUT)
    
    print "LED on"
    GPIO.output(18,GPIO.HIGH)

     This will turn on the output from pin #18 (GPIO 24) on your Raspberry Pi

    To close and save the file just press 'Ctrl + x'

View all 5 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates