Introduction: The "Rare Vogel" Birdhouse Controller

A birdhouse controller for a bird based game, why? I saw this birdhouse in the store and felt instantly inspired! Going from something big and grand with a shortage of time for the school's deadline to something small and cute. It inspired an entire game around it!


It was an interesting project, I learned how to read data from the datastream directly into unity, how to use two pin buttons, items and more in arduino and learned how to plan things out in tight spaces!


It was build by looking at the components online and ordering them, trying them out, seeing what works all in the bird house and seeing what it could add!


Supplies

The things you will need are a computer and these things;

Software:

  • Unity
  • Arduino IDE

Tools:

  • Soldering Iron
  • Double sided tape (Thick and thin)
  • Glue (Optional but recommended)
  • Drill
  • Sanding paper (Soft)
  • A file

Components:

  • Buttons
  • Wires
  • Tilt Sensor
  • IR break beam sensor
  • Potentiometer
  • USB B Cable
  • Arduino Uno (May use a different one depending on your birdhouse size)

Parts:

  • A 4/40 screw, nut and spacer
  • Birdhouse (Buy a cheap one or make your own! We'll be using one from the Action)
  • Cardboard
  • Pin headers

Step 1: Breaking In

Open up the house so you can get in there, in the case of this one it was glued together so I was able to pull it open! This will differ depending on your scenario!

Be sure to sand the hole, a finger will come through this so we wanna avoid splinters! (Sand it down in general actually.. but especially this hole!)


If you break anything, feel free to use the glue!

Step 2: You Sure Push My Buttons

Grab your birdhouse and drill two holes in the top for your buttons, Depending on the size of your buttons you may need to drill different sizes than displayed here. If you're using the same birdhouse as me the wood is soft, you may not even be needed to use a drill but something sharp like a knife (Not recommended)

Step 3: This Sure Sticks Out

Take the stick out of the house! Considering this specific house was made of soft wood, I was able to poke through it with something sharp.

Do not throw away the stick! We'll still need it later!


File the stick down (Or use something sharp, not recommended!) if your potentiometer has an opening. Try to fit it in there by filing it down.

Alternatively, you can glue it directly to it!

After attaching the stick to the potentiometer, cover it up a bit so it looks cleaner and attach it to the house! we used thick strong doublesided tape for both the inbetween and behind areas.


Step 4: I Love Spaghetti!

Once you know the holes fit properly and have the potentiometer fit, it's time to wire these bad boys up, grab your soldering iron and add some wires to them! (Orientation of the wires shouldn't matter! Recommend using yellow instead of red like here for the buttons to avoid confusion)

While you're at it, consider preparing other parts too! So the same layout on the potentiometer and add pin headers on the end of all your wires.

In order to accommodate for the amount of ports of the arduino, connect all the red/black wires to a single pin (Again, this does NOT go for your red/yellow wires on the buttons)

As a reference, see the diagram what needs to be soldered to what! I recommend using a four pin header for the 7-4 pins, on this order; BUTTON R, BUTTON L, IR SENSOR, TILT SENSOR.

Not follow this order may require you to re-work some Unity Code.


Useful tip!

Be sure the buttons are already in when you hook them up all onto one ground cable!

Step 5: I See You, Don't Shake Me!

Grab your IR break beam sensor and allign them to the middle of the hole! We used double sided tape to keep them in place.

Furthermore get your tilt sensor ready, we also taped this one down UPSIDE DOWN!

This way it reads when it's held upside down far more reliably, especially considering people will be holding this as a controller so it needs some wiggleroom!

Make sure it's directly down, not screwed or crooked.

Step 6: Crafty, Aren't You?

Phew, that was a lot! But we're almost there!

In order not to have the players fiddle with the cables, you grab a piece of cardboard!

Make two pieces, Again size depends on your specific birdhouse!

Be sure they fit, one bendable piece so you can easily drop it in, attack it with glue or double sided tape.

Same for the second piece, this will be used as a bottom part!

Now our player will not fiddle around in spaghetti (Yay!)

Step 7: Holes! Holes! More Holes!

Test fit your arduino into a corner piece, and measure where the USB hole needs to be, I can't give exact directions for this depending on the case of arduino you're using.

There needs to be a USB hole as well as a scew which will hold your arduino into place.


CAUTION:

USE THE SPACER AND DO NOT OVERTIGHTEN THE SCREW!

