# Bugged Out on TEC ART

The installation is finished and standing at the festival.

We realised the area it was in was quite dark, this made it hard for the program to detect a face. We put some LED lights around the screen to fix this problem.

# Bug electronics

After the previous tests with the fibers we knew that we wanted to use bright LEDs. We also knew that the 3W LEDs Ilse had were good so we decided to order more of them and use that one.

## Needed current

The LEDs can handle a maximum current. This current is for red 400 mA, for green 350 mA and for blue 350 mA. (Velleman, H3RGB Datasheet V01, 2014)

Because the relationship between current and light output are never linear there is a table in the same source that tells the relationship:

The datasheet does not tell anything about the individual colours, that is why we tested it by our eyes. We concluded that a current of 280mA for all colours individual is enough to output the maximum light output.

## Constant current supply

To get a constant current of 280mA a constant current supply is used. There are two types of constant current supplies. Linear and switching.

Linear supplies lower the voltage and current by acting as a electrical resistance. This results in a lot of heat. For example, when there is 280mA of current floating though the supply and it have to lower the voltage 5V, then (0,28 * 5 = 1,5) 1,5 Watts of energy will transformed into heat in the current regulator.

Switching supplies works on principle of switching the voltage rapidly on and off and stabilise the output so the output is the average. This principle is called Pulse With Modulation (PWM). Theoretical this is 100% efficient and does not generate heat at all. (Wikipedia, Switched-mode power supply ,2020)

For one bug we needs 4 RGB LEDs. This means 12 channels. Switching supplies are more expensive so for this project we chooses to use linear regulators.

## LM317

A linear regulator that is really famous is the LM317. I (Michiel) had a lot of them so this one is used.

In the datasheet (ST, LM317 Datasheet, Rev 21) is the following formula described:

Io = (Vref / R1 ) + Iadj = 1.25 V / R1

This can be described as:

Io = 1.25 V / R1

R1 = 1.25 V / Io

To get 280 mA the resistor have to be:

R1 = 1.25 V / 280 mA = 1.25 / 0.28 = 4,46 ohm

Because there is a current floating though the resistor (R1), the resistor is also generated heat. This can be calculated with the following formula:

P1 = I^2 * R = 280 mA ^ 2 * 4,46 ohm = 0.28 ^ 2 * 4.46 = 0.35 Watts

The most common resistors can handle 0,25 W. To meet this requirement two resistors in parallel will be used. In this configuration the power (0.35 W) will split over the two resistors. To allow this, the resistor value have to be choose doubled because the total resistance of a circuit is split when using two resistors in parallel.

## MOSFET switch

To switch the LED on and off a STP16NF06 MOSFET is used. This can be used as an electronic switch to enable the current to flow or not.

## Total LED driver

When the LM317, the calculated resistors and MOSFET switch are combined you get the following schematic.

## Total schematic

The MOSFET in the previous schematic are connected to an Arduino. In this way the LEDs can be controlled by software. Also the capacitive touch inputs are added and connected to the Arduino. The information about the capacitive touch can be found here: https://smartsolutionsgogbot.wordpress.com/2019/11/14/test-with-bug-prototype-and-powerled/

## Combining fabrics and fibers

We approved on make the LEDs respond to fabrics as written down and tested in previous blog posts. After looking for parts that can be used screw terminals where found. This are terminals you can attach to a circuit-board and are made to screw cables in. The idea was that the smallest screw terminal in the storage bin can also be used for fabric yarns.

After some stretch testing the conclusion was that it is not usable and that we need to use something else. Then the idea came to use long pins where the fabric yarns can be connected to by use of a knot. This worked so this became the final solution on the circuit board.

Later in the progress Joëlle, Franciska and I (Michiel) came to the conclusion it was easier to knot an electrical wire to the fabric itself. So on the end the electrical wire is soldered into the pins.

To combine the LEDs with the fibers we needed something to hold a fiber bundle in front of the LEDs. The first idea was to make a tube with a screw in the middle to fixed the fibers. The only downside was that it is hard to centre all the fiber exactly in the middle. We wants this so more light is going into the fibers. To fix this multiple screws in all directions can be used, but this will make the design more difficult.

After searching for ideas the idea came to mind to use cable glands. This are plastic terminals with a piece of rubber inside that crimps when you turn the outer shell. It is made for fixating cables waterproof into electrical boxes but we will used it for fixating fibers on top of the LEDs.

## Sources

