lifeofchrome-blog1
lifeofchrome-blog1
IGME 470 Blog
3 posts
Don't wanna be here? Send us removal request.
lifeofchrome-blog1 · 5 years ago
Text
Final Project - Fireworks Viewing Party
Final Project - Fireworks Viewing Party
youtube
Introduction –
          The goal of this assignment was to create a compelling, interactive experience by having an Arduino communicate with another device. To accomplish this, I had an Arduino communicate with Unity to create a fireworks display.
Initial thoughts –
          My favorite aspect of Game Design/ Development is making making the game itself look as good as possible. I am a Technical Artist, someone who creates art with code, so I wanted this project to demonstrate my design and coding skills. I picked the theme in lieu of Covid-19 holding the world to a standstill. Had I had a normal Summer, I would have gone to Cape May, NJ with my family on the 4th of July. There is always a big fireworks display that I have probably seen too many times. I commemorate missing this tradition, I created a virtual fireworks display. 
Implementation –
 The Arduino-
Because of my limited arsenal of sensors, I had to prioritize which sensors to use, and which can be represented in the Unity Scene. I originally had 2 potentiometers, a Neopixel strip, a regular LED. The potentiometers were used to control the amount of rockets and the color. The Neopixel would roughly represent the firework’s color gradient. The LED would have represented the connection status of the Arduino. I condensed this into just a potentiometer to control the spawn amount  (potentiometer value / 255 * 10)  and a switch to control the gradient inversion (returns a -1 or 1)  , as the other information would be best represented in the program itself. 
The Unity Scene-
The scene consists of a Camera, User Interface, a terrain, and a Particle Emitter. Given my technical work in Unreal Engine 4, using Unity’s new and improved Visual Effects Graph and post processing was pretty easy. 
The camera was set up to be static and have all the post processing attached to it. I used bloom, an a vignette effect,to set the dark forest mood. The bloom was essential to see the fireworks optimally. The fireworks ‘pop’ as much as they do because the bloom is set to brighten bright lights, giving the glow effect.  The vignette adds darkness to the edges of the screen, making the center area much more vibrant in comparison.  I added black fog that scales off of distance make the background  darker (more like night-time).  Using post processing was absolutely necessary and essential to make the scene look as it does. 
The background is a skybox(*1) taken from the Unity store. To create the variable terrain, I simply used a brush to ‘paint’ the terrain height. I used Unity’s terrain editor to do this. Also within the editor, I added trees(*2) taken from the asset store to surround the camera and fill up the terrain. I ended up making the area surrounding the camera more open by removing the surrounding trees to fully see the fireworks.
The fireworks are the most involved part of the scene. The GameObject that the fireworks is attached to is also responsible for communicating with the Arduino and handles the sound and particle emitters. The fireworks are a bit complex but basically boil down to: a rocket is shot into the sky with a small orange trail following it, then on death, the rocket explodes into smaller particles with trails following them. The amount of rockets spawned and the color gradient are visible parameters that the fireworks GameObject modifies.
To communicate between the Arduino and Unity, I used a pre-existing Unity package(*3). This package flawlessly handled the communication between ports and was super simple to set up. Basically, as long as the Arduino is plugged in, and the Unity scene is running, they should communicate simply by having ‘Serial.println’ line in the Arduino code. In Unity, I had to use a communication manager GameObject provided by the package, which handled the the heavy-lifting for me.  The manager required me to implement 2 methods for communication, which I implemented in the fireworks main code. 
The sound effects(*4) are played when the rocket is launched to the sky. I slightly modified these in Audacity to my liking. After a small delay the explosion sound plays in sync with the actual explosion.
The UI just displays the Arduino value to the screen. This is just to remove the unnecessary hardware UI components such as the LED to make the system more cohesive. 
Challenges and Problems-
          The hardest part of this project was actually playing the synchronized sound effects. Unity’s VFX graph actually do not support direct sound implementation, so I had to create a work around. I created a wave system to spawn the rocket in intervals, rather than just having them go off randomly. This allowed me to have control when the sound effects should be played. 
Future Improvements-
Personally, I would have liked to added more environmental effects like ambient wind or stars. This would have added more immersion to the scene and movement to make it more realistic. I also tend to make my own assets for projects like this, however I settled with free assets this time around. It takes a lot of time to make realistic models and textures.
Sources-
*1 - https://assetstore.unity.com/packages/2d/textures-materials/sky/allsky-free-10-sky-skybox-set-146014
*2 - https://assetstore.unity.com/packages/3d/vegetation/trees/conifers-botd-142076
*3 - https://ardity.dwilches.com/
*4 - http://soundbible.com/692-Fireworks.html
0 notes
lifeofchrome-blog1 · 5 years ago
Text
Project 2 - Tone Guessing Game
youtube
Introduction –
           The goal of this assignment was to create a compelling, interactive auditory experience. In order to fit the criteria of the assignment, I created a tone guessing game using capacitance touch sensors, a speaker, and 2 LED’s. 
Initial thoughts –
           This project was tricky to get started. There are a lot of applications for using 8-bit audio in interactive experiences and it was hard to find the balance between audio  app and interactive experience. I eventually combined the 2 to form this idea.
Implementation –
           The set-up itself was simple. This is primarily due to the fact there just isn’t a lot of board space with the speaker attached. The set-up consists of 3 resistors which act as a capacitance touch sensor, a speaker, and UI LEDs. I decided to have 3 different tones that can be emitted by the system: A4, B4, C4. These tones are represented by the 3 capacitance sensors.
Playing the game is simple. The game will emit its first series of tones, and the player has to select the tones by touching the cap. sensors in the right sequence. Upon inputting the correct sequence, the game goes up a level and increases the number of tones in the sequence. If the player gets the sequence wrong, the game simply restarts the level. 
The game loop is divided into 3 parts: initialization, game play, and resolution. Once the game is booted up it initializes, then goes into the game sequence. Upon completion of 10 levels, the game ends. When the game loads a level, it randomly creates a sequence of the 3 tones. This information is stored until level completion. Every time the player touches a cap. sensor, the speaker emits a the tone and stores the value of the touched tone. This way the game can track the player’s guess sequence. After the sequence is finished, the game compares the player answer against the solution and will either pass and continue, or wipe the player answer and start the level again.
To add some interface to the game, I added LEDs. The green LED will go off once the player successfully completes the sequence. The red LED determines when the game is playing the solution. 
Challenges and Problems-
           The hardest part of this project was setting up the game logic. Since the Arduino IDE compiles in C, I tried to implement dynamic arrays for levels and guesses using array pointers. This actually caused way more problems then intended, so I created a level cap of 10 and just limited the iterations of each loop to the current level of the game.
Future Improvements-
After some play testing, the immediate change I could make is adding a ‘play back button’, just something to replay the solution sequence. After maybe 4 tones, the difficulty ramps up. Having a playback button would help players familiarize themselves with the solution.
0 notes
lifeofchrome-blog1 · 5 years ago
Text
Project 1 - Thermometer
youtube
Introduction –
            The goal of this assignment was to use 2 or more Arduino inputs to control LEDs. To complete this requirement, I created a digital thermometer. The project currently uses a 3-LED NeoPixel strip, a potentiometer, thermistor, and a switch.
 Initial thoughts –
            At first, I wanted to create a heatmap using the 30-LED NeoPixel strip. Using the thermistor, I would extract the temperature map data from the different areas of contact between the thermistor and the comparison object and display this information with various lights. The issue with this idea is that the thermistor has a very small surface area, and only returns one data value, the voltage across the thermistor. There was no easy way to solve this issue, so I reworked the idea into a digital thermometer.
 Implementation –
            The lighting on the NeoPixels is dependent on 3 criteria: the brightness, whether the system is on or off, and the current temperature of the thermistor.
The brightness is modified using a potentiometer.  A potentiometer can measure how far an object is rotated. Like the thermistor, this is just a voltage value. By using the map() function, I can align the value of the potentiometer to a range of [0, 255]. Since the maximum brightness of the NeoPixels is 255, I simply tied the brightness to the constrained potentiometer value. As a result, the user can use the potentiometer as a knob to control the LED brightness.
A switch was used to turn the system on or off. If the system is off, the LEDs can no longer light up.  This acts as an on/off switch. This originally was a simple push button, but the buttons themselves were too finicky to get working.
Reflecting the temperature of the thermistor was a two-step process. First, the thermistor creates an ‘average’ temperature. This is a one-time set up done when the system is initially turned on. The program takes 10 samples and averages the values together. The sample size should be increased to get a more accurate average, but for the sake of debugging I used a sample size of 10.  This, however, produced an accurate representation of the current room temperature. After the average was obtained, all other thermistor values would be compared against it. Any objects that produced a thermistor value lower than the average turned the LEDs blue, likewise any values greater than the thermistor turned the LEDs red.
 Challenges and Problems-
            The hardest part of this project was obtaining the average temperature. It was difficult to create an algorithm that would accurately get the room temperature, while fitting within the project’s existing code base. The current solution works but has some problems. One problem is that there is no way it can change the room temperature dynamically. So, if the room suddenly gets colder or warmer, the only way to change the room temperature is to reset the program. This can be fixed by adding reset code to the on/off switch function.
Future Improvements-
If I had something to display the temperature, like an LED screen, I would use that to actually determine the temperature of the object and relay that to the user. Currently, the program does not have this functionality, but this can easily be determined. The voltage divider between the thermistor and the circuit is given by R2 = (R1)(Vin/Vout - 1). From there, the Stein-Hart equation, 1/T = A + B ln(R2) + C ln(R2), gives the temperature in kelvin which would be converted to Fahrenheit or Celsius.
1 note · View note