LAB 2_ DIGITAL INPUT AND OUTPUT WITH AN ARDUINO

In this lab, I’ve connected several digital input circuits and a digital output circuits to a microcontroller. I’ve used LEDs and pushbuttons , switches during the development for testing whether everything’s working.

Materials I’ve used are an Arduino Nano 33 not, jumper wires, a solder less breadboard, s speaker, LED’s, 220-ohm and 10-kilohm resistors and a pushbutton.

I’ve mounted my Arduino Nano , at the top of the solderless breadboard, straddling the center divide, with USB connector facing up. The top pins of the Nano are in row of the breadboard. The Nano’s 3.3V pin is connected to the left side red column of the breadboard. The Nano’s GND pin is connected to the left side black column. I’ve connected a pushbutton to digital input 2 on the Arduino. Than, Ive connected a 220-ohm resistor and an LED in series to digital pin 3 and another to digital pin 4 of the Arduino.

The Nano’s 3.3V pin (physical pin 2) is connected to the left side red column of the breadboard. The Nano’s GND pin (physical pin 14) is connected to the left side black column.

Circuit

Circuit

Schematic Diagram

Schematic Diagram

 

After I’ve checked my board’s type(Arduino NANO 33 not) and port(/dev/tty.usbmodem-XXXX), I wrote a program that reads the digital input on pin 2. When the pushbutton is pressed, turn the white LED on and the red one off. When the pushbutton is released, turn the red LED on and the white LED off. Lastly, I’ve compiled my sketch and uploaded it.

Program Module

Program Module

Preview

Preview

 

In this lab, I’ve connect a variable resistor to a microcontroller and read it as an analog input which allows me to read changing conditions from the physical world and convert them to changing variables in a program. In addition to the similar materials above, I needed a potentiometer and a force sensing resistor.

As I always do, I’ve connected a power and ground on the breadboard to power and ground from the microcontroller. Then, I’ve connected the wiper of a potentiometer to analog in pin 1 of the module and its outer connections to voltage and ground. Than, I’ve connected a 220-ohm resistor to digital pin 9 and put the anode of an LED to the other side of the resistor, and the cathode to ground. The +3.3 and ground pins of Arduino are connected by bored and blue wires to the left and outer side row and for positive, inner side row. I’ve mounted the potentiometer that I’ve soldered before in the left side of the board. I’ve put an additional red LED and resistor. I’ve connected the other end of the resistor to Nano’s digital pin 8. As a second part of the LAB, I’ve replaced the LED with a speaker to try audible output.

Force sensing resistor

Force sensing resistor

Program Module_2

Program Module_2

Audible Outputs

Physical Computing_analog_audible output

Program module_3

Program module_3