Use a Touch Sensor to make an Interactive Box of Live Spiders!

Annasmerag edited this page Jun 18, 2018 · 4 revisions

This tutorial walks you through the process of connecting a Capacitive Touch Sensor Hat to Spacebrew and visualize the message in Unity. The project was done on MacOS. This tutorial will walk you through how to install the Cap Hat on your Raspberry Pi, have it send messages to Spacebrew, and receive Spacebrew messages in Unity.

DEmo_GIF


Hardware needed

Software needed

  • Terminal for Mac
  • Unity
  • Spacebrew

Steps

Step 1: Solder the Sensor chip to the Raspberry Pi

  • Instead of soldering them directly to each other, solder a set of header pins to the sensor so it's not a p permanent attachment.
  • Attach the Cap Hat to the Pi

Step 2: Connect the Raspberry Pi and set it up

Step 3: Organise the folders on your Pi

  • Log in to your Pi
  • Navigate to the Adafruit_Python_MPR121 folder.
  • Copy the folder Spacebrew from the Mixed-Reality-Hardware-Toolkit into Adafruit_Python_MPR121.
  • Make sure pySpacebrew is also in Adafruit_Python_MPR121 > Python > examples

Step 3: Run the test of the sensor

  • Run simpletest.py from Adafruit_Python_MPR121 > examples by entering sudo python simpletest.py in terminal.
  • You should see the result printed in the console when you touch the different touch pins
  • Download and place caphat_pub.py into Adafruit_Python_MPR121 > Python > examples.
  • Run caphat_pub.py in terminal to confirm it's working. Tap on pin 0 and it should look like this: Button 0 pressed

Step 4: Download and run the Unity file

  • Download the Unity project from here.
  • Open the scene WALKINGSPIDERS.
  • We have one publisher: buttonPress that is triggered when the sensor detects a touch on pin 0
  • We have two subscribers: spawn and toggleCapsule spawn corresponds to the function spiderLaunch() which makes new spiders. toggleCapsule corresponds to the function spiderWalk() which makes the spider walk using the transform.Translate function.

Step 5: Putting it together in Spacebrew

  • From the Spacebrew server page, link your Raspberry Pi publisher (here named MRHT_Light_Button) to both the Unity subscribers spawn and toggleCapsule.

flowchart

Step 6: Putting it together in real life.

  • Take an alligator clip, clip one end to pin 0 on the hat, and the other to a gross conductive material of your choice.
  • Slip gross thing inside a box, make your friends touch it and watch them squeal in disgust!

reaction gif

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.