Thursday, November 10, 2016

Manage animatronic props from a wireless tablet, Part 1

Moving up to a Raspberry Pi from the Arduino provides several benefits.  The Pi is basically a computer which allows us to do a whole lot more.  We have more choices in programming languages, the ability to play high quality video and audio files, and with the Pi 3's integrated wireless network interface we can even turn the Pi into an access point and configure the prop via an iPad (or other wireless tablet) using a web interface.

Project Steps
  1. Configure a Pi 3 as a wireless access point that redirects all URLs to its own IP address and advertise a prop name over the network
  2. Install a suitable web server and server-side application framework (such as Python or Mono)
  3. Develop a prop control program that allows users to "program" prop logic using a web browser.  Pi GPIO pins can be referred to by name, On or Off can be defined as High or Low, video playback, audio playback, delays, if/then, looping, etc.  Optionally provide a way to change the wifi channel via the web interface, change the operating mode from access point to join an existing wifi network, and change other network settings
  4. Research audio/video capabilities (crossfading, looping, transition from static image to video on trigger, etc.)
  5. Interface 5v relay boards with Pi 3.3v GPIO
  6. Interface an audio amplifier board over i2c
  7. Build optoisolated triggers for Insteon, motion and IR beam-break sensors

Step 1:  Configure a Pi 3 as a wireless access point that redirects all URLs to its own IP address and advertise a prop name over the network

First follow my initial configuration guide for setting up a new Raspberry Pi 3.

Set the hostname of the prop to "NewProp"

Configure the DHCP client to register as "NewProp":
  1. Edit /etc/dhcp/dhclient.conf
  2. Comment out with # any uncommented send host-name lines
  3. Add the line send host-name "NewProp";
  4. CTRL-X followed by Y and Enter to save & exit nano editor.
You need to select a static IP address for the prop.  I used for the first prop.  The next prop will use and so on.

I was able to successfully complete this step by following the instructions in these articles:
  • In /etc/hostapd/hostapd.conf, "driver=nl80211", the character after the n is an L not a 1.
  • Change all occurrences of 172.24.1 to 10.10.1
  • In /etc/hostapd/hostapd.conf change "ssid=Pi3-AP" to "ssid=NewProp"
  • Change "address=/#/" to "address=/#/"

After all the configuration changes have been made, run sudo reboot to reboot the Pi.

On the iPad, the wifi network shows up:

After connecting this is the IP info I got:

Running Fing on the iPad shows the Pi on the network under the specified hostname:

However, for the rest of the project we need to switch the Raspberry Pi 3 back to connecting to an existing wifi network so it has internet access to install packages and we can SSH to it from another computer.  The instructions for that are at:

You can use Fing on the iPad to determine what IP address it got from your home DHCP server (router):

Then you can use an SSH client (such as Putty) from any computer on your home wifi network to connect to the Pi to continue installation and configuration.

If SSH is not enabled on the Pi run sudo raspi-config and go to Advanced Options.  You should find SSH there.

Continue to Part 2

No comments:

Post a Comment