All posts by Katherine M Thoma-Hilliard

Final Project

My final project idea was to create a piano with the Arduino and then make a display for it in p5. The piano uses capacitive resistors so the keys play when you touch them. I got the ideas from here:

http://www.instructables.com/id/Capacitive-Touch-Arduino-Keyboard-Piano/

http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense

The piano works fine, but for some reason there is a large delay between the Arduino and p5 and it is not very responsive. I did get one key to work very well in the test trial but forgot to record it.

For the visual I started with a very simple one that would tell you what note you were playing and wanted to create a way for you to know how often you played that note. So I created rain and blocks. I originally wanted the blocks to stack but that didn’t work. I was keeping track of a bottom variable and moving it up each time a key was pressed for that section, but it wasn’t working. For the second idea I wanted to use Perlin Noise but I was having difficulty modifying the code to do the things I wanted, like changing all the points colors at once from a key press, or using textToPoints() to draw the notes. So I did minor changes to Shiffman’s code, and added an amp so you could tell how loud the sounds were. I thought I could map the points of the letters outline then make them in to the flow field by making the points in to static lines and then add the points as vectors to flow through the letters. This is Shiffman’s orginal code:

https://github.com/CodingTrain/Rainbow-Code/tree/master/challenges/CC_24_PerlinNoiseFlowField

Since the first part was almost completely my code and the final part was all my code I decided to keep this part in and I just really liked how it looked.

For the last part I mad a program that could tell if you were playing Mary Had  a Little Lamb properly and would slowly draw a lamb for you. I put the code in to hook it up to the physical keyboard but the keyboard still isn’t working that well so I left it commented out. I drew the lamb myself and did like a stop motion animation style using Illustrator.

The piano sounds are from here:

https://www.freesound.org/people/jobro/packs/2489/?page=1#sound

I was going to have more octaves initially but for some reason the code I wrote did not work. I was going to add something like:
if(keyCode === UP_ARROW){

notes[i]+=12;

}

But it wasn’t doing anything. I made them in to three seperate codes because the way they were set up it was easier to do that some had the background withdrawn and it would have been a lot with all the sound files and stuff to add in. It is doable but I like it better as three programs. Since the physical keyboard doesn’t work that well I also had built in using the computer keys as keys and layed it out the same as a piano. In the videos you won’t hear the oscillator because you can only hear it with ear buds.

Here is a link to all o my code.

I originally built 13 keys but was having difficulty with the shift register so I left it at 8 and didn’t use sharps and flats. I got the keyboard to work but forgot to press enter so it was stuck in oscillator mode which doesn’t work without headphones I also went back and fixed it so everything else like rain and blocks works for the physical keyboard as well.

Progress

I finished building the actual keyboard and am going to use this code for the Arduino. I think I am just going to use the 8 main notes and skip the sharps and flats, because I would have to add more keys and inputs. I may however try using pitch to achieve those half steps, but it depends on how well that works. I have not had much time to actually code for it but I have continued experimenting with the code I put up last week. Which can be found here.

Maps API

I used the Mapquest API to make a fun way to check how much a trip will cost and measured the length of time in units of a song I chose. I added the fun display just to give it motion, but it is not that interactive. I also think it only works for the continental US and I don’t know about cities with two part names like New York you may have to add a ‘+’ or something like that.

Here is the code and below is a video of it in action.

Starting to Build

I have started to build my piano and found some easy to follow instructions here. Since the main focus is the display rather than the actual keyboard I just chose a design I liked and will go from there. Now I have to decide whether or not I want to try making sharps and flats because that decides the difference between using pitch or pre-recorded piano notes or if I want to find an extension so I can have more digital pins. I also started playing around with some code, but it doesn’t really resemble my final code yet.

Final Progress

I haven’t made that much physical progress in my project yet. I am thinking about making a keyboard by using wood, springs, and copper tape to close the circuit, but I don’t know how to use that as input. I have also looked at the p5 sound library and will probably use freesound.org to get piano sounds. I want it to be a functional keyboard, but don’t want it to be more of an experimental project, so it doesn’t need to be played like a real keyboard. I also built the circuit for the keyboard in the Arduino book. I still need to research how to use the input, but I think the p5 side I get pretty well, but am going to look at The Nature of Code to try and see if I can incorporate noise into the project. If this is too difficult I might change the project to use singing to the computer and it creating a visual based on pitch, length of note, and volume. I will figure this out by Wednesday. I don’t want it to be completely computer based, so I would rather there be a keyboard or your voice.

Characteristics

Computers appeared mostly to help with long mathematical equations, ones that would take a long time to calculate or ones that needed to be repeatedly calculated. The hard thing about communication is that it is two sided, there is a receiver and a sender and if things go wrong on either end or in the middle a lot can be lost. I don’t know if computational media is better at expressing my internal life, I think it may be a less accessible medium though, because it takes a set of more specialized learned skills versus drawing or writing. I think interactivity can enhance a narrative if used properly. In general interactivity will engage an audience, but it is dependent on how they are engaged and can only be gauged by their reaction. I think this is a good thing, because it makes the audience more invested in the narrative. Computational media is important because I always see it as a mix of liberal arts and STEM. It makes science and data and stuff like that that some people would rather shy away from more accessible and fun. It can be used as an art expression or to visualize data. I think that computational data can be used to help people understand other peoples stories, but it needs to be used effectively. And people need to realize that it is just one narrative and you can’t understand everything about the creator from a single piece.  But computational media is more flexible in its ability to engage the audience and in it’s broad range of possible mediums.

Many Things

For this assignment I decided to do a lot of different things and tied them together with a stop light and green had a fully moving interactive display, yellow had a somewhat interactive display, and red had a completely static display. The snake game was developed from last class, and is just inspired by the snake game you can’t actually die in my version.

Code is here.

Organized

I was originally going to make the Snake Game, but had troubles making a certain amount of the tail appear, I tried using an array but it wasn’t working so I just turned it into a more artistic program. So I turned to tweaking a code I had made for a creative coding class a few weeks ago that fulfilled the rest of the requirements for the home work. It is much more abstract and just plays around with some of the functions in p5. With for loops, arrays, different events, and time.

For some reason since I built the other one in the p5 web browse

r it doesn’t work well in the p5 IDE, but here’s the link.

Link to all my code.

Brainstorming

For part of another class I went to see Teknopolis and one of the interactive installations was a simple touch keyboard with a display, the guide said it was built with an Arduino.If you watch the video on the home page it’s at the 6 second mark. I was not very impressed with the display, but really liked it as an instrument. The Arduino Projects Book has a simple button keyboard project, so I want to see if I can expand on that project and use the inspiration from the exhibit to create a keyboard I am more satisfied with. I may need to get a bigger bread board to make a larger keyboard, I may also look in to using a different sensor other than a button, the one at the exhibit just used human touch to complete the circuit, so I may look in to that as well.

Telecommunication

For this assignment I used a potentiometer to control how many balls were bouncing from my last project. I mapped the values from 0 to 10, and added a delay so the balls wouldn’t change to fast. It takes away balls if it is moving to the left and adds if it is twisted to the right, this may be different if you plug your potentiometer in with the positive and grounded ends switched because I used the difference between the last and current number. However depending on how fast it registers the balls don’t always show up as expected.

Code!

Assignment 4

