Wednesday, 14 December 2016

P&PI PROJECT 2A PART 2 - Light Sensor

For this project, we had to use a combination of the breadboard circuit + the Arduino/Processing software to create/build a dynamic visualisation of information read from an analog sensor. Afterwards, we had to modify the code so that the design, such as the strokes and colours, would be styled differently.

I was not able to understand what an analog sensor was or how to get/build it. However I did understand that if I was able to correct this properly, I should be able to build a circuit that can create a visual representation of the amount of light in the room. It would act like a sonar and would react differently depending on the amount of light that would shine on the sensor. It would create longer lines the more light there was and smaller to no lines the darker it is.

I tried following the example pictures and programming as best as I could. Although after wiring the breadboard circuit and connecting the 5V wire, I noticed that in the example it was clearly labeled '+5V'. I was unable to understand the difference that the posistive symbol would make, but I was sure it would have a hand in this connection not working.


Once I inputed all the code, I uploaded/ran the program. The was an error in the arduino code, but unfortunately I was unable to understand it. The only graph design that appeared was a dot. The lack of lines and placement of the dot lead me to believe that it is unable to see any light. I knew at that point that it was because I was missing some sort of analog sensor. I tried messing around with the circuit and the only notable change was that once I took out the resistor, the graph started the sonar by showing lines, but at full strength. Meaning I removed the part that enables accurate measure.

Video result of my FIRST attempt --> https://www.youtube.com/watch?v=uiBnU1ULOuk&feature=youtu.be

I am pleased to say that I finally got it working after being stuck on it for 2 weeks. I didn't realise that all the resistors had different values. I thought that they were all the same and I was using the wrong one. So I switched it for the proper resistor and I got it to finally recognize light.


Video of the Completed Result --> https://www.youtube.com/watch?v=nvg26PvIq6w&feature=youtu.be



Once I completed the original task, my next task was to modify into into a different style. I knew what I was going to do with this because I messed around with star radius's during my time in graphic design. You can see from the image below that I modified the map size to allow a larger image. I also changed the size of the stroke, the speed of the angle and the frame rate to allow space. Like I expected, by concelling the light sensor in darkness and slowly raising my hands to shine light, I was able to create a star pattern. Of which, you can see below from my screenshot and video result of the modified version.

Video of the MODIFIED VERSION'S Result --> https://www.youtube.com/watch?v=xo3hjtdBlbc&feature=youtu.be


P&PI PROJECT 2 - TUTORIAL 6 - Choose from Communication Examples.

For our final tutorial on Arduino & Processing software/hardware, we had to pick our own tutorial from the list of examples in the Communication section of the built-in Arduino software examples. One of my previous tutorials, the PhysicalPixel, was also from this list. I was really interested in 2 of the examples that were listed. 


At first I decided to pick the 'Dimmer' tutorial, where you can control the brightness of an LED light using the movement of your mouse. I found this control interesting so I thought I would give it a go. Looking at the hardware required I seemed to have everything I needed. Although as I looked at the diagram, I became incredibly confused. I couldn't figure out where it was asking me to insert or connect to the LED light. In both diagrams I tried understanding the placements, however it was a no-go. So I moved on to trying the 'Graph' tutorial. 


When I tried the Graph tutorial, I noticed that the hardware required was something called an Analog Sensor, (Potentiometer, Photocell, FSR, etc). I assumed from the diagram it meant the F-M Cable that we were supplied with. I tried to connect it up but to no avail.  


Once I tried moving on to another tutorial I started to notice that they were all looking for an 'Analog Sensor'. Which is something that I either didn't have, or something that I did have, was under a different name, and couldn't figure out how to connect it. 

The only example that didn't require one was the 'Serial Event' tutorial. So I spent a good while trying to figure that one out, but I couldn't get it to work. 

No video result this time as I was unable to get any reaction or completion.




P&PI PROJECT 2 - TUTORIAL 5 - ANALOG INPUT/FADE

This is the final part of my pre-chosen tutorials on Arduino for my college assignment. This one was similar to the first 'Blink' tutorial, but with an added feature. I had to hook up the breadboard and program arduino so that the LED light would gradually get brighter from being off to being fully on and then at the same pace, gradually turn the brightness down until it goes off and then starts over again. The main physical difference is that the LED light is now on the breadboard rather than the UNO board.

In Arduino, the main piece of could that you can mess with is the 'delay()', as it changes the speed of the brightness. I changed the delay from 30 miliseconds to 500 milliseconds and I could actually see the brightness going up a small amount once every 0.5 seconds. I dropped it down to 100 milliseconds to get a slow but smooth change. Finally I put it to 0.1 second as it has enough of a delay to be quick and smooth but not too quick that it may as well be blinking.

Video Result of Tutorial 5 --> https://www.youtube.com/watch?v=XCChGJjgfIo&feature=youtu.be




