IISC Bangalore CPDM
Project Report: Motor Angle Controller
17/Dec/2019
Parnika Gupta
Banasthali Vidyapith
B.Tech Electronics & Comm. Eng
Completed Tasks
1. Make a DC motor work like a stepper - you input an angle the motor must turn to that
angle. Use a feedback control system. Implement this in hardware, no simulations
allowed.
Ans.
 Schematic
 Arduino Code
int SENSOR_B=2;
int motor=5;
int encoderCounter;
int counter;
int encoder_angle;
int c;
int sensed_angle=0;
int Max_count= 100;
void encoderIncrementISR()
{
counter++;
}
void setup() {
Serial.begin(9600);
pinMode(SENSOR_B, INPUT_PULLUP);
pinMode(motor, OUTPUT);
attachInterrupt(digitalPinToInterrupt(SENSOR_B), encoderIncrementISR, CHANGE);
}
void loop() {
//Serial.print(sensed_angle, DEC);
counter=0;
encoder_angle= 0;
if(Serial.available()>0)
{
encoder_angle = Serial.readString().toInt();
//Serial.print("MOTOR ANGLE: ");
//encoder_angle = (encoder_angle, DEC);
Serial.print("t");
encoderCounter = map(encoder_angle, 0, 360, 0, Max_count);
//Serial.print("ENCODER COUNTER: ");
//encoderCounter = (encoderCounter, DEC);
//Serial.print("n");
delay(3000);
while(counter <= encoderCounter)
{
digitalWrite(motor, HIGH);
c = counter;
}
sensed_angle = map(c, 0, Max_count , 0, 360);
digitalWrite(motor, LOW);
Serial.print(sensed_angle, DEC);
Serial.print("n");
delay(2000);
}
}
2. Make a GUI with python using pyside2 library to control the motor overUART. The
GUI must take the input angle and display the sensed angle from motor. A minimal
GUI is acceptable; however, it must function as required.
 Schematic
 PySide2 and PySerial App
import serial
import time
import sys
from PySide2.QtWidgets import *
from PySide2.QtGui import *
ser= serial.Serial('com9', 9600)
app = QApplication(sys.argv)
win = QWidget()
win.setWindowTitle("Motor Controller")
l1 = QLabel()
l1.setText("Enter the degrees: ")
l1.setFont(QFont("Arial", 24))
e1 = QLineEdit()
e1.setFont(QFont("Arial", 20))
def Motor_Angle():
val= e1.text()
ser.write(val.encode())
time.sleep(5)
a = ser.readline().strip()
print("Sensed Angle", a.decode())
app.exit()
button = QPushButton("ENTER")
button.clicked.connect(Motor_Angle)
layout = QVBoxLayout()
layout.addWidget(l1)
layout.addWidget(e1)
layout.addWidget(button)
win.setLayout(layout)
win.show()
sys.exit(app.exec_())
3. Make a video demonstration and put the link in the document. Also describe what you
did in less than 200 words, add screenshots of the GUI, and attach the code(s).
Ans. (Approx. 280 words)
 The video demonstration link:
https://photos.app.goo.gl/tfvM9Kho7qVa1rmm7
 Motor Controller
o Aim
a. DC motor work like a stepper - you input an angle the motor must turn to that
angle
b. Use a feedback control system
c. Make a GUI with python using pyside2 library to control the motor over UART
d. The GUI must take the input angle and display the sensed angle from motor.
o Components Used
a. Arduino Mega: For controlling the motor by Arduino programming
b. DC Motor: For angular rotation demonstration
c. Rotatory disc: For indicating steps the motor rotated IR speed motor
d. IR LM393: For counting the steps of motor
o Working
 The GUI app takes the angle and saves in a ‘val’ / value which is sent to the
serial port of the Arduino by PySerial library through UART.
 The angle is converted into the counter/ step values that the motor has the
count to make user defined angle.
 The steps taken by the motor is again converted into the angle and shown in
