Arduino Kit Documentation

Part I 

Myriam Edouard Arduino Kit 12

  • Arduino Projects Book (170 pages) 
  • Arduino UNO board rev.3 (1/1)
  • USB cable (0/1)
  • Breadboard (1/1)
  • Easy-to-assemble wooden base (1/1)
  • 9v battery snap (1/1)
  • jumper wire (15)
  • Photoresistor [VT90N2 LDR] (5/6)
  • Potentiometer 10 kilohm (2/3)
  • Pushbuttons (10/10)
  • Temperature sensor [TMP36] (1/1)
  • Tiltsensor (1/1)
  • alphanumeric LCD (16×2 characters) (1/1)
  • LED (bright white) (1/1)
  • LED (RGB) (1/1)
  • LEDs (red) (10/8)
  • LEDs (green) (9/8)
  • LEDs (yellow) (8/8)
  • LEDs (blue) (1/3)
  • Small DC motor 6/9V (1/1)
  • Small servo motor (1/1)
  • Piezo capsule [PKM17EPP-4001-B0] (1/1)
  • H-bridge motor driver [L293D] (1/1)
  • Optocouplers [4N35] (2/2)
  • Transistor [BC547] (5/5)
  • Mosfet transistors [IRF520] (1/2)
  • Capacitors 100nF (5/5)
  • Capacitors 100uF (3/3)
  • Capacitors 100pF (5/5)
  • Diodes [1N4007] (7/5)
  • Transparent gels (red, green, blue) (0/3)
  • Male pins strip (40×1) (1/1)
  • Resistors 220 ohm (22/20)
  • Resistors 560 ohm (2/5)
  • Resistors 1 kilohm (17/5)
  • Resistors 4.7 kilohm (0/5)
  • Resistors 10 kilohm (2/20)
  • Resistors 1 megohm (7/5)
  • Resistors 10 megohm (7/5)

P.S. Click Pictures to appear larger
After downloading Arduino, make sure your Board and Port are correct because it can cause errors.

 Part II & III

Arduino Uno Practice

After downloading the Arduino software, I practiced using my Uno by making it turn on an LED on for a second, then off for one second, repeatedly. I did this easily by going to File> Examples>Blink then modified some comments and verify and uploaded it with no problems.

Screen Shot 2015-03-05 at 4.28.36 AM

The next task was to rename the sketch and change the pin and the delay to blink slower than the previous code on a different pin. So I replaced 1000 with 4000 and 13 with 7 and I modified the inline comments to support.

Screen Shot 2015-03-05 at 4.53.03 AM

Part IV The protosnap sketches gave me a very hard time. I kept getting a error message saying “not in sync, programmer not responding every time I did a new sketch. It was frustrating but I solved it by continuing to press compile and upload.

For the buttonProtoSnap sketch, I used the button code below which could also be found at spark fun’s website and put it into a new arduino sketch (File>New)

     
int buttonPin = 7;  // button is connected to pin 7
int ledPin = 13;  // LED's connected to pin 13

int buttonStatus; // variable we'll use to store the button's status

void setup() {
  pinMode(buttonPin, INPUT);  // Initialize the buttonPin as input
  pinMode(ledPin, OUTPUT);  // The LED is an output
}

void loop() {
  /* First read the status of the button
  HIGH = button is NOT pressed
  LOW = button IS pressed */
  buttonStatus = digitalRead(buttonPin);
  
  if (buttonStatus == LOW) {
    digitalWrite(ledPin, HIGH);  // If the button's pressed turn the LED on
  }
  else {
    digitalWrite(ledPin, LOW);  // Otherwise, turn the LED off
  }
}

This code is used to program the buttonStatus and ledPin variables so that when the button is not pressed, the LED is off, otherwise the LED is on.

Screen Shot 2015-03-05 at 1.13.25 AM

The picture above is what your sketch should look like after being verified and uploaded.

The ending result of this sketch allowed me to push the button to turn led on and when it wasn’t pushed the LED remained off.

IMG_0923

For the RGB Protosnap sketch, I had to change the conditional statement so that the LEDs only cycle halfway through the range of brightness.

So the first thing I did was paste the code below in a new sketch

     
int redPin = 3;  // red RGB LED
int greenPin = 5;  // green RGB LED
int bluePin = 6;  // blue RGB LED

void setup() {
  /* set all LED pins as outputs */
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  
  analogWrite(redPin, 0);  // Turn the red LED all the way on
  analogWrite(greenPin, 255);  // Turn green fully off
  analogWrite(bluePin, 220);  // turn blue sort-of on
}

void loop() {
  /* We'll use for loops to cycle the brightness of the red LED */
  /* First turn the red LED from all the way on to fully off,
  and everywhere in between */
  for (int brightness=0; brightness<=255; brightness++) {
    analogWrite(redPin, brightness);
    delay(5);  // delay a bit for visibility
  }
  /* Then turn the red LED from off back to on, and everywhere
  in between */
  for (int brightness=255; brightness>=0; brightness--) {
    analogWrite(redPin, brightness);
    delay(5);  // delay a bit for visibility
  }
}

Then I modified everywhere it said 255 to 127 and the comments to “fully off” to “half way off”, then I Verified and uploaded

 Screen Shot 2015-03-05 at 1.39.28 AM

My end result was successful The analogwrite function used Pulse Width Modulation to get a signal switched between on and off.

Before
Before
After
After

The photoCell ProtoSnap sketch, I wanted to change the statement printed in the serial monitor to: “Whew! It’s bright in here!” instead of “Hello world, let’s read some light sensors” on the serial monitor

Screen Shot 2015-03-05 at 2.11.54 AM
Above is the light sensor code with modifications

For the buzzerProtoSnap, I changed the length of time the buzzer will play.

I used the following code and I modified only where it says 100 ms and Pitch, 100

     
int buzzerPin = 2;  // buzzer's connected to pin 2
int lightPin = A0;  // light sensor's connected to analog 0
int buttonPin = 7;  // button's connected to pin 7

const int lightMaximum = 100;  // change this to the maximum output of the light sensor
const int lightMinimum = 0;  // change this to the minimum value of the light sensor
const int maxFrequency = 2000;  // change this to your preffered high-frequency

void setup() {
  pinMode(buzzerPin, OUTPUT);  // setup the buzzer as an output
  pinMode(buttonPin, INPUT);  // setup the button as an input
}

void loop() {
  int sensorReading = analogRead(lightPin);  // Read the sensor
  /* below we'll use map() to change the light sensor value to something
  that'll make more sense for the buzzer */
  int thisPitch = map(sensorReading, lightMinimum, lightMaximum, 100, maxFrequency);

  /* If we're pressing the button, play a tone for 100ms */
  if (!digitalRead(buttonPin)) {
    tone(buzzerPin, thisPitch, 100);  // the tone() function plays a tone on the buzzer
  }
  /* this while loop will loop until you release the button
  the arduino will be doing nothing while it's in here */
  while(!digitalRead(buttonPin))
    ;

}

Example of code after verification and upload.

Screen Shot 2015-03-05 at 2.27.45 AM

Here is a link for more tutorials

2 thoughts on “Arduino Kit Documentation

  1. Good update. It is much clearer. A couple of things:

    This wasn’t part of the assignment, but can you guess why this seems a bit counterintuitive? Hint: think about what the numbers in this portion of code represent. Look at the comments.

    analogWrite(redPin, 0); // Turn the red LED all the way on
    analogWrite(greenPin, 255); // Turn green fully off
    analogWrite(bluePin, 220); // turn blue sort-of on

    Like

Leave a comment