Arduino Programming

Producing our own Arduino Program

19 November 2021

This week, we focused on the skill of Arduino Programming.

After this week's practical, I will be able to:

1. Develop my own Arduino code to make something work.

2. Navigate myself comfortably around the TinkerCad software.

3. Understand the concept of interfacing Input and Output devices.


INTERFACING INPUT DEVICES ON THE ARDUINO BOARD




The image above shows the individual tasks that we needed to do for this week's practical!

Potentiometer Analog Input

For the first activity, I was tasked to interface a Potentiometer Analog Input to maker UNO board and measure its signal in serial monitor using TinkerCad.
This was the video I used to guide me for this activity:


The video allowed me to get the basic set up of the Potentiometer Analog down and I was able to get the whole system working. I found out that I was able to control the potentiometer and adjust the voltage and current that the multimeter was receiving.

The video below shows my Potentiometer Analog Input in TinkerCad in action:





Light Dependent Resister (LDR)

Next, we were tasked to Interface a LDR to maker UNO board and measure its signal in serial monitor using TinkerCad. We made use of another video below as reference for the setup.


By following the guide in the video, I was able to make this setup in TinkerCad. When the LDR is adjusted, the light bulb will either dim or brighten depending on how I adjust the resistor.




LDR DOWNLOAD




INTERFACING OUTPUT DEVICES USING ARDUINO BOARD

3 LED to UNO board (Fade)

Moving on, we were tasked to interface output devices using TinkerCad. Our first activity was to interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc)
I made use of this video as a reference and a guide to make this setup:


After following through the video, I decided to make changes to the setup and modified the original code. I decided to duplicate the blocks of the initial code highlighted in red twice such that 2 more loops will be created and 2 more LEDs can be added to the setup. I also edited the pin number for the 2 new loops based on the corresponding pin numbers that I chose which were pins 10 and 11.

Do make sure to have a resistor connected to every LED otherwise the setup may not work.





The video above shows how the modified code and setup works, and as you can see, the LEDs light up one by one simultaneously and slowly fade off before the next one lights up, and this process is in a constant loop.

3 LED UNO DOWNLOAD


DC Motor On/Off with push button

For the final task, we were tasked to interface the DC motor to maker UNO board and program it to on and off using push button on the board.
The videos on YouTube were not as useful compared to the other activities and I had to try and make this setup by myself which was extremely hard.

First, I started off with the given Breadboard and Arduino setup.



Next, I added the push button to the breadboard and connected it to the 3.3V power supply using the wires.



After that, connect a resistor of 10k ohm to the push button and pin 7.







Add in your DC motor and connect the wiring as shown. A 150 ohm resistor is also added to pin 8 and is connected to the positive end of the DC motor.


Lastly, connect the ground wire to the push button and DC motor.



This is the code that I used...


Reflection

This practical enabled me to really see the power of  Arduino Programing. Although this process can be quite frustrating, I can actually see myself putting this skill into good use for my projects in the future! In addition to this, the individual competency test that we did during that week allowed me to see where my skill level in programming is at. I remember panicking during the test and messing up my code despite knowing what to do, so I had to do it a second time to "prove" my worthiness! During the re-test I remember telling myself to stay calm and not panic, I was feeling more confident in myself and I was actually able to complete the code in less than 3 minutes! This competency test really was a test of not only how well I knew my programming but also if I could stay calm and composed under time constraints. 
I definitely faced many challenges when doing the individual task, although I can navigate myself around TinkerCad efficiently, inputting the codes and connecting the breadboard and arduino board together still confuses me at times. I feel that I still have little knowledge on Arduino Programming and I think that there are many areas I have to work on for this topic. But in general, I am definitely able to see myself using this set of skills for my future projects like FYP.






Comments