Author Topic: ATmega328P Based Power Supply Voltage Monitor  (Read 4185 times)

0 Members and 1 Guest are viewing this topic.

Offline UPITopic starter

  • Regular Contributor
  • *
  • Posts: 139
  • Country: us
ATmega328P Based Power Supply Voltage Monitor
« on: December 21, 2012, 02:41:11 am »
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-Inputs


Feel 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
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: ATmega328P Based Power Supply Voltage Monitor
« Reply #1 on: December 21, 2012, 07:30:21 am »
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).
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline Harvs

  • Super Contributor
  • ***
  • Posts: 1202
  • Country: au
Re: ATmega328P Based Power Supply Voltage Monitor
« Reply #2 on: December 21, 2012, 11:53:53 am »
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.
 

Offline UPITopic starter

  • Regular Contributor
  • *
  • Posts: 139
  • Country: us
Re: ATmega328P Based Power Supply Voltage Monitor
« Reply #3 on: December 21, 2012, 07:58:42 pm »
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).

I 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?


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.

I 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!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf