1. Project Title: Kapsul PCB Testing
Shipeng Yang & Ziheng Liu
A. Wish to improve our English communication skills and this Kapsul project is really a good challenge
B. Learn how to apply the real-time embedded system knowledge into real problems
C. Wish to learn the process of unit test and design some practical function to finish the test
Step1: Communicate with project providers to understand the function of each kapsul part
Step2: Watch tutorial materials to learn more about embedded C and related MCU and sensor data sheets to testing the PCB
Step3: Change the source codes and upload the program by JTAG programmer to test the circuits
Step4: Use FIDI friend to create and send commands to control the kapsul board
Step5: Set Arduino as a virtual fan and use it to verify the function of Pwm and Tach
Step6: Use Arduino to send commands to control the board
Step7: Remove all the laptop to test the board
Step8: Combine all the test units into one integrated test
5. Project Components
Hardware: ATSAMD21G18A-MU, Kapsul PCB，JTAG programmer, Arduino
Software: Atmel studio 7.0, Arduino series, Tera Term Mechanical Effort: Using breadboard to create testing circuits
6. Testing and Evaluation
A. Read codes and learn each function of the Kapsul PCB well after continuous and effective communication
B. Successfully verify correct function of the host microcontroller subsystem
C. Successfully verify correct function without the laptop
D. Design an off-board circuit to realize the test
Baseline1: Changed the source codes to test the PWM and TACH directly
Baseline2: Use and create the commands to test the PWM and TACH
Baseline2: Use Arduino to create a virtual fan and test the PWM and TACH as a closed loop
- Develop a user-friendly and more detailed test sequence a. Realize continuous PWM test b. Solve conflict command lines c. Create commands which are not realized(change the target speed directly) d. Add more tests into the test sequence (UI & Compressor)
- Realize the mutual communication between Arduino and Kapsul board
- Use WIFI function of ESP32 Dev module to save the MAC addresses
- Hardware Design a. Design an assembly device to test the board without any laptop
Nov 8- Nov 12
Read Codes (Fancontrol.c & CompressorControl.c); Learned how to use Ceedling; Learned some basic knowledge of unit test.
Nov 12 - Nov 16
Read codes (TempCntrl.c); Learned the schematics of the board; Try to give the power supply to the board and met some problems.
Nov 16 – Nov 21
Read codes (keep reading the codes above); Try to upload the program into the board.
Nov 21 – Nov 26
Read codes (ACS724CurrentDriver.c); Get familiar with the related functions of the board; Changed the source code to test the GPIO.
Nov 26 – Nov 29
Read codes (UserInterface.c & NoriaCommands.c); Use Arduino to replace with the power supply and oscilloscope; Learn to create test command to finish the test based on firmware.
Nov 29 – Dec 6
Use Arduino to send command line to the control board Combine the PWM & Tach test and UI Leds test together without mutual influence Test the COMP_CNTRL with Arduino Combine PWM & Tach, UI Leds and COMP_CNTRL together Design an assembly board to realize the test
9. Stage of development
Regular meetings Since our project requires a lot of communication to get started, we have regular meeting with Don, where we demo what have been done and point what confuse us in the past week. (meeting documents) Read codes We have kept reading the codes, mainly including: Fancontrol.c, CompressorControl.c, TempCntrl.c, ACS724CurrentDriver.c, UserInterface.c, NoriaCommands.c. In order to find the particular function to realize the test, we draw the layouts of main codes, which become important reference in the later test. (code notes)
Change the source code to test directly Based on our understanding of the code, we try to change the source code to check the output difference. Finally, we find the exact positions to control the PWM and TACH. Then, we figure out the relation between these two GPIO, using the multiplier to give the pulses and using oscilloscope to check the PWM. The results verify our assumption that when the current speed is less than target speed, the PWM will increase until they are equal and vice versa. The test excel records show the details of test. (video & test excel)
Use and create commands to realize the test We use FIDI Friends to communicate with the control board through Tera Term on the laptops. After reading the Parameter.c and NoriaCommands.c, we can use the commands to set and get the status. Also, we successfully create new commands to turn on the LEDs and to set target speed, which requires not only following the complex format in NoriaCommands.c but also creating new cases in the exact position in the source code. (video)
Use Arduino uno to create a virtual fan In order to get rid of the waveform generator and oscilloscope, we decide to use Arduino to create a virtual fan, which could receive the PWM from control board and send correlated TACH impulses back to the board. The TACH impulses can be accelerated or decelerated according to the difference between the target speed and current speed. Next, when these two speeds are equal, the PWM generated by the control board will not change any more and then we turn on the light of PB5 to show the result, which indicate that if the outer device works well, the control board can do it job correctly. What’s more, we use the command we create to change the target speed, it is clear that the unchanged PWM starts to change because it needs to control the virtual fan to achieve the new speed.
Use Arduino to send command and remove all the laptops and multipliers The next milestone for us is using Arduino to command the control board. It is not as easy as include uart,h and just use printf to realize the communication because the command line is not stable and communication between two MCUs is also troublesome. At first, we corrected the Baud rate, the wire connection, the “printf” format in Arduino and have tried a lot of times. But the command still cannot be sent successfully. At last, we found that the control board cannot deal with the string in terms of the low speed, so we send commands character by character and delay proper time. What’s more, there are some tricky things in this communication which we could not fully understand. For example, in the main.c we need to define the F_CPU as 20000000L and in the uart.h the value should be 16000000L. (video)
Combine separate test functions into an integrated code When it comes to combination, things get complex because the different functions could affect each other by interruption. We spend a lot of time on adjusting the codes because the value needs to be rechecked and the priority of interruption ought to be carefully taken into consideration. Also, during this time, by using Arduino to send different command, we successfully test the COMP_CNTRL, which is combined into the final codes, too. The output can change from 0v to 3.5v when a button is pushed.
Wi-Fi client and socket server In this part, we built a Wi-Fi client using esp32 micro controller and a python socket server. We plan to use these implementations to send the PCB MAC address and test results to a local Wi-Fi server. For the Wi-Fi client part, we used the wifi.h library in Arduino Studio. After we connected to the Wi-Fi based on the Wi-Fi name and password, we created a Wi-Fi client object and call the connect method on our WiFiClient object, using IP address as the first input and port number as the second input. Then we use Python to build a local server. We imported the socket module in Python and called the bind function to set the IP address and port number. When the IP address and port number matches between the Wi-Fi client and server, the server start to receive data from the client. As the following data shows, the frame of MAC address and test results transferred successfully. This part should be improved to store the received message in a database, so that it can be used for serial testing.
Design an off-board circuit to start the test and show the test result For this part, the design is very simple since the kapsul board should be returned after this project, we cannot change the way of connection between GPIO and off-board circuits. (picture)