1 / 52

CENG4480 Digital Systems Design

Explore self-balancing robots, music robots, vision robots, and FPGA projects. Learn about IMU boards, Kalman filters, complementary filters, and digital filters. Engaging and informative resources for hardware design projects.

awillis
Télécharger la présentation

CENG4480 Digital Systems Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CENG4480 Digital Systems Design Hardware project examples Hardware project examples (v.5d)

  2. Overview • Self balancing robot • Music robot • Vision robot • FPGA projects Hardware project examples (v.5d)

  3. Project 1: Self balance vehicle / robot • Segway http://www.segway.com/ Hardware project examples (v.5d) http://www.ebay.com/itm/Toy-Mechanical-Robot-Remote-Walking-Dual-Wheel-Balancing-Multiple-Modes-Kids-Toy-/111728506257 http://news1.ghananation.com/latest-news/300907-it-s-the-segway-section-chinese-cops-on-patrol-for-shoplifters-on-electric-scooters.html

  4. Khw1404 FYP a self balanced robotby HA Ngo Lam, LEE Yiu Hei supervised by Prof. KH Wong Hardware project examples (v.5d)

  5. The basic idea • Motion against the tilt angle, so it can stand upright Hardware project examples (v.5d)

  6. Student ID: __________________Name: ______________________Date:_______________ (Submit this at the end of the lecture.) Exercise 5.1IMU board • Inertial Measurement Unit board • Direction (electronic compass) • What does it measure? _____________. Absolute or relative? _____ • Position (accelerometer) • What does it measure?_____________. Absolute or relative? _____ • Angular velocity (gyroscope) • What does it measure?_____________. Absolute or relative? _____ • Pressure (Barometer) • What does it measure?_____________ . Absolute or relative? _____ • Temperature • What does it measure?______________. Absolute or relative? _____ Hardware project examples (v.5d)

  7. The algorithm is based on two Filter methods • Kalman Filter • Complementary Filter Hardware project examples (v.5d)

  8. Algorithm - Kalman Filter • New Measurement Prediction of New Data Data Knowledge Base New Measurement Update New Data Using Weight Output Average Output Hardware project examples (v.5d)

  9. See how nosier can be removed by Kalman filter Hardware project examples (v.5d)

  10. Kalman code (lab5: IMU) • // Kalman filter module • float Q_angle = 0.001; • float Q_gyro = 0.003; • float R_angle = 0.03; • float x_angle = 0; • float x_bias = 0; • float P_00 = 0, P_01 = 0, P_10 = 0, P_11 = 0; • float dt, y, S; • float K_0, K_1; • float kalmanCalculate(float newAngle, float newRate,int looptime) { • dt = float(looptime)/1000; • x_angle += dt * (newRate - x_bias); • P_00 += - dt * (P_10 + P_01) + Q_angle * dt; • P_01 += - dt * P_11; • P_10 += - dt * P_11; • P_11 += + Q_gyro * dt; • y = newAngle - x_angle; • S = P_00 + R_angle; • K_0 = P_00 / S; • K_1 = P_10 / S; • x_angle += K_0 * y; • x_bias += K_1 * y; • P_00 -= K_0 * P_00; • P_01 -= K_0 * P_01; • P_10 -= K_1 * P_00; • P_11 -= K_1 * P_01; • return x_angle;} Hardware project examples (v.5d)

  11. Complementary filter to combine gyroscope and accelerometer • Algorithm-complimentary filter Gyroscope Integration Complimentary Filter (weighted average) Angle output Kalman Filter Accelerometer Hardware project examples (v.5d)

  12. Complementary Filter to combine gyroscope and accelerometer • Combine two sensors for good measurement: • Gyroscope • response faster but has drift over time • Accelerometer • response slower but no drift • Positive • If not moving, accelerometer will give accurate reading of tilt angle • Negative • Accelerometers are slower to respond than Gyro's • Accelerometers are prone to vibration/noise Demo https://www.youtube.com/watch?v=jUxU7jsCa-U Ref: http://www.hobbytronics.co.uk/accelerometer-gyro Hardware project examples (v.5d)

  13. Complementary Filter codein CENG4480: lab 6 • Read_acc(); • Read_gyro(); • //compute interval since last sampling time in millisecond • interval = newMilli - lastMilli; • lastMilli = newMilli; // save for next loop, please note interval • // will be invalid in first sample but we don't use it • Ayz=atan2(RwAcc[1],RwAcc[2])*180/PI; //angle measured by accelerometer • Ayz-=offset; //adjust to correct balance point • Angy = 0.98*(Angy+GyroIN[0]*interval/1000)+0.02*Ayz; //complement filter • kang = kalmanCalculate(Angy, GyroIN[0],interval); //kalman filter • Serial.print(kang); • LRspeed = 0; Hardware project examples (v.5d)

  14. Exercise 5.2 • Explain the operation of the complementary filter and why do we need to have this filter. • Answer: Hardware project examples (v.5d)

  15. A short introduction to digital filter Gain G(f) in dB • Analog filter • Using capacitor resistors, inductors with op-amp • Digital filter (using digital hardware or software) • FIR ( Finite Impulse Response, non-iterative) • IIR (Infinite impulse response, iterative) 3dB Frequency Hardware project examples (v.5d)

  16. Example: Finite Impulse Response (FIR) Low pass filter (LPF) (one pole) Analog LPF • Algorithm • For an input of x(n): • x(time =0), x(time =1),x(time=2),… • Or X(n=0), x(n=1), x(n=2)… • y(n)=g*x(n)+a*x(n-1), if g=0.5,a=0.5 • y(n)=0.5(x(n)+x(n-1)) //=averaging filter, • Only use previous signal samples • Simple to implement (non-iterative) , and stable Equivalent digital (FIR) LPF Hardware project examples (v.5d) http://soundlab.cs.princeton.edu/learning/tutorials/DSP/DSP.html

  17. Exercise 5.3 • If you have a signal x(0),x(1),x(2),x(3),x(4),x(5). Write the filter output y(n) for time is n=1,2,3,4,5 if the filter (with g=0.6, a=0.4) is y(n)=g*x(n)+a*x(n-1) • If x(0)=4,x(1)=3,x(2)=7,x(3)=5,x(4)=6.2,x(5)=9, what is the value of y(5)? • Answers: Hardware project examples (v.5d)

  18. Algorithm - PID Control to stabilize robot Proportional control Kp * proportional term Sum Motor Speed Derivative control Kd * derivative term Integral control Ki * integral term IMU Angle Setpoint Hardware project examples (v.5d)

  19. TUMBLER Version1 Hardware project examples (v.5d)

  20. TUMBLER 3 Hardware project examples (v.5d)

  21. TUMBLER Version3in action Hardware project examples (v.5d)

  22. Design Hardware project examples (v.5d)

  23. Kalman code (lab5: IMU) • // Kalman filter module • float Q_angle = 0.001; • float Q_gyro = 0.003; • float R_angle = 0.03; • float x_angle = 0; • float x_bias = 0; • float P_00 = 0, P_01 = 0, P_10 = 0, P_11 = 0; • float dt, y, S; • float K_0, K_1; • float kalmanCalculate(float newAngle, float newRate,int looptime) { • dt = float(looptime)/1000; • x_angle += dt * (newRate - x_bias); • P_00 += - dt * (P_10 + P_01) + Q_angle * dt; • P_01 += - dt * P_11; • P_10 += - dt * P_11; • P_11 += + Q_gyro * dt; • y = newAngle - x_angle; • S = P_00 + R_angle; • K_0 = P_00 / S; • K_1 = P_10 / S; • x_angle += K_0 * y; • x_bias += K_1 * y; • P_00 -= K_0 * P_00; • P_01 -= K_0 * P_01; • P_10 -= K_1 * P_00; • P_11 -= K_1 * P_01; • return x_angle;} Hardware project examples (v.5d)

  24. PID code in CENG4480:lab6 • if ((abs(kang)>=minangle)&&(abs(kang)<maxangle)){ • delta=kang; • diff = delta - last; • diff2 = delta - last2; • diff = constrain(diff,-maxdiff,maxdiff); • diff2 = constrain(diff2,-maxdiff,maxdiff); • last2 = last; • last = delta; • LRspeed = P*delta + I*accu*interval*0.001 + D*(diff*100+diff2*100)/interval; • accu+=delta; • accu = constrain(accu,-maxaccu,maxaccu); • } Hardware project examples (v.5d)

  25. Exercise 5.4 • Explain why we need to have PID control. Hardware project examples (v.5d)

  26. Project 2: Chinese flute (Dizi) playing robotprevious FYP (KHW1101) and MSc (Zhang Hao) projects, CUHKSupervisor (Prof. KH Wong) https://www.youtube.com/watch?v=NJ7wv2z8Wgk Hardware project examples (v.5d) http://www.ebay.com/itm/Toy-Mechanical-Robot-Remote-Walking-Dual-Wheel-Balancing-Multiple-Modes-Kids-Toy-/111728506257 http://news1.ghananation.com/latest-news/300907-it-s-the-segway-section-chinese-cops-on-patrol-for-shoplifters-on-electric-scooters.html

  27. The structure of the Chinese flute playing robot The air jet head Hardware project examples (v.5d)

  28. PID is used to adjust blowing angle By a newly designed robot’s mouth, we aimed solve this problem next semester. Hardware project examples (v.5d)

  29. Fingering control schemes Hardware project examples (v.5d)

  30. Use of servo motor (positional control motors) • Servo motors can be controlled by Arduino directly by open source library. In CENG4480 Lab 4:Self-balancing Tray Robot Control https://www.youtube.com/watch?v=dT56qAZt8hI Hardware project examples (v.5d)

  31. Exercise 5.5 • What is the difference between a DC motor and a servo motor? • Discuss how to control a servo motor by an embedded system. Hardware project examples (v.5d)

  32. Blowing mechanism Hardware project examples (v.5d)

  33. Software for pitch adjustment and measurement to maximum sound quality and volume Hardware project examples (v.5d)

  34. Results Hardware project examples (v.5d)

  35. Western Flute playing robot • Flute playing by WF-4R II - Sexy Robots Videos • Flute Robot WF-4RV passive duet performance https://www.youtube.com/watch?v=lYDW2A5-Cbw https://www.youtube.com/watch?v=acK_rZEDgLw Hardware project examples (v.5d)

  36. Audio signal processing techniques Hardware project examples (v.5d)

  37. Fourier Transform(use Fast Fourier Transform --FFT library in embedded systems) http://wiki.openmusiclabs.com/wiki/ArduinoFFT Energy in dB |Xm|= (real2+imginary2) Signal voltage/ pressure level single freq.. Fourier Transform Time S0,S1,S2,S3. … SN-1 freq. (m) Spectral envelop Hardware project examples (v.5d)

  38. Fourier Transform concept • Any signals can be decomposed into some puresine and cosine wave components, each with a certain frequency and amplitude. • Fourier transform is a way to find the frequencies and amplitudes of these components Example: The square wave has all the frequencies inside http://www.chemicool.com/definition/fourier_transform.html http://1.bp.blogspot.com/_iCUnH8P-OYo/S7ZTAluquWI/AAAAAAAAAOM/y-G5aH_w248/s1600/2000px-Fourier_Series.svg.png Hardware project examples (v.5d)

  39. Example: W3=W1+W2 W1(pure sine) W2(pure sine) W3(complex wave) Fourier Transform will generate the two outputs W1 and W2 http://www.slideshare.net/azizulhoque539/311-communication-system-concepts Hardware project examples (v.5d)

  40. http://www.solar-energy-for-home.com/pure-sine-inverter.html Exercise 5.6 • Draw the wave when these two waves are added. Hardware project examples (v.5d)

  41. Exercise 5.7 • Disuses a hardware project that you want to do. Hardware project examples (v.5d)

  42. Project 3: Vision robot • Based on opencv (http://opencv.org/) • Demos • Grand Canyon reconstruction-youtube • Man Chuen Leung ,Kai Ki Lee, Kin Hong Wong, Michael Chang, "A Projector-based Hand-held Display System", CVPR2009  • Man following robot  • Tracking result videos by Zhe Zhang , KH wong Sept 2014.  • Viewing 3-D without spectacles. Feature SFM Structure from motion For 3D display Or to control robot Hardware project examples (v.5d)

  43. Face edges • Demo http://www.youtube.com/watch?v=CDlLe-53a0w Hardware project examples (v.5d)

  44. Application of edges • Lane detection http://www.youtube.com/watch?v=Al4DnNkZUeA&feature=related http://www.youtube.com/watch?v=9F3_6xL8hEY&feature=related Hardware project examples (v.5d)

  45. Rectangular object detection in video • Stream using the Generalized Hough Transform http://www.youtube.com/watch?v=9r16YiKyaZQ&feature=related http://www.youtube.com/watch?v=jPEfoi9g0Lw&feature=related Hardware project examples (v.5d)

  46. Quadrangle detection application • cvpr09 Projector based Hand Held Display System http://www.youtube.com/watch?v=YHhQSglmuqY&feature=channel_page Hardware project examples (v.5d)

  47. 5) Mean shift (cam-shift) http://www.youtube.com/watch?v=iBOlbs8i7Og http://www.youtube.com/watch?v=zjteYlhjm-s&feature=related Hardware project examples (v.5d)

  48. Face tracking applications • Face change http://www.youtube.com/watch?v=i_bZNVmhJ2o Hardware project examples (v.5d)

  49. Demo: 3D reconstruction (see also http://www.cse.cuhk.edu.hk/khwong/demo/index.html)(Click picture to see movie) • Grand Canyon Demo • Flask • Robot http://www.youtube.com/watch?v=2KLFRILlOjc http://www.youtube.com/watch?v=xgCnV--wf2k http://www.youtube.com/watch?v=ONx4cyYYyrI http://www.youtube.com/watch?v=4h1pN2DIs6g Hardware project examples (v.5d)

  50. Demo 5 • 3-D display without the use of spectacles. http://www.youtube.com/watch?v=oyxR_RT4NNc Hardware project examples (v.5d)

More Related