| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Reader Jay Lab 2

Page history last edited by zahraa@... 5 years, 2 months ago

1.

 

a. What line(s) of code do you need to change to make the LED blink (like, at all)?

 

The “digitalwrite” function controls the the output of the pin and therefore the LED (for the case of pin 13).

 

By setting a pin to “High” it sets the voltage to high, and therefore creates a drop, which will light the LED. In this case, since the onboard LED is hardwired to pin 13, we can turn it on with “digitalwrite(13, HIGH)” or off with “digitalwrite(13, LOW). Since this is a loop function, the arduino will cycle over the high/low digitalwrites, turning the LED on/off, creating a blinking pattern.

b. What line(s) of code do you need to change to change the rate of blinking?

 

The “delay” function, similarly used in C++ and other languages, causes the program to pause for however many milliseconds are specified as a parameter. In this case, changing both delay(1000)’s to delay(100)’s would shorten the rate from every second to every tenth of a second

c. What circuit element would you want to add to protect the board and LED?

 

A resistor. Grounding will also be important.

2.

 

a. Which lines do you need to modify to correspond with your button and LED pins?

 

“const int ledPin =  13;”  - needs to be pin 9

const int buttonPin = 2; - is pin 2, so ok.

These variables then correspond to the pins that read the button voltage and output to the led.

b. Modify the code or the circuit so that the LED lights only while the button is depressed. Include your code in your lab write-up.

 

const int buttonPin = 2;     // the number of the pushbutton pin

const int ledPin =  9;      // the number of the LED pin

 

// variables will change:

int buttonState = 0;         // variable for reading the pushbutton status

 

void setup() {

 // initialize the LED pin as an output:

 pinMode(ledPin, OUTPUT);

 // initialize the pushbutton pin as an input:

 pinMode(buttonPin, INPUT);

}

 

void loop() {

 // read the state of the pushbutton value:

 buttonState = digitalRead(buttonPin);

 

 // check if the pushbutton is pressed.

 // if it is, the buttonState is HIGH:

 if (buttonState == HIGH) {

    // turn LED on:

    digitalWrite(ledPin, HIGH);

 }

 else {

    // turn LED off:

    digitalWrite(ledPin, LOW);

 }

}

3.

 

a) Which line(s) of code do you need to modify to correspond with your LED pin?

 

int ledPin = 9;

    This sets up pin 9 as the variable used throughout the code.

 - though in this case I’m hooked up to pin 9 so I wont need to change it.

b) How would you change the rate of fading?

 

“for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5)”  controls the value of output for the analog pin as we fade on. It loops from 0 -> 255, incrementing at a value of 5.

As such, by changing the third value we change the rate of increment, and therefore the rate of fading on. A higher value means we skip at higher intervals and will fade on faster, with lower => slower.

 

Similarly,

“for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5)” controls the value of output for the analog pin as we fade on. It loops from 0 -> 255, decrementing by a value of 5.

As such, by changing the third value we change the rate of decrement, and therefore the rate of fading off.A higher value means we skip at higher intervals and will fade off faster, with lower => slower.

 

The line “analogWrite(ledPin, fadeValue);” then matches the output of the analog pin to fadeValue, giving the led the corresponding amount of power.

✔ Great

c) (Extra) Since the human eye doesn't see increases in brightness linearly and the diode brightness is also nonlinear with voltage, how could you change the code to make the light appear to fade linearly?

 

To do this linearly in this case we can notice that the max value is almost a perfect square. With this in mind, the fading loop (on) then becomes “for(int fadeValue = 0; fadeValue<=255; fadeValue+= 2*fadeValue), or something of the sort. This way the value increases linearly by a factor of 2. (and can be decreased in a similar way).

PART C

 

1.

a. What is the minimum resistor size that should be used with these LEDs? (Hint: think about your voltage supply and what the diode voltage drop means.)

 

(5V-1.8V)/30mA = 60 Ohms


 

2. Take apart your electronic device, and draw a schematic of what is inside.

a. Is there computation in your device? Where is it? What do you think is happening inside the "computer?"

Yes, there is an embedded processor, reference here:

http://www.alldatasheet.com/datasheet-pdf/pdf/204622/AMCC/PPC405EP-3GB266CZ.html

 

It’s designed specifically to handle multiple inputs and outputs via ethernet ports, specifically in regard to waveform (some of the features described are “clocking waveform” and “float timing waveform”. Considering that this is a network router, it would make sense that this controller can set the output signal for the antennae and handle signals it receives, in essence handling the data passed between a wirelessly connected device and the ethernet port.

b. Are there sensors on your device? How do they work? How is the sensed information conveyed to other portions of the device?

 

If there are, they would be related to a temperature sensor and the incoming and outgoing signals. That said they are not the focus of this device and are not readily apparent.

 

c. How is the device powered? Is there any transformation or regulation of the power? How is that done? What voltages are used throughout the system?

 

There is a 12VDC power source, which is transformed:

 

    Some components used in power handling include

A choke - http://www.cdiweb.com/datasheets/pulse/T626.pdf

Another signal transformer (this is connected directly to the ethernet port though)

http://www.mouser.com/ProductDetail/TDK/TLA-6T118LF-T/?qs=mm8AnwBj5sXeA41eP%2F26qg%3D%3D

        A step down controller, that produces 2 out of phase waves from an input supply.

http://www.maximintegrated.com/en/products/power/switching-regulators/MAX1876.html

 

^this one is particularly important because it most likely supplies the signals for each antenna. In this, it is at the heart of what is most likely a dual-band router, since there are multiple antennae and multiple signals produced.

 

    Other components also include resistors, transistors, and capacitors for power regulation

 

In other places there are marks of +5V and ground, and some of the other components, such as the processor, are spec’d to only handle 5V, so it makes sense that this input voltage would be regulated to that amount. While the DC input jack may be cheaper to produce at 12V since it is standard issue, most components cannot handle that potential.

d. Is information stored in your device? Where? How?

There is onboard memory in the processor, and there are 2 DRAM modules connected to it as well:

http://pdf1.alldatasheet.com/datasheet-pdf/view/75956/MICRON/MT48LC8M16A2FB-7EIT.html

Comments (1)

zahraa@... said

at 2:43 pm on Jul 15, 2015

great job

You don't have permission to comment on this page.