GUI and the sensed counts are converted back to angle and shown on
PyCharm terminal.
o Graph
o Conclusion
a. DC motor work like a stepper, you input an angle the motor must turn to that
angle – By mapping one rotation step counts to 0 to 360 degree angle range
b. Make a GUI with python using pyside2 library to control the motor over UART-
By PySide2 GUI app and PySerial serial connection to Arduino Com port library
from PyCharm tool
c. The GUI must take the input angle- GUI takes the angle input in the QLineEdit
widget
d. Display the sensed angle from motor- PyCharm console shows angle that has
been travelled by the motor by converting the step count at the time of rotation
of motor to the corresponding angle.
4. Research on non-contact temperature sensors and the types available for medical
applications. Do a write up in about 250 words.
Ans. (Approx. 266 words)
Introduction
Non- contact temperature sensors are basically used where there is vacuum or
controlled atmosphere and quick response is required like while measuring temperature
18
32
54
75
93
118
136
154
180 190
216
237
255
270
298
313
334
356
0
50
100
150
200
250
300
350
400
20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360
Entered Angle VS Sensed Angle Sensed Angle
of ventilation chamber or of 100s of people in a place having epidemics with an error of
±2 °C or ±4 °F and does not come with worldwide standardization. They are generally
used in monitoring devices, works on portable battery and digital mechanisms.
Working
Principle of Planck’s Law for thermal radiation is used, higher the temperature, the
faster the molecules move. It is measured by calibrating the intensity/energy emitted by
different wavelengths since unlike the contact sensors these do not maintain
equilibrium with the object’s temperature.
Types
Non- contact sensors are preferably divided into broadband, narrowband, ratio and
optical sensors devices. Broadband and narrow bands devices measure intensity and
differentiated with range of wavelengths, only dust, water vapour, smoke, radiation
absorptive and steam can create errors while measuring. Ratio radiation devices
calculates the ratio of the two energies with function of the temperature of the object
and optical radiation devices are sensitive to optical brightness and works majorly in
visible range.
Medical application types
For medical applications basically there are spot IR thermometers, IR scanning systems,
IR thermal imaging cameras. Here, the IR pyrometers are used for instantaneous
measurement of body of child (like- IR ear laser thermometer used by keeping in the ear
of child) or of a critical patient. IR scanners can be utilized for manufacturing of the
medicines, sanitation and security purpose in hospitals whereas the IR thermal cameras
are used for medical image processing, images are known as thermogram.
Thank you

