Landing : Athabascau University
  • Blogs
  • Project 3 Motion (SIK Tutorials)

Project 3 Motion (SIK Tutorials)

Circuit 3A: Servo Motors

Video Demonstration

https://youtu.be/N_ypZANQ1To 

Coding Challenge
Reverse the Servo Direction

This coding challenge was interesting, I learnt that you need to adjust the two last digits of the range mapping in order to complete this task. I flipped the two numbers on line 3 “servoPosition = map(potPosition, 0, 1023, 160, 20)” from “20, 160” to “160, 20”. 

Change of the Range

This code challenge focuses on the first part of range mapping. To make the servo motor move slowly when using the potentiometer, the range changes need to be adjusted. Specifically, line 3 should be modified from “servoPosition = map(potPosition, 0, 1023, 160, 20)” from “0, 1023” to “0, 2000”. Then, to make it move faster, the range should be changed from “0, 1023” to “0, 500”.

Reflection

This is the first circuit project for Project 3. It introduces the servo motor and demonstrates how to code it for control. It also covers new concepts such as duty cycles, Arduino libraries, objects, and methods.

This circuit project was straightforward and easy to complete without any issues. The only slightly annoying part was dealing with the long cable for the motor along with the jumper cables. Other than that, it was a quick and effective project for introducing the servo motor.


Circuit 3B: Distance Sensor

Video Demonstration

https://youtu.be/VxzLp4U6ppM 

Coding Challenge
Change the Limits of the Distance Sensor

To complete this coding challenge I changed line 42 “if (distance <= 10)” to 5, then line 49 “else if (10 < distance && distance < 20)” to 5 for the first number and 10 for the second number. This  resulted in my hand having to be closer in order for the light to change color.

Reflection

In this circuit project a new component called the ultrasonic distance sensor is introduced along with new concepts like datasheets and “else if” statements. In this project you use the distance sensor to detect the presence of an object such as my hand and light up an RGB light based on where my hand is located.

This circuit project was interesting to complete. I can see how this sensor could be used in multiple applications like detecting an object to either approach it or avoid it entirely. I am excited to see how this sensor will be used in future projects

Problems Encountered

At first the distance sensor was not working, when I looked at the Serial Monitor I noticed that the reading was jumping around even though my hand was not in front of it. I had to double check my wirings and it turns out that I made an error in one of the hookups.


Circuit 3C: Motion Alarm

Video Demonstration

https://youtu.be/KRJKMRLCaVk 

Coding Challenge
Changing the Servo Behavior

For this code challenge I decided to have the motor go slower. After that I decided to change the speed to a bit faster and then changed the tone to make it sound scarier. The speed change can be done by changing “delay(100)”, decreasing the number would make the motor go faster and increasing it would make the motor go slower. For the sound, I changed the “tone(buzzerPin, 272)” to a different value for the tone frequency.

Reflection

This circuit project concludes Project 3 with the creation of a motion alarm. It incorporates the servo motor, piezo buzzer, RGB light, and distance sensor, along with the concept of mechanisms. This project uses light, sound, and motion to scare someone away when the distance sensor detects them nearby.

As each project is completed, they become more complex, and I need to pay close attention to the placement of my wiring and components since it is easy to make mistakes. I spent more time on this project than on my previous ones because I messed up the wiring. Overall, I enjoyed learning how to use multiple components to create an alarm more than simply lighting up an LED.

Problems Encountered

The major problem that I encountered was actually finding a paper clip that would fit in the hole of the linkage rod that is on my servo motor. I ended up having to just tape it to the rod and hope for the best; lucky for me it worked!