TONE OUTPUT & SERVO MOTOR
Week 03 - 09/21/2022
Familiarization
It has been three weeks, I start finding myself getting more and more comfortable with the concepts, connecting wires, making things work, etc.
One thing that I am still afraid, and always followed by mistakes, is writing code myself. At this point I still need to strictly follow the lab examples. I am able to make some tweaks, but honestly, creating something new from scratch is still a huge challenge. However, everything seems better than week 02.
The labs this week are straightforward, I did not struggle too much when working on them. The most exciting part of this week is that I am trying to make the ideas from week 02 work, which are controllable retractor and distance sensor.
Tone Output Using An Arduino
This lab went smoothly. I started by testing if the speaker works, and then a force sensor was added. After that I learned that adding a transistor can make it louder by amplifying the power. Finally, a musical instrument was made — it was interesting to see how simple a series of tones can be.
Personally, tone output will help my project, I will have to figure out how to make tone output work with distance sensor — when the ideal distance is reached, speaker involves.
video 1 - test if the speaker works: playing middle A, 440Hz
Servo Motor Control with an Arduino
Servo motor is very versatile. I have already had many ideas which can be accomplished by using servo motor(s).
At first, I connected the wire to Analog Reference instead of Analog In so the motor was not working as it should be. Once it was fixed and mapped properly, it worked.
video 3 - N-channel MOSFET is added to amplify the power
Poop Bag Retractor w/ Potentiometer
I was hoping to control the speed of DC motor with an Arduino and potentiometer, like how we originally connected the LED and adjusted the brightness of it. However, it did not work. I went to the workshop for help and was told that Arduino is not the most ideal candidate in this case due to the pseudo-analog voltage that the PWM produces. Instead, a motor driver is needed. Or, I can simply connect the DC motor to the battery, and a potentiometer can help to adjust the speed a bit, but not ideal. So far, I only worked on the battery option, I will explore the motor driver shortly. This week I focus more on the ultrasonic distance sensor.
Ultrasonic Distance Ranger w/ Arduino
I bought a few HC-SR04 ultrasonic distance sensor and I2C LCD displays.
This week’s goal is to make a device that can measure the distance — with its own power resource attached, which greatly increases its mobility.
I started with the distance sensor alone, the display and battery were added step by step. Functionally, it works. However, aesthetically, it is not acceptable so far. I will rearrange the wires and make it more presentable — perhaps eventually make a box for it.
video 2 - force sensor is added in order to produce different frequencies
video 5 - wrong analog input
video 4 - test of a simple musical instrument
video 9 - retract
video 6 - correct analog input
figure 1 - motor does not work with pseudo-analog voltage
video 7 - test
video 8 - release
video 10 - failure
figure 3 - distance sensor connection
figure 4 - distance sensor test
figure 5 - moment of the week!
video 11 - test with moving object
figure 2 - simple setup - speed is controllable with a potentiometer
In the process of making the ultrasonic distance sensor and the display work, I found many great resources online and they all helped tremendously. I learned about trigPin, echoPin, VCC, SDA, SCL, wire library, LiquidCrystal library, etc. Mostly importantly, I got more familiar with the the system, concepts and components.
This project still needs quite a lot of work and upgrades, however, I think this is a good start.