I was originally going to try and make one of those things that spin and has pictures that are drawn sequentially so it looks like a moving picture, but realized that exact project was in the book and would be difficult to make my own besides drawing a different story. So I decided to try and make a strobe like effect and use the piezo to make some sort of buzzing noise while the light was on. But it didn’t quite turn out the way I expected. I used the code from the book for the piezo and changed some of Dakotas code from the last assignment to try and make my project work. So the whole thing only works when the button is pressed except the piezo that still makes a low buzzing noise, I think it always does that as long as it’s connected.  Then the light is supposed to turn on when the photoresistor receives enough light, the piezo is also controlled by this. Then the DC motor was supposed to be used to cut off the light at regular intervals, but the DC motor is too fast, I realized a bit too late. If I were to try this again I would have used the other motor. The grounding wire also fell of the DC motor, so I got to practice soldering again. Since I forgot to post the picture last time, I’ll add the one of the motor here.

Here’s a video of the project working, just not the way I expected.

Here’s my code for the self portrait and Arduino project.

Assignment 3

So I started this project similar to the last one. I first made the Color Mixing Lamp from the Arduino Projects Book. Then I decided to switch out the photo-resistors for potentiometers so I could control the colors and the brightness better.  Then I decided to add a switch just to make it more like a regular light. The code isn’t that much different than my last project but it does use both analog(potentiometers) and digital sensors(the button). However for some reason I couldn’t get the timings to go off. It is supposed to turn on when you press the button and allow you to mix the red blue and green while you hold the button down. Then after 10 seconds it should blink at the color that you have picked and change if you wish to continue turning the potentiometers. Then after another 10 seconds it should start fading out then turning back on then fading out. At this point you can no longer change the color with the potentiometers. Finally after another 10 seconds it is supposed to turn to red. I was sort of seeing if I could turn my project from last week into one with just one LED and more sensors. In the video I put a small piece of paper over the LED just to make it easier to see the color of the lamp. Since the timing wasn’t working I wrote smaller blocks of code in different sketches to show what it would look like had it worked.

The potentiometers are connected in parallel to the power source through the switch which is why they don’t work and the light doesn’t turn on unless the button is pressed. I connected them in parallel so they would get the same amount of voltage. I could have put the resistor in series with the button, but I had added the button near the end, so I forgot to simplify the circuit as I went, but it would make it look less complicated, it still has the same functionality though.

Here’s the link to my code.

Assignment 2

For this assignment I decided to use the photo-resistor, because its a switch that you can turn on and off again, and you can play with how long the light stays on for. I started by building the Color Changing Light from the book and then making it simpler so I could write my own code. I decided to use two LEDs and design it sort of like a timer. The green light turns on when there is enough light, and then after 10 seconds it blinks a little and if you don’t turn it off then, then it switches off and the red LED turns on. Then if you cover it both go off again. It can be repeatable too. I decided to write the code so that the LED didn’t fade on and off like it usually does with the photo-resistor because I wanted a more responsive switch. I did this by watching the output of the photo-resistor and picking a number for when the LED would light up. I made the time interval pretty short just so it would be quicker to film. The LEDs also turn off whenever there isn’t enough light, not just when it finishes it’s cycle. For the code it was all if statements, but I probably could have used a while loop instead.

Assignment 1

First I decided to build a simple motor with a battery, magnet, and copper wire. The motor causes the copper wire to spin around. I used this to complete the circuit, and cause the light to turn on. The circuit was really simple and just used a LED light, two AA batteries( they are 1.5V each), and the motor. I used the bread board to make everything in series. Taped two batteries together since they are in series and are both facing the same way the voltage builds up instead of cancelling out. And since the source voltage only adds up to 3V there is no need for a resistor. Then the rest is connected in series and then I left a break in the circuit to be closed when the motor spun the wire around to fill the gap. The motor is a simple physics trick and works because an electromagnetic field is produced, and the wire is also carrying a charge and so a force is induced and pushes the wire around in a circle. Ideally I would have made it so the motor would just brush up against the wires at the same moment so the light would flicker on and off by itself as the motor continued to spin the wire around, but it was a bit difficult as the wire was difficult to balance on the battery and to space the connecting wires perfectly.

 

This is how the motor works.

This is how I set up the circuit.

This is my project in action.