Tutorials
This week contains 3 main milestone activities:
EOweek Videos and tutorials include how to Program an Arduino Uno board to do serial communication through a wire (USB) and wirelessly (Via Bluetooth). Using a simple Graphical User Interface on PC to control a smart circuit wirelessly (Via Bluetooth) Using a simple Graphical User Interface on phone to control a smart circuit wirelessly (Via Bluetooth).
Doing the Weekly assignment about Communicating wirelessly with a Smart Circuit via a Graphical User Interface (GUI) on your phone or PC.
For the materials: i used some electrical sets from the given Kit as follows:
Arduino Uno
Servo Motor
RGB, LED Lamps 2.2V
Bluetooth Module HC-50
Jumper Wires MM, MF
Resistors 220,560 and 1 K ohm
Breadboard
USB Connection
Ultrasonic Sensor
In the Smart Device i made, I used:
Arduino Uno
Bluetooth Module HC-50
Resistors 220,560 and 1 K ohm
Servo Motor
RGB LED Lamp
Breadboard
Ultrasonic Sensor
Jumper Wires MM, MF, FF
USB Connection
For the software:
I used the tinkercad as a simulation program that used for simulating the electric circuits.
Arduino Uno IDE 1.8.15 programming Software.
BT terminal App for wire communication between mobile and arduino..
Processing I3 for PC Connection GUI.
Andriod Phone for mobile Connection GUI. (Arduino Bluetooth Control).
BT terminal App
Arduino Bluetooth Control
TinkerCad
Arduino Uno
Arduino Uno IDE programming Software
Processing I3
Breadboard
Servo Motor
RGB LED
USB Connection From Arduino to Laptop
Ultrasonic Sensor
560 and 1 K Ohm Resistors
Resistors 220 ohm
Wires male male
Bluetooth Module
Connecting a Smart Circuit using an Arduino UNO and Mobile App GUI via Bluetooth Module
The main idea: I connected last week's circuit with Bluetooth Module HC-50 to control my circuit by a mobile App.
Main Concept: It will differ its opening angle according to the distance of the occupants. and The wall will emit different lights according to its opening angle states. The fully Closed state 0 for detecting no one in space with a far distance of more than 40 cm / the light will be purple then- semi-opened/closed state 45 for detecting a near body from the wall between 40 and 20 cm and the color will be cyan color Fully opened state 90 for detecting a very near body less than 20 cm with green color.
The technical components: the output component: motion and light, the action components are done by using servo motor and RGB LED, The brain is the Ardunio UNO, power management: the breadboard will take the power from Ardunio UNO that is taken from the laptop by using USB. the controlling is via bluetooth module and a Mobile App.
The Datasheets of each component are as follows:
Arduino Datasheet
From Datasheets>>>For RGB LED:
Required Blue color voltage= 3.2 V
Required Red color voltage= 2 V
Required Green color voltage= 3.2 V
For Servo motor:
Required voltage= 5V
Angles from 0 to 180 degrees.
Input of Arduino = 5Volt
5-3.4=40/100R
R= 230-320 Ohm ( for RGB LED resistors).
HC-50
it is required a 560 and 1K ohm resistors as it needs only 3.3 volt for the RXD.
Steps of implementation on Arduino IDE
First, i begin to assign each value that will be used to add the <servo.h> library to read the servo motor and I named it as servoMotor. Then, I set the trigger and echo of the ultrasonic sensor to be able to read the distance of any object correctly. i added then the character of the incoming data that will be sent by the Mobile app and settle it as zero (initial value).
2. Then, in the void setup(), i begin with assigning each pin to its pin number and its state. also i attached the serial monitor code >> Serial. begin (9600) to be able to read the readings on my screen. the RGB LEDS 9,10,11 are as output pins. the servo motor is attached to the pin 3 .
3. Then through the void loop(), i begin with constructing the While condition that illustrate when I added a value the system will act as it. So iadded then the incoming data will be euqal the serial read function. if the incoming data as an example (pressing =1), the motion and light of the RGB LED will act by constrained values. The full path can be illustrated as follows: this is done by adding the Distance order as follows:
4- Then, I opened Arduino IDE and upload it to the Actual Ardunio after porting it with the USB.
Snapshots of the Code in the Arduino IDE ( the Full File is in the Ass files section)
Wiring Diagram by using Tinker cad
I used the Tinker cad to ONLY simulate the wiring of the circuit.
First, I chose from the panel: Ardunio Uno, mini breadboard, Bluetooth Module, Servo Motor, RGB LED, and resistors of 220,560,1k ohms.
I supplied the 5 V power pin from Arduino to the + side of the Breadboard and the GRD to the -Ve side of the Breadboard respectively.
4. i placed the RGB LED in the bread board and supplied the common cathode of it with the -Ve of the breadboard. Also for the anodes colors i crossed resistors of 220 ohms along them then to the Arduino digital pins as 9,10,11 respectively.
5. i connected the servo motor to the breadboard by supplying the power pin to the +ve and the GRD to the -Ve of the breadboard. And, the signal pin to the the Digital pin 3 on Arduino.
6. Last, i connected the Bluetooth Module HC-50 to the breadboard by supplying the power pin to the +ve and the GRD to the -Ve of the breadboard. Also, the TXD to the the Digital pin 0 on Arduino and the RXD to Digital pin 1on Arduino. i added 560, 1k as voltage divider 3.3 v.
First, I conducted the power by using MM jumper wires on one side along with the mini breadboard and the other on 5V of the Arduino. the same was done for the GRD side.
2. i connected the Bluetooth module HC-50 to the board. there are 4 pins in this module, Vcc to the =Ve of the board, GRD to the -ve of the Board, TXD to pin 0 in the Arduino uno, RXD to the pin1 of the Arduino uno. but the RXD needs to be as 3.3V output, so I added 2 resistors 560 and 1K ohm to act as a divider module (Regulator).
3.Then, I put the slider switch on the lower part of the breadboard. i settled the RGB LEDi placed the RGB LED in the breadboard and supplied the common cathode of it with the -Ve of the breadboard. Also for the anodes colors i crossed resistors of 220 ohms along them then to the Arduino digital pins as red, blue, green 9,10,11 respectively.
4. i connected the Servo motor to the circuit, by adding the power and ground of the motor to the line of the upper slots in the breadboard. Also, the signal pin to the Digital pin 3 on Arduino.
5- Then, I opened Arduino IDE and upload it to the Actual Ardunio after porting it with the USB.
6- Then, I opened Mobile app ( Mobile Bluetooth controller) after i paired it with HC-50 on my phone. i re connect it in the app.
6- As i programmed the code when pressing 1, 2,3 or 4. i made 4 equations by fixing the angle to the RGB led lights.
State 3 ( Far position with purple color)
State 2 (Middle position with cyan color)
State 1 (Near position with Green Light)
Demo for the Circuit implementation
In the off session, we go through the Hackathon i learned some new tips about managing the circuit with a 9 V power supply instead of the USB cable. This tip will help me a lot in the completion of the whole project idea.
Also in this activity, my partners in the group were Ramie who helped with writing the code of the circuit. Also, i helped Randa in the implementation of the circuit and the connections among different inputs and outputs.
i also learned a tip of the difference between CHAR and INT in coding and the importance to add '----' single quotes to the Char function in order to read it as numbers.
Problem: During practising the turorials, i added the bluetooth module HC-50 to the circuit and then I tried to upload the code to the Arduino. but it uploaded very slow and with errors.
The solution was to upload the code first to Arduino by removing the receiver and transmitter pins of the Bluetooth module, then adding them after uploading.
2. Problem: During practising the turorials, i added the bluetooth module HC-50 to the circuit and then I tried to connect the Bluetooth module with the PC. i paried it successfully, but while uploading the processing file, I see three different names of the Module to add in the code. and i didnot know which one to add.
The solution was that i opened the bluetooth options and read the name that the device configured my module. then i added it in the code and it works!
Practicing the controlling of a circuit with using mobile/pc app, is my first try to go deeply in this. This will be a great addition in my project.
In the Assignment of this week, I succeeded to do the circuit of my final project, i could control my project Circuit through a mobile app.
The most coolest thing of this week that i could connect my project Circuit through a mobile app. i controlled the angle of opening and also the RGB Led light through the Android mobile app.
Also in the hackathon session, about building and playing with the robot arm. That's was so cool.
project Circuit through a mobile app
Practicing the Tutorials through mobile and pc Apps, and Arduino IDE.
I also watched some helpful videos about Mobile apps and pc control connections.