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.

Which MSP430 - Design Question? - Scalable Power Metering

Other Parts Discussed in Thread: MSP430G2131

Hello all,

I realise there is a lot of information on metering, however, I have a specific requirement which I have not seen discussed.

I am designing a power sub metering/logging system that requires one or more (say up to 16, typically 6) mains AC circuits feeding various parts of a large complex.  The critical criteria is cost - surprise!!!

In my current design I have taken a scalable modular approach with one or more dedicated metering units that are connected via a serial interface (I2C or SPI) to a common monitor/logger in a linear daisy-chain configuration.  Each metering unit will be attached to its own Current Transformer as a separate module on it's own PCB.  At a minimum the metering unit should measure the power consumed on the circuit it is attached to.  The data from each unit will be pulled  from the metering units in a round-robin scheme via the serial link at arbitrary intervals.  Ideally the Current Transformer will house the chosen MSP430 and will exist as an autonomous unit that can be arbitrarily added to the serial bus of a monitoring/logging unit thus providing an additional monitoring channel.

I have had a look at the ADE78xx series devices (Analog Devices Polyphase Multifunction Energy Metering IC) which provide adequate functionality with an I2C/SPI interface but cost is an issue and precision and functionality are perhaps an overkill for what is required. 

I have also looked at the MSP430FE42xx series and all of them have support for LCD which is not required and if I'm correct do not support I2C but do support SPI - again functionality and precision is perhaps an overkill.

My questions are:

1) Does this design sound practical and feasible?
2) Is there a more cost effective design to do this?
3) Which serial interface to use SPI/I2C - it will be a moderately noisy environment and metering units will be up to 3m max apart?
4) Could one of the G2xx Value Series be used to accomplish basic power metering functionality?

Any comments and suggestions would be much appreciated!

