Arduino Programming

Arduino Programming Task

Overview

For this week, week 5's practical, I learned about what an Arduino is and what is Arduino programming. I also learned about the different parts of an Arduino board as well as different components that can be used with an Arduino board. This includes LEDs etc.

We were tasked with 4 activities. They include: 

a. Interface a Potentiometer Analog Input to maker UNO board and measure its signal in serial monitor Arduino IDE 

b. Interface a LDR to maker UNO board and measure its signal in serial monitor Arduino IDE 

c.  Interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc) 

d.  Interface the DC motor to maker UNO board and program it to on and off using push button on the board

Potentiometer Analog Input

This is how it looks like on Tinkercad !


After the assembly of the setup, I proceeded with copying and pasting the code that was provided by Tinkercad. However, there were a few adjustments made to the code. You see, in order to read the serial monitor, I have to add Serial.begin(9600) under void setup () This is because this is to match the 9600 baud in the serial monitor. Additionally, I also have to add Serial.println(sensorValue); under void loop () as this gives me the values that will appear in the serial monitor

Below is a picture of my serial monitor !


As seen from the values, 0 is when the potentiometer knob is at its most left position while 1023 means that the knob is turned to the most right.

Light Dependent Resistor LDR

This is how it looks like on Tinkercad :) 


Below is a picture of my serial monitor for the LDR


For this LDR setup, I referred it from Tinkercad. How this setup works is that when there is no light for the LDR, the resistance decreases as evident from the serial monitor that the value is 6. This results in the LED being able to light up. On the other hand, when the brightness is max for the LDR, the resistance increases. This is evident from the serial monitor where the value is 679 on max brightness. This results in the LED not able to light up.

3 LEDs

This is how my setup looks like on Tinkercad


This is by far the easiest setup and coding that I had to do. For this activity, I managed to make all of them do a blinking action with a 1 second interval. 

DC Motor

This is how it looks like in Tinkercad !

For the DC Motor exercise, I programmed it to when you press and hold the button, it will start to spin. On the contrary, if you do not press and hold the button, the dc motor will not spin. In my opinion, this exercise was quite challenging as I have to know where to put the button for example.

Overall, the 4 activities was rather challenging yet enjoyable. I managed to learn a few tricks along the way with the help of some of my friends. In the future, I hope to be proficient in Arduino programming as I believe it is really useful for future projects or assignments.

Comments

Popular posts from this blog

CAD Part 1

DOE