Jump to content
43oh

Recommended Posts

  • Model of LaunchPad used and rev. #: MSP430F5529 Rev.1 Launchpad Evaluation Kit, Bundled with the CC3100EMUBOOST and CC3100BOOST
  • Model of MCU: MSP430F5529
  • Model of BoosterPack/Sensor used: SimpleLink Wi-Fi CC3100BOOST, with Analog Devices ADXL001-70BEZ (Personally designed SMD eval. board)
  • Link to the sensor datasheet: ADXL001 Rev.A Datasheet
  • Name and version of the IDE used: Energia 14 (0101E0014)
  • OS the IDE is running on: Windows 8.1 64 bit
  • Whenever possible, minimal code to replicate the issue: Will post after I can pinpoint what I'm trying to ask.

Hello all! Okay, so I guess I'll start with a few simpler questions I'm seeking an answer to. While looking through the Energia files, I came across "adc12_a.c" and "wiring_analog.c", yet they both seem to provide functionality for initializing analogRead/ADC. I'm looking to change some of the timings around, but I'm not sure if 'adc12_a.c' is even used; my testing appears to not show any differences with code changes there. However, "wiring_analog.c" does! What is the proper way of going about making some modifications? A few specifics as to why: I'm developing a system to detect vibrations, using the Analog Devices ADXL001_70BEZ. This is the +-70G, 3.3V/5V option they have.

 

I've designed a little breakout board including a passive low-pass filter, a unity gain, non-inverting voltage follower buffer, and the datasheet's recommended 100nF cap. Great. Now for sampling! Being an analog device, I intend to take samples at a target rate of 40kHz, so I can hopefully get viable readings for FFT at 20khz. In 3.3V mode, there is 16.0mV/G sensitivity. In 5V mode, 24.2mV/G sensitivity. Note, I am a one man team for this entire project. I have done the circuit design, MSP programming, node.js/d3.js/mySQL/PHP/HTML front-end/back-end all alone... I've settled on using IBM's Bluemix as a cloud host, with an MQTT websocket protocol for interfacing the MSP430F5529 to the IOT webapp we've got going on. I only state all this to give an idea of how stretched my brain is with all this. Anyhow...

 

I first started using the ADXL001 in 5V mode, with the thinking that I would just "Get the damn data now!" and worry about going low-power in later prototypes. I can read from my ADC inputs just fine. For all my preliminary testing, I had the CC3100 Boosterpack unconnected. I used a resistor voltage-divider to knock the ADXL's output down to a safe level. 0 G's should read a typical of 2.5V according to the sheet.

With the voltage divider, it does read a nice dead center 1.65V. Good.

 

Now, the noise. This is where I need more information. There -seems- to be a good deal of it. I am unsure as to what the best way to proceed would be. I want to play with ADC software settings and initialization first to attempt to reduce this. Being an analog sensor, I realize there will be noise no matter what. Eventually, I mayyyy be using a 5th order butterworth low-pass filter, but again, I'd like to tackle software first.

 

I read ADC as follows:

startT = micros();

  for(ict=0; ict<idx; ict++){
    samples[ict] = analogRead(A12);
  }

  endT = micros();

where idx is the maximum number of samples I want to keep. Great. Now where I'm utterly confused:

 

In "wiring_analog.c" at the 

#if defined(__MSP430_HAS_ADC12_PLUS__)

part of it's analogRead() function, we have all the initialization stuffs. I've been using a mix of "adc12_a.h" "adc12_a.c" "wiring_analog.c" and "msp430f5xx_6xxgeneric.h" to kinda try to jump around and figure out what's happening. NOTE: Many of the ADC12 "Default" values in the comments of "adc12_a.c" are not actually the default... When I noticed this, I stopped tweaking that, and jumped to "wiring_analog". So, with my StartT and endT times in micros, and the number of samples I'm taking, I'm getting a rudimentary way of calculating my sampling frequency. (around 44kHz)

 

Back to "Wiring_analog": I have it use ADC12SSEL_0 as clock source, and ADC12DIV_2 as clock divider. I also use ADC12SHT0_0 which should be a Sampling Timer hold of 4 cycles. 

 

I am shooting in the dark with all of this due to my lack of understanding. All I know is that I've been getting around a calculated 44kHz sampling rate. But perhaps this is a big source of my noise? I wish I knew how to better understand this. I also was looking at Page 5 of http://www.ti.com/lit/ds/symlink/msp430f5529.pdf for the F5529 pin location of VREF+/VREF- .... Pins 9 and 10 respectively. I looked there because of Page 727 of http://www.ti.com/lit/ug/slau208n/slau208n.pdf describing using an external reference. Would using an external reference help?

 

I could always bump the ADXL's power down to 3v3 V, (this would lower the noise floor, but also sensitivity, no?)

 

I am against the idea of sampling and averaging; it seems to throw off FFT at higher frequencies in my range. For testing FFT, I am using a modified version of http://mattzz.no-ip.org/wiki/Projects/ArduinoVibrationMeasurement  which has processing do serial reads, so I can visualize the sensor readings. It then saves the data to a csv file, and there's a python script for doing the FFT.

 

I could be so way off base with some of these methods, but I am here to learn. I've gotten this far by breaking down each problem into a smaller one, and have had a lot of fun learning what I have so far! Now, there are so many pieces that I am nervous to continue down any set path in fear of wasting time with a better alternative.

 

I know this was probably a doozy to read. I'm hoping it won't scare off the knowledgeable who can help me... I did read somewhere that the best way to get an answer online is to post the wrong way of doing things... but I'm not from that circle of thinking. I'll be happy to answer any further questions. Thanks!

 

Oh! Also, are there any decent IRC resources for Energia/MSP? What I mean is, which would be more viable for answers; the forum, or #energia or #43oh?

 

OH! Another thing! Is there a way I can lock into a certain sampling frequency? Every few sets of sampling intervals will have a slightly lesser frequency. This is gonna add up and throw off FFT. I also read about putting the MCU in low-power, then turning on only ADC12 for better results? Thoughts?

Link to post
Share on other sites

I don't think using an external reference would help here.  Your analog device has its own voltage source.  Using the 2.5V internal reference may help with all the math though.

 

Can't speak for the noise, but it sounds like you have the analog chops to eventually figure it out :-)

 

Sounds like you have SLAU208 and SLAS590 (datasheet).  Those are important for getting the details together.  I believe the ADC12_A can be triggered using Timer peripherals, and the user's guide (SLAU208) mentions looking at the datasheet for which ones.  So you could trigger ADC conversions with a precise timer, and look at options for handling the output (e.g. using the ADC ISR, which I don't think Energia hijacks for itself in wiring_analog.c).

 

Fwiw, Energia 13+ does add sleep() (LPM3 low-power sleep), sleepSeconds() (a coarser 1sec-resolution LPM3 sleep), suspend() (LPM4) and wakeup() (run in an ISR to tell Energia to abort any current sleep/sleepSeconds/suspend call) to help you design low-power applications.  Note that Serial output requires that you keep the clocks running at full speed, so only use delay() or use Serial.flush() to wait until your serial data has been output before going to sleep.  Not sure that'll be much of a concern here though.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...