This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Communicate analog value

Other Parts Discussed in Thread: MSP430F5529, ENERGIA

Hi

I am a C-Programmer , but not yet really familar with the microcontroller world.

I have little project where I need to mesure a Analog Signal (0-5V) with a resolution of 12bit for a certain time (lets say 50ms, triggered by a digital signal or by PC) as often as possible (min. 50 mesurements), calculate then a weighted average value (not really complicated algorithm) and send this value to the computer where I can recieve it with a C-Program on Windows 7.

As far as I can see, the LaunchPad MSP430F5529 meets my needs.

I see that it can read the Analog value, there are some timers and some digital inputs.

What I don't see is how I could communicate to the computer.

What do you think about this, is this doable with this board, even for a newbie in Microcontrollers?

Best Regards

Dominic

  • I probably found it just right now by myself:

    http://energia.nu/Tutorial_Graph.html

    I think this is already very close to what I need.

  • Sounds pretty straightforward.  Just be sure to narrow that signal down to something that the MSP430 can handle, as the ADC input ports shouldn't be exposed to more than 3.3V or else it'll damage the microcontroller.  A voltage divider cutting the signal in half may work, and then you can use the MSP430's built-in 2.5V voltage reference and the values should turn out accurate (0-4095) without needing to scale it.

  • I'm sorry, wrong voltage, I need to convert 10 Volt to those 2.5Volt.

    Is it true that I just need two resistors?

    How I imaging the circuit:

    Source 0-10V -> Resistor 1 -> Input port on MSP430 -> GND??? -> Resistor 2 -> Back to the Source GND.

    And R1 = 3*R2.

    Would R1 = 40KΩ and R2 = 10KΩ be ok?

    I just read things about impendance, high and low pass filter etc. and these things I don't remember anymore, school was too long ago...

  • First, 3*10k is 30k, not 40k J

    Then, the “GND???” In the middle is wrong. It’s Input->R1->MSP->R2->GND. On MSPs with separate AVSS pin, signal source and AVSS should be connected and routed separately to the supply GND, so no digital supply currents run on this trace.

    Yes, if you use 10k/30k voltage divider, this means you have a 40k load on the source. On 10V signal, this means a current of 250µA, plus the inrush current of the ADC during sampling phase. It also means the inrush current for the ADC is limited by 30k series resistor, so a sufficiently long sampling time is required. (check the users guide or datasheet for the sampling capacitor size, and calculate the charging time constant for it). This also acts as a low-pass filter on the signal.

    You can raise R1+R2, and the sampling time, to make the load smaller.
    Also, the signal source itself has a resistance (R0), which is in series to R1. It may be small or large. The larger it is, the more does the impedance of the voltage divider R1+R2 affect the measured voltage and the required sampling time.
    U2 is actually R2/(R0+R1+R2).

  • If you want to add hardware an OpAmp could work. You could divide the voltage by about 3 very easy, which would fit within the 3v3 analog input range of the MSP430. A minor issue might be the slew rate though.

    Impedance on the MSP430 board wouldn't be an issue since OpAmps have high output impedance.

  • Sven Bex said:
    OpAmps have high output impedance.

    No, the have a high input impedance (so they can work with high- and low-impedance sources) and a low output impedance (so they can work with high  and low input impedances on the following circuitry).

    However, an OpAmp is overkill unless you have a signal source with a very high output impedance (thus delivering only a very low current without breaking down) and need a high sampling frequency, so the sampling time must be short and the source output current can't charge the sampling capacitor in time.
    Sure, a resistor divider means a relatively high cross-current from signal to GND (through the two resistors), but an OpAmp requires some operating current too. Also an OpAmp cannot amplify by a factor less than 1 (unless you operate it in inverting mode, which means you need a second OpAmp to revert it, and a negative supply), so you'd need a resistor divider on its input too (even though it might have a higher resistance due to the higher OpAmp input impedance).

**Attention** This is a public forum