Switched-mode power supply (2020). Wikipedia. Accessed at 20 January 2020, from https://en.wikipedia.org/wiki/Switched-mode_power_supply

PWM gemiddelde waarde (2012). Jef Daems. Accessed at 20 January 2020, from https://commons.wikimedia.org/wiki/File:PWM_gemiddelde_waarde.gif

LM317 Datasheet (Rev 21). ST. Accessed at 20 January 2020, from https://www.st.com/resource/en/datasheet/lm317.pdf

# The code behind the website

This file is made to give inside in how to website is constructed. All codes are created in Visual Studio.

For reference screenshots are added to the ‘codeswebsite’ document including:

– ‘The Story’

– ‘The Game’

– ‘ The Team’

– ‘The Machine’

– ‘Contact’: HTML contact form & PHP & HTML thank you – ‘CSS’: basic & second

I designed the business cards that people can take with them after visiting the machine on the open day and during TECART.

# Meeting with Harry | 24-1-’20

• We had a talk about the finishing touches for the installation to make it ready for TECART.
• We have till end of next week to really finish the installation.
• We should make an appointment with Kees to “deliver” the end result.
• Harry was very happy with us as a group. He liked how we worked all together and how we help each other. He hopes that the next group he gets for Smart Solutions is just as our group. He enjoyed being our teacher for this project.
• We made an appointment with Harry to have a drink next week with everybody, to end this project with a nice cold beer.

# Finishing the website

There are some last implementations made to finish the website of the project. One of the core acts was optimizing the continuity on the style of the website. Therefore changes are made in the setting from the Youtube API. As well as a photo of the machine.

Video overlay on pause

Adding rel=0, to influence the ‘more videos’ that are shown on the overlay when one pause the video. Normally the video will show populair youtube videos. By setting the rel parameter to 0, the overlay will only show the channels videos.

``````<iframe id="player" width=100% height=100% src="https://www.youtube.com/embed/hEH_a5oUnto?autoplay=1&rel=0" allow="autoplay" allowfullscreen>
</iframe``````

Removing related videos
After the videos on ‘the Game’ and ‘Select Player’ pages where fully played. It showed popular YouTube videos all over the screen. This did not add anything to the user experience. Therefore a loop is created in the code.

``````<iframe id="player" width=100% height=100% src="https://www.youtube.com/embed/hEH_a5oUnto?autoplay=1&rel=0&loop=1&playlist=hEH_a5oUnto" allow="autoplay" allowfullscreen>
</iframe``````

It loops over the embed video. First it didn’t work. But by creating a playlist in the code with only the embedded video. The problem is solved and the video on the page will replay without any user action.

Adding a picture of the machine
To give the machine a more prominent place on the website. A page is added called the Machine. On this page some information is add about how the machine works and tells a bit more about the bug on the side.

# Adding music to the game | Unity Engine

The only thing what the game is missing is music. So I started adding some music to it.

I started with the attraction scene (the stand by screen). Also Harry as Kees asked if the video’s from Mattanja are going to implemented in the game. So I decided to put the “breaking news” video in the attraction scene. I got an illustration of a TV screen from the internet and put the video behind it, so it looks like the news is on TV.

In the menu scenes (the scene with the keyboard, the scene with the playbutton and the scene with the terms and conditions) and the scene with the fake news contains the music from the “team” video. The scene where you play the game contains the music from the “breaking news” video. It was not very hard to find the music, because I chose to use the music from the videos. In this way the game and the website with the videos are connected to each other.

The only challenge was to continue the music in the menu, switching to another scene. I found a tutorial on YouTube which helped me a lot. So I created this code:

``````using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AudioManager : MonoBehaviour
{

void Awake()
{
GameObject[] objs = GameObject.FindGameObjectsWithTag("Music");
if (objs.Length > 1)
Destroy(this.gameObject);

}
}``````

This code search for an object with the tag “Music” (which the Audio Source has) and doesn’t destroy it when it goes to the next scene. When you start playing the game the “menu music” stops with the following code also when the game switches back to the attraction scene. It searches for the tag “Music” again and destroys it:

``````using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StopBackgroundMusic : MonoBehaviour
{
private void Awake()
{
GameObject obj = GameObject.FindGameObjectWithTag("Music");
Destroy(obj);
}
}``````

The finished music in the game:

I also picked the shooting sound from the “breaking news” video and used the sound for the shooting in the game.

With the music the game is ready to play. The music makes the experience of the arcade a lot better. After this I only need to test the game on some last bugs and I need to test it on the computer and screen we’re using for the installation.