In my next post I will be running through a tutorial that I got to choose myself.

P&PI PROJECT 2 - TUTORIAL 4 - PHYSICALPIXEL

This post is for tutorial 4 for my Arduino Project. For this tutorial I had to use both Arduino and Processing software to create a small square on screen that has 2 seperate reactions once I hover my mouse icon over it. One being a standard hover reaction, which added a thin white outline around the square and the second was to make an LED light on the Arduino board light up once I hover over it.

This was the easiest and most interesting tutorial so far as it showed how interacting with a fake square graphic with a mouse on a computer screen can create a real world, physical reaction.

Combining this tutorial with the last one, I can now fully understand how it is that I can get my Playstation 4 controller to how instant reactions on my TV screen as I push a button.

I didn't really have to do anything for this tutorial since all I had to do was stick on an LED light onto the board and then click onto a pre-made example on the software. It was more to show me how something that doesn't technically exist, such as graphics on a computer screen, can have a real world reaction. Fascinating really.

Video Result of Tutorial 4 -> https://www.youtube.com/watch?v=Ov0cesGmKIY&feature=youtu.be


P&PI PROJECT 2 - TUTORIAL 3 - Digital Read Serial

This post is continuing my Ardunio project by following the tutorial - Digital Read Serial.

I was finally getting the hang of these tutorials and understanding what it was supposed to be doing and yet the obvious issue had me stressing and looking everywhere to understand where I went wrong. For this tutorial, I had to set up the wires and Arduino board so that I would be able to monitor the serial communication of a pushbutton in real time through 1's & 0's. I understood that's what I was looking for but I wasn't that smart. I thought the moment I connected everything together, 1's & 0's would start popping up in my Arduino code or in a text document. I was searching everywhere online to figure out what I was doing wrong.

It turns out that in the Arduino program board, I just had to go up to 'Tools -> Serial Monitor'.
I should have known since i set it to send 9600 bits of data per second. This would mean that every second, I would see 9600 '0's, until I pushed the button to '1's. This shows active communication between button and laptop. Video and images of result are shown below.

Video result of Tutorial 3 -> https://www.youtube.com/watch?v=XeNiPWttxaU&feature=youtu.be



P&PI PROJECT 2 - TUTORIAL 2 - Pushbutton

This post is relating to the 2nd tutorial for my project where I have to create a push button. I connect a button onto a breadboard and once the tutorial is complete, I should be able to turn on a light by pressing the button and turn off the light by letting go of the button.

It took me a while to figure out what the proper way to use a breadboard is. As the 2 tutorial pictures were different in design I was worried that I wouldn't be able to figure it out. However I found that only certain parts of the connections that I made had to be specific. Namely the a1. b2, c3, etc, row.
I could actually connect the other wire to any of the negatives and it would still work. However if I put it into a positive, it would cease working.

I took the photoresistor out and although the light would only turn on once I pushed the button, it refused to turn off after I let go of the button. It was from this process of messing around and taking them apart that I was able to understand what they were used for. I am finding that the majority of this assignment doesn't make sense until I mess around with the board after tutorial completion. I will continue to try out this process.

Result of Tutorial 2 -> https://www.youtube.com/watch?v=X8GcxHBopbQ&feature=youtu.be



P&PI PROJECT 2 - TUTORIAL 1 - Blink

For our second big project, we have been given an Elegoo Basic Starter Kit and have been told to download the applications, 'Arduino IDE' & 'Processing' onto our own laptops. After doing this, we must complete the following tutorials on the brief and document the process, via our blogs, using images & text. We must also record short videos to show our results on each test. All of this is only Part 1 of 3 of this assignment.

Within this post, I will be documenting the first tutorial: Blink.

I was put off this assignment for a while since I was unable to attend the tutorial class, I was deeply confused by how the tutorial started off. As you could see in the picture, I was worried that I was supposed to automatically understand what all the 'D13' stuff meant straight away. But after getting a lesson from a couple students in my class, they showed me how to start off that assignment amd told me to just continue down the tutorial and it will make sense afterwards. It certainly did. Although I will admit that I don't really understand the specifics, I can certainly understand the basics and how to make them work.

This tutorial was to get a light to flash a specific timeframes using programming in the Arduino software. There were a couple hiccups along the way, such as not realising I had to connect the port and upload the code once it is changed, but I got there in the end. I set the light to stay on for 800 milliseconds and turn off for 300 milliseconds.

Extra test - I had it on 50 miliseconds on & off to see how fast it would go. Afterwards I set it to 5 milliseconds each and it stopped working. At first I thought it decided to recognise my '5' as '5 seconds' but it seems that it just simply can't go that fast and it just stays on to combat the set speed.

Video Result of Tutorial 1 -> https://youtu.be/2ArXfrkV2Xc