Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.90 KB | None | 0 0
  1. Hello and welcome to my Physical Computing blog, wherein I will be talking about my development and learning of Phsyical Computing, but more specifically, Arduinos. Physyical Computing really excites me, taking programming out of a computer for use in the real world is just so much more fun and gratifying and I'm very eager to start making some cool things.
  2. But first things first, I'll need to learn how to use the technology that'll be the basis of these things. The first program most people write when learning to program is the "Hello World" application, where you write a program to simply output "Hello World" to the console window, but in the Arduino world, since a screen is a relatively advanced piece of output, the equivilent established is making an LED blink, and so that's what I did. Although simple, it teaches a lot of the necessities of working with Arduinos: connecting to the Arduino, writing a program for the Arduino and uploading the program to the Arduino. The model of Arduino I'll be working with is the Leonardo, it is a slightly more powerful version of the Uno, which is what most people start off with. The Arduino has a nifty little on-board LED that can be programmed to light up and light off, this is what we will use to do our first program.
  3. After this, I tried to emulate the same effect but with using an external LED, which meant the introduction of wiring, breadboards, inputs and outputs, and resistors. I have knowledge of most of the basics of circuitry, but little beyond that. This was my first introduction to breadboards, all circuity I'd done beforehand was just wire to wire stuff, and I had a little difficulty wrapping my head around how the metal inside the breadboard connected and how power coursed through them, but I soon got to grips with them and see how they are hugely useful tools in prototyping circuity.
  4.  
  5.  
  6. TWO
  7. LDR sensor
  8. Just getting values from it
  9. Using the value to power an LED
  10. Using the value to rotate a servo
  11. Using a potentiometer to rotate a servo
  12. This week we were introduced to a new piece of kit: the LDR sensor, which is used in generating a value based on how much light it's exposed to. These things are used in devices that react to the surrounding light levels, the most popular usage of which are street lamps that only turn on at night. To begin with, we just retrieved the data generated by the LDR sensor in the Arduino environment Serial Window, which is basically the Arduino's console.
  13. [VIDEO]
  14. As you can see, the data ranges from 1-1024, increasing to it's higher values when a torch is shone on it. Now it's time to do something with this value. To begin with, I just used it to modify the power given to an LED
  15. [VIDEO]
  16. It's a little hard to see, but the effect is there, shining the torch over the LDR sensor increases the brightness of the LED, it's like a hugely inefficient way of transferring light.
  17. After this, we were introduced to a new piece of kit, the servo. Servo is short for servomotor or servomechanism. It's basically a motor that can be programmed to go to specific rotations. So naturally the first thing we try to do is connect the LDR sensor with the servo. It felt a bit weird poking the wires into the cable of the servo itself, I anticipated we would have had to plug the cable into the arduino itself but this was not the case, at this point I'm learning that most devices are simply power, ground, and signal, and they can all be connected together somehow.
  18. [VIDEO]
  19. The effect is very apparent, and quite aggressive. I'm not sure what practical application there is to a servo directly controlled by an LDR sensor, but hey, it's possible!
  20. After this, a new piece of kit enters the ring: the potentiometer. A potentiometer is a fancy name given to a knob that can be twisted to generate a value, like the knobs on an audio amp to adjust volume, bass and frequency etc,. So with our previous circuit already in place, I just tried to replace the LDR sensor with the potentiometer. I had a little trouble figuring out what the prongs on it did, finding out that the ones on the side are just to attach it to stuff and the 3 prongs in the middle are the power, signal, and ground, this makes it a little awkward when attaching them to breadboards as the prongs on the side must be bent so it can be attached.
  21. [VIDEO]
  22. I got it to work, and the effect is pretty cool! I can accurately control the servo arm with a twist of the potentiometer, this could then be quite easily adapted to a larger scale system.
  23. THREE
  24. BUTTONS
  25. BUTTON TO MAKE SERVO ARM TWIST
  26. BEDAZZLED WITH LEDS
  27. This week, we were introduced to buttons! Everybody loves buttons, I am no exception, perhaps the most basic instrument of digital inputs, incredibly simple, vastly useful. Although the button itself is quite simple, the wiring required was anything but, I still don't understand the full circuit completely, I'll have a closer looker at it at some point, but it works and that's what's important. So before we do anything fancy with the button press input, it's wise to simply print to the monitor that the button is being pressed.
  28. After we have that part of the circuit established ,we can then connect stuff to it. I first decided to use an LED, and the effect is about what you expect, button down, LED on, button up, LED off. This wasn't too interesting so I decided to attach something a little more exciting to the button: a servo. The effect I aimed for was rotating the servo for however long the button was pressed down for, until it reached it's limit, which is 180 degrees, and then making it return back to it's 0 degrees state whenever the button wasn't being pressed.
  29. [VIDEO]
  30. It worked quite well! After this I decided to reintroduce the LEDs but with a bit more pizazz, I would use 3 different coloured LEDs, red, amber, and green, to indicate where the motor was in it's rotation, if it was between 0/3 - 1/3 in it's rotation it would be red, 1/3 - 2/3 would be amber, and 2/3 - 3/3 would be green.
  31. [VIDEO]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement