2017年3月7日星期二

Y2 Project Week 5

Week 5

The improvement of the circuit

The problem in last week was the first thing to do in this week, which is the error of the phase difference may be higher than our expectation.  We discussed and found the reason was that the values of capacitor in the cascade circuit and the parallel circuit are different.  Therefore, we need to do the calculation and choose the suitable capacitor before connecting the circuit.
In this week, we decided to replace the BJT by the MOS.  The advantages of the MOS are that it save the space on the breadboard and it only determined by the voltage.  When it compared to the BJT, it does not need to change the value of the capacitor in the circuit.  The following figures will show the MOS and the whole circuit:

Figure 1

Figure 2




Figure 3



The new circuit will collect the voltage and current by the ARM, and then the voltage will be transferred into square wave.  Next, the ARM will calculate the original power factor of the circuit.  After the calculation of the original power factor, the ARM will change the voltage of the MOS in order to realize the switch function of the MOS.  Afterwards, the circuit will be connected to the different capacitors.  The ARM will calculate the power factor and reserve the best capacitor.  The result will be displayed on the LED screen of the ARM. 
However, the new circuit still has some problems.  The most important problem is that the amplifier can not work.  The amplifier is used to amplify the voltage to the MOS, and the voltage will determine the state of the MOS.  If the amplifier can not work, the whole circuit will not work.  In addition, when we tested the circuit, we found that the accuracy will decrease when we increase the frequency.  These two problems cause the new circuit can not work well.

Test of the circuit

After using the MOS to replace the BJT, we need to test the whole circuit to check the circuit can work or not.  The following figure will display the result of the circuit:

Figure 4
From the result, we can see the power factor has been improved.  It has realized the function of saving energy.  This technology can be applied in our daily life to help us to save energy and improve the efficiency when we using the electronic appliance.


2017年3月2日星期四

Y2 Project Week 4

Week 4

The aim of this week's group project

In this week, we need to solve the problem of the circuit in last week and then connect the circuit to the ARM microcontroller in order to finish the whole design and test for the project.

The design of the circuit

The first part of this stage is to solver the problem in last week.  Last week, we found that the voltages in cascade circuit have a problem, which is that the value of voltage of a resistor is 0 and the other resistor's voltage is the voltage of the whole cascade circuit.  In this week, we checked the circuit and simulate the circuit by using the PSPICE.  After the checking and testing, we found that the reason for the problem is the wrong connection of the circuit. The wire form two channels of the oscilloscope should be connected together when two wires are required to realize the function of connecting to the earth ground.  
The next step is to test the whole circuit without the ARM microcontroller. When we using oscilloscope to test the circuit, we found that the error of the phase may be higher than our expectation.  In order to solve this problem, our group member raised a solution to replace the inductance by the capacitor.  We decided to try this solution in next week.
Without the problem of the error of the phase, our circuit was successful because we can find the phase difference on the oscilloscope.  The figure for the circuit and the wave to indicate the phase difference are displayed in figure 1, figure 2 and figure 3.

Figure 1


Figure 2


Figure 3

The code for the ARM

Unfortunately, we still cannot solve the problem in last week, which is the computer cannot display the time of testing on the screen because of the problem of the port from the ARM microcontroller.  It sometimes displays the result and it sometimes does not display the result.  That is really confused us.  
Beside this problem, we complete the logic and the code of the ARM.  The whole logic for ARM to realize the function has 5 steps.  Firstly, it collect the voltage on the power and the resistor.  Secondly, it transfer these voltage into the square wave.  If the voltage is higher than the value of average value, it will be considered as the value 1.  If the voltage is lower than the value of average value, it will be considered as the value 0.  Thirdly, using these voltages in square wave to calculate the phase difference.  Fourthly, using the phase difference to calculate the power factor.  Fifthly, change to another capacitor and then repeating the steps to calculate the power factor.
The square wave of the voltage by using the ARM to realize this function and the code for the ARM are displayed in the figure 4 and figure 5.

Figure 4

Figure 5