Wednesday, 8 March 2017

week 5

This week we tested the essential function of mobile DC motor control, that is using smart phone to give the instructions to the circuit through blue tooth and control the speed of the motor. It worked well, however, when we moved on to next step, we met a serious problem, that is the encoder cannot be used. The encoder consists of two parts: a disc to interrupt light and a photo-sensor to detect light, nevertheless, this two parts are separate and the area of photo senor is too small to aim, as a consequence, when we combine the encoder with the motor, we cannot find the position where the disc can interrupt the light, and the pulse shown on the oscilloscope is unstable and we cannot use the encoder to calculate the speed and draw the graph. 

Therefore, we planned to use a smart car instead of encoder. The smart car we built before has a component can achieve the same function as encoder. In this way, we can show that the code we wrote is correct. Unfortunately, the sensor on the car did not work, it cannot detect the wheel’s speed.

As a result, we had to buy a new motor with an encoder, and the encoder was fixed on the motor so that we could use it directly (shown in Figure 1).
Figure 1

We bought online on Friday, it will send to us on nest Tuesday. After receiving the motor, we built the whole circuit (shown in Figure 2).
Figure 2

We tested it and result was positive: it worked properly. Then we linked the motor with the wheel to test the code. We counted the pulse during each time period on behalf of measure speed of the motor directly; we set four gears: 1/4 speed, half speed, 3/4 speeds and full speed. We set a theoretical pulse, and use a PID controller to form a close loop and adjust the real time speed. We tested the code first, the motor worked well. Then we connected it to the serialchart to print the real time speed. At first time, there was no graph drawn on the screen, thus, we adjust the minimum and maximum value of y-axis, the graph was shown on the screen correctly (shown in Figure 3).
Figure 3
In the data section, in the same line, the first data is the real time speed, the second data is the theoretical speed, the red line in the graph is the theoretical speed and the black line is represent the real time speed. The real values were close to the theoretical value, which means our project was accomplished successfully!   

week 4

This week we started to write the code, and tried to add encoder to measure real time speed, then send speed data to serial chart the draw graph. We separated into two groups: one group tried to figure out how to measure the speed, the other group learnt how to draw the graph.  

We met some problem. In order to measure real time speed, timer interrupt would be used in code. Timer interrupt will stop the main program in a certain period whilst a real time speed will be detected and send to serial chart, and then the serial chart will draw graphs according to each real time speed detected in every single period. Nevertheless, when the real time speed is measured, the main program is stopped and it may not send command to motor to adjust motor. It was never be done before, we did not know how to solve the problem, we searched on the Internet, and there was no a proper solution. As a result, we attempted to write the code first, see whether the problem would cause any negative influence. Then we consider we can write 'attachinterrupt' into the code to solve the problem.

Meanwhile, we wrote the figuration for serialchart and connected it to encoder to draw the graph of real time speed. On the left side of serialchart  is the real time data that come from the motor, and on the right side is the configuration that needed to enter, at the bottom of serialchart will show the graph. There is a example of how does it draw the graph (In Figure 1) .
Figure 1

We received the PCB that we asked for last week (shown in Figure 2), hence, we began to solder the encoder with PCB, however,  we did not finished soldering, thus, we left the soldering part to next week.
Figure 2
   

Tuesday, 7 March 2017

week 3

This week we made a profound improvement. We made a really significant discussion that we decided to change the chip of the drive circuit, which means we had to re-design the circuit and re-build it. There were serial reasons support us to change the H-bridge.
Firstly, the old circuit did not connected well. There was an open circuit in the circuit, however, after testing at each point, the cause was still unclear. Secondly, the motor we ordered was not arrived, hence we had to use a new motor, however, these two motors had different limited voltage, and if we wanted to use the motor we had, which the limited voltage is 3-6 voltage, then the old H-bridge (LMD 18200) was no longer adjust. As a result, we decided to change the chip. we use L293D motor driver instead Shown in Figure 1. it can provide bidirectional current 1A at the voltage 4.5V to 36V that will fit our motor.The L293D are quadruple high-current half-H drivers. These devices are designed to drive a wide array of inductive loads such as relays, solenoids, DC and bipolar stepping motors, as well as other high-current and high-voltage loads.
Figure 1
Figure 1 shows the pin functions of L293D motor driver.


Figure 2
Figure 3 shows the block functions of motor driver L293D.
We began to design a new circuit, as shown in Figure 3
Figure 3
 the new circuit contained four capacitors, which are used to control the direction of current flow through motor. Connect a encoder to detect the real time speed, however the diameter for the plate of the encoder is much larger than the bearing axle of the motor, thus we need to make a ring to over-striking the bearing axle so that it would fit the encoder plate. We also asked the technician for help to make a PCB, which used to connect encoder, shown in Figure 4.


Figure 4

 The testing result was positive, when connected to the power supply, the motor worked well.  

week 2

In this week, we started to build the drive circuit. However, we met serial difficulties.  Because the motor still not arrived, we tried to use a 3-6V motor (shown in Figure 1) connected with a resistor in series to replace the motor we required.
Figure 1
Using the 3-6V motor was just the alternative method that we could build and test the circuit. We used breadboard to build the circuit, shown in Figure 2
Figure 2
 However, the connection inside breadboard was not reliable, as a consequence, during testing, the results were not stable. The tested voltage between pin 2 and pin 10 (which is the voltage of motor) could be correct sometimes, other times it appeared to 0V, which means the drive circuit was an open circuit, whilst the input voltage (between pin 6 and pin 7) was correct.
After eliminating the error of circuit, the only possibility that may cause this problem was the connected inside breadboard opened. We built the circuit again in a new breadboard, the testing results were better than former testing, but still had some error results.

Saturday, 4 March 2017

week 1


It was the first week of Year 2 Project. The group members firstly had a meeting with Academic Adviser on Thursday, re-clarify the project target, to build a mobile controlled DC motor; then, made a clear plan which include what would be done in each week.

 On Friday, we first check whether all needed components were sent to the laboratory, unfortunately, the DC motor we needed was not arrive, which means we could not build the whole circuit. Instead of wasting time on waiting for the motor, we checked the rest of components, for instance, the arduino UNO that is one of the most significant components (shown in Figure 1), runs well.

Figure 1
We double-checked the circuit we created to make sure it were not have any mistakes, and when we begin to build the circuit, it will not waste our time.