IISC CPDM Task 2 Report

  • 1.
    IISC Bangalore CPDM ProjectReport: Motor Angle Controller 17/Dec/2019 Parnika Gupta Banasthali Vidyapith B.Tech Electronics & Comm. Eng Completed Tasks 1. Make a DC motor work like a stepper - you input an angle the motor must turn to that angle. Use a feedback control system. Implement this in hardware, no simulations allowed. Ans.  Schematic
  • 2.
     Arduino Code intSENSOR_B=2; int motor=5; int encoderCounter; int counter; int encoder_angle; int c; int sensed_angle=0; int Max_count= 100; void encoderIncrementISR() { counter++; } void setup() { Serial.begin(9600); pinMode(SENSOR_B, INPUT_PULLUP); pinMode(motor, OUTPUT); attachInterrupt(digitalPinToInterrupt(SENSOR_B), encoderIncrementISR, CHANGE); } void loop() { //Serial.print(sensed_angle, DEC); counter=0; encoder_angle= 0; if(Serial.available()>0) { encoder_angle = Serial.readString().toInt(); //Serial.print("MOTOR ANGLE: "); //encoder_angle = (encoder_angle, DEC); Serial.print("t"); encoderCounter = map(encoder_angle, 0, 360, 0, Max_count); //Serial.print("ENCODER COUNTER: "); //encoderCounter = (encoderCounter, DEC); //Serial.print("n"); delay(3000);
  • 3.
    while(counter <= encoderCounter) { digitalWrite(motor,HIGH); c = counter; } sensed_angle = map(c, 0, Max_count , 0, 360); digitalWrite(motor, LOW); Serial.print(sensed_angle, DEC); Serial.print("n"); delay(2000); } } 2. Make a GUI with python using pyside2 library to control the motor overUART. The GUI must take the input angle and display the sensed angle from motor. A minimal GUI is acceptable; however, it must function as required.  Schematic  PySide2 and PySerial App import serial import time import sys from PySide2.QtWidgets import * from PySide2.QtGui import * ser= serial.Serial('com9', 9600)
  • 4.
    app = QApplication(sys.argv) win= QWidget() win.setWindowTitle("Motor Controller") l1 = QLabel() l1.setText("Enter the degrees: ") l1.setFont(QFont("Arial", 24)) e1 = QLineEdit() e1.setFont(QFont("Arial", 20)) def Motor_Angle(): val= e1.text() ser.write(val.encode()) time.sleep(5) a = ser.readline().strip() print("Sensed Angle", a.decode()) app.exit() button = QPushButton("ENTER") button.clicked.connect(Motor_Angle) layout = QVBoxLayout() layout.addWidget(l1) layout.addWidget(e1) layout.addWidget(button) win.setLayout(layout) win.show() sys.exit(app.exec_()) 3. Make a video demonstration and put the link in the document. Also describe what you did in less than 200 words, add screenshots of the GUI, and attach the code(s). Ans. (Approx. 280 words)  The video demonstration link: https://photos.app.goo.gl/tfvM9Kho7qVa1rmm7
  • 5.
     Motor Controller oAim a. DC motor work like a stepper - you input an angle the motor must turn to that angle b. Use a feedback control system c. Make a GUI with python using pyside2 library to control the motor over UART d. The GUI must take the input angle and display the sensed angle from motor. o Components Used a. Arduino Mega: For controlling the motor by Arduino programming b. DC Motor: For angular rotation demonstration c. Rotatory disc: For indicating steps the motor rotated IR speed motor d. IR LM393: For counting the steps of motor o Working  The GUI app takes the angle and saves in a ‘val’ / value which is sent to the serial port of the Arduino by PySerial library through UART.  The angle is converted into the counter/ step values that the motor has the count to make user defined angle.  The steps taken by the motor is again converted into the angle and shown in GUI and the sensed counts are converted back to angle and shown on PyCharm terminal. o Graph
  • 6.
    o Conclusion a. DCmotor work like a stepper, you input an angle the motor must turn to that angle – By mapping one rotation step counts to 0 to 360 degree angle range b. Make a GUI with python using pyside2 library to control the motor over UART- By PySide2 GUI app and PySerial serial connection to Arduino Com port library from PyCharm tool c. The GUI must take the input angle- GUI takes the angle input in the QLineEdit widget d. Display the sensed angle from motor- PyCharm console shows angle that has been travelled by the motor by converting the step count at the time of rotation of motor to the corresponding angle. 4. Research on non-contact temperature sensors and the types available for medical applications. Do a write up in about 250 words. Ans. (Approx. 266 words) Introduction Non- contact temperature sensors are basically used where there is vacuum or controlled atmosphere and quick response is required like while measuring temperature 18 32 54 75 93 118 136 154 180 190 216 237 255 270 298 313 334 356 0 50 100 150 200 250 300 350 400 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 Entered Angle VS Sensed Angle Sensed Angle
  • 7.
    of ventilation chamberor of 100s of people in a place having epidemics with an error of ±2 °C or ±4 °F and does not come with worldwide standardization. They are generally used in monitoring devices, works on portable battery and digital mechanisms. Working Principle of Planck’s Law for thermal radiation is used, higher the temperature, the faster the molecules move. It is measured by calibrating the intensity/energy emitted by different wavelengths since unlike the contact sensors these do not maintain equilibrium with the object’s temperature. Types Non- contact sensors are preferably divided into broadband, narrowband, ratio and optical sensors devices. Broadband and narrow bands devices measure intensity and differentiated with range of wavelengths, only dust, water vapour, smoke, radiation absorptive and steam can create errors while measuring. Ratio radiation devices calculates the ratio of the two energies with function of the temperature of the object and optical radiation devices are sensitive to optical brightness and works majorly in visible range. Medical application types For medical applications basically there are spot IR thermometers, IR scanning systems, IR thermal imaging cameras. Here, the IR pyrometers are used for instantaneous measurement of body of child (like- IR ear laser thermometer used by keeping in the ear of child) or of a critical patient. IR scanners can be utilized for manufacturing of the medicines, sanitation and security purpose in hospitals whereas the IR thermal cameras are used for medical image processing, images are known as thermogram. Thank you