8th Week - Journal
8th Week - Journal
I'm not gonna use the Bluetooth module in my final project so I wanted to make a simple assignment that fits the requirements and also will help me in my final project so I made Auto servo.
When you apply a number, the servo will move to the desired angle as I wrote in my code also the mode you entered (number) will appear on 7-segment display.
This one is used to upload write Arduino code and upload it to Arduino UNO.
I wanted so badly to try fritzing software since I saw lots of people using it and also there were components that I need in my circuit wiring but it's not available in Tinkercad so I took a shot!
Used to simulate the circuit (without bluetooth module).
Used to contact with circuit through bluetooth module.
We had to use two action components to control using bluetooth module. I chose micro servo motor and 7 sigment display. The wiring done as follow:
1- Each pin of the segment was connected to input pins (5, 6, 7, 8, 9, 10, 11, and 12). I used all of them as digital pins. The common pin was connected to 220 ohm resistance which connected to -ve terminal of breadboard.
( It's better to use 220 ohm resistance on each pin i.e. using 8 resistors. To make sure that the current reaching each pin will be sufficient to light it with the same intensity. I didn't do that because I was kinda hurrying.
2- The GND pin of servo is connected to -ve of breadboard and power terminal is connected to +ve of breadboard. The third signal pin is connected to pin 3.
3- Bluetooth module doesn't appear here but I connected as in this week video tutorials using 560 ohm resistor and 1kohm resistor.
4- The +ve and -ve columns of breadboard are connected using male-male jumper wires to 5V pin and GND pin of Arduino respectively.
First Step: Building the circuit
I started by building the circuit as I designed in Tinkercad.
Writing the code using Arduino C.
First, I downloaded the "Servo" library.
Second, I identify a character (char) called "userinput" and store the value 0 in it.
I identified my servo name in the global scoop (before setup).
Inside "void setup", I identified the pins of 7 segment display, and servo. Since I'm going to use serial monitor I had to setup the data speed between the Arduino and my PC using serial.begin tool.
Inside "void loop", I set while serial.available to allow input from console to program via "Serial monitor". Then I set if condition, that if he received 0 character from user, he will set servo on 0 degrees and display on segment 0. if he received 1 character, the servo will move to 30 degrees and display 2 on segment etc.
Second Step: Write the code.
Third Step: Test the Code on Tinkercad.
Fourth Step: Adding Bluetooth Module.
I added bluetooth to the actual circuit and on fritzing. The VCC pin is connected to +ve terminal of breadboard. While GND is attached to -ve terminal of breadboard. The TX pin of module is connected to RX of Arduino. The RX pin of module is connected to 560 resister and 1kohm series parallel. The terminal of 560 ohm resistor is connected to TX of Arduin while 1kohm resistor is connected to GND.
I uploaded the code on Arduino Uno. I used Arduino Bluetooth Control android app to connect with Bluetooth module and be the monitor.
Fifth Step: Test on real Components.
I did this assignment in the morning so there was no time to take feedback unfortunately. However, I did had trouble with uploading the code on Arduino Uno. but when I turned to troubleshooting channel on slack I found someone had the same problem so I got help from the people who replied there. Thank you guys.
I faced couple of problems:
First, the code was giving me an error saying that "myservo.Write(0);" is not declared so after searching I found that I didn't identify it in the global scop so I edited the code and added "Servo myservo;" in the global scope before setup.
Secondly, even when I removed the power of module before uploading the code, the code didn't upload on Arduino saying that the error is related to the space capacity so I searched but with no clue. Then I went to troubleshooting channel on slack and I found there an answer from a person who had the same problem as me. She said that the serial RX & TX pins connected to Arduino must be removed before uploading the code and I did. It worked! Thanks Marwa Yasser.
Third and last problem, I couldn't find Bluetooth module on Arduino Bluetooth Control android app to connect even when the phone Bluetooth is on, and my colleague Sara Samir helped me in this. She said I have to connect the phone with module first from the settings then connect app wit it.
It helped me in coding the servo motor since I'll use it.
I took this picture at the first week of maker diploma. I still remember the feeling, I was all confused and not sure what I'm doing exactly. We were just following the tutorial
But here I'm, after the past 8 weeks I'm able to recognize Arduino, LCD, the pushbutton, the buzzer and the sensor! and how we connect all of these things together :)
So I think it's pretty amazing what I have learnt during this journey.
That the Beginners team (my team) won in the last competition that held between all maker teams. Thank you Sara Samir, Ahmed Sami and for sure the instructors, Sherif and Amany for the help! Also great thanks to Sara Alaa for her help in fixing the magnet.