magnetometer testing board
DESCRIPTION
Magnetometer Testing Board. Presented by Jianer Shi 04/25/2011. Sections. Sections. Background Board Design Code 2.1Microcontroller 2.2Graphic User Interface (GUI) From here on…. Section 1/4. Background. Background. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/1.jpg)
Magnetometer Testing Board
Presented byJianer Shi
04/25/2011
![Page 2: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/2.jpg)
SECTIONS
![Page 3: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/3.jpg)
Sections
1. Background2. Board Design3. Code
2.1 Microcontroller2.2 Graphic User Interface (GUI)
4. From here on…
![Page 4: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/4.jpg)
BACKGROUNDSection 1/4
![Page 5: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/5.jpg)
Background
• Toque coil is used to produce a magnetometer dipole which controls the satellites attitude.
• In order for the toque coil to behave as expected, an accurate measurement of magnetic field is required.
• Magnetometer is an essential part to determine the earth magnetic field
![Page 6: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/6.jpg)
Background
• Previous testing done by Ryne Beeson in 2009 shows noise of 0.02 Gauss, which is unacceptable for accurate attitude determination and control. Further testing is suggested and a magnetometer testing board is built for easy testing and lower electronic noise.
![Page 7: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/7.jpg)
BOARD DESIGNSection 2/4
![Page 8: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/8.jpg)
Board Summary
PCB Laying Tool: Eagle 5.11.0Microcontroller: PIC18F2221-ICommunication Port: Mini – USB BPower: Mini-USB 5VCrystal Oscillator: 11.0592MhzUART Communication Baud Rate: 57600Communication: Serial-USB (FT232RL)
![Page 9: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/9.jpg)
Design Criteria
• Microcontroller– Support I2C– Support UART
• Board– Small size– Mountable
• User Interface– Able to pool and save Matlab friendly data for later process
• Communication– Error tolerance
![Page 10: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/10.jpg)
Microcontroller
• PIC18F2221-I– Minimum Pin Number to satisfy the requirement– Small size (SOIC Package)– Has 1 UART and 1 I2C– 5V Power Supply from USB– Errata page provided by manufacturer has no
significant problem with UART and I2C– Compare to other Microcontrollers, this is the
minimum one satisfies the design criteria.
![Page 11: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/11.jpg)
Power and Communication
• Mini-Usb Port– Small size– Provide both 5V power and communication
• FT232RL USB-Serial Chip• Provide 3.3V output - eliminate 2 voltage regulators
and has 500mA cutoff current protection• Provide UART to USB link
![Page 12: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/12.jpg)
Crystal Oscillator
• 11.0592Mhz– This choice will resulte in 0% error with a wide
range of baud rate choice.– We choose 57600 baud rate
611.0592 1057600 64(2 1)
![Page 13: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/13.jpg)
![Page 14: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/14.jpg)
PIC
Magnetometer
USBTo
Serial
Mini USB
Connect to ICD2 to
Program
3.3<->5.5 I2C Logic Level
Conversion
MagnetometerZoff+,Zoff-,Yoff+,Yoff-
Ground Polygon
Top Layer
![Page 15: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/15.jpg)
CrystalOscillator11.0592
Mhz
Ground Polygon
Mounting Hole
Bottom Layer
![Page 16: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/16.jpg)
MICROCONTROLLER CODESection 3.1/4
![Page 17: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/17.jpg)
Microcontroller Task Overview
MicrocontrollerHMC6343Magnetometer
FT232RLUSB Serial Computer
I2C
UART
USB Cable (serial)
![Page 18: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/18.jpg)
I2C
• Communication between magnetometer and microcontroller
• Library provided by i2c.h and pic18f2221.h from C18 Compiler
![Page 19: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/19.jpg)
I2C Write
![Page 20: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/20.jpg)
I2C Read
![Page 21: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/21.jpg)
Magnetometer I2C
• Slave address(0x32) for write(0x33) for read
![Page 22: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/22.jpg)
Magnetometer I2C
• Functions(0x40) Accelerometer Data of 3 axis(0x45) Magnetometer Data of 3 axis(0x50) Heading Data of 3 axis(0x55) Tilt Data of 3 axisReturn value: 6 byte, 2 byte per axis (in hex: xxxx)
(0x82) Reset the processor, no return value
![Page 23: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/23.jpg)
Magnetometer Spec
• 500ms power up delay before extract data• 1ms delay for each read
![Page 24: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/24.jpg)
3.3V to 5.5VI2C Logic Level Conversion
• Logic Level conversion is necessary because components operate on different power
Magnetometer 3.3VMicrocontroller 5V
![Page 25: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/25.jpg)
3.3V to 5.5VI2C Logic Level Conversion
Source: <Bi-directional level shifter for I²C-bus and other systems. Philips>
![Page 26: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/26.jpg)
UART
• Library– Usart.h
• 2 Pins– TX for sending– RX for receiving
![Page 27: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/27.jpg)
Serial Protocol
In order to send information that the computer side can decode, all information pulling from the magnetometer is sent through a protocol (in hex)
(eeeeeeee) (00) (function 1 byte xx)(data 2 byte xxxx)(ffffffff)
![Page 28: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/28.jpg)
Serial Protocol
(eeeeeeee) (00) (function 1 byte xx)(data 2 byte xxxx)(ffffffff)
• (eeeeeeee) starting flag• (ffffffff) end of line• (00) There are still new function data to be transferred
![Page 29: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/29.jpg)
Serial Protocol
(eeeeeeee) (00) (function 1 byte xx)(data 2 byte xxxx)(ffffffff)Functions
(41) Accelerometer X(42) Accelerometer Y(43) Accelerometer Z
(51) Heading X(52) Heading Y(53) Heading Z
(46) Magnetometer X(47) Magnetometer Y(48) Magnetometer Z
(56) Tilt X(57) Tilt Y(58) Tilt Z
![Page 30: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/30.jpg)
GRAPHICAL USER INTERFACE(GUI)
Section 3.2/4
![Page 31: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/31.jpg)
Complete GUI
![Page 32: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/32.jpg)
GUI Programing Language
• Python– Pyserial– wxtools
• Qt4– Matplotlib
• Toolchain– Pyqt4
![Page 33: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/33.jpg)
Python
• State Machine to decode protocol– 24 State to decode serial protocal– Error Tolerance imbedded even though the UART
will in theory result in 0% communication error
![Page 34: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/34.jpg)
Qt4
![Page 35: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/35.jpg)
Data Saving Button
• All raw data will be saved in a tabular format, This can be easily imported into a matlab vector.
• Button to control start saving data and stop saving data
• Reason to keep raw data– Decimal data will result Matlab underrun (not
enough precision)
![Page 36: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/36.jpg)
Real Time Plot
• Based on the open source code developed by Eli Bendersky• 3 colors to display the 3 axis data on the same graph simultaneously
![Page 37: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/37.jpg)
FROM HERE ON ...Section 4/4
![Page 38: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/38.jpg)
From here on
• The board will handed over to whoever is going to test the magnetometer
• Since the GUI has been revised many times for easy testing, the tester will find the whole system easy to use and test
![Page 39: Magnetometer Testing Board](https://reader033.vdocuments.net/reader033/viewer/2022061608/568164ae550346895dd6bafe/html5/thumbnails/39.jpg)
THANKS!