Brain Bats

From HackManhattan! Wiki
(Redirected from Brain Pong)
Jump to: navigation, search


Contents

Brain Bats (the game formerly known as Brain Pong)

TheGame.jpg


A digital game of table tennis controlled solely by brainpower, using EEG headsets.

The public debut of Brain Pong will happen at the Figment Festival on Governor's Island, June 9-10 2012. Our installation will feature a jumbo light display designed and built by Hack Manhattan! members. This project is made possible by a generous donation of EEG headsets from NeuroSky, Inc..

Overview

Brain Pong uses wireless electroencephalographic headsets to control the output of an Arduino microcontroller fitted with a LoL Shield. Data from the headsets is processed and visualized on the computer using customized Python code. That data is then used to power the Pong game, which lights LEDs on the LoL shield through a sketch running in the Arduino programming environment.

Links

  • Websites
    • Kickstarter [1]
  • Press
    • New York Times [2]
    • Mashable [3]
    • The Verge [4]
    • TXNOLOGIST [5]
    • AlterNet [6]

Display

Brain-pong-sketch.jpg

The display will consist of between 100 and 300 LED lamps on a grid. Each lamp is driven by a transistor and a solid state latch.

To turn a lamp on or off, a set of electromechanical relays will be attached to each row and column to send a signal to the latch.


Electronics

Circuit.jpg

Wiring

  • clock in columns, data in rows
  • clock is blue, data is green
  • top row is Row 1
  • left column is Column 1
  • Row 1/Col 1 is the left pin going into the RJ-45 jack


Test rig.JPG
  • Testing the LEDs

From Robert Diamond: I took the first two pixels we assembled home so I could test their operation. The pixels are intended to be assigned a state (on or off), and remember that state until they are told to change it. In computer parlance, this is called "latching".

A latch has two pins, one for the state it should remember, called 'data', and another to tell it to remember that state, called 'clock'. The latch will ignore the data line except when the clock line is pulsed or 'ticked', brought from 0 to 1 and back again.

So I wrote an Arduino sketch to test this behavior - set the data, delay, pulse the clock line, then change the data and delay again in an infinite loop. I also set the Arduino's builtin LED to show the state of the data line, so we could see that the latch was doing the right thing. Here's the sketch in its entirety:

Testing.gif

byte value = 0; byte clk = 2; byte data = 3;

void setup() {

 digitalWrite(clk,LOW);
 digitalWrite(data,LOW);
 digitalWrite(13,LOW);
 pinMode(clk,OUTPUT);
 pinMode(data,OUTPUT);
 pinMode(13,OUTPUT);

}

void loop() {

 digitalWrite(13,value);
 digitalWrite(data,value);
 delay(900);
 digitalWrite(13,!value);
 delay(100);
 digitalWrite(13,value);
 digitalWrite(clk,HIGH);
 digitalWrite(clk,LOW);
 delay(1000);
 value = !value;

}

We will use this sketch to test the boards as we assemble them.

I then connected the clock, data, and LED power and hit 'upload'. Here's the (successful) result. Note the Arduino's builtin LED on the left (a little hard to see since the pixel is so bright by comparison, even with a ping-pong ball over it to diffuse it a bit):

Tech details

LED display test

File:Brainpongtest2.ino.zip

Connect to serial, 115200 bps, 8N1, set line termination to newline in Arduino serial monitor.

It takes commands terminated by newline.

h or ? shows help.

Set data: d followed by 11 ones or zeroes (no spaces), you have to set every data line. For example, d11000000000 will turn on the first two data lines.

Read pin status: r

Test a column: t5 tests column 6 because we use zero-based numbering

Test a row: T4 tests row 5

Test all pins: a

Wiring and pinout

In this section, “left” and “right” refers to the panels viewed from the front.

Clock is wired in columns, through all panels. Data for the left two panels and right two panels are wired together with an RJ-45 patch cable.

Data is wired in rows, through all panels. There are 11 rows. Data for the top two panels and bottom two panels are wired together with an RJ-45 patch cable.

The wires are collected on a piece of protoboard that is inserted in pins 22-53 of the Arduino Mega:

  • Pins 22, 24, 26, 28, 30, 32, 34, 36: 8 clock lines for left two panels
  • Pins 23, 25, 27, 29, 31, 33: 6 data lines for top two panels
  • Pins 35, 37: unconnected (because RJ-45/Cat 5E has 8 pins)
  • Pins 38, 40, 42, 44, 46, 48, 50, 52: 8 clock lines for right two panels
  • Pins 39, 41, 43, 45, 47: 5 data lines for bottom two panels
  • Pins 49, 51, 53: unconnected (because we only have 11 rows, and because RJ-45/Cat 5E has 8 pins)