This might bend or even break your arduino!


Be sure the spacer is under your arduino, you can test fit it, but don't leave it in there yet as we still need the arduino!


Step 8: Plugging Things In!

Plug everything into your arduino!

  • D7 - Right button
  • D6 - Left button
  • D5 - IR receiver
  • D4 - Tilt ensor
  • A0 - Potentiometer

And ofcourse the power+ground wires!

Carefully push these into the box, be sure that any exposed wiring that may come in contact with another has been isolated!

Wedge the USB port into the hole and secure the arduino with the screw, remember; the order here is important for screwing, see the previous step!


Don't close it off yet! Plug your arduino in and let's see if it works!

Step 9: IT'S ALIVE!

Open your aruino IDE and use this script, caution! This is gonna need the library below!

#include "signalenzo.h" //Thanks to Aeralius for helping create this library!

	float lastValue;

	void setup() {
	   //Opening connection
	   Serial.begin(9600);

	  //Regestering all the buttons  
	  pinMode(7, INPUT_PULLUP);
	  registerSignalCommand(7);
	  pinMode(6, INPUT_PULLUP);
	  registerSignalCommand(6);  
	  pinMode(5, INPUT_PULLUP);
	  registerSignalCommand(5);  
	  pinMode(4, INPUT_PULLUP);
	  registerSignalCommand(4);  
	}

	void loop() {
	  //Don't torture the Arduino :)
	  delay(50);
	  checkSignals();
	

	  float Input = analogRead(0)/1023.0;
	  if(Input > lastValue+.01f || Input < lastValue-.01f){
	    lastValue = Input;
	    Serial.print("A0,"); Serial.println(lastValue);
	  }
	}

The script registers buttons and let's unity know when something is pressed/changed!


The libary;

//With help from Aeralius!

	bool signalPins[14] = {};   
	bool signalPinsUps[14] = {};
	bool signalPinsDowns[14] = {};

	void registerSignalCommand( int Pin )
	{
	  signalPins[Pin]=true; //Add the pin to the pin list thing :)
	   
	}

	void checkSignals()
	{
	  for(int i=0;i<14;i++)
	  {
	    if(signalPins[i]==true)
	    {
	      //DOWN
	      if(!digitalRead(i) and !signalPinsUps[i])
	      {
	        signalPinsUps[i] = true;
	        signalPinsDowns[i] = false;
	        Serial.print("D");Serial.print(i); Serial.println(",1");  
	      }
	      //UP
	      if(digitalRead(i) and !signalPinsDowns[i])
	      {
	        signalPinsUps[i] = false;
	        signalPinsDowns[i] = true;
	        Serial.print("D");Serial.print(i); Serial.println(",0"); 
	      }
	    }
	  }
	}

This is the actual managing system for letting unity know!

In case you don't want to setup the project yourself, you can also get it from git here.


Flash the code and check if all actions work!

Open the serial monitor and see if you can toggle all the actions like the attached image above;

Rotating stick:A0 (0 to 1 float)

Right button:D7 (0 or 1)

Left button:D6 (0 or 1)

Hole sensor:D5 (0 or 1)

Upside down:D4 (0 or 1)


If these all work properly, you can close off the birdhouse by gluing the bottom and move over to unity/the game!

If not, you might wanna check your wiring and check some steps!

Step 10: It's Gametime

You can build/run the game in unity yourself, the git is available here, the project was made in 2020.3.18f1, you can find that specific version here or alternatively you can upgrade the project to a higher version.

In here you can adjust all settings and the entire feel of the game to your liking, fair warning, the code was rushed so it isn't clean at all!


If you do not wish to use unity but just play the game you can get it right here!

Your experience should look something like the video attached!


How to play the game:

Left button: DESTROYS BLUE CHAIRS!

Right button: DESTROYS RIGHT CHAIRS!

Hole: Slows down the bird, to give you more control (Blocks shooting!)

Stick: Move around (This is additive! Don't go too fast or you'll tumble!!)

Hold upside down: Butt forward to destroy weak wall parts!! (And farts when trying to shoot!)

Goal:

Get your a high score! And block those pesky chairs from passing you, as they take points away!

Step 11: Bonus Step, DECORATING!

Make your own awesome custom design to keep the piece interesting! Very curious to see what you'd do with your birdhouse!