ATmega328P Based Power Supply Voltage Monitor - Page 1
Forum section: electronics / general

author: UPI
author_rank: Regular Contributor
timestamp: December 21, 2012, 02:41:11 am
content: I am creating a PCB to monitor 7 analog voltages in a piece of semiconductor manufacturing equipment. The PCB layout still needs to be done, but I thought I would pass it by the EEVblog community to see if I have made any obvious errors or omissions in the circuit design.The analog voltages (+28V, -28V, +24V, +12V, -12V, +8V and 5V) are passed through voltage dividers comprised of TL431 references (set to various voltages) and a resistor or two to present 0V through +4V into the ADC pins. The negative voltages are offset with on-board 5V regulated power. The AREF is set to 4.096V using an LM4040 reference.The voltages can only be read accurately when they are within +/-15% or so of their expected values. If they are out of this range, it is time to error anyways. All analog pins will have gain and offset values that will be used to calibrate these valid ranges.The board is powered by +8V or +12V and will continue to run as long as one of these voltages is present. Ground and VCC traces will be separated between analog and digital. 10uh inductors are used with several cap values to provide clean power to digital and analog devices.Communication will be handled through an optional USB to TTL serial cable and an ICSP pad set will be available as well.We are using a CSTCE16M0V53-R0 resonator an there will not be any time critical tracking that would necessitate anything more (IMHO).There is a DS18B20 one wire temperature sensor to monitor the temperature in the drawer. More (5-6) sensors may be added on an external cable so a 3k pullup resistor is used rather than the recommended 4.7k. If we run out of pullup power, we can add a resistor on the cable to help out.We use a MMBT3904_D87Z NPN Bipolar transistor and a BSS84AK,215 P Channel MOSFET to drive a 12V buzzer at approx 25ma.The circuit board will probably be 2 layers if we can get it all crammed in. We will be using a licensed version of Eagle 6.3.0.I have attached a rough Mouser BOM, TL431 Spice Model, Analog Inputs Spice and a PDF schematic. Put TL431.asy into the lib\sym folder and TL431.sub in the lib\sub folder.Analog input simulation:http://tinyurl.com/Falstad-TL431-Analog-InputsFeel free to comment or ask questions.This is my first post here and actually the first post to any forum in many years.Thanks,Ron

author: Kremmen
author_rank: Super Contributor
timestamp: December 21, 2012, 07:30:21 am
content: I took a quick look at the schematic. Should be OK for the most part. The only thing really that i noticed was that you have a 7.5k resistor (R110) from the reset line to +5V rail. That value is a bit too low and may cause issues when programming the chip via the ISP header. Atmel recommends min 10k and i always make that 22k and it works every time (no pullup is really needed). You might want to think about doing the same. Also take care that the cap (C107) floats when using debugWire because if grounded at the other end, it is a sure killer for the serial comms taking place over the reset line. For details, see Atmel Mega48-328 datasheet p.268 (document 8271B-AVR-04/10).

author: Harvs
author_rank: Super Contributor
timestamp: December 21, 2012, 11:53:53 am
content: What accuracy are you trying to achieve? What sample rate?I would just suggest you probably need to add up all the potential error including time induced drift and temp co to ensure you're within you're error budget.A cheap external delta-sigma 16bit ADC with precision internal reference and simple resistor divider would simplify the circuit and probably result in better accuracy. Cost wouldn't be much different (I used a Microchip 16bit ADC the other day for $1.77 from memory.) You would either need to get one with 8-channel input mux, or add a cheap analog mux on the input.Another thing to consider is the relatively high input impedance you're driving the ADC with. Might be alright with the relatively low resolution.

author: UPI
author_rank: Regular Contributor
timestamp: December 21, 2012, 07:58:42 pm
content: Quote from: Kremmen on December 21, 2012, 07:30:21 amI don't think we will need debugWire but its better to support it just in case. We will change the pullup to something around 22k should we add a diode inline with the cap to block reverse flow through the serial DTR, or in this case RTS?Quote from: Harvs on December 21, 2012, 11:53:53 amI would be happy with +/-20mv of error on the two 5V lines at A0 and A3. All others would be fine with +/-50mv or more. We are using 1% 100ppm resistors with the TL431 references and these were personally breadboard tested to be stable within ~5mv when set to 10V from 25C to 70C. I guess I am not familiar enough with drift over time issues to know how to guesstimate it.If we used basic resistor voltage dividers to format the voltages to be between 0-4V, we would lose a lot of resolution. I switched to the voltage references as part of the divider so that all of the voltages below 24V would be 1 to 1. In other words, if their voltages change by 1V, we will see a 1V change at the ADC input. The +/-28V lines needed to have more range than 4V (due to some power supplies in the machine being unregulated that change from 36V to 28V when loaded so we divided those down so the range was closer to 10V.As far as input impedance, we added the .1uf cap at the analog inputs to provide a stored charge for when the ADC switches from pin to pin. We will also be taking multiple medianed reads and then averaging several of those as well. I think we will be OK.We are trying to keep the total parts cost below $30 if possible (ordering parts/boards to build quantities of 50/batch) so we are making the best use we can of the ADC in the ATmega. We are also short on space on the PCB so we implemented the USB to Serial TTL signals off of the board.Thanks for the feedback!