Columns are numbered from the left. Rows are numbered from the top. Note that the test sketch uses 0-based numbering.

Function Pin Pin Function
Clock column 1 22 23 Data row 1
Clock column 2 24 25 Data row 2
Clock column 3 26 27 Data row 3
Clock column 4 28 29 Data row 4
Clock column 5 30 31 Data row 5
Clock column 6 32 33 Data row 6
Clock column 7 34 35 Not connected
Clock column 8 36 37 Not connected
Clock column 9 38 39 Data row 7
Clock column 10 40 41 Data row 8
Clock column 11 42 43 Data row 9
Clock column 12 44 45 Data row 10
Clock column 13 46 47 Data row 11
Clock column 14 48 49 Not connected
Clock column 15 50 51 Not connected
Clock column 16 52 53 Not connected

Arduino-mega.png

Basically, clock lives at pin 22 going down, data is at pin 23 going down, with a few gaps for data.

Come Out & Play

BrainBatsLogo.jpg

We will be inviting Come Out & Play: After Dark visitors to participate in a game of Brain Pong, July 13th from 7 - 11 p.m. at Seaport.

Organizer: Crystal Butler

Event Info

  • Date:13 Jul 2012
  • Location: @Seaport
  • Address: Front St & Beekman St, New York
  • Time: 7:00 PM to 11:00 PM


WearingHeadset.jpg

Figment Festival

We will be inviting Figment Festival visitors to participate in a game of Brain Pong, June 9th and 10th on Governor's Island.

Organizer: Crystal Butler

Budget/fundraising

Wish_List_Fundraising#FIGMENT

Kickstarter campaign (preview)

We would prefer a little coordination for the Kickstarter campaign once it opens. If you are a member and want to contribute, I would recommend:

  • Pledging a small amount, for example $10–$30, on Kickstarter, so we can show that there is interest in the project
  • Don't pledge too much so there's a sense of urgency for potential backers and it doesn't look like we have enough money
  • Monitor the campaign toward the end to see if we need more to get over the goal
  • Donate separately to the project so we can avoid the 6-8% fees from Amazon Payments and Kickstarter


Figment player.jpeg

Schedule

  • Figment Festival Event Dates
    • May 15th: Meet and Greet for Exhibitors
    • May 26 from 10:15 am to 1:00 pm: Governor's Island visit for FIGMENT exhibitors. Per Figment: In order to properly prepare our teams, please complete the RSVP form. Please be prepared, checked in to the Manhattan ferry terminal, and in line by 9:45 am. The first ferry departs at exactly 10:00 am. Do expect longer lines, this is the first public weekend for the island.When you arrive to the island, please head directly to the entrance of Ft. Jay. We will conduct our meeting there and begin promptly at 10:15 am. What to expect:
      Introduction / Discuss Process
      Team will hand out map and coordinates to artists or their representatives
      Artist check coordinates/location
      If they're fine, you may leave the island or explore further
      If they're not fine, come back to the designated spot in front of Ft Jay to discuss OR email their curator with questions
    • June 3: Deadline for submitting Ferry Access Forms for EVERYONE who wants to do setup on the 7th or 8th. Details from Figment:
      Anyone wanting access to the island MUST USE THEIR LEGAL NAME AS IT APPEARS ON THEIR ID.
      A form must be filled out for EACH person requesting access to the island.
      The form must be filled out EACH time you plan to install and de-install (this is crucial as we have had problems with this in the past)
      If there are any conflicts at security, BE NICE TO THEM and email nyclogistics@figmentproject.org. They will do their best to sort it out.
    • June 7-8: Setup. Storage is available: get specifics to FIGMENT on how much space we need & find out what the storage location will be.
    • June 9-10: Event: Danielle from FIGMENT recommends getting the 7 a.m. ferry on the 9th for beating the crowds and making sure everything is working.
    • June 11-12: Teardown


Board and Module Pix

120706 1637.jpg
120706 1649.jpg
120706 1662.jpg
120706 1665.jpg
120706 1792.jpg
120706 1676.jpg
120706 1688.jpg
120706 1692.jpg
120706 1699.jpg
120706 1715.jpg
120706 1720.jpg
120706 1721.jpg
120706 1729.jpg
120706 1779.jpg
120706 1675.jpg

Crystal Butler 12/29/2012