30 likes | 115 Views
Current Works. Downloaded XBee API firmware Was Freezing because correct setting was not selected Performed A/D conversion on all 4 XBee pins Set XBee to automatically perform A/D conversions every millisecond Researched XBee API framing setup to determine how to parse frames
E N D
Current Works • Downloaded XBee API firmware • Was Freezing because correct setting was not selected • Performed A/D conversion on all 4 XBee pins • Set XBee to automatically perform A/D conversions every millisecond • Researched XBee API framing setup to determine how to parse frames • Began implementing parse code in MATLAB • Having difficulty getting MATLAB to continuously read whole frames • Implemented a function to wait for start sequence of a frame; Current code works fine for around 170 frames and then bytes are shifted • See next slide • Initial testing performed with IMU • Output voltage around 1.4 volts when stationary • Determined resistor values for voltage divider
Matlab • firstbyte=fread(serobjw, 1) • while(firstbyte~=126)%first byte needs to be 126 • firstbyte=fread(serobjw, 1); • end • i=0; • values=[0;1;2;3]%create vector • while(i<2000) • bytes=serobjw.BytesAvailable; • if(bytes>28)%wait until 56 bytes read • ret = fread(serobjw, 56);%frame is 56 bytes • v0=[ret(47) ret(48)]; • v1=[ret(49) ret(50)]; • v2=[ret(51) ret(52)]; • v3=[ret(53) ret(54)]; • newvalues=[v0; v1; v2; v3;]; • values=[values newvalues]; • end • i=i+1; • end • Need to add timer instead of just looping as fast as possible
What’s Next? • Continue testing of accelerometer and gyroscope output of IMU • Connect 2 accelerometers and 1 gyroscope to XBee with voltage dividers (could be used with Planar motion) • Continue work on MATLAB code for parsing XBee frames • Research other A/D conversion chips/microprocessors • Should be used in final version to read output from third accelerometer and is more precise