Clint

  • Clint,

    I have my comments on your following question. 

    AnotherClint said:

    3) Which serial interface to use SPI/I2C - it will be a moderately noisy environment and metering units will be up to 3m max apart?

    I don't think you should use SPI/I2C communication for the modules that are 3 meters apart. Instead you can use the UART peripheral and use the RS232 interface to communicate with the units. 

     

    Regards,

    Nag

     

  • Nagabhushan Reddy said:

    I don't think you should use SPI/I2C communication for the modules that are 3 meters apart. Instead you can use the UART peripheral and use the RS232 interface to communicate with the units. 

    Hi Nag,  Thanks for the response - could you give some reasoning for that.  I wanted to take advantage of then I2C bus addressing to simplify communication with each metering unit, using a UART or SPI would mean a proprietary solution (more code)!  I'm not familiar with I2C but I think the bus length may be a problem - do you know what the maximum bus length is for slow communication?  I believe SPI is more tolerant of  longer bus lengths!?

    More important than the comms is which MSP430!  Do you have an idea on that?

    Thanks for your input.

    Clint

  • Clint,

    In my opinion, I2C and SPI are generally used for communicating between the chips which are at very less distance apart. Generally the chips connected with I2C or SPI buses will be on the same board. Also they are prone to noise. You can find much more information on the net regarding this.

    Sorry, I don't have any idea on which MSP430 part suites your application. I hope some experts on this domain watching this post will post their comments.

    Regards,

    Nag

  • Hi Nag,  

    Your help is appreciated.

    I agree that I2C is for inter-chip communication which in a way is what I am after and I do see it being used for low speed off board interfacing.  I will need to research this aspect further!

    Thanks

    Clint

  • For longer distances, we use RS485, which uses a differential line.
    On the endpoints, it is similar to RS232 (you use the normal UART). The difference is that RS485 is half-duplex only. The driver is switched from read to writ emode and back. This allows multiple senders and receivers on the same line (bus).
    When used with a normal UART, the software needs to control the direction, e.g. pulling a port pin before sending, and releasing it when sending is done. While sending, the UART is deaf.
    Alternatively, one can set up a small hardware around the 485 driver which triggers a monoflop with the falling edge of the start bit. The monoflop timeout will be at least one byte length (10 bit), so if you send 0xff, the monoflop will switch the driver back to receive shortly after the stop bit, if you sent 0x00, it will last a bit longer in send mode. This way, you don't need to control the direction manually, but you cannot simply switch baudrates without reconfiguring the monoflop.
    In any case you should avoid sendign while someone else is sending too (else it will be garbled for everyone).

    We use a simple polling protocol: 'master' sends a request, 'slave' answers. This way, there ar eno collisions and it works very well over distances of up to 100meters (if bus termination is properly finetuned). For shorter distances, you don't even have to have a ground connection (the differential lines allow simple current-flow-direction detection), but it is better to have one to avoid problems with huge potential differences.

    SPI and I2C are not suited for larger distances, as they don't have any mechanism for noise suppression, while RS232 has parity (optional), frame check and then the hardware layer (V.24 or RS485 for detecting/suppressing electrically invalid signals)

    We also use an ADE as this chip has all the math already built-in and generally does a good job. And since it flows on AC level and for the other side we need decoupled interfaces, we had the choice to either decouple every single interface, or use a second processor on the low voltage side. We tried the first and ended up with the second as the cheaper way (and the smaller footprint). For the isolation we use the ADUM chips (magnetic digital decoupling) which work with up to 1MHz signal frequency.

    Whether to use an ADE or one of the MSPs with SD16 (there are few with up to 7 simultaneous converters, most only have one converter and switch inputs) is a matter of choice. The ADE may be expensive, but it works out-of-the-box. With the MSP, you'll have to write most of the code yourself, but then you can cutomize it.. And it is a bit cheaper once the software has been developed.

    The G series is not usable for energy metering itself. YOu can use the newest members for polling an ADE (using SPI of the USCI module) chip and forwarding the results to a PC or datalogger. They are, however, optimized for low cost and do not have much memory or hardware. And are not suited fordoing the metering job themselves.

    P.s.: on the MSPs with LCD support, you can use all signals used for driving the LCD as notmal I/O port pins too. And some of these pins offer additional funcitonality when you don't use the LCD driver.

  • Hi Jens,

    Thanks for the very informative answers.

    What I'm hearing from this is:

    - That I2C/SPI is not going to cut it
    - That the ADE component works but has a cost factor
    - The G Series is not going to cut it for e metering
    - The LCD I/Os on MSPs can be used for other uses

    Awesome information - I'm listening!

    A few more twists:

    - Each off board slave metering unit need only perform a metering function - no logging or storing, except for maybe one or two buffered results while waiting for the master logging unit to pull the data.  Imagine Current Transformer with MSP tacked onto it!
    - I imagine the logging unit supplying the chain of off board metering units with power Vcc/Vss along with serial bus lines in a shielded/twisted cable.
    - I was ambitious with the distance of the bus being up to 3m, I can reduce that to under 1m.

    With this in mind:

    - Will that still eliminate I2C/SPI as a bus option - I'm trying to keep it real simple and most importantly cost effective - every cent costs (target production of many units)?
    - Is the low cost G series still not capable of performing the metering function for one metered line plus comms to the master logging unit?

    You input is much appreciated!

    Clint

  • Foe energy metering, especially for true RMS calculation, it is vital to measure voltage and current simultaneously. The G devices have an ADC units which can only do one conversion at a time and have to switch input channels using an analog multiplexer, thus preventine simultaneous sampling. The phase delay of a CT, however, might offer a way to circumvent it (sample V first, then switch to I and sample it according to the CTs phase error). The 430FE devices have several simultaneous Delta-Sigma converters. They also have a dedicated calculation unit that helps with the necessary calculations.

    The main problem with the G devices is the low amount of ram and the somewhat limited clock system. For energy metering, a stable clock source/timing might be very important, which is difficult with an out-of-the-box G device.

    The problem with the data transmission is, that usually a device for energy metering works in a noisy environment. And both, SPI and I2C (as well as standard UART) are prone to transmission errors if there is much noise. A shielded connection may help. In any case, I'd suggest adding a checksum to the data and implement a protocol that includes acknowledgement. I2C has per-byte-Acknowledgement which can be 'abused' to signal a 'bad data received/resend data' request. I'd recommend I2C for another reason too: since you'll have to implement both sides of the connection, I2C is more relaxed with its timing requirements on the slave side. Writing an SPI slave is a very difficult task, since there is no way for the slave to control the timing. If the master calls, you'll have to be ready. immediately. That's difficult to accomplish.

  • Hi Jens,

    Once again thanks for your informative reply - you have some brilliant advice!

    I guess the next step is to put something together and see how it talks to me.  

    SLA075 discusses using MSP430C11x to do simultaneous I & V sampling (actually one V and 2 I captures with 3 channels on a single-slope ADC per sample) which I found very interesting, so a device with that capability plus an I2C may cut it.

    Thanks for your help!

    Clint

     

  • Clint,

    Yes, this is doable with the MSP430 family of metering devices. It is important to note that the MSP430 family also has a poly-phase metering device and has up to 7 Sigma Deltas. By this you can connect one voltage (i assume you have one voltage source and multiple currents) and the other 6 channels can be connected to the CTs. This will be a single SoC solution. However, if you want to have a modular approach, you can use the low-cost metering chip the MSP430AFE2xx family of devices. This low-cost chip will do single phase voltage and current. This device however has up to 3 Sigma Deltas. You can create modules with this chip and attach it to each of your load. Also some comments

    1. If you use a polyphase chip from MSP430, it will cater to 6 different currents and one voltage. This will also imply one interface only (SPI/I2C). You can of course add multiples of these to cater to more currents.

    2. If you use the AFE solution, it will mean that you will have at best a single voltage and 2 currents to play with with each module. I believe this is to be the most cost effective solution. This part does not support HW I2C, but will do SPI/UART.

    Best regards

    Kripa

  • Hi Kirpa,

    Those are some great cost effective/saving ideas.  

    I was aware of the MSP430FEx range but had overlooked the other multi Sigma Delta ADC devices - that is a really interesting idea - thank you!

    I'm not too concerned about no I2C in the FEx devices as I have seen that a software BitBang I2C approach is not out of the question in those cases.

    Thank you for your help!

    Clint

  • Hi Clint,

    Please take a look at SLAA391, you can take measuring part from that, but instead of F149, you can use other chips that have the same functionality in analog part but cheaper, I'm working on similar design with F235.

    I think it's better to use RS485 for your comms, in power system noise is more important than distance.

    Roozbeh 

  • Hi Roozbeh,

    Thank you - I have read that app note a few times and it is a great source of information!  In terms of cost I will need to consider the level shifting or current preamplification cost compared to the MSP430FEx options that don't have this requirement.

    There are some interesting options!

    Thank you

    Clint

  • Hi Clint,

    You can avoid the op-amps by using higher resistor value in your CT output,

    also for level shifting you can use simple resistor divider and remove the op-amp buffer, if you can't neglect the non-linearity effect of loading the resistor divider you can compensate it in firmware.

    In this way you can save the cost and space of on IC.

    Regards

    Roozbeh

  • Hi Roozbeh,

    I've been looking at that and I came to the same conclusion!  I guess if you are concerned about accuracy then perhaps the opamp route needs to be reconsidered, but for my needs your suggestion is perfect.

    Thanks

    Clint

  • Hi Clint, 

    So if the accuracy will allow you, maybe MSP430G2131 with 10 bit ADC could be considered as an option for your design, (But make sure the 1KB Flash is enough for  your firmware)

    You can use it's I2C for your data transfer, but be aware of safety issue if  your bus is connected to main power,

    For communication If you want use isolator or due to noise you can't use 3V level, an alternative solution like follow may help you:

    Connect the transmitter pin to transistor level shifter or LED of optoisolator, then for receive pin you can use transistor output of optoisolator or simply the resistor divider,  then connect level shifted transmitted signal to the receive signal. In such configuration although you have two different pin in your microcontroller for transmit and receive but the real bus is one wire distributed between different units, in this single signal wire bidirectional bus, each micro will receive what it is sending and logic zero has priority in the bus, then you can choose whether master slave or collision type protocol for send and receive the data between the sub-meters.

    Roozbeh        

  • Thanks Roozbeh,

    I'll be using CT's so there is some isolation, I would think the only issue will be noise which I think is a factor of transmission speed and therefore number of chained mcu's etc.

    I like to idea of the low cost G series and I need to do some calculations on accuracy (or at least the difference in accuracy between 10 and say 12 bit ADCs).

    Thanks for your help!

    Clint

**Attention** This is a public forum