Rather than continuing on in the other threads where this has been being discussed I thought it might be worthwhile to start a new topic specific to using Arduino for panel meters.
The premise here is to use an Arduino micro-controller, LED/LCD displays, and Hall-Effect current sensing modules to build a set of highly accurate panel meters to monitor the voltage and current of each output on a transformer. I'm planing on 4 channels at this time, but the design is expandable for many more if needed.
I'm also planning to add some extra features, some of which are quite useful, and others that ate neat, but not really so useful. The primary added feature is high speed, programable circuit protection. Because we already will have a micro-controller monitoring both instantaneous current and voltage, as well as RMS current and voltage, it should be fairly simple to use that information to shut off track power if current rises too high. What this current limit is could be adjustable by the user, and could also be programed in steps, allowing say 1 amp over current for 10 seconds, 2 amps over for 5 seconds, 3 amps over for 2 seconds, etc until at maybe 5 amps over the set level power would be instantly shut off.
As a clarification of terms, when I use the term instant here, I mean within the realm of the limitations of the speed of the electronics and the mechanical limitations of whatever device is used to disrupt the flow of power. In effect this is likely to be in the realm of 15-30 milliseconds, competitive with the fastest acting breakers on the market today for electric trains. When I have a working prototype I'll have to test to see just how fast the device responds.
At this point key features I'm planing on are:
True RMS voltage displays with 1/20th volt resolution (0.05V).(edited typo here)
True RMS Current (Amps) displays with 1/20th Amp resolution (0.05A).
At least 1/10th second refresh times on the displays, with a user adjustment for preferred refresh speed. (ex. some folks may not like seeing the numbers jumping about so quickly and may prefer slower changes. )
Programable, adjustable electronic circuit breakers for each channel.
Real time line frequency adaptability. (See Note #1 below for why and how this matters, in a huge block of useless text) In effect this will provide extremely accurate readings from the meters as well as the ability for the meters to operate on any power grid or source, as well as being operational with DC power.
LED and/or LCD displays for RMS voltage and RMS current, peak voltage and peak current( over, say, the last 30 seconds?), possibly an indication of any DC offset on the signal, and if I can figure out how to do so, a warning that a high voltage spike has been detected.
I'd like to hear what other features might be desired in this project from other folks so I can see if they could be worked in. Also, do folks prefer simple on/off circuit breakers that could be handled with a relay, or would it be worthwhile to investigate designing a fold-back system that will lower voltage to limit current?
The actual parts I'm planning on using are all fairly inexpensive and readily available shipped from China. ACS712 Hall effect modules will be used for current sensing. These will provide 1/20th Amp sensitivity up to 30 amps, and should not be damaged by less than 50 amps. For voltage measurement I'm planning on using a bridge rectifier to feed a voltage divider made of two resistors. This will convert the AC track voltages into a 0 - 5 VDC level that can be read by an Arduino. If my math is correct we should be able to read RMS pure sine wave voltages up to about 36 volts with 1/20th volt resolution. I plan on using a zener diode to clamp excess voltage from damaging the Arduino.
To provide the most accurate measurements, it may be that I will have to use several Arduinos linked together. Once I have parts I'll be able to test things to see if a single processor will be fast enough to take all the measurements and process data for the displays. if it is not, I plan to use a separate processor for each channel that will report data to a master controller. This method costs less but is more complex than the alternative, which is to use something like an Arduino Due which has an 84MHz CPU, as opposed to the 16MHz found on the less expensive boards. The Due has it's own issues, the biggest one for me being that it requires 3.3V logic levels as opposed to the 5v logic used on other boards. Another option may be to use Raspberry Pi instead of Arduino, but I have only a limited understanding of RPi.
In the end, mu goal is to use the most cost effective route that will provide exceptionally accurate results. I think there are already plenty of great products out there for mediocre accuracy, and don't see much point in reinventing the wheel if it will not bring something better to the table. Here in the planning stage it looks like I'll be needing around $30 in parts to provide the desired features, however if a single, faster microprocessor ends up being needed it will quickly double that price. This also does not include a case of any sort or fuses/holders that I'd like to install as a fail-safe.
Anyway, lets see what we can come up with here, let the comments commence!
JGL
Note #1: When measuring for True RMS the frequency of the AC matters. in the US we typically have a 60Hz line frequency, however in other parts of the world 50Hz is standard. Further more, there are slight fluctuations in this frequency throughout the day, often being fractionally less than 60Hz at peak power consumption times of the day and fractionally above 60Hz through the night when there is less power consumed from the grid. Power grids in the US follow a rule that they must average out the number of cycles in a full day, but do not care about the exact line frequency in any given second or minute. While there have been some tests to see what effect it will have by changing, at the moment, the US power grid provides exactly 5.184,000 cycles every day. This is done so that devices such as clocks and timers that depend on line frequency will keep accurate time.
In the case of measuring for true RMS to get a truly accurate reading you need to measure an absolutely exact amount of time equal one full wave period, or a multiple there of, ex: 2 waves, or 5, or 10. Because of this I'm planning on measuring the frequency of current so that accurate measurements can be taken. I do not know if this level of accuracy has any need for layout meters, but the difficulty in programing will be similar just to allow for automatic adjustment for 50Hz or 60Hz grids, so I may as well see how it works in real time. I think that it may prove too taxing on the processor to check frequency too often, but it should be little trouble to update every 60 seconds or so. If that doesn't work out I'll simply have a single check at start up.