How to use 5V analog sensors with MSP430G2?

AISHA's picture


Joined: Sep 07, 2017

Replies: 256
How to use 5V analog sensors with MSP430G2?
April 16, 2018 - 6:27pm

Hi, I have recently started to work with MSP430G2 using the Energia IDE. Earlier I was working with Arduino. I am aware that Arduino works with 5V and MSP works with 3.3V. 

Now, my question is how can I interface my 5V analog sensor like the ACS712 with my MSP430? It can measure voltage only from 0V to 3V as per energia website. How can I read till 5V !! Please help


Hiro_Hamada's picture


Joined: Apr 17, 2018

Replies: 120

Yes Aisha you are correct, the Arduino works with 5V and the MSP430G2 typically works with 3.3V. So we cannot directly connect a 5V sensor to the ADC pins of MSP430.

The maximum voltage that could be applied to the ADC pin of MSP430 is  equal to the operating voltage of the MSP430 board. The maximum operating voltage of MSP430G2 is only 4.1V so there is no way we can read upto 5V. uisng this board.

The best way to go around this is to use a potential divider, this will map the 0-5V from the sensor to 0-3.3V ofcourse the resolution will be lost. But I cant think of a simpler way. If you are very concerned about resolution then use an external ADC.

You can calculate the value for resistor from this calculator  it also explains the connections. Roughly the values should be 1K and 2K for converting 5V to 3.3V.

Also refer to the Analog Reference() option available in energia